public void PuzzleExample_FindFirstInvalid() { const int preambleLength = 5; var system = new XmasSystem(PuzzleExample); system.FindFirstInvalid(preambleLength).Should().Be(127); }
public void Puzzle1_FindFirstInvalid() { const int preambleLength = 25; var system = new XmasSystem(Input.Day09); system.FindFirstInvalid(preambleLength).Should().Be(138879426L); }
public static void Part1(string[] input) { Helper.PrintChallengePart("Part 1"); XmasSystem xmas = new XmasSystem(input); long result = xmas.FindInvalidData(25); Console.WriteLine("Invalid: " + result); }
public static void Part2(string[] input) { Helper.PrintChallengePart("Part 2"); XmasSystem xmas = new XmasSystem(input); long result = xmas.FindInvalidData(25); long sum = xmas.FindContiguousSet(result); Console.WriteLine("Contiguous Sum: " + sum); }
public void Puzzle2_FundSumOfMinAndMaxOfSetThatAddsToInvalid() { const long firstInvalid = 138879426L; var system = new XmasSystem(Input.Day09); var set = system.FindSetThatAddsToInvalid(firstInvalid); var(min, max) = (set.Min(), set.Max()); (min + max).Should().Be(23761694L); }
public void Day9Part1() { // Arrange string[] input = Helper.ParseInput(@"Inputs\\Day9_example.txt"); //Act XmasSystem xmas = new XmasSystem(input); long result = xmas.FindInvalidData(5); //Assert Assert.AreEqual(127, result); }
public void Day9Part2() { // Arrange string[] input = Helper.ParseInput(@"Inputs\\Day9_example.txt"); //Act XmasSystem xmas = new XmasSystem(input); long result = xmas.FindInvalidData(5); long sum = xmas.FindContiguousSet(result); //Assert Assert.AreEqual(62, sum); }
public void PuzzleExample_FindSetThatAddsToInvalid() { var expectedSet = new List <long> { 15, 25, 47, 40 }; var system = new XmasSystem(PuzzleExample); var actual = system.FindSetThatAddsToInvalid(127); actual.Should().BeEquivalentTo(expectedSet); var(min, max) = (actual.Min(), actual.Max()); (min + max).Should().Be(62); }