public void setUp() { oneBoard = new NQueensBoard(1); eightBoard = new NQueensBoard(8); af = NQueensFunctionFactory.getIActionsFunction(); rf = NQueensFunctionFactory.getResultFunction(); }
public void testSingleSquareBoard() { board = new NQueensBoard(1); Assert.IsFalse(goalTest(board)); board.addQueenAt(new XYLocation(0, 0)); Assert.IsTrue(goalTest(board)); }
public void testSimpleBoardSuccessorGenerator() { ICollection <QueenAction> actions = CollectionFactory.CreateQueue <QueenAction>(actionsFn.apply(oneBoard)); Assert.AreEqual(1, actions.Size()); NQueensBoard next = resultFn.apply(oneBoard, actions.Get(0)); Assert.AreEqual(1, next.getNumberOfQueensOnBoard()); }
public void testPrint() { NQueensBoard board2 = new NQueensBoard(2); board2.addQueenAt(new XYLocation(0, 0)); string expected = " Q - \n - - \n"; Assert.AreEqual(expected, board2.getBoardPic()); }
public void setUp() { oneBoard = new NQueensBoard(1); eightBoard = new NQueensBoard(8); board = new NQueensBoard(8); actionsFn = NQueensFunctions.getIFActionsFunction(); resultFn = NQueensFunctions.getResultFunction(); goalTest = NQueensFunctions.testGoal; }
public void testEquality() { board.addQueenAt(new XYLocation(0, 0)); NQueensBoard board2 = new NQueensBoard(8); board2.addQueenAt(new XYLocation(0, 0)); Assert.AreEqual(board, board2); NQueensBoard board3 = new NQueensBoard(8); board3.addQueenAt(new XYLocation(0, 1)); Assert.IsFalse(board.Equals(board3)); }
public void test_getBoardForIndividual() { NQueensBoard board = NQueensGenAlgoUtil .getBoardForIndividual(new Individual <int>(CollectionFactory.CreateQueue <int>(new[] { 5, 6, 1, 3, 6, 4, 7, 7 }))); Assert.AreEqual(" - - - - - - - - \n" + " - - Q - - - - - \n" + " - - - - - - - - \n" + " - - - Q - - - - \n" + " - - - - - Q - - \n" + " Q - - - - - - - \n" + " - Q - - Q - - - \n" + " - - - - - - Q Q \n", board.getBoardPic()); Assert.AreEqual("--------\n" + "--Q-----\n" + "--------\n" + "---Q----\n" + "-----Q--\n" + "Q-------\n" + "-Q--Q---\n" + "------QQ\n", board.ToString()); }
public void testSingleSquareBoard() { board = new NQueensBoard(1); Assert.assertFalse(goalTest.isGoalState(board)); board.addQueenAt(new XYLocation(0, 0)); Assert.assertTrue(goalTest.isGoalState(board)); }
public void setUp() { goalTest = new NQueensGoalTest(); board = new NQueensBoard(8); }
public void setUp() { board = new NQueensBoard(8); }
public void testPrint() { NQueensBoard board2 = new NQueensBoard(2); board2.addQueenAt(new XYLocation(0, 0)); String expected = " Q - \n - - \n"; Assert.assertEquals(expected, board2.getBoardPic()); }
public void testEquality() { board.addQueenAt(new XYLocation(0, 0)); NQueensBoard board2 = new NQueensBoard(8); board2.addQueenAt(new XYLocation(0, 0)); Assert.assertEquals(board, board2); NQueensBoard board3 = new NQueensBoard(8); board3.addQueenAt(new XYLocation(0, 1)); Assert.assertFalse(board.equals(board3)); }