示例#1
0
        public void Next_Creates_Correct_NextRow_FromInput()
        {
            var sut = new Traps();

            var next = sut.Next("..^^.");

            Assert.Equal(".^^^^", next);
        }
示例#2
0
        // This test runs correctly, but is very time-consuming.  And actually, the "test" is the
        // live test case to submit, not an actual test.
        //[Fact]
        public void ActualProblem()
        {
            var input = "^.^^^.^..^....^^....^^^^.^^.^...^^.^.^^.^^.^^..^.^...^.^..^.^^.^..^.....^^^.^.^^^..^^...^^^...^...^.";
            var sut   = new Traps();

            var rows = sut.Next(input, 399999, includefirstRow: true);

            var safeSpots = sut.SafeSpots(rows);
        }
示例#3
0
        public void Next_CreatesCorrectRows_FromInitialInput()
        {
            var sut = new Traps();

            var rows = sut.Next("..^^.", 2);

            Assert.Equal(".^^^^", rows.First());
            Assert.Equal("^^..^", rows.Last());
        }
示例#4
0
        public void SafeSpots_LongerExample_IsCorrect()
        {
            var sut = new Traps();

            var rows = sut.Next(".^^.^.^^^^", 9, includefirstRow: true);

            var actual = sut.SafeSpots(rows);

            Assert.Equal(38, actual);
        }
示例#5
0
        public void SafeSpots_CorrectlyCountsSafeSpotsInAllRows()
        {
            var sut = new Traps();

            var rows = sut.Next("..^^.", 2, includefirstRow: true);

            var actual = sut.SafeSpots(rows);

            Assert.Equal(6, actual);
        }
示例#6
0
        public void Next_LongerExample_IsCorrect()
        {
            var expected = new string[] { ".^^.^.^^^^", "^^^...^..^", "^.^^.^.^^.", "..^^...^^^",
                                          ".^^^^.^^.^", "^^..^.^^..", "^^^^..^^^.", "^..^^^^.^^", ".^^^..^.^^", "^^.^^^..^^" };

            var sut = new Traps();

            var actual = sut.Next(".^^.^.^^^^", 9, includefirstRow: true);

            Assert.Equal(expected, actual);
        }