Beispiel #1
0
        public void Add(string in1, string in2, string expected)
        {
            var sn  = new Day18.SnailNumber(in1);
            var sn2 = new Day18.SnailNumber(in2);

            sn.Add(sn2).ToString().Should().Be(expected);
        }
Beispiel #2
0
        public void Reduce(string start, string expected)
        {
            var sn = new Day18.SnailNumber(start);

            sn.Reduce().ToString().Should().Be(expected);
        }
Beispiel #3
0
        public void SnailNumber_NestingLevel()
        {
            var snailNumber = new Day18.SnailNumber("[[[[8,7],[7,7]],[[8,6],[7,7]]],[[[0,7],[6,6]],[8,7]]]");

            snailNumber.MaxNestingLevel().Should().Be(4);
        }
Beispiel #4
0
        public void SnailNumber_RegularNumbers()
        {
            var snailNumber = new Day18.SnailNumber("[[[[8,7],[7,7]],[[8,6],[7,7]]],[[[0,7],[6,6]],[8,7]]]");

            snailNumber.RegularNumbers().Should().BeEquivalentTo(new[] { 8, 7, 7, 7, 8, 6, 7, 7, 0, 7, 6, 6, 8, 7 });
        }
Beispiel #5
0
        public void SnailNumber_ToString(string rawNumber, string expected)
        {
            var snailNumber = new Day18.SnailNumber(rawNumber);

            snailNumber.ToString().Should().Be(expected);
        }
Beispiel #6
0
        public void SnailNumber_Magnitude(string rawNumber, int expected)
        {
            var snailNumber = new Day18.SnailNumber(rawNumber);

            snailNumber.Magnitude().Should().Be(expected);
        }