Пример #1
0
    public void TestAdjacencyListNoDuplication()
    {
        GameObject space1 = SpacesTest.CreateBlueSpace();
        GameObject space2 = SpacesTest.CreateBlueSpace();
        GameObject edge   = CreateEdge(space1, space2);

        AbstractSpace as1 = space1.GetComponent <AbstractSpace>();

        Assert.IsTrue(as1.IncidentEdges.Count == 1);
    }
Пример #2
0
    public void TestAdjacencyList()
    {
        GameObject    space1 = SpacesTest.CreateBlueSpace();
        GameObject    space2 = SpacesTest.CreateBlueSpace();
        GameObject    edge   = CreateEdge(space1, space2);
        AbstractSpace as1    = space1.GetComponent <AbstractSpace>();
        AbstractSpace as2    = space2.GetComponent <AbstractSpace>();

        Assert.IsTrue(as1.IncidentEdges.Contains(edge));
        Assert.IsTrue(as2.IncidentEdges.Contains(edge));
    }
Пример #3
0
    public void TestCantOverwriteNodesInEdge()
    {
        GameObject space1        = SpacesTest.CreateBlueSpace();
        GameObject space2        = SpacesTest.CreateBlueSpace();
        GameObject edge          = CreateEdge(space1, space2);
        Edge       edgeComponent = edge.GetComponent <Edge>();

        Assert.IsTrue(edgeComponent.Source == space1);
        Assert.IsTrue(edgeComponent.Destination == space2);

        edgeComponent.Source      = space2;
        edgeComponent.Destination = space1;

        Assert.IsTrue(edgeComponent.Source == space1);
        Assert.IsTrue(edgeComponent.Destination == space2);
    }