예제 #1
0
        public void FindLoopTest()
        {
            var tested = Day8.ParseInstructions(SampleData);

            var result = Day8.FindLoop(tested);

            Assert.Equal(1, result);
            Assert.Equal(5, tested.Accumulator);
        }
예제 #2
0
        public void ParseInstructionsTest()
        {
            var expected = new Day8.Instruction[]
            {
                new(Day8.Operation.Nop, 0),
                new(Day8.Operation.Acc, 1),
                new(Day8.Operation.Jmp, 4),
                new(Day8.Operation.Acc, 3),
                new(Day8.Operation.Jmp, -3),
                new(Day8.Operation.Acc, -99),
                new(Day8.Operation.Acc, 1),
                new(Day8.Operation.Jmp, -4),
                new(Day8.Operation.Acc, 6),
            };

            var result = Day8.ParseInstructions(SampleData);

            Assert.NotNull(result);
            Assert.Equal(expected, result.Instructions);
        }