Ejemplo n.º 1
0
        public void ShouldCorrectlyRunExample2()
        {
            List <int> program = new List <int>()
            {
                1002, 4, 3, 4, 33
            };
            IntcodeVirtualMachine virtualMachine = new IntcodeVirtualMachine(program);

            virtualMachine.Run();

            List <long> expected = new List <long>()
            {
                1002, 4, 3, 4, 99
            };

            Assert.Equal(expected, virtualMachine.GetState());
        }
Ejemplo n.º 2
0
        public void ShouldCorrectlyCalculateExample1()
        {
            List <int> opcodes = new List <int>()
            {
                1, 9, 10, 3, 2, 3, 11, 0, 99, 30, 40, 50
            };
            IntcodeVirtualMachine intMachine = new IntcodeVirtualMachine(opcodes);

            intMachine.Run();

            List <long> actual   = intMachine.GetState();
            List <long> expected = new List <long>()
            {
                3500, 9, 10, 70, 2, 3, 11, 0, 99, 30, 40, 50
            };

            Assert.Equal(expected, actual);
        }
Ejemplo n.º 3
0
        public void ShouldCorrectlyCalculateExample5()
        {
            List <int> opcodes = new List <int>()
            {
                1, 1, 1, 4, 99, 5, 6, 0, 99
            };
            IntcodeVirtualMachine intMachine = new IntcodeVirtualMachine(opcodes);

            intMachine.Run();

            List <long> actual   = intMachine.GetState();
            List <long> expected = new List <long>()
            {
                30, 1, 1, 4, 2, 5, 6, 0, 99
            };

            Assert.Equal(expected, actual);
        }
Ejemplo n.º 4
0
        public void ShouldCorrectlyCalculateExample4()
        {
            List <int> opcodes = new List <int>()
            {
                2, 4, 4, 5, 99, 0
            };
            IntcodeVirtualMachine intMachine = new IntcodeVirtualMachine(opcodes);

            intMachine.Run();

            List <long> actual   = intMachine.GetState();
            List <long> expected = new List <long>()
            {
                2, 4, 4, 5, 99, 9801
            };

            Assert.Equal(expected, actual);
        }