コード例 #1
0
    static void Verify(ControlFlowGraph expected, ControlFlowGraph result)
    {
        expected = expected.Canonicalize();
        result   = result.Canonicalize();
        Assert.Equal(expected.Nodes.Count, result.Nodes.Count);
        Assert.Equal(expected.Edges.Count(), result.Edges.Count());

        for (int i = 0; i < expected.Nodes.Count; i++)
        {
            Assert.Equal(expected.Nodes[i].ToString(), result.Nodes[i].ToString());
        }

        var i1 = expected.Edges.GetEnumerator();
        var i2 = result.Edges.GetEnumerator();

        while (i1.MoveNext())
        {
            i2.MoveNext();
            Assert.Equal(i1.Current.Item1, i2.Current.Item1);
            Assert.Equal(i1.Current.Item2, i2.Current.Item2);
        }
    }