public void fourNumbersOnePossibilitySolverTest()
        {
            FourBoard testBoard = new FourBoard();

            string[] lines = File.ReadAllLines(@"E:\School Stuff\Homework\CS 5700\SudokuSolver\SudokuSolver\TestBoards\Input\Puzzle-4x4-0001.txt");
            Assert.IsNotNull(lines);
            List <char> testPuzzle = new List <char>();

            for (int i = 2; i < lines.Length; i++)
            {
                ParseSudokuPuzzle.ParsePuzzleLine(lines[i], testPuzzle);
            }
            Assert.IsNotNull(testPuzzle);
            testBoard.Init(testPuzzle);
            Assert.AreEqual(2, testBoard.Cells[0].Value);
            NumbersOnePossibilitySolver onePSolver = new NumbersOnePossibilitySolver();

            onePSolver.SolveCells(testBoard);
            Assert.AreEqual(16, testBoard.SolvedCells);
            Assert.AreEqual(4, testBoard.Cells[1].Value);
        }
Example #2
0
        public void TestFourBoard()
        {
            FourBoard testFour  = new FourBoard();
            Cell      testCell1 = new Cell(1, 1, 1);
            Cell      testCell2 = new Cell(4, 4, 4);
            Cell      testCell3 = new Cell(2, 3, 2);

            Assert.IsNotNull(testFour);
            foreach (Cell cell in testFour.Cells)
            {
                Assert.IsNotNull(cell);
                Assert.AreNotEqual(-1, cell.Box);
            }

            Assert.AreEqual(16, testFour.Cells.Count);
            Assert.AreEqual(testCell1.Row, testFour.Cells[0].Row);
            Assert.AreEqual(testCell2.Row, testFour.Cells[15].Row);
            Assert.AreEqual(testCell1.Box, testFour.Cells[0].Box);
            Assert.AreEqual(testCell2.Box, testFour.Cells[15].Box);
            Assert.AreEqual(testCell3.Row, testFour.Cells[7].Row);
            Assert.AreEqual(testCell3.Box, testFour.Cells[7].Box);
        }