Exemplo n.º 1
0
        public void Should_Fold_Correctly()
        {
            var dots = new Dot[]
            {
                new(6, 10),
                new(0, 14),
                new(9, 10),
                new(0, 3),
                new(10, 4),
                new(4, 11),
                new(6, 0),
                new(6, 12),
                new(4, 1),
                new(0, 13),
                new(10, 12),
                new(3, 4),
                new(3, 0),
                new(8, 4),
                new(1, 10),
                new(2, 14),
                new(8, 10),
                new(9, 0)
            };

            var instruction = new Instruction(false, 7);

            dots = PaperFolder.Fold(instruction, dots);

            instruction = new Instruction(true, 5);
            dots        = PaperFolder.Fold(instruction, dots);

            Assert.Equal(16, dots.Length);
        }
        public void Day13_Puzzle2_OK()
        {
            var lines = Utils.ReadLinesFromFile("Day13.txt");

            Assert.Equal(815, lines.Length);

            var sut = new PaperFolder(lines);

            Assert.Equal(802, sut.Points.Count);
            Assert.Equal(12, sut.Folds.Count);

            sut.DoAllFolds();
            sut.DumpPoints();
        }
        public void Day13_Test1_OK()
        {
            var lines = Utils.ReadLinesFromFile("Day13Test.txt");

            Assert.Equal(21, lines.Length);

            var sut = new PaperFolder(lines);

            Assert.Equal(18, sut.Points.Count);
            Assert.Equal(2, sut.Folds.Count);

            int actual = sut.DoFold(sut.Folds[0]);

            Assert.Equal(17, actual);
        }
        public void Day13_Puzzle1_OK()
        {
            var lines = Utils.ReadLinesFromFile("Day13.txt");

            Assert.Equal(815, lines.Length);

            var sut = new PaperFolder(lines);

            Assert.Equal(802, sut.Points.Count);
            Assert.Equal(12, sut.Folds.Count);

            int actual = sut.DoFold(sut.Folds[0]);

            Assert.Equal(669, actual);
        }