public void PartB_Actual()
        {
            var sut    = new DayNine();
            var result = sut.PartB();

            Assert.Equal("3527845091", result);
        }
        public void FindWinningScore(int numberOfMarbles, int numberOfPlayers, int expected)
        {
            var sut    = new DayNine();
            var result = sut.FindWinningScore(numberOfMarbles, numberOfPlayers);

            Assert.Equal(expected, result);
        }
        public void testWithActualPartB()
        {
            var sot    = new DayNine();
            var result = sot.LengthOfMaximumDecompressedFile();

            Assert.Equal(11317278863, result);
        }
        public void Part1_CalculateResultForSimpleExample()
        {
            var input = new List <long>()
            {
                35,
                20,
                15,
                25,
                47,
                40,
                62,
                55,
                65,
                95,
                102,
                117,
                150,
                182,
                127,
                219,
                299,
                277,
                309,
                576
            };

            DayNine.FindNonXmasNumber(input, 5).Should().Be(127);
        }
示例#5
0
        public void PartA_Actual()
        {
            var sut    = new DayNine();
            var result = sut.PartA();

            Assert.Equal("14144619", result);
        }
        public void testWithActualPartA()
        {
            var sot    = new DayNine();
            var result = sot.LengthOfDecompressedFile();

            Assert.Equal(183269, result);
        }
        public void TestPartA()
        {
            var sut    = new DayNine();
            var result = sut.PartA();

            Assert.Equal("16021", result);
        }
        public void TestParseStringAndReturn_GarbageScore(string input, int totalScore)
        {
            var sut    = new DayNine();
            var result = sut.ParseStringAndReturn(input).GarbageScore;

            Assert.Equal(totalScore, result);
        }
        public void TestPartB()
        {
            var sut    = new DayNine();
            var result = sut.PartB();

            Assert.Equal("7685", result);
        }
示例#10
0
        public void PartB_Actual()
        {
            var sut    = new DayNine();
            var result = sut.PartB();

            Assert.Equal("1766397", result);
        }
        public void Part2_FindContiguousRangeSummingUpToTotal()
        {
            var input = new List <long>()
            {
                35,
                20,
                15,
                25,
                47,
                40,
                62,
                55,
                65,
                95,
                102,
                117,
                150,
                182,
                127,
                219,
                299,
                277,
                309,
                576
            };

            DayNine.FindContiguousRangeSummingUpToTotal(127, input).Should().Be((2, 5));
        }
示例#12
0
        public void FindNumberWithWeakness()
        {
            string filePath = @"Nine\DayNineTestInputA.txt";
            var    sut      = new DayNine();
            var    result   = sut.FindNumberWithWeakness(filePath, 5);

            Assert.Equal(127, result);
        }
示例#13
0
        public void testMaximumDecompressInput(string input, string expected, int len)
        {
            var sut    = new DayNine();
            var result = sut.MaximumDecompressInput(input);

            Assert.Equal(expected, result);
            Assert.Equal(len, sut.LengthOfInput(result));
        }
示例#14
0
        public void FindSumOfSmallestAndLargestEqualingTarget()
        {
            string filePath = @"Nine\DayNineTestInputA.txt";
            var    sut      = new DayNine();
            var    result   = sut.FindSumOfSmallestAndLargestEqualingTarget(filePath, 127);

            Assert.Equal(62, result);
        }
            public void Test_6_Has_0_Garbage_Characters()
            {
                int garbage = new DayNine(test6).garbageCharacters;

                Assert.AreEqual(0, garbage);
            }
            public void Test_3_Has_Score_5()
            {
                int score = new DayNine(test3).score;

                Assert.AreEqual(5, score);
            }
示例#17
0
        static void Main(string[] args)
        {
            /*  try{
             *  var dayOne = new DayOne();
             *  Console.WriteLine(dayOne.RunTestsAndGetResultPartOne());
             *  Console.WriteLine(dayOne.RunTestsAndGetResultPartTwo());
             * }
             * catch(Exception ex){
             *  Console.WriteLine(ex.Message);
             * }
             */

            try{
                var dayTwo = new DayTwo();
                Console.WriteLine(dayTwo.RunTestsAndGetResultPartOne());
                // Console.WriteLine(dayTwo.GetResultPartTwo());
            }
            catch (Exception ex) {
                Console.WriteLine(ex.Message);
            }


            /*
             * try{
             * var dayThree = new DayThree();
             * var watch = System.Diagnostics.Stopwatch.StartNew();
             * Console.WriteLine(dayThree.RunTestsAndGetResultPartOne());
             * watch.Stop();
             * Console.WriteLine("Time:" + watch.ElapsedMilliseconds);
             * }
             * catch(Exception ex){
             * Console.WriteLine(ex.Message);
             * }
             *
             * try{
             * var dayThree = new DayThree();
             * var watch = System.Diagnostics.Stopwatch.StartNew();
             * Console.WriteLine(dayThree.RunTestsAndGetResultPartTwo());
             * watch.Stop();
             * Console.WriteLine("Time:" + watch.ElapsedMilliseconds);
             * }
             * catch(Exception ex){
             * Console.WriteLine(ex.Message);
             * }
             */

            /*
             * try{
             * var dayFour = new DayFour();
             * var watch = System.Diagnostics.Stopwatch.StartNew();
             * Console.WriteLine(dayFour.RunTestsAndGetResultPartOne());
             * watch.Stop();
             * Console.WriteLine("Time:" + watch.ElapsedMilliseconds);
             * }
             * catch(Exception ex){
             * Console.WriteLine(ex.Message);
             * }
             */



            try{
                var dayFive = new DayFive();
                var watch   = System.Diagnostics.Stopwatch.StartNew();
                dayFive.RunTestsAndShowResultPartOne();
                watch.Stop();
                Console.WriteLine("Time:" + watch.ElapsedMilliseconds);
            }
            catch (Exception ex) {
                Console.WriteLine(ex.Message);
            }

            try{
                var dayFive = new DayFive();
                var watch   = System.Diagnostics.Stopwatch.StartNew();
                dayFive.RunTestsAndShowResultPartTwo();
                watch.Stop();
                Console.WriteLine("Time:" + watch.ElapsedMilliseconds);
            }
            catch (Exception ex) {
                Console.WriteLine(ex.Message);
            }


            /*
             * try{
             * var daySix = new DaySix();
             * var watch = System.Diagnostics.Stopwatch.StartNew();
             * Console.WriteLine(daySix.RunTestsAndGetResultPartOne());
             * watch.Stop();
             * Console.WriteLine("Time:" + watch.ElapsedMilliseconds);
             * }
             * catch(Exception ex){
             * Console.WriteLine(ex.Message);
             * }
             *
             * try{
             * var daySix = new DaySix();
             * var watch = System.Diagnostics.Stopwatch.StartNew();
             * Console.WriteLine(daySix.RunTestsAndGetResultPartTwo());
             * watch.Stop();
             * Console.WriteLine("Time:" + watch.ElapsedMilliseconds);
             * }
             * catch(Exception ex){
             * Console.WriteLine(ex.Message);
             * }
             */


            try{
                var daySeven = new DaySeven();
                var watch    = System.Diagnostics.Stopwatch.StartNew();
                Console.WriteLine(daySeven.RunTestsAndGetResultPartOne());
                watch.Stop();
                Console.WriteLine("Time:" + watch.ElapsedMilliseconds);
            }
            catch (Exception ex) {
                Console.WriteLine(ex.Message);
            }

            try{
                var daySeven = new DaySeven();
                var watch    = System.Diagnostics.Stopwatch.StartNew();
                Console.WriteLine(daySeven.RunTestsAndGetResultPartTwo());
                watch.Stop();
                Console.WriteLine("Time:" + watch.ElapsedMilliseconds);
            }
            catch (Exception ex) {
                Console.WriteLine(ex.Message);
            }


            /*
             * try{
             * var dayEight = new DayEight();
             * var watch = System.Diagnostics.Stopwatch.StartNew();
             * Console.WriteLine(dayEight.RunTestsAndGetResultPartOne());
             * watch.Stop();
             * Console.WriteLine("Time:" + watch.ElapsedMilliseconds);
             * }
             * catch(Exception ex){
             * Console.WriteLine(ex.Message);
             * }
             *
             * try{
             * var dayEight = new DayEight();
             * var watch = System.Diagnostics.Stopwatch.StartNew();
             * Console.WriteLine(dayEight.RunTestsAndGetResultPartTwo());
             * watch.Stop();
             * Console.WriteLine("Time:" + watch.ElapsedMilliseconds);
             * }
             * catch(Exception ex){
             * Console.WriteLine(ex.Message);
             * }
             */


            try{
                var dayNine = new DayNine();
                var watch   = System.Diagnostics.Stopwatch.StartNew();
                Console.WriteLine(dayNine.RunTestsAndGetResultPartOne());
                watch.Stop();
                Console.WriteLine("Time:" + watch.ElapsedMilliseconds);
            }
            catch (Exception ex) {
                Console.WriteLine(ex.Message);
            }
        }
            public void Test_5_Has_Score_1()
            {
                int score = new DayNine(test5).score;

                Assert.AreEqual(1, score);
            }
            public void Test_4_Has_Score_16()
            {
                int score = new DayNine(test4).score;

                Assert.AreEqual(16, score);
            }
            public void Test_7_Returns_Five_Groups()
            {
                int numberOfGroups = new DayNine(test7).totalGroups;

                Assert.AreEqual(5, numberOfGroups);
            }
            public void Test_8_Returns_Two_Groups()
            {
                int numberOfGroups = new DayNine(test8).totalGroups;

                Assert.AreEqual(2, numberOfGroups);
            }
            public void Test_4_Returns_Six_Groups()
            {
                int numberOfGroups = new DayNine(test4).totalGroups;

                Assert.AreEqual(6, numberOfGroups);
            }
            public void Test_6_Returns_One_Group()
            {
                int numberOfGroups = new DayNine(test6).totalGroups;

                Assert.AreEqual(1, numberOfGroups);
            }
            public void Test_3_Returns_Three_Groups()
            {
                int numberOfGroups = new DayNine(test3).totalGroups;

                Assert.AreEqual(3, numberOfGroups);
            }
            public void Test_7_Has_Score_9()
            {
                int score = new DayNine(test7).score;

                Assert.AreEqual(9, score);
            }
            public void Test_8_Has_Score_3()
            {
                int score = new DayNine(test8).score;

                Assert.AreEqual(3, score);
            }
            public void Test_2_Has_17_Garbage_Characters()
            {
                int garbage = new DayNine(test2).garbageCharacters;

                Assert.AreEqual(17, garbage);
            }
            public void Test_3_Has_3_Garbage_Characters()
            {
                int garbage = new DayNine(test3).garbageCharacters;

                Assert.AreEqual(3, garbage);
            }
            public void Test_4_Has_2_Garbage_Characters()
            {
                int garbage = new DayNine(test4).garbageCharacters;

                Assert.AreEqual(2, garbage);
            }
            public void Test_7_Has_10_Garbage_Characters()
            {
                int garbage = new DayNine(test7).garbageCharacters;

                Assert.AreEqual(10, garbage);
            }