public void Part2_Answer() { var day8 = new Day8(); var actual = day8.FindHighest(TEST_INPUT); Assert.Equal(6619, actual); }
public void Part1_Answer() { var day8 = new Day8(); var actual = day8.FindLargest(TEST_INPUT); Assert.Equal(6611, actual); }
public void TestLoopStopper() { var console = Day8.ParseGameConsoleCode("Advent_of_Code_2020.Day8.SampleInput.txt"); Day8.DoesConsoleLoop(console); Assert.Equal(5, console.Accumulator); }
public void TestLoopFixer() { var console = Day8.ParseGameConsoleCode("Advent_of_Code_2020.Day8.SampleInput.txt"); Day8.FindLoopingFix(console); Assert.Equal(8, console.Accumulator); }
public void Day08Part2Test() { var day8 = new Day8(); var actual = day8.Part2(); var expected = 797; Assert.AreEqual(expected, actual); }
public void Day08Part1Test() { var day8 = new Day8(); var actual = day8.Part1(); var expected = 1782; Assert.AreEqual(expected, actual); }
public void Part2() { var day8 = new Day8(); var actual = day8.FindHighest(@"b inc 5 if a > 1 a inc 1 if b < 5 c dec -10 if a >= 1 c inc -20 if c == 10"); Assert.Equal(10, actual); }
public void Part1_CheckParser() { var day8 = new Day8(); var actual = day8.Parse("b inc 5 if a > 1"); Assert.Equal("b", actual.Register); Assert.Equal(Operation.Inc, actual.Operation); Assert.Equal(5, actual.Offset); Assert.Equal("a", actual.ConditionRegister); Assert.Equal(Condition.GT, actual.ConditionType); Assert.Equal(1, actual.ConditionValue); }
public void Part1_SetNewRegister() { var day8 = new Day8(); var instruction = new Instruction(); instruction.Register = "a"; instruction.Operation = Operation.Inc; instruction.Offset = -100; var registers = new Dictionary <string, int>(); day8.UpdateRegister(instruction, registers); Assert.Equal(-100, registers["a"]); }
public void Part1_TestFalsePredicate() { var day8 = new Day8(); var instruction = new Instruction(); instruction.ConditionRegister = "a"; instruction.ConditionType = Condition.EQ; instruction.ConditionValue = 10; var registers = new Dictionary <string, int>(); var actual = day8.EvaluateCondition(instruction, registers); Assert.False(actual); }
public void Part1_UpdateExistingRegister() { var day8 = new Day8(); var instruction = new Instruction(); instruction.Register = "b"; instruction.Operation = Operation.Dec; instruction.Offset = 12; var registers = new Dictionary <string, int>(); registers.Add("b", 100); day8.UpdateRegister(instruction, registers); Assert.Equal(88, registers["b"]); }
public void Part1_TestTruePredicate() { var day8 = new Day8(); var instruction = new Instruction(); instruction.ConditionRegister = "b"; instruction.ConditionType = Condition.GTE; instruction.ConditionValue = 100; var registers = new Dictionary <string, int>(); registers.Add("b", 101); var actual = day8.EvaluateCondition(instruction, registers); Assert.True(actual); }
public void Part2_2() { List <string> program = new List <string> { "nop +0", "acc +1", "jmp +4", "acc +3", "jmp -3", "acc -99", "acc +1", "jmp -4", "acc +6" }; Computer computer = new Computer(); computer.Load(program); int result = Day8.ModifyUntilExecuteToEnd(computer); Assert.AreEqual(8, result); }
public void Answer2() { int answer = 1375; Assert.AreEqual(answer, Day8.Problem2()); }
public void Answer1() { int answer = 1548; Assert.AreEqual(answer, Day8.Problem1()); }