Beispiel #1
0
        public void RegioGraaf_a_TestAllPaths_OnGraph14_1_AfterDijkstra()
        {
            // Arrange
            IGraph graph = DSBuilder.CreateGraph14_1();

            graph.Dijkstra("V0");

            //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
            // NOTE: Since there are no regions, we expect
            // this test to succeed also on when
            // Dijkstra is changed for RegioGraaf!
            //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

            var expected = StringWithoutSpaces(
                "V0;V1<-V0;V2<-V3<-V0;" +
                "V3<-V0;V4<-V3<-V0;" +
                "V5<-V6<-V3<-V0;" +
                "V6<-V3<-V0;");

            // Act
            string actual = StringWithoutSpaces(graph.AllPaths());

            // Assert
            Assert.AreEqual(expected, actual);
        }
Beispiel #2
0
        public void Graph_ClearAll_AllVerticesDefaultValues()
        {
            // Arrange
            IGraph graph = DSBuilder.CreateGraph14_1();

            // Act
            graph.ClearAll();
            List <Vertex> vertices = graph.GetAllVertices();
            bool          actual   = false;

            foreach (Vertex vertex in vertices)
            {
                if (vertex.Dist.Equals(Graph.INFINITY) && !vertex.Known && vertex.Prev == null)
                {
                    actual = true;
                }
                else
                {
                    actual = false;
                    break;
                };
            }

            // Assert
            Assert.IsTrue(actual);
        }
Beispiel #3
0
        public void Graph_IsConnected_OnNotConnectedGraph()
        {
            // Arrange
            IGraph graph = DSBuilder.CreateGraph14_1();

            // Act
            bool actual = graph.IsConnected();

            // Assert
            Assert.IsFalse(actual);
        }
Beispiel #4
0
        public void RegioGraaf_a_TestAllPaths_OnGraph14_1()
        {
            // Arrange
            IGraph graph    = DSBuilder.CreateGraph14_1();
            string expected = "V0;V1;V2;V3;V4;V5;V6;";

            // Act
            string actual = StringWithoutSpaces(graph.AllPaths());

            // Assert
            Assert.AreEqual(expected, actual);
        }
        public void Graph_ToString_OnGraph14_1()
        {
            // Arrange
            IGraph graph = DSBuilder.CreateGraph14_1();
            string expectedWithSpaces = StringWithoutSpaces("V0 [ V1(2) V3(1) ] V1 [ V3(3) V4(10) ] V2 [ V0(4) V5(5) ] V3 [ V2(2) V5(8) V6(4) V4(2) ] V4 [ V6(6) ] V5 V6 [ V5(1) ]");
            string expected           = StringWithoutSpaces(expectedWithSpaces);

            // Act
            string actual = StringWithoutSpaces(graph.ToString());

            // Assert
            Assert.AreEqual(expected, actual);

            Assert.Pass();
        }