Example #1
0
        private void RunIrTest(string testName, string sExp, Action <ProcedureBuilder> builder)
        {
            var m = new ProcedureBuilder(testName);

            builder(m);
            var program = CreateProgram(m.Procedure);
            var sActual = ProcedureRenderer.RenderProcedureIR(program, m.Procedure.EntryAddress.ToString());

            if (sExp != sActual)
            {
                Console.WriteLine(sActual);
                Assert.AreEqual(sExp, sActual);
            }
        }
Example #2
0
        private void RunHllTest(string testName, string sExp, Action <Procedure, AbsynCodeEmitter> builder)
        {
            var arch  = new FakeArchitecture(new ServiceContainer());
            var frame = arch.CreateFrame();
            var proc  = Procedure.Create(arch, Address.Ptr32(0x00123400), frame);

            proc.Body = new List <Core.Absyn.AbsynStatement>();
            var m = new AbsynCodeEmitter(proc.Body);

            builder(proc, m);
            var program = CreateProgram(proc);
            var sActual = ProcedureRenderer.RenderProcedureHll(program, proc.EntryAddress.ToString());

            if (sExp != sActual)
            {
                Console.WriteLine(sActual);
                Assert.AreEqual(sExp, sActual);
            }
        }