Exemplo n.º 1
0
        public void handle_nop_operation_returns_next_line_of_1_more()
        {
            var state = new Day08Task1.State(123, 10);
            var nop   = new Day08Task1.Nop(12);

            var result = nop.Handle(state);

            result.NextLine.Should().Be(11);
        }
Exemplo n.º 2
0
        public void handle_acc_operation_returns_next_line_of_1_more()
        {
            var state = new Day08Task1.State(123, 10);
            var acc   = new Day08Task1.Acc(124);

            var result = acc.Handle(state);

            result.NextLine.Should().Be(11);
        }
Exemplo n.º 3
0
        public void handle_nop_operation_returns_the_same_accumulator()
        {
            var state = new Day08Task1.State(123, 10);
            var nop   = new Day08Task1.Nop(11);

            var result = nop.Handle(state);

            result.Accumulator.Should().Be(123);
        }
Exemplo n.º 4
0
        public void handle_jmp_operation_returns_the_same_accumulator()
        {
            var startingAccumulatorValue = 123;
            var state = new Day08Task1.State(startingAccumulatorValue, 10);
            var jmp   = new Day08Task1.Jmp(11);

            var result = jmp.Handle(state);

            result.Accumulator.Should().Be(startingAccumulatorValue);
        }
Exemplo n.º 5
0
        public void handle_acc_operation_sets_was_executed_flag()
        {
            var state = new Day08Task1.State(123, 10);
            var acc   = new Day08Task1.Acc(124);

            acc.WasExecuted.Should().BeFalse();
            var result = acc.Handle(state);

            acc.WasExecuted.Should().BeTrue();
        }
Exemplo n.º 6
0
        public void handle_acc_operation_changes_accumulator_value(int value)
        {
            var startingAccumulatorValue = 123;
            var state = new Day08Task1.State(startingAccumulatorValue, 10);
            var acc   = new Day08Task1.Acc(value);

            var result = acc.Handle(state);

            result.Accumulator.Should().Be(startingAccumulatorValue + value);
        }
Exemplo n.º 7
0
        public void handle_nop_operation_sets_was_executed_flag()
        {
            var state = new Day08Task1.State(123, 10);
            var nop   = new Day08Task1.Nop(13);

            nop.WasExecuted.Should().BeFalse();
            var result = nop.Handle(state);

            nop.WasExecuted.Should().BeTrue();
        }
Exemplo n.º 8
0
        public void handle_jmp_operation_sets_was_executed_flag()
        {
            var state = new Day08Task1.State(123, 10);
            var jmp   = new Day08Task1.Jmp(124);

            jmp.WasExecuted.Should().BeFalse();
            var result = jmp.Handle(state);

            jmp.WasExecuted.Should().BeTrue();
        }
Exemplo n.º 9
0
        public void handle_jmp_operation_returns_next_line_with_offset(int offset)
        {
            var startingLineValue = 10;
            var state             = new Day08Task1.State(123, startingLineValue);
            var jmp = new Day08Task1.Jmp(offset);

            var result = jmp.Handle(state);

            result.NextLine.Should().Be(startingLineValue + offset);
        }