Example #1
0
 //[InlineData("data_2.txt",660)]
 public void ShouldProcessDataCorrectly(string datafile, int result)
 {
     using (AOC aoc = new AOC())
     {
         List <string> input = ParseInput(datafile);
         List <double> data  = aoc.ProcessData(input);
         Assert.Equal(result, data.Count);
     }
 }
Example #2
0
 //its not 135541730127163
 //its not 135541730225161 either;
 //its not 180648334137911 all too high
 //its not 125113350
 public void ShoulCalculateContigiousCorrectly(string datafile, int preamble, int result)
 {
     using (AOC aoc = new AOC())
     {
         List <string> input = ParseInput(datafile);
         List <double> data  = aoc.ProcessData(input);
         Assert.Equal(result, aoc.GetNotSummableValue(data, preamble, true));
     }
 }
Example #3
0
        public void ShouldValidateDataCorrectly(string datafile, bool result)
        {
            List <string> input = ParseInput(datafile);

            using (AOC aoc = new AOC())
            {
                var data = aoc.ProcessData(input);
                Assert.Equal(result, aoc.ValidateInstructions(data));
            }
        }
Example #4
0
        public void ShouldReturnCorrectAccumulator(string datafile, int result)
        {
            List <string> input = ParseInput(datafile);

            using (AOC aoc = new AOC())
            {
                var data        = aoc.ProcessData(input);
                int accumulator = aoc.ExecuteInstructions(data);
                Assert.Equal(result, accumulator);
            }
        }
Example #5
0
        public void ShouldProcessDataCorrectly()
        {
            List <string> input = ParseInput("data.txt");

            using (AOC aoc = new AOC())
            {
                var output = aoc.ProcessData(input);
                Assert.Equal(9, output.Count());

                Assert.Equal(output[3], new Tuple <int, string, int>(0, "acc", 3));
            }
        }
Example #6
0
        public void ShouldProcessData()
        {
            List <string> input = ParseInput("data.txt");
            List <int>    check = new List <int>()
            {
                16, 10, 15, 5, 1, 11, 7, 19, 6, 12, 4
            };

            using (AOC aoc = new AOC())
            {
                Assert.Equal(check, aoc.ProcessData(input));
            }
        }
Example #7
0
        public void ShouldFindValidInstructionSet(string datafile, int result)
        {
            List <string> input = ParseInput(datafile);

            using (AOC aoc = new AOC())
            {
                var data = aoc.ProcessData(input);
                var validInstructions = aoc.FindValidInstructionSet(data);
                Assert.Equal(true, aoc.ValidateInstructions(validInstructions));
                int accumulator = aoc.ExecuteInstructions(validInstructions);
                Assert.Equal(result, accumulator);
            }
        }