public void CpySupportsRegisters() { var instructions = new string[] { "cpy 42 a", "cpy a b" }; var sut = new AdventOfCode2016.Day12.Day12(instructions); var expected = 42; sut.Run(); var actual = sut.RegisterB; Assert.Equal(expected, actual); }
public void JnzSupportsIntegers() { var instructions = new string[] { "jnz 1 2", "inc a", "inc a" }; var sut = new AdventOfCode2016.Day12.Day12(instructions); var expected = 1; sut.Run(); var actual = sut.RegisterA; Assert.Equal(expected, actual); }
public void JnzPerformsNegativeJump() { var instructions = new string[] { "cpy 2 a", "dec a", "inc b", "jnz a -2" }; var sut = new AdventOfCode2016.Day12.Day12(instructions); var expected = 2; sut.Run(); var actual = sut.RegisterB; Assert.Equal(expected, actual); }
public void DecDecreasesValueInRegister() { var instructions = new string[] { "cpy 43 a", "dec a" }; var sut = new AdventOfCode2016.Day12.Day12(instructions); var expected = 42; sut.Run(); var actual = sut.RegisterA; Assert.Equal(expected, actual); }
public void CpyCopiesValueToRegister() { var instructions = new string[] { "cpy 41 a" }; var sut = new AdventOfCode2016.Day12.Day12(instructions); var expected = 41; sut.Run(); var actual = sut.RegisterA; Assert.Equal(expected, actual); }
private static void Day12() { var lines = File.ReadAllLines(@"..\..\Day12\input.txt"); var d12 = new Day12.Day12(lines); d12.Run(); Console.WriteLine($"{d12.RegisterA}"); d12.RegisterA = 0; d12.RegisterB = 0; d12.RegisterC = 1; d12.RegisterD = 0; d12.Run(); Console.WriteLine($"{d12.RegisterA}"); }