예제 #1
0
        public void PuzzelOne()
        {
            var data   = InputParser.Parse("input_data/day1-1.txt");
            var result = Day1.CountIncreasing(data);

            Assert.Equal(1688, result);
        }
예제 #2
0
        public void StepsToEnterBasementRealData()
        {
            const int expected = 1795;
            var       step     = Day1.StepToEnterBasement(LoadFromResource.Load("AdventOfCode.Tests.TestData.Day1.txt"));

            Assert.Equal(expected, step);
        }
예제 #3
0
        public void TestInput()
        {
            var data   = InputParser.Parse("input_data/day1-test.txt");
            var result = Day1.CountIncreasing(data);

            Assert.Equal(7, result);
        }
예제 #4
0
        public void FinalFloorRealData()
        {
            const int expected = 74;
            var       floor    = Day1.FinalFloor(LoadFromResource.Load("AdventOfCode.Tests.TestData.Day1.txt"));

            Assert.Equal(expected, floor);
        }
예제 #5
0
        public void PuzzelTwo()
        {
            var data   = InputParser.Parse("input_data/day1-1.txt");
            var result = Day1.CountIncreasingWithinSlidingWindow(data, 3);

            Assert.Equal(1728, result);
        }
예제 #6
0
        public void TestInputTwo()
        {
            var data   = InputParser.Parse("input_data/day1-test.txt");
            var result = Day1.CountIncreasingWithinSlidingWindow(data, 3);

            Assert.Equal(5, result);
        }
예제 #7
0
        public void Test2()
        {
            var day1 = new Day1();

            var result = day1.ExecutePart2("1721&979&366&299&675&1456");

            Assert.Equal(241861950, result);
        }
예제 #8
0
        public void Part2Result()
        {
            var day1 = new Day1();

            var result = day1.ExecutePart2("1714&1960&1256&1597&1853&1609&1936&2003&1648&1903&1248&1525&1330&1281&1573&1892&1563&1500&1858&176&1802&1370&1708&1453&1342&1830&1580&1607&1848&1626&1602&1919&1640&1574&1414&766&1581&1924&1727&1949&1406&323&957&1862&1354&1427&1583&1067&1863&1553&1923&1990&691&1372&1357&1887&1485&1799&1270&1743&1601&1457&1723&1888&1272&1600&1880&1381&1413&1452&277&1866&1542&1693&1760&1637&1675&1975&1304&1327&1985&1842&1255&1915&1266&1944&1824&1770&1392&1259&1313&1547&1293&1393&1896&1828&1642&1979&1871&1502&1548&1508&710&1786&1845&1334&1362&1940&2009&1271&1448&1964&1676&1654&1804&1835&1910&1939&1298&1572&1704&1841&1399&1576&1164&1868&1035&262&1569&1639&1669&1543&1616&1658&1750&1765&1718&1861&1351&1531&1665&1771&1348&1289&875&1408&1486&1275&1625&1594&1816&704&1800&1564&1291&1234&1981&1843&1387&1938&1827&1883&1911&1755&1353&1808&1498&1416&2006&1916&1411&1539&1963&1874&1898&1951&1292&1366&1912&1369&1478&1359&1859&1421&1384&1534&1283&1913&1794&1494&1860&1312&1869&1730&1510&1319&1428&1706&1432&1532");

            Assert.Equal(193171814, result);
        }
예제 #9
0
        public void Test1()
        {
            var day1 = new Day1();

            var result = day1.Execute("1721&979&366&299&675&1456");

            Assert.Equal(514579, result);
        }
예제 #10
0
        public void Part1Example()
        {
            var testee = new Day1();

            var(first, second) = testee.Part1(ExampleData);

            new[] { first, second }
            .Should()
            .BeEquivalentTo(new[] { 1721, 299 });
        }
예제 #11
0
        public Day1Test()
        {
            var dataHandler = new DataHandler();

            this.day = new Day1(dataHandler)
            {
                pathToData = @"../../../Data/day1.txt"
            };
            this.day.ReadData();
        }
예제 #12
0
        public void Part2Example()
        {
            var testee = new Day1();

            var(first, second, third) = testee.Part2(ExampleData);

            new[] { first, second, third }
            .Should()
            .BeEquivalentTo(new[] { 979, 366, 675 });
        }
예제 #13
0
        public void TestPartB()
        {
            int[] numbers        = new int[] { 1721, 979, 366, 299, 675, 1456 };
            var   data           = new IntData(numbers);
            int   expectedOutput = 241861950;
            Day1  day1           = new Day1(data);

            var actualOutut = day1.Puzzle2Solution();


            Assert.AreEqual(expectedOutput, actualOutut);
        }
예제 #14
0
        public void Day1_FirstTask_1()
        {
            // Arrange
            Day1 day = new Day1();

            day.InputString = "1122";
            string expectedResult = "3";

            // Act
            var result = day.GetResult(Enums.TaskNumber.First);

            // Assert
            Assert.AreEqual(expectedResult, result);
        }
예제 #15
0
        public void Day1_SecondTask_2()
        {
            // Arrange
            Day1 day = new Day1();

            day.InputString = "1221";
            string expectedResult = "0";

            // Act
            var result = day.GetResult(Enums.TaskNumber.Second);

            // Assert
            Assert.AreEqual(expectedResult, result);
        }
예제 #16
0
        // Part 1

        public Day1_tests()
        {
            _day1 = new Day1();
        }
예제 #17
0
        public void FinalFloor(string descriptor, int expectedFloor)
        {
            var actual = Day1.FinalFloor(descriptor);

            Assert.Equal(expectedFloor, actual);
        }
예제 #18
0
        public void Part2RealPuzzle()
        {
            var result = Day1.SolvePart2(GetPuzzleInput());

            Assert.Equal(1284, result);
        }
예제 #19
0
        public void Part2Tests(string input, int expected)
        {
            var result = Day1.SolvePart2(input);

            Assert.Equal(expected, result);
        }
예제 #20
0
 public void ThrowsIfNeverEntersBasement()
 {
     Assert.Throws <InvalidOperationException>(() => Day1.StepToEnterBasement("("));
 }
예제 #21
0
        public void StepToEnterBasement(string descriptor, int expectedStep)
        {
            var actual = Day1.StepToEnterBasement(descriptor);

            Assert.Equal(expectedStep, actual);
        }
예제 #22
0
 public void TestDay1Part2(string input, int answer)
 {
     Day1.
     Part2(input).
     ShouldBeEquivalentTo(answer);
 }