public void RunsOpcodes_Day2Part1_ReturnsTheAnswer() { var input = File.ReadAllText(@"C:\Projects\Homework\AdventOfCode2019-PuzzleInput\day-2-input-part-1.txt"); var subject = new RunsOpcodes(new ParsesOpcodeStrings()); subject.Run(input).Should().StartWith("5434663"); }
public void RunsOpcodes_Day2Part2_FailsOnTheAnswer() { var parser = new ParsesOpcodeStrings(); var subject = new RunsOpcodes(parser); var input = File.ReadAllText(@"C:\Projects\Homework\AdventOfCode2019-PuzzleInput\day-2-input-part-1.txt"); var codes = parser.Parse(input); for (int noun = 0; noun < 100; noun++) { for (int verb = 0; verb < 100; verb++) { var codeArray = codes.ToArray(); codeArray[1] = noun; codeArray[2] = verb; subject.Run(codeArray.ToList()).Should().NotStartWith("19690720"); } } }
public void RunsOpcodes_MultipleOpcodes_ReturnsExpectedString() { var subject = new RunsOpcodes(new ParsesOpcodeStrings()); subject.Run("1,1,1,4,99,5,6,0,99").Should().Be("30,1,1,4,2,5,6,0,99"); }
public void RunsOpcodes_MultiplyTwo_ReturnsExpectedString() { var subject = new RunsOpcodes(new ParsesOpcodeStrings()); subject.Run("2,4,4,5,99,0").Should().Be("2,4,4,5,99,9801"); }
public void RunsOpcodes_Multiply_ReturnsExpectedString() { var subject = new RunsOpcodes(new ParsesOpcodeStrings()); subject.Run("2,3,0,3,99").Should().Be("2,3,0,6,99"); }
public void RunsOpcodes_FirstTestInput_Returns2() { var subject = new RunsOpcodes(new ParsesOpcodeStrings()); subject.Run("1,0,0,0,99").Should().Be("2,0,0,0,99"); }