Example #1
0
        public void TestGiven3()
        {
            var icc = new IntCodeCompiler("1", new List <long> {
                104, 1125899906842624, 99
            }, false);

            icc.Calculate();
            Assert.AreEqual(1125899906842624, icc.LastOutput);
        }
Example #2
0
        public void TestGiven2()
        {
            var icc = new IntCodeCompiler("1", new List <long> {
                1102, 34915192, 34915192, 7, 4, 7, 99, 0
            }, false);

            icc.Calculate();
            Assert.AreEqual(16, icc.LastOutput.ToString().Length);
        }
Example #3
0
        public void TestGiven()
        {
            var icc = new IntCodeCompiler("1", new List <long> {
                109, 1, 204, -1, 1001, 100, 1, 100, 1008, 100, 16, 101, 1006, 101, 0, 99
            }, false);

            icc.Calculate();
            Assert.AreEqual(99, icc.LastOutput);
        }
Example #4
0
        public void TestGiven5a(int i, int e)
        {
            IList <long> input = new List <long> {
                3, 12, 6, 12, 15, 1, 13, 14, 13, 4, 13, 99, -1, 0, 1, 9
            };
            var inputs = new Queue <long>();

            inputs.Enqueue(i);
            var icc = new IntCodeCompiler(input, inputs);

            icc.Calculate();
            Assert.AreEqual(e, icc.LastOutput);
        }
Example #5
0
        public void TestGiven4(int i, int e)
        {
            IList <long> input = new List <long> {
                3, 3, 1107, -1, 8, 3, 4, 3, 99
            };
            var inputs = new Queue <long>();

            inputs.Enqueue(i);
            var icc = new IntCodeCompiler(input, inputs);

            icc.Calculate();
            Assert.AreEqual(e, icc.LastOutput);
        }
Example #6
0
        public void TestGiven6(int i, int e)
        {
            IList <long> input = new List <long> {
                3, 21, 1008, 21, 8, 20, 1005, 20, 22, 107, 8, 21, 20, 1006, 20, 31, 1106, 0, 36, 98, 0, 0, 1002, 21, 125, 20, 4, 20, 1105, 1, 46, 104, 999, 1105, 1, 46, 1101, 1000, 1, 20, 4, 20, 1105, 1, 46, 98, 99
            };
            var inputs = new Queue <long>();

            inputs.Enqueue(i);
            var icc = new IntCodeCompiler(input, inputs);

            icc.Calculate();
            Assert.AreEqual(e, icc.LastOutput);
        }