示例#1
0
        public void ADD_Test()
        {
            ushort testOpcode = 0x8124; //Adds V2 to V1

            memory.opcode = testOpcode;
            memory.V[1]   = 10;
            memory.V[2]   = 20;
            memory.V[0xF] = 0;

            instructions.ADD();

            Assert.AreEqual(30, memory.V[1], 0, "Did not add correctly");

            memory.V[1]   = 250;
            memory.V[2]   = 50;
            memory.V[0xF] = 0;

            instructions.ADD();

            Assert.AreEqual(255, memory.V[1], 0, "Did not add correctly at overflow");
            Assert.AreEqual(1, memory.V[0xF], 0, "Did not correctly set overflow flag");
        }