public void TestAdditionDirect(long a, long b, long answer) { List <long> program = new List <long>() { 1102, a, b, 0, 99, 2, 3 }; IntCodeVM2 vm = new IntCodeVM2(program); vm.ExecuteProgram(); Assert.That(vm.GetMemory(0), Is.EqualTo(answer)); }
public void TestAdditionAddresses(long a, long b, long answer) { List <long> program = new List <long>() { 2, 5, 6, 0, 99, a, b }; IntCodeVM2 vm = new IntCodeVM2(program); vm.ExecuteProgram(); Assert.That(vm.GetMemory(0), Is.EqualTo(answer)); }
public void TestAdditionBaseOffset(long a, long b, long answer) { List <long> program = new List <long>() { 109, 7, 2202, 0, 1, 0, 99, a, b }; IntCodeVM2 vm = new IntCodeVM2(program); vm.ExecuteProgram(); Assert.That(vm.GetMemory(0), Is.EqualTo(answer)); }
public void TestInputDirect(long answer) { List <long> program = new List <long>() { 103, 5, 99, 3, 4, 5 }; IntCodeVM2 vm = new IntCodeVM2(program); vm.AddInput(answer); vm.ExecuteProgram(); Assert.That(vm.GetMemory(1), Is.EqualTo(answer)); }
public void TestInputAddresses(long answer) { List <long> program = new List <long>() { 3, 0, 99, 4, 5, 6 }; IntCodeVM2 vm = new IntCodeVM2(program); vm.AddInput(answer); vm.ExecuteProgram(); Assert.That(vm.GetMemory(0), Is.EqualTo(answer)); }
public void TestInputBaseOffset(long answer) { List <long> program = new List <long>() { 109, 3, 203, 4, 99, 5, 6, 7 }; IntCodeVM2 vm = new IntCodeVM2(program); vm.AddInput(answer); vm.ExecuteProgram(); Assert.That(vm.GetMemory(7), Is.EqualTo(answer)); }