Пример #1
0
        public void ShouldCorrectlyCalculatePart2()
        {
            SIFImage   _imageParser = new SIFImage(@"Inputs\Day08Input.txt", 25, 6);
            List <int> expected     = new List <int>()
            {
                0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0
            };

            Assert.Equal(expected, _imageParser.StackedImage);
        }
Пример #2
0
        public void ShouldCorrectlyConstructFromFile()
        {
            SIFImage sifImageFromFile = new SIFImage(@"Inputs\Day08Example1Input.txt", 3, 2);

            List <List <int> > expectedLayers = new List <List <int> >
            {
                new List <int>()
                {
                    1, 2, 3, 4, 5, 6
                },
                new List <int>()
                {
                    7, 8, 9, 0, 1, 2
                }
            };

            Assert.Equal(3, sifImageFromFile.XPixels);
            Assert.Equal(2, sifImageFromFile.YPixels);
            Assert.Equal(6, sifImageFromFile.LayerSize);
            Assert.Equal(expectedLayers, sifImageFromFile.Layers);
        }
Пример #3
0
        public void ShouldCorrectlyConstructFromIEnumerable()
        {
            SIFImage sifImageFromIEnumerable = new SIFImage(new List <int>()
            {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2
            }, 3, 2);

            List <List <int> > expectedLayers = new List <List <int> >
            {
                new List <int>()
                {
                    1, 2, 3, 4, 5, 6
                },
                new List <int>()
                {
                    7, 8, 9, 0, 1, 2
                }
            };

            Assert.Equal(3, sifImageFromIEnumerable.XPixels);
            Assert.Equal(2, sifImageFromIEnumerable.YPixels);
            Assert.Equal(6, sifImageFromIEnumerable.LayerSize);
            Assert.Equal(expectedLayers, sifImageFromIEnumerable.Layers);
        }
Пример #4
0
        public void ShouldCorrectlyCalculatePart1()
        {
            SIFImage _imageParser = new SIFImage(@"Inputs\Day08Input.txt", 25, 6);

            Assert.Equal(1474, _imageParser.Checksum);
        }