コード例 #1
0
        public void It_runs_v2_test_program_correctly()
        {
            var computer = new DockComputer();
            var program  = File.ReadAllLines("test2.txt");

            computer.RunV2(program);
            Assert.AreEqual(208, computer.SumMemory());
        }
コード例 #2
0
        public void It_runs_test_program_correctly()
        {
            var computer = new DockComputer();
            var program  = File.ReadLines("test.txt");

            computer.Run(program);
            Assert.AreEqual(165, computer.SumMemory());
        }
コード例 #3
0
        static void Main(string[] args)
        {
            DockComputer computer;
            var          program = File.ReadLines(args[0]);

            computer = new DockComputer();
            computer.Run(program);
            Console.WriteLine($"Sum of values in memory: [{computer.SumMemory()}]");

            computer = new DockComputer();
            computer.RunV2(program);
            Console.WriteLine($"Sum of values in memory: [{computer.SumMemory()}]");
        }