Exemplo n.º 1
0
        public void RotateAndFlip()
        {
            var original = @"
#....####.
#..#.##...
#.##..#...
######.#.#
.#...#.#.#
.#########
.###.#..#.
########.#
##...##.#.
..###.#.#.".Trim();

            var expected = @"
..#.###...
##.##....#
..#.###..#
###.#..###
.######.##
#.#.#.#...
#.###.###.
#.###.##..
.######...
.##...####".Trim();

            var input    = original.ChopToList().Select(row => row.ToCharArray().ToList()).ToList();
            var r1       = Day20.Flip(Day20.Rotate(input));
            var asString = Day20.DataToString(r1);

            asString.ShouldBe(expected);
        }
Exemplo n.º 2
0
        public void RotateAndFlipMini()
        {
            var original = @"
123
456
789".Trim();

            var exFlipped = @"
789
456
123".Trim();

            var expected = @"
147
258
369".Trim();

            var input   = original.ChopToList().Select(row => row.ToCharArray().ToList()).ToList();
            var flipped = Day20.Flip(input);
            var rotated = Day20.Rotate(flipped);

            var flippedAsString = Day20.DataToString(flipped);

            flippedAsString.ShouldBe(exFlipped, "exFlipped");

            var rotatedAsString = Day20.DataToString(rotated);

            rotatedAsString.ShouldBe(expected, "expected");
        }
Exemplo n.º 3
0
        public void Flip()
        {
            var original = @"
#....####.
#..#.##...
#.##..#...
######.#.#
.#...#.#.#
.#########
.###.#..#.
########.#
##...##.#.
..###.#.#.".Trim();

            var expected = @"
..###.#.#.
##...##.#.
########.#
.###.#..#.
.#########
.#...#.#.#
######.#.#
#.##..#...
#..#.##...
#....####.".Trim();

            var input    = original.ChopToList().Select(row => row.ToCharArray().ToList()).ToList();
            var result   = Day20.Flip(input);
            var asString = Day20.DataToString(result);

            asString.ShouldBe(expected, "result");

            var inputAsString = Day20.DataToString(input);

            inputAsString.ShouldBe(original, "original");
        }