Exemple #1
0
        public void Decompile(string file)
        {
            file = string.Concat(_testPaths[Environment.MachineName], file);

            var objData = Compile(file);
            var reader = new CodeReader(objData);
            var writer = new InstructionTextWriter(Console.Out);
            foreach  (var instruction in reader)
            {
                writer.Write(instruction);
            }
        }
Exemple #2
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);
        }
Exemple #3
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);
            }
        }
Exemple #4
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);
        }