Esempio n. 1
0
        public async Task ShouldPerformOptimizedPolymerReactionForBigInput()
        {
            var sut = new OptimizedPolymer(PuzzleInputParser.ParseString("Day5/Input.txt"));
            await sut.ReactAsync();

            sut.Units.Should().Be(5122);
        }
Esempio n. 2
0
        public void ShouldCalculateRootNodeValueFromBigInput()
        {
            var raw = PuzzleInputParser.ParseString("Day8/Input.txt");
            var sut = new Tree(raw);

            sut.RootNodeValue.Should().Be(28779);
        }
Esempio n. 3
0
        public void ShouldCalculateMetadataSumFromBigInput()
        {
            var raw = PuzzleInputParser.ParseString("Day8/Input.txt");
            var sut = new Tree(raw);

            sut.MetadataSum.Should().Be(40309);
        }
Esempio n. 4
0
        public void ShouldPrintPossibleTextForBigInput()
        {
            var points = PointOfLightParser.Parse(PuzzleInputParser.ParseStrings("Day10/Input.txt")).ToList();

            var sut = new Sky(points);

            sut.MoveTimeUntilStarsSpellMessage();
            sut.Print();

            PuzzleInputParser.ParseString("Day10/Output.txt").Should().Be(PuzzleInputParser.ParseString("Day10/BigOutput.txt"));
            sut.Seconds.Should().Be(10681);
        }
Esempio n. 5
0
        public void ShouldPrintPossibleTextForExampleInput()
        {
            var points = PointOfLightParser.Parse(new List <string>
            {
                "position=< 9,  1> velocity=< 0,  2>",
                "position=< 7,  0> velocity=<-1,  0>",
                "position=< 3, -2> velocity=<-1,  1>",
                "position=< 6, 10> velocity=<-2, -1>",
                "position=< 2, -4> velocity=< 2,  2>",
                "position=<-6, 10> velocity=< 2, -2>",
                "position=< 1,  8> velocity=< 1, -1>",
                "position=< 1,  7> velocity=< 1,  0>",
                "position=<-3, 11> velocity=< 1, -2>",
                "position=< 7,  6> velocity=<-1, -1>",
                "position=<-2,  3> velocity=< 1,  0>",
                "position=<-4,  3> velocity=< 2,  0>",
                "position=<10, -3> velocity=<-1,  1>",
                "position=< 5, 11> velocity=< 1, -2>",
                "position=< 4,  7> velocity=< 0, -1>",
                "position=< 8, -2> velocity=< 0,  1>",
                "position=<15,  0> velocity=<-2,  0>",
                "position=< 1,  6> velocity=< 1,  0>",
                "position=< 8,  9> velocity=< 0, -1>",
                "position=< 3,  3> velocity=<-1,  1>",
                "position=< 0,  5> velocity=< 0, -1>",
                "position=<-2,  2> velocity=< 2,  0>",
                "position=< 5, -2> velocity=< 1,  2>",
                "position=< 1,  4> velocity=< 2,  1>",
                "position=<-2,  7> velocity=< 2, -2>",
                "position=< 3,  6> velocity=<-1, -1>",
                "position=< 5,  0> velocity=< 1,  0>",
                "position=<-6,  0> velocity=< 2,  0>",
                "position=< 5,  9> velocity=< 1, -2>",
                "position=<14,  7> velocity=<-2,  0>",
                "position=<-3,  6> velocity=< 2, -1>",
            }).ToList();

            var sut = new Sky(points);

            sut.MoveTimeUntilStarsSpellMessage();
            sut.Print();

            PuzzleInputParser.ParseString("Day10/Output.txt").Should().Be(PuzzleInputParser.ParseString("Day10/ExampleOutput.txt"));
            sut.Seconds.Should().Be(3);
        }