public void TestInputParsing() { var(rules, myTicket, otherTickets) = Problem16.ParseInput(_firstTestInput); Assert.AreEqual(3, rules.Count()); Assert.AreEqual(4, otherTickets.Count()); Assert.AreEqual(3, myTicket.Fields.Count); Assert.AreEqual("class", rules.First().Name); }
public void TestFindDepartureValueProduct() { string[] testInput = { "class: 0-1 or 4-19", "row: 0-5 or 8-19", "seat: 0-13 or 16-19", "", "your ticket:", "11,12,13", "", "nearby tickets:", "3,9,18", "15,1,5", "5,14,9" }; var(rules, myTicket, otherTickets) = Problem16.ParseInput(testInput); Assert.AreEqual(11, Problem16.FindDepartureValueProduct(rules, myTicket, otherTickets, "row")); Assert.AreEqual(12, Problem16.FindDepartureValueProduct(rules, myTicket, otherTickets, "class")); Assert.AreEqual(13, Problem16.FindDepartureValueProduct(rules, myTicket, otherTickets, "seat")); }
public void TestScanErrorRate() { var(rules, myTicket, otherTickets) = Problem16.ParseInput(_firstTestInput); Assert.AreEqual(71, Problem16.FindErrorScanRate(rules, otherTickets.Append(myTicket))); }