public void Execute_PlusThreeToZero_ReturnsThree()
        {
            AddInstruction instruction = new AddInstruction(3);

            var expectedOutput = 3;

            Assert.AreEqual(expectedOutput, instruction.Execute(0));
        }
예제 #2
0
        public void Execute_NegativeNumber()
        {
            reg[9]  = 0x3;
            reg[10] = 0xFFFFFFFF;
            target  = new AddInstruction(8, 9, 10);

            target.Execute(ref pc, mem, reg);

            Assert.AreEqual(0x2, reg[8]);
            Assert.AreEqual(0x4, pc);
        }
예제 #3
0
        public void Execute_Overflow()
        {
            reg[9]  = 0xFFFFFFFF;
            reg[10] = 0x1;
            target  = new AddInstruction(8, 9, 10);

            target.Execute(ref pc, mem, reg);

            Assert.AreEqual(0x0, reg[8]);
            Assert.AreEqual(0x4, pc);
        }
예제 #4
0
        public void Execute_PositiveNumbers()
        {
            reg[9]  = 0x1;
            reg[10] = 0x3;
            target  = new AddInstruction(8, 9, 10);

            target.Execute(ref pc, mem, reg);

            Assert.AreEqual(0x4, reg[8]);
            Assert.AreEqual(0x4, pc);
        }