Exemplo n.º 1
0
        public void return_incremented_index_if_int_value_is_0(string instructionString, int currentIndex, int expectedIndex)
        {
            var instruction = new JumpInstruction(instructionString, new Registers());

            var actualIndex = instruction.Execute(currentIndex);

            Assert.AreEqual(expectedIndex, actualIndex);
        }
Exemplo n.º 2
0
        public void return_index_of_instruction_to_execute_next_if_register_is_not_0(string instructionString, char register, int currentIndex, int expectedIndex)
        {
            var registers = new Registers {
                [register] = 3
            };                                                //anything but 0

            var instruction = new JumpInstruction(instructionString, registers);

            var actualIndex = instruction.Execute(currentIndex);

            Assert.AreEqual(expectedIndex, actualIndex);
        }