Move general graph compilation tests to 'src/test/graph_test.h'.
2 #include <hugo/list_graph.h>
3 #include <hugo/minlengthpaths.h>
5 #include "test_tools.h"
18 typedef ListGraph::Node Node;
19 typedef ListGraph::Edge Edge;
25 Node s=graph.addNode();
26 Node v1=graph.addNode();
27 Node v2=graph.addNode();
28 Node v3=graph.addNode();
29 Node v4=graph.addNode();
30 Node v5=graph.addNode();
31 Node t=graph.addNode();
33 Edge s_v1=graph.addEdge(s, v1);
34 Edge v1_v2=graph.addEdge(v1, v2);
35 Edge s_v3=graph.addEdge(s, v3);
36 Edge v2_v4=graph.addEdge(v2, v4);
37 Edge v2_v5=graph.addEdge(v2, v5);
38 Edge v3_v5=graph.addEdge(v3, v5);
39 Edge v4_t=graph.addEdge(v4, t);
40 Edge v5_t=graph.addEdge(v5, t);
43 ListGraph::EdgeMap<int> length(graph);
54 std::cout << "Minlengthpaths algorithm test..." << std::endl;
58 MinLengthPaths< ListGraph, ListGraph::EdgeMap<int> >
59 surb_test(graph, length);
61 check( surb_test.run(s,t,k) == 2 && surb_test.totalLength() == 46,
62 "Two paths, total length should be 46");
64 check( surb_test.checkComplementarySlackness(),
65 "Complementary slackness conditions are not met.");
67 // typedef DirPath<ListGraph> DPath;
71 surb_test.getPath(P,0);
72 check(P.length() == 4, "First path should contain 4 edges.");
73 cout<<P.length()<<endl;
74 surb_test.getPath(P,1);
75 check(P.length() == 3, "Second path: 3 edges.");
76 cout<<P.length()<<endl;
80 check( surb_test.run(s,t,k) == 1 && surb_test.totalLength() == 19,
81 "One path, total length should be 19");
83 check( surb_test.checkComplementarySlackness(),
84 "Complementary slackness conditions are not met.");
86 // surb_test.getPath(P,0);
87 // check(P.length() == 4, "First path should contain 4 edges.");
89 cout << (passed ? "All tests passed." : "Some of the tests failed!!!")
92 return passed ? 0 : 1;