Exemple #1
0
        static void Main()
        {
            IMachine adder      = new Adder();
            IMachine subtractor = new Subtractor();

            WriteLine(adder.Run(new MemoryState(1, 5, 7)));
            WriteLine(subtractor.Run(new MemoryState(8, 3)));
            WriteLine(subtractor.Run(new MemoryState(3, 8)));
        }
        public void SubtractorTestMethod2()
        {
            var sig1 = UnitTestUtitlities.LoadSignal("TestingSignals/Signal1.ds");
            var sig2 = UnitTestUtitlities.LoadSignal("TestingSignals/Signal3.ds");

            var expectedOutput = UnitTestUtitlities.LoadSignal("TestingSignals/Subtractor_TestCase2.ds").Samples;

            Subtractor m = new Subtractor();

            m.InputSignal1 = sig2;
            m.InputSignal2 = sig1;

            m.Run();

            Assert.IsTrue(UnitTestUtitlities.SignalsSamplesAreEqual(expectedOutput, m.OutputSignal.Samples));
        }