Esempio n. 1
0
        public void Part2_Answer()
        {
            var day7   = new Day7();
            var actual = day7.FindIdealWeight(TEST_INPUT);

            Assert.Equal(1226, actual);
        }
Esempio n. 2
0
        public void Part1_Answer()
        {
            var day7   = new Day7();
            var actual = day7.FindBase(TEST_INPUT);

            Assert.Equal("vgzejbd", actual);
        }
Esempio n. 3
0
        public void TestCountChildBagAmount()
        {
            var bags = Day7
                       .ParseBagInput("Advent_of_Code_2020.Day7.SampleInput2.txt")
                       .ToList();

            Assert.Equal(126, Day7.CountAmountOfChildBags(bags, "shiny gold"));
        }
Esempio n. 4
0
        public void TestCountContainingBags()
        {
            var bags = Day7
                       .ParseBagInput("Advent_of_Code_2020.Day7.SampleInput.txt")
                       .ToList();

            Assert.Equal(4, Day7.CountParentBags(bags, "shiny gold"));
        }
        public void Day07Part1Test()
        {
            var day7 = new Day7();

            var actual   = day7.Part1();
            var expected = 224;

            Assert.AreEqual(expected, actual);
        }
        public void Day07Part2Test()
        {
            var day7 = new Day7();

            var actual   = day7.Part2();
            var expected = 1488;

            Assert.AreEqual(expected, actual);
        }
Esempio n. 7
0
        public void TestInputParser()
        {
            var bags = Day7
                       .ParseBagInput("Advent_of_Code_2020.Day7.SampleInput.txt")
                       .ToList();

            var testChildBagAmount = bags
                                     .First(bag => bag.Color == "light red").ChildBags
                                     .First(relation => relation.ChildBag.Color == "muted yellow")
                                     .Amount;

            Assert.Equal(2, testChildBagAmount);
        }
Esempio n. 8
0
        public void Part2()
        {
            var given = @"pbga (66)
xhth (57)
ebii (61)
havc (66)
ktlj (57)
fwft (72) -> ktlj, cntj, xhth
qoyq (66)
padx (45) -> pbga, havc, qoyq
tknk (41) -> ugml, padx, fwft
jptl (61)
ugml (68) -> gyxo, ebii, jptl
gyxo (61)
cntj (57)";

            var day7   = new Day7();
            var actual = day7.FindIdealWeight(given);

            Assert.Equal(60, actual);
        }
Esempio n. 9
0
 public void Promblem2()
 {
     Assert.AreEqual(45157, Day7.Problem2());
 }
Esempio n. 10
0
 public void Promblem1()
 {
     Assert.AreEqual(278, Day7.Problem1());
 }