예제 #1
0
    /*
     * Test find reachable blocks methods
     */
    private static void TestFindReachableBlocks(int index, SortedSet <int> expected)
    {
        IRGraph             cfg       = BuildSampleCFG();
        SortedSet <IRBlock> result    = DominatorTree.FindReachableBlocks(cfg, index);
        SortedSet <int>     intResult = ConvertToIndexSet(result);

        if (!intResult.SetEquals(expected))
        {
            throw new Exception("Reachable blocks for block " + index + " is " + ConvertSetToString(intResult) + " should be " + ConvertSetToString(expected));
        }
    }