コード例 #1
0
        public void DetectNonOverlappedCubes(string core, int expectedCubes)
        {
            var sut = new ReactorCore(core);

            Assert.Equal(expectedCubes, sut.GetTurnedOnCubesCount());
            Assert.False(sut.HasOverlaps);
        }
コード例 #2
0
        public void Test1()
        {
            var sut = new ReactorCore(@"on x=-5..47,y=-31..22,z=-19..33
on x=-44..5,y=-27..21,z=-14..35");

            Assert.Equal(248314, sut.GetTurnedOnCubesCount());
            Assert.True(sut.HasOverlaps);
        }
コード例 #3
0
        public void Test19()
        {
            var original = new ReactorCore(@"on x=-5..47,y=-31..22,z=-19..33
on x=-33..15,y=-32..19,z=-34..11");
            var sut      = new ReactorCore(@"on x=-33..-6,y=-32..19,z=-34..11
on x=-5..15,y=-32..-32,z=-34..11
on x=-5..15,y=-31..19,z=-34..-20
on x=-5..15,y=-31..19,z=-19..11
on x=-5..15,y=-31..19,z=12..33
on x=-5..15,y=20..22,z=-19..33
on x=16..47,y=-31..22,z=-19..33");

            Assert.Equal(235693, original.GetTurnedOnCubesCount());
            Assert.Equal(original.GetTurnedOnCubesCount(), sut.GetTurnedOnCubesCount());
            Assert.True(original.HasOverlaps);
            Assert.False(sut.HasOverlaps);
        }
コード例 #4
0
        public void Test10()
        {
            var sut = new ReactorCore(@"on x=-49..-1,y=-11..42,z=-10..38
on x=-20..34,y=-40..6,z=-44..1");

            Assert.Equal(244244, sut.GetTurnedOnCubesCount());
            Assert.True(sut.HasOverlaps);
        }
コード例 #5
0
        public void Test7()
        {
            var sut = new ReactorCore(@"on x=-44..5,y=-27..21,z=-14..35
on x=-49..-1,y=-11..42,z=-10..38");

            Assert.Equal(185362, sut.GetTurnedOnCubesCount());
            Assert.True(sut.HasOverlaps);
        }
コード例 #6
0
        public void Test15()
        {
            var sut = new ReactorCore(@"on x=-43..-34,y=-45..-28,z=7..25
on x=-33..-33,y=-45..-33,z=7..25
on x=-33..-33,y=-32..-28,z=-34..6
on x=-33..-33,y=-32..-28,z=7..11
on x=-33..-33,y=-32..-28,z=12..25
on x=-33..-33,y=-27..19,z=-34..11
on x=-32..15,y=-32..19,z=-34..11");

            Assert.Equal(120945, sut.GetTurnedOnCubesCount());
            Assert.False(sut.HasOverlaps);
        }
コード例 #7
0
        public void Test14()
        {
            var sut = new ReactorCore(@"on x=-43..-42,y=-45..-28,z=7..25
on x=-41..-33,y=-45..-42,z=7..25
on x=-41..-33,y=-41..-28,z=-36..6
on x=-41..-33,y=-41..-28,z=7..8
on x=-41..-33,y=-41..-28,z=9..25
on x=-41..-33,y=-27..6,z=-36..8
on x=-32..5,y=-41..6,z=-36..8");

            Assert.Equal(105030, sut.GetTurnedOnCubesCount());
            Assert.False(sut.HasOverlaps);
        }
コード例 #8
0
        public void DetectNoOverlaps()
        {
            var sut = new ReactorCore(@"on x=-49..-45,y=-11..42,z=-10..38
on x=-44..-1,y=-27..-12,z=-14..35
on x=-44..-1,y=-11..21,z=-14..-11
on x=-44..-1,y=-11..21,z=-10..35
on x=-44..-1,y=-11..21,z=36..38
on x=-44..-1,y=22..42,z=-10..38
on x=0..5,y=-27..21,z=-14..35");

            Assert.Equal(185362, sut.GetTurnedOnCubesCount());
            Assert.False(sut.HasOverlaps);
        }
コード例 #9
0
        public void Test5()
        {
            var sut = new ReactorCore(
                @"on x=-44..-6,y=-27..21,z=-14..35
on x=-5..5,y=-31..-28,z=-19..33
on x=-5..5,y=-27..21,z=-19..-15
on x=-5..5,y=-27..21,z=-14..33
on x=-5..5,y=-27..21,z=34..35
on x=-5..5,y=22..22,z=-19..33
on x=6..47,y=-31..22,z=-19..33");

            Assert.Equal(248314, sut.GetTurnedOnCubesCount());
            Assert.False(sut.HasOverlaps);
        }
コード例 #10
0
        public void Test18()
        {
            var original = new ReactorCore(@"on x=-5..47,y=-31..22,z=-19..33
on x=-41..5,y=-41..6,z=-36..8");
            var sut      = new ReactorCore(@"on x=-41..-6,y=-41..6,z=-36..8
on x=-5..5,y=-41..-32,z=-36..8
on x=-5..5,y=-31..6,z=-36..-20
on x=-5..5,y=-31..6,z=-19..8
on x=-5..5,y=-31..6,z=9..33
on x=-5..5,y=7..22,z=-19..33
on x=6..47,y=-31..22,z=-19..33");

            Assert.Equal(original.GetTurnedOnCubesCount(), sut.GetTurnedOnCubesCount());
            Assert.True(original.HasOverlaps);
            Assert.False(sut.HasOverlaps);
        }
コード例 #11
0
        public void Test17()
        {
            var original = new ReactorCore(@"on x=-5..47,y=-31..22,z=-19..33
on x=-20..34,y=-40..6,z=-44..1");
            var sut      = new ReactorCore(@"on x=-20..-6,y=-40..6,z=-44..1
on x=-5..34,y=-40..-32,z=-44..1
on x=-5..34,y=-31..6,z=-44..-20
on x=-5..34,y=-31..6,z=-19..1
on x=-5..34,y=-31..6,z=2..33
on x=-5..34,y=7..22,z=-19..33
on x=35..47,y=-31..22,z=-19..33");

            Assert.Equal(original.GetTurnedOnCubesCount(), sut.GetTurnedOnCubesCount());
            Assert.True(original.HasOverlaps);
            Assert.False(sut.HasOverlaps);
        }
コード例 #12
0
        public void Test16()
        {
            var original = new ReactorCore(@"on x=-5..47,y=-31..22,z=-19..33
on x=-49..-1,y=-11..42,z=-10..38");
            var sut      = new ReactorCore(@"on x=-49..-6,y=-11..42,z=-10..38
on x=-5..-1,y=-31..-12,z=-19..33
on x=-5..-1,y=-11..22,z=-19..-11
on x=-5..-1,y=-11..22,z=-10..33
on x=-5..-1,y=-11..22,z=34..38
on x=-5..-1,y=23..42,z=-10..38
on x=0..47,y=-31..22,z=-19..33");

            Assert.Equal(original.GetTurnedOnCubesCount(), sut.GetTurnedOnCubesCount());
            Assert.True(original.HasOverlaps);
            Assert.False(sut.HasOverlaps);
        }
コード例 #13
0
        public void BeInitializedCorrectly(string steps, int expectedCount)
        {
            var sut = new ReactorCore(steps);

            Assert.Equal(expectedCount, sut.GetTurnedOnCubesCount());
        }