Пример #1
0
        public void WriteMissingParameter()
        {
            var badInstruction = new Instruction(OpCode.Mov).Source(10);
            Assert.That(badInstruction.ToString(), Is.StringMatching(@"^Mov"));

            var ms = new StringWriter();
            using (var writer = new InstructionTextWriter(ms))
            {
                writer.Write(badInstruction);
            }
        }
Пример #2
0
        public void WriteBadOpCode()
        {
            var badInstruction = new Instruction((OpCode) 254);
            Assert.That(badInstruction.ToString(), Is.StringMatching(@"^254\s+;.*"));

            var ms = new StringWriter();
            using (var writer = new InstructionTextWriter(ms))
                writer.Write(badInstruction);
        }
Пример #3
0
        public void WriteExtraParameter()
        {
            var badInstruction = new Instruction(OpCode.Ret).Source(10);
            Assert.That(badInstruction.ToString(), Is.StringMatching(@"^Ret\s+\$10"));

            var ms = new StringWriter();
            using (var writer = new InstructionTextWriter(ms))
                writer.Write(badInstruction);
        }
Пример #4
0
 public void ParseExpression()
 {
     var instruction = new Instruction(OpCode.Mov).Destination(Register.A).Source(10);
     Assert.That(instruction.OpCode, Is.EqualTo(OpCode.Mov));
     Assert.That(instruction.OpCodeMask, Is.EqualTo(13));
     Assert.That(instruction.ToString(), Is.StringMatching(@"^Mov\s+r1\s+\$10"));
 }