<commit_before>package model;

import junit.framework.TestCase;

import java.awt.Color;


/**
 * 
 * @author bwoconnor
 *
 */

public class TestBoard extends TestCase{
	Board b;
	BoardTile bt;
	@Override
	protected void setUp(){
		b = new Board();
		b.board[1][0] = new BoardTile(1,0);
		b.board[2][0] = new BoardTile(2,0);
		b.board[3][0] = new BoardTile(3,0);
		b.board[4][0] = new BoardTile(4,0);
		b.board[5][0] = new BoardTile(5,0);
		bt = new BoardTile(0,0);
		b.swapTile(bt);
	}
	@Override
	protected void tearDown(){
		
	}
	
	//test if the swap method works (run in setUp)
	public void testSwapTile(){
		assertEquals("board:0,0", b.board[0][0].toString());
	}
	
	//test the number of board tiles
	public void testNumBoardTiles(){
		assertEquals(b.getNumBoardTiles(), 6);
	}
	
	//test if the new tile type is a board tile, where the tile was swapped in
	public void testType(){	
		b.swapTile(bt);
		
		String str1 = b.board[0][0].tileType;
		String str2 = bt.tileType;
		
		assertEquals(str2, str1);
		assertEquals(bt.rowOnBoard, 0);
	}
	
	//test functions working with pieces
	public void testPieceFunctions(){	
		//add a piece
		Piece p = new Piece(1);
		assertTrue(b.willFit(p, 2, 0));
		b.putPieceOnBoard(p, 2, 0);
		
		//check if tile type changed and if board contains piece
		assertEquals(b.board[0][0].tileType,"piece");
		assertTrue(b.pieces.contains(p));
		assertEquals(b.getTileAt(0, 0), b.board[0][0]);
		
		
		b.board[1][1] = new BoardTile(1,1);
		b.board[1][1] = new BoardTile(1,1);
		b.board[2][1] = new BoardTile(2,1);
		b.board[3][1] = new BoardTile(3,1);
		b.board[4][1] = new BoardTile(4,1);
		b.board[5][1] = new BoardTile(5,1);
		
		Piece p2 = new Piece(1);
		b.showPiecePreview(p2, 2, 1);
		
		assertEquals(Color.RED, b.board[1][1].color);
		
		Piece p3 = new Piece(1);<commit_msg>made some changes to TestBuilder<commit_after>package model;

import junit.framework.TestCase;

import java.awt.Color;


/**
 * 
 * @author bwoconnor
 *
 */

public class TestBoard extends TestCase{
	Board b;
	BoardTile bt;
	@Override
	protected void setUp(){
		b = new Board();
		b.board[1][0] = new BoardTile(1,0);
		b.board[2][0] = new BoardTile(2,0);
		b.board[3][0] = new BoardTile(3,0);
		b.board[4][0] = new BoardTile(4,0);
		b.board[5][0] = new BoardTile(5,0);
		bt = new BoardTile(0,0);
		b.swapTile(bt);
	}
	@Override
	protected void tearDown(){
		
	}
	
	//test if the swap method works (run in setUp)
	public void testSwapTile(){
		assertEquals("board:0,0", b.board[0][0].toString());
	}
	
	//test the number of board tiles
	public void testNumBoardTiles(){
		assertEquals(b.getNumBoardTiles(), 6);
	}
	
	//test if the new tile type is a board tile, where the tile was swapped in
	public void testType(){	
		b.swapTile(bt);
		
		String str1 = b.board[0][0].tileType;
		String str2 = bt.tileType;
		
		assertEquals(str2, str1);
		assertEquals(bt.rowOnBoard, 0);
	}
	
	//test functions working with pieces
	public void testPieceFunctions(){	
		//add a piece
		Piece p = new Piece(1);
		assertTrue(b.willFit(p, 2, 0));
		b.putPieceOnBoard(p, 2, 0);
		
		//check if tile type changed and if board contains piece
		assertEquals(b.board[0][0].tileType,"piece");
		assertTrue(b.pieces.contains(p));
		assertEquals(b.getTileAt(0, 0), b.board[0][0]);
		
		
		b.board[0][1] = new BoardTile(0,1);
		b.board[1][1] = new BoardTile(1,1);
		b.board[2][1] = new BoardTile(2,1);
		b.board[3][1] = new BoardTile(3,1);
		b.board[4][1] = new BoardTile(4,1);
		b.board[5][1] = new BoardTile(5,1);
		
		b.removePiece(p);
		
		Piece p2 = new Piece(1);
		b.showPiecePreview(p2, 2, 1);
		
		assertEquals(Color.GREEN, b.board[1][1].color);
		
		Piece p3 = new Piece(1);
{'fraction_non_alphanumeric': 0.16866812227074235, 'fraction_numerical': 0.0425764192139738, 'mean_word_length': 3.7721354166666665, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3596912', 'n_tokens_mistral': 1579, 'n_tokens_neox': 1420, 'n_words': 342}