Exemplo n.º 1
0
    /*
       * Test Building Full Dominator Tree
       */
    public static void TestBuildFullTree()
    {
        // Build Dominator Tree
        IRGraph cfg = BuildSampleCFG();
        DominatorTree dominatorTree = new DominatorTree(cfg);

        // Expected
        DominatorTreeNode expected = BuildExpectedDominatorTree();

        // Compare Result to Expected
        if(!dominatorTree.GetRoot().Equals(expected)) {
          Console.WriteLine("\n\n *** RESULT ***");
          printTree(dominatorTree.GetRoot());

          Console.WriteLine("\n\n *** EXPECTED ***");
          printTree(expected);

          throw new Exception("Dominator Tree built doesn't match expected dominator tree");
        }
    }
Exemplo n.º 2
0
    /*
     * Test Building Full Dominator Tree
     */
    public static void TestBuildFullTree()
    {
        // Build Dominator Tree
        IRGraph       cfg           = BuildSampleCFG();
        DominatorTree dominatorTree = new DominatorTree(cfg);

        // Expected
        DominatorTreeNode expected = BuildExpectedDominatorTree();

        // Compare Result to Expected
        if (!dominatorTree.GetRoot().Equals(expected))
        {
            Console.WriteLine("\n\n *** RESULT ***");
            printTree(dominatorTree.GetRoot());

            Console.WriteLine("\n\n *** EXPECTED ***");
            printTree(expected);

            throw new Exception("Dominator Tree built doesn't match expected dominator tree");
        }
    }