public void PartA_Actual()
        {
            var sut    = new DayTen();
            var result = sut.PartA();

            Assert.Equal("2210", result);
        }
        public void PartB_Actual()
        {
            var sut    = new DayTen();
            var result = sut.PartB();

            Assert.Equal("7086739046912", result);
        }
        public void FindJoltDifferenceProduct(string filePath, int expected)
        {
            var sut    = new DayTen();
            var result = sut.FindJoltDifferenceProduct(filePath);

            Assert.Equal(expected, result);
        }
        public void FindNumberOfValidAdapterCombos(string filePath, int expected)
        {
            var sut    = new DayTen();
            var result = sut.FindNumberOfValidAdapterCombos(filePath);

            Assert.Equal(expected, result);
        }
        public void testWithListedTestCase()
        {
            var sot             = new DayTen();
            var microChipsItHas = new List <int>()
            {
                5, 2
            };

            var instructions = new List <string>
            {
                "value 5 goes to bot 2",
                "bot 2 gives low to bot 1 and high to bot 0",
                "value 3 goes to bot 1",
                "bot 1 gives low to output 1 and high to bot 0",
                "bot 0 gives low to output 2 and high to output 0",
                "value 2 goes to bot 2"
            };

            var result = sot.GetNumberOfBotResponsible(microChipsItHas, instructions);

            Assert.Equal(2, result);
            Assert.Equal(5, sot.outputs[0]);
            Assert.Equal(2, sot.outputs[1]);
            Assert.Equal(3, sot.outputs[2]);
        }
        public void testWithActualPartB()
        {
            var sot             = new DayTen();
            var microChipsItHas = new List <int>()
            {
                17, 61
            };

            var          instructions = new List <string>();
            string       line;
            StreamReader file = new StreamReader(@"Ten\DayTenInput.txt");

            // Iterate over each line in the input and gather them
            while ((line = file.ReadLine()) != null)
            {
                instructions.Add(line);
            }
            file.Close();

            sot.GetNumberOfBotResponsible(microChipsItHas, instructions);

            long result = sot.outputs[0] * sot.outputs[1] * sot.outputs[2];

            Assert.Equal(133163, result);
        }
Exemple #7
0
        public void TestPartA()
        {
            var sut    = new DayTen();
            var result = sut.PartA();

            Assert.Equal("2928", result);
        }
        public void FindSecondWhereStarsAlign()
        {
            var filePath = @"Ten\DayTenTestInput.txt";
            var sut      = new DayTen();
            var result   = sut.FindSecondWhereStarsAlign(filePath);

            Assert.Equal(3, result);
        }
Exemple #9
0
        public void TestPartB()
        {
            var sut    = new DayTen();
            var result = sut.PartB();

            Assert.Equal(32, result.Length);
            Assert.Equal("0c2f794b2eb555f7830766bf8fb65a16", result);
        }
Exemple #10
0
        public void TestKnotHash_string()
        {
            var        dayTen        = new DayTen();
            List <int> originalInput = dayTen.Input;
            string     stringInput   = string.Join <int>(",", originalInput);

            var knotHash = new KnotHash(stringInput);

            Assert.Equal(32, knotHash.HexOutput.Length);
            Assert.Equal("0c2f794b2eb555f7830766bf8fb65a16", knotHash.HexOutput);
        }
        public void Part2_GetTotalArrangementsForSimpleExample()
        {
            var input = new List <int>
            {
                16,
                10,
                15,
                5,
                1,
                11,
                7,
                19,
                6,
                12,
                4
            };

            DayTen.GetTotalArrangementsForAdapterChain(input).Should().Be(8);
        }
        public void Part1_GetJoltageDistributionForSimpleExample()
        {
            var input = new List <int>
            {
                16,
                10,
                15,
                5,
                1,
                11,
                7,
                19,
                6,
                12,
                4
            };

            DayTen.GetJoltageDistrubutionForAdapterChain(input).Should().Be((7, 0, 5));
        }
        public void Part1_GetJoltageDistributionForLargerExample()
        {
            var input = new List <int>
            {
                28,
                33,
                18,
                42,
                31,
                14,
                46,
                20,
                48,
                47,
                24,
                23,
                49,
                45,
                19,
                38,
                39,
                11,
                1,
                32,
                25,
                35,
                8,
                17,
                7,
                9,
                4,
                2,
                34,
                10,
                3
            };

            DayTen.GetJoltageDistrubutionForAdapterChain(input).Should().Be((22, 0, 10));
        }
        public void Part2_GetTotalArrangementsForLargerExample()
        {
            var input = new List <int>
            {
                28,
                33,
                18,
                42,
                31,
                14,
                46,
                20,
                48,
                47,
                24,
                23,
                49,
                45,
                19,
                38,
                39,
                11,
                1,
                32,
                25,
                35,
                8,
                17,
                7,
                9,
                4,
                2,
                34,
                10,
                3
            };

            DayTen.GetTotalArrangementsForAdapterChain(input).Should().Be(19208);
        }
        public void Part1_CalculateResult()
        {
            var input = File.ReadAllLines(@"Input/input10.txt");

            System.Console.WriteLine(DayTen.CalculateResultForPartOne(input));
        }
Exemple #16
0
        private static void DayTen()
        {
            var dayTen = new DayTen();

            dayTen.RunDayTen(@"Files\DayTen.txt");
        }