예제 #1
0
 public void nQueensTest()
 {
     foreach (var testdata in TestDataList)
     {
         IList <IList <string> > queens = NQueens.SolveNQueens(testdata.Input);
         foreach (var output in queens)
         {
             foreach (var chessboard in output)
             {
                 Console.WriteLine(chessboard);
             }
             Console.WriteLine("******************");
         }
     }
 }
예제 #2
0
        public void Test1()
        {
            var sol      = new NQueens();
            var res      = sol.SolveNQueens(4);
            var expected = new List <IList <string> >()
            {
                new List <string>()
                {
                    ".Q..", "...Q", "Q...", "..Q."
                },
                new List <string>()
                {
                    "..Q.", "Q...", "...Q", ".Q.."
                },
            };

            Utlilitiy.AssertAreEqualIgnoreOrder(expected, res);
        }
예제 #3
0
 public void NQueenTest(int n, bool expected)
 {
     Assert.Equal(expected, NQueens.SolveNQueens(n));
 }