Пример #1
0
        public void DisconnectNodeShouldRemoveEdge(ControlFlowEdgeType edgeType, bool removeSourceNode)
        {
            var graph = new ControlFlowGraph <int>(IntArchitecture.Instance);

            var n1 = new ControlFlowNode <int>(0, 0);
            var n2 = new ControlFlowNode <int>(1, 1);

            graph.Nodes.AddRange(new[]
            {
                n1,
                n2
            });

            n1.ConnectWith(n2, edgeType);

            if (removeSourceNode)
            {
                n1.Disconnect();
            }
            else
            {
                n2.Disconnect();
            }

            Assert.Empty(n1.GetOutgoingEdges());
            Assert.Empty(n2.GetIncomingEdges());
        }
Пример #2
0
        public void RemoveNodeShouldRemoveOutgoingEdges()
        {
            var graph = new ControlFlowGraph <int>(IntArchitecture.Instance);

            var n1 = new ControlFlowNode <int>(1);
            var n2 = new ControlFlowNode <int>(2);

            graph.Nodes.Add(n1);
            graph.Nodes.Add(n2);

            n1.ConnectWith(n2);

            Assert.Single(n1.GetOutgoingEdges());
            Assert.Single(n2.GetIncomingEdges());

            graph.Nodes.Remove(n1);

            Assert.Empty(n1.GetOutgoingEdges());
            Assert.Empty(n2.GetIncomingEdges());
        }