Exemple #1
0
        public void PartA_Actual()
        {
            var sut    = new DayFive();
            var result = sut.PartA();

            Assert.Equal("866", result);
        }
        public void testPartA()
        {
            var sut    = new DayFive();
            var result = sut.PartA();

            Assert.Equal("372671", result);
        }
Exemple #3
0
        public void PartB_Actual()
        {
            var sut    = new DayFive();
            var result = sut.PartB();

            Assert.Equal("583", result);
        }
        public void testPartB()
        {
            var sut    = new DayFive();
            var result = sut.PartB();

            Assert.Equal("25608480", result);
        }
Exemple #5
0
        protected async Task ShowResults()
        {
            if (ValidateTextbox())
            {
                invalid = false;
                DayFive _challengeSolver = new DayFive();

                await RefreshReport();

                if (_boardingPasses.Count > 0)
                {
                    _partOne = _challengeSolver.PartOne(_boardingPasses);
                    _partTwo = _challengeSolver.PartTwo(_boardingPasses);
                }

                if (_partOne != 0 && _partTwo != 0)
                {
                    childOne.Show();
                    childTwo.Show();
                }
                else
                {
                    invalid = true;
                }
            }
            else
            {
                invalid = true;
            }
        }
        public void FindBestPolymerAfterRemovingAUnit()
        {
            var input  = "dabAcCaCBAcCcaDA";
            var sut    = new DayFive();
            var result = sut.FindBestPolymerAfterRemovingAUnit(input);

            Assert.Equal(4, result);
        }
        public void CalculateUnitsRemainingAfterReactions()
        {
            var input  = "dabAcCaCBAcCcaDA";
            var sut    = new DayFive();
            var result = sut.CalculateUnitsRemainingAfterReactions(input);

            Assert.Equal(10, result);
        }
        public void testCountNumberOfSteps()
        {
            int[] input  = new[] { 0, 3, 0, 1, -3 };
            var   sut    = new DayFive();
            var   result = sut.CountNumberOfSteps(input);

            Assert.Equal(5, result);
        }
Exemple #9
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);
            }
        }
Exemple #10
0
        public void Test_Input_Returns_10_Steps_With_Strange_Enabled()
        {
            int steps = DayFive.Run(testInput, true);

            Assert.AreEqual(10, steps);
        }
Exemple #11
0
        public void Test_Input_Returns_5_Steps()
        {
            int steps = DayFive.Run(testInput);

            Assert.AreEqual(5, steps);
        }
Exemple #12
0
        public void DayFivePartTwoReturnsCorrectly(string input, int expected)
        {
            var result = DayFive.PartTwo(input);

            Assert.AreEqual(expected, result);
        }
Exemple #13
0
        public void Part2_CalculateResult()
        {
            var input = File.ReadAllLines(@"Input/input5.txt");

            System.Console.WriteLine(DayFive.CalculateResultForPartTwo(input));
        }
Exemple #14
0
 public void Part1_CanFindSeatColumnForBoardingPass()
 {
     DayFive.FindColumn("FBFBBFFRLR").Should().Be(5);
 }
Exemple #15
0
 public void Part1_CanFindSeatRowForBoardingPass()
 {
     DayFive.FindRow("FBFBBFFRLR").Should().Be(44);
 }
Exemple #16
0
 public void Day5Part1() => Assert.AreEqual(359348, DayFive.ComputePartOne(NewInputListInstance));
Exemple #17
0
 public void Day5Part2Example() => Assert.AreEqual(10, DayFive.ComputePartTwo(NewExampleListInstance));
Exemple #18
0
 public void Day5Part2() => Assert.AreEqual(27688760, DayFive.ComputePartTwo(NewInputListInstance));
Exemple #19
0
 public int ProblemTwo_ValidInput_ReturnsCorrectResult(
     int[] intcode, int inp)
 => DayFive.ProblemTwo(intcode, inp);
Exemple #20
0
        public void Day5_P1Test()
        {
            var input = File.ReadAllText("./Files/Day_5/Day5_Test.input").Split("\r\n");

            Assert.AreEqual(820, DayFive.Day5_P1(input));
        }
Exemple #21
0
 public void Day5Part1Example() => Assert.AreEqual(5, DayFive.ComputePartOne(NewExampleListInstance));