Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var program = Puzzle.Input;
            var test    = new ThermalEnvironmentSupervisionTerminal(program, IO.Console);

            test.Run();
        }
Exemplo n.º 2
0
        public void Day5_Indirect_Samples(int[] initial, int[] final)
        {
            var interpreter = new ThermalEnvironmentSupervisionTerminal(initial, IO.None);

            interpreter.Run();
            Assert.Equal(final, initial);
        }
Exemplo n.º 3
0
        public void Day5_PartII_Samples(int[] program, int[] input, int[] output)
        {
            var io          = new QueuedIO(new Queue <int>(input), new Queue <int>());
            var interpreter = new ThermalEnvironmentSupervisionTerminal(program, io);

            interpreter.Run();
            Assert.Empty(io.Input);
            Assert.Equal(output, io.Output);
        }
Exemplo n.º 4
0
        public void Day5_IO_Write_Samples()
        {
            var program     = new[] { 4, 2, 99 };
            var io          = new QueuedIO(new Queue <int>(), new Queue <int>());
            var interpreter = new ThermalEnvironmentSupervisionTerminal(program, io);

            interpreter.Run();
            Assert.Equal(new[] { 99 }, io.Output);
        }
Exemplo n.º 5
0
        public void Day5_IO_Read_Samples()
        {
            var program     = new[] { 3, 1, 99 };
            var io          = new QueuedIO(new Queue <int>(new [] { 42 }), new Queue <int>());
            var interpreter = new ThermalEnvironmentSupervisionTerminal(program, io);

            interpreter.Run();
            Assert.Empty(io.Input);
            Assert.Equal(new[] { 3, 42, 99 }, program);
        }