public void DEC_VisitTest_06_14() { Maze maze = new Maze(10, 10); SWA_Ariadne_Model_MazeAccessor mazeAccessor = new SWA_Ariadne_Model_MazeAccessor(maze); maze.CreateMaze(); // 10 x 10 mazeAccessor.xStart = 4; mazeAccessor.yStart = 9; mazeAccessor.xEnd = mazeAccessor.yEnd = 0; DeadEndChecker target = new DeadEndChecker(maze); List <MazeSquare> deadSquares; MazeSquare sq = maze.StartSquare; // 4,9 deadSquares = Move(target, ref sq, WallPosition.WP_E, 0); // 5,9 deadSquares = Move(target, ref sq, WallPosition.WP_E, 0); // 6,9 deadSquares = Move(target, ref sq, WallPosition.WP_E, 0); // 7,9 deadSquares = Move(target, ref sq, WallPosition.WP_N, 0); // 7,8 deadSquares = Move(target, ref sq, WallPosition.WP_E, 0); // 8,8 deadSquares = Move(target, ref sq, WallPosition.WP_E, 2); // 9,8 ! deadSquares = Move(target, ref sq, WallPosition.WP_N, 0); // 9,7 deadSquares = Move(target, ref sq, WallPosition.WP_N, 0); // 9,6 deadSquares = Move(target, ref sq, WallPosition.WP_N, 0); // 9,5 deadSquares = Move(target, ref sq, WallPosition.WP_N, 0); // 9,4 deadSquares = Move(target, ref sq, WallPosition.WP_W, 0); // 8,4 deadSquares = Move(target, ref sq, WallPosition.WP_W, 0); // 7,4 ! deadSquares = Move(target, ref sq, WallPosition.WP_S, 0); // 7,5 deadSquares = Move(target, ref sq, WallPosition.WP_S, 0); // 7,6 deadSquares = Move(target, ref sq, WallPosition.WP_W, 0); // 6,6 ! deadSquares = Move(target, ref sq, WallPosition.WP_N, 0); // 6,5 deadSquares = Move(target, ref sq, WallPosition.WP_N, 0); // 6,4 deadSquares = Move(target, ref sq, WallPosition.WP_W, 0); // 5,4 ! deadSquares = Move(target, ref sq, WallPosition.WP_N, 0); // 5,3 deadSquares = Move(target, ref sq, WallPosition.WP_N, 0); // 5,2 deadSquares = Move(target, ref sq, WallPosition.WP_W, 0); // 4,2 deadSquares = Move(target, ref sq, WallPosition.WP_W, 0); // 3,2 deadSquares = Move(target, ref sq, WallPosition.WP_S, 0); // 3,3 deadSquares = Move(target, ref sq, WallPosition.WP_S, 0); // 3,4 deadSquares = Move(target, ref sq, WallPosition.WP_E, 1); // 4,4 ! deadSquares = Move(target, ref sq, WallPosition.WP_S, 0); // 4,5 deadSquares = Move(target, ref sq, WallPosition.WP_S, 0); // 4,6 deadSquares = Move(target, ref sq, WallPosition.WP_W, 0); // 3,6 deadSquares = Move(target, ref sq, WallPosition.WP_S, 0); // 3,7 deadSquares = Move(target, ref sq, WallPosition.WP_W, 0); // 2,7 deadSquares = Move(target, ref sq, WallPosition.WP_S, 0); // 2,8 Assert.AreEqual(2, sq.XPos, "current square at wrong X position"); Assert.AreEqual(8, sq.YPos, "current square at wrong Y position"); deadSquares = Move(target, ref sq, WallPosition.WP_S, 14); // 2,9 ! }
private static void TestDecodeIdentity(string testObject, int version) { SWA_Ariadne_Model_MazeDimensionsAccessor dimensionsObj = SWA_Ariadne_Model_MazeDimensionsAccessor.Instance(version); SWA_Ariadne_Model_MazeCodeAccessor codeObj = SWA_Ariadne_Model_MazeCodeAccessor.Instance(version); Random r = new Random(); for (int nTests = 0; nTests < 100; nTests++) { int xSize = r.Next(dimensionsObj.MinSize, dimensionsObj.MaxXSize + 1); int ySize = r.Next(dimensionsObj.MinSize, dimensionsObj.MaxYSize + 1); Maze maze = new Maze(xSize, ySize, version); maze.CreateMaze(); SWA_Ariadne_Model_MazeAccessor accessor = new SWA_Ariadne_Model_MazeAccessor(maze); int seed = accessor.seed; WallPosition direction = accessor.direction; int xStart = accessor.xStart; int yStart = accessor.yStart; int xEnd = accessor.xEnd; int yEnd = accessor.yEnd; string code = maze.Code; int seedActual, xSizeActual, ySizeActual; codeObj.Decode(code , out seedActual , out xSizeActual, out ySizeActual ); bool ok = true; ok &= (seed == seedActual); ok &= (xSize == xSizeActual); ok &= (ySize == ySizeActual); if (!ok) { ok = false; } Assert.AreEqual(seed, seedActual, testObject + ": seed was not set correctly."); Assert.AreEqual(xSize, xSizeActual, testObject + ": xSize was not set correctly."); Assert.AreEqual(ySize, ySizeActual, testObject + ": ySize was not set correctly."); } }