Esempio n. 1
0
        public override Day Run()
        {
            dayOfMonth = 18;
            stopwatch.Start();
            ShuntingYard homework = new ShuntingYard();

            answer_part1 = homework.SumOfExpressionsFromFile(false, "input/day18.txt").ToString();
            answer_part2 = homework.SumOfExpressionsFromFile(true, "input/day18.txt").ToString();
            return(this);
        }
Esempio n. 2
0
        public void TestSumOfExpressionsInFile()
        {
            ShuntingYard homework = new ShuntingYard();

            Assert.Equal(26 + 437 + 12240 + 13632, homework.SumOfExpressionsFromFile(false, "input/day18.txt"));
        }
Esempio n. 3
0
        public void TestSumOfExpressionsWithPrecedenceInFile()
        {
            ShuntingYard homework = new ShuntingYard();

            Assert.Equal(46 + 1445 + 669060 + 23340, homework.SumOfExpressionsFromFile(true, "input/day18.txt"));
        }
Esempio n. 4
0
        public void TestEvaluate(string expression, bool precedence, int expected)
        {
            ShuntingYard homework = new ShuntingYard();

            Assert.Equal(expected, homework.Evaluate(precedence, expression));
        }