Esempio n. 1
0
        public void ParsesOpcodeStrings_TestString_ReturnsAListWithTheRightNumberOfValues()
        {
            var            subject = new ParsesOpcodeStrings();
            List <decimal> result  = subject.Parse("1,0,0,0,99");

            result.Count.Should().Be(5);
        }
Esempio n. 2
0
        public void ParsesOpcodeStrings_ListOfCodes_ParsedBackIntoText()
        {
            var subject = new ParsesOpcodeStrings();
            var input   = new List <decimal> {
                0, 1, 2, 3
            };

            subject.Parse(input).Should().Be("0,1,2,3");
        }
Esempio n. 3
0
        public void RunsOpcodes_Day2Part2_FailsOnTheAnswer()
        {
            var parser  = new ParsesOpcodeStrings();
            var subject = new RunsOpcodes(parser);
            var input   = File.ReadAllText(@"C:\Projects\Homework\AdventOfCode2019-PuzzleInput\day-2-input-part-1.txt");
            var codes   = parser.Parse(input);

            for (int noun = 0; noun < 100; noun++)
            {
                for (int verb = 0; verb < 100; verb++)
                {
                    var codeArray = codes.ToArray();
                    codeArray[1] = noun;
                    codeArray[2] = verb;

                    subject.Run(codeArray.ToList()).Should().NotStartWith("19690720");
                }
            }
        }
Esempio n. 4
0
 public RunsOpcodes(ParsesOpcodeStrings parsesOpcodeStrings)
 {
     _parsesOpcodeStrings = new ParsesOpcodeStrings();
 }