public void TraceMode_Should_Reach_Data_Beyond_Run_Opcodes_When_Needed() { long[] data = new long[] { 1001, 8, 1, 8, 1005, 8, 0, 99, -5, }; IntcodeComputer computerTested = new IntcodeComputer(data, IntcodeMode.Trace); string[] expected = new[] { "0000 pos_0: pos_1 = pos_1 + 1", "0004 if (pos_1 != 0) goto pos_0", "0000 pos_1 = pos_1 + 1", "0004 if (pos_1 != 0) goto pos_0", "0000 pos_1 = pos_1 + 1", "0004 if (pos_1 != 0) goto pos_0", "0000 pos_1 = pos_1 + 1", "0004 if (pos_1 != 0) goto pos_0", "0000 pos_1 = pos_1 + 1", "0004 if (pos_1 != 0) goto pos_0", "0007 stop", "", "0008 pos_1: data 0", }; computerTested.Run(); List <string> trace = computerTested.GetTrace(); trace.Should().BeEquivalentTo(expected); }
public void TraceMode_Should_Generate_Labelized_Events_Really_Hapenning() { long[] data = new long[] { -5, 1001, 0, 1, 0, 1005, 0, 1, 99, }; IntcodeComputer computerTested = new IntcodeComputer(data, IntcodeMode.Trace); string[] expected = new[] { "0000 pos_0: data -5", "", "0001 pos_1: pos_0 = pos_0 + 1", "0005 if (pos_0 != 0) goto pos_1", "0001 pos_0 = pos_0 + 1", "0005 if (pos_0 != 0) goto pos_1", "0001 pos_0 = pos_0 + 1", "0005 if (pos_0 != 0) goto pos_1", "0001 pos_0 = pos_0 + 1", "0005 if (pos_0 != 0) goto pos_1", "0001 pos_0 = pos_0 + 1", "0005 if (pos_0 != 0) goto pos_1", "0008 stop" }; computerTested.Run(); List <string> trace = computerTested.GetTrace(); trace.Should().BeEquivalentTo(expected); }