package bot;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

/**
 * Test cases where we didn't lose but made a bad choice
 * 
 * @author Ben Thurley
 *
 */
public class BadMovesTest
{

	MoveEngine mover = new MoveEngine();

	@Test
	public void testMove1()
	{
		Field field = new Field(7, 6);
		field.parseFromString(
				"0,0,0,2,0,0,0;0,0,1,2,0,0,0;2,0,2,1,2,0,1;1,0,1,1,1,0,2;2,0,1,2,1,0,2;2,1,1,1,2,0,2");
		field.printField();
		int move = mover.makeTurn(25, field, 1);
		System.out.println(move);

		assertEquals("Need to go in column 4 to set up the win", 4, move);
	}

	@Test
	public void testMove2()
	{
		Field field = new Field(7, 6);
		field.parseFromString(
				"0,0,0,2,0,0,0;0,0,0,1,0,0,0;0,1,0,1,2,0,0;0,2,2,1,1,1,0;2,2,1,2,1,2,0;2,2,1,1,2,1,0");
		field.printField();
		int move = mover.makeTurn(23, field, 1);
		System.out.println(move);

		assertEquals("Need to go in column 2 to win", 2, move);
	}

}
@@ -54,16 +54,65 @@
 Equals;%0D
+%0Aimport static org.junit.Assert.assertNotEquals;%0D
 %0A%0D%0Aimpor
@@ -1025,9 +1025,437 @@
 %0D%0A%09%7D%0D%0A%0D%0A
+%09@Test%0D%0A%09public void testMove3()%0D%0A%09%7B%0D%0A%09%09Field field = new Field(7, 6);%0D%0A%09%09field.parseFromString(%0D%0A%09%09%09%09%220,0,0,0,0,0,0;0,0,0,0,0,0,0;0,0,0,0,0,0,0;0,0,0,2,0,0,0;0,0,1,1,1,0,0;0,0,2,1,2,0,2%22);%0D%0A%09%09field.printField();%0D%0A%09%09int move = mover.makeTurn(9, field, 1);%0D%0A%09%09System.out.println(move);%0D%0A%0D%0A%09%09assertNotEquals(%22Avoid column 1 giving the win away%22, 1, move);%0D%0A%09%09assertNotEquals(%22Avoid column 5 giving the win away%22, 5, move);%0D%0A%09%7D%0D%0A%0D%0A
 %7D

Add unit test for bad move