Ejemplo n.º 1
0
        private bool TestOpCode(Sample sample, OpCodes testOpCode)
        {
            Registers result;

            switch (testOpCode)
            {
            case OpCodes.addi: result = addi(sample.Before, sample.Instruction); break;

            case OpCodes.addr: result = addr(sample.Before, sample.Instruction); break;

            case OpCodes.bani: result = bani(sample.Before, sample.Instruction); break;

            case OpCodes.banr: result = banr(sample.Before, sample.Instruction); break;

            case OpCodes.bori: result = bori(sample.Before, sample.Instruction); break;

            case OpCodes.borr: result = borr(sample.Before, sample.Instruction); break;

            case OpCodes.eqir: result = eqir(sample.Before, sample.Instruction); break;

            case OpCodes.eqri: result = eqri(sample.Before, sample.Instruction); break;

            case OpCodes.eqrr: result = eqrr(sample.Before, sample.Instruction); break;

            case OpCodes.gtir: result = gtir(sample.Before, sample.Instruction); break;

            case OpCodes.gtri: result = gtri(sample.Before, sample.Instruction); break;

            case OpCodes.gtrr: result = gtrr(sample.Before, sample.Instruction); break;

            case OpCodes.muli: result = muli(sample.Before, sample.Instruction); break;

            case OpCodes.mulr: result = mulr(sample.Before, sample.Instruction); break;

            case OpCodes.seti: result = seti(sample.Before, sample.Instruction); break;

            case OpCodes.setr: result = setr(sample.Before, sample.Instruction); break;

            default: throw new Exception("Tried testing op code that is not handled.");
            }

            return(Registers.Equal(sample.After, result));
        }
Ejemplo n.º 2
0
        private bool TestOpCode(Sample sample, OpCode testOpCode)
        {
            var result = RunOp(sample.Before, sample.Instruction, testOpCode);

            return(Registers.Equal(sample.After, result));
        }