예제 #1
0
 public void Structure()
 {
     var ccc = new CompoundConditionCoalescer(proc);
     ccc.Transform();
     var reg = Execute();
     proc.Body.AddRange(reg.Statements);
 }
        private void RunTest(string sourceFilename, string outFilename)
        {
            using (FileUnitTester fut = new FileUnitTester(outFilename))
            {
                RewriteProgramMsdos(sourceFilename, Address.SegPtr(0xC00, 0));
                foreach (Procedure proc in program.Procedures.Values)
                {
                    proc.Write(false, fut.TextWriter);
                    fut.TextWriter.WriteLine();

                    CompoundConditionCoalescer ccc = new CompoundConditionCoalescer(proc);
                    ccc.Transform();
                    proc.Write(false, fut.TextWriter);
                    fut.TextWriter.WriteLine("================");
                }

                fut.AssertFilesEqual();
            }
        }
예제 #3
0
        private void RunTest(string sExp, Procedure proc)
        {
            var cfgc = new ControlFlowGraphCleaner(proc);

            cfgc.Transform();
            if (ccc != null)
            {
                ccc.Transform();
            }
            var ps  = new StructureAnalysis(new FakeDecompilerEventListener(), new Program(), proc);
            var reg = ps.Execute();
            var sb  = new StringWriter();

            reg.Write(sb);
            sb.GetStringBuilder().Replace("\t", "    ");
            var s = sb.ToString();

            if (sExp != s)
            {
                Debug.WriteLine(s);
                Assert.AreEqual(sExp, s);
            }
        }