コード例 #1
0
 public void Day8Part2Exercise()
 {
     var raw          = new RawPicture(25, 6, RawData.Day8);
     var picture      = new Picture(raw);
     var result       = picture.Decode();
     var stringResult = picture.ToString();
     // hard to test but string result should equal LGYHB
 }
コード例 #2
0
        public void Day8Part1Exercise()
        {
            var raw     = new RawPicture(25, 6, RawData.Day8);
            var picture = new Picture(raw);
            var sut     = new CorruptionChecker();
            var res     = sut.Check(picture);

            res.Should().Be(1088);
        }
コード例 #3
0
        public void Day8Part2Example1()
        {
            var raw     = new RawPicture(2, 2, "0222112222120000");
            var picture = new Picture(raw);
            var decoded = picture.Decode();

            decoded.Should().BeEquivalentTo(new FakeLayer
            {
                Rows = new List <IList <int> >
                {
                    new List <int> {
                        0, 1
                    },
                    new List <int> {
                        1, 0
                    }
                }
            });
        }
コード例 #4
0
        public void Day8Part1Example1()
        {
            var raw     = new RawPicture(3, 2, "123456789012");
            var picture = new Picture(raw);

            picture.Should().BeEquivalentTo(new FakePicture
            {
                Width  = 3,
                Height = 2,
                Layers = new List <ILayer>
                {
                    new FakeLayer
                    {
                        Rows = new List <IList <int> >
                        {
                            new List <int> {
                                1, 2, 3
                            },
                            new List <int> {
                                4, 5, 6
                            }
                        }
                    },
                    new FakeLayer
                    {
                        Rows = new List <IList <int> >
                        {
                            new List <int> {
                                7, 8, 9
                            },
                            new List <int> {
                                0, 1, 2
                            }
                        }
                    }
                }
            });
        }