1.1 --- a/src/test/minlengthpaths_test.cc Tue May 04 09:33:21 2004 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,80 +0,0 @@
1.4 -#include <iostream>
1.5 -#include <list_graph.h>
1.6 -#include <minlengthpaths.h>
1.7 -using namespace std;
1.8 -using namespace hugo;
1.9 -
1.10 -
1.11 -
1.12 -int main()
1.13 -{
1.14 -
1.15 -
1.16 -
1.17 -bool passed = true;
1.18 -
1.19 -void check(bool rc, char *msg="") {
1.20 - passed = passed && rc;
1.21 - if(!rc) {
1.22 - std::cerr << "Test failed! ("<< msg << ")" << std::endl; \
1.23 -
1.24 -
1.25 - }
1.26 -}
1.27 -
1.28 -
1.29 -
1.30 -int main()
1.31 -{
1.32 -
1.33 - typedef ListGraph::Node Node;
1.34 - typedef ListGraph::Edge Edge;
1.35 -
1.36 - ListGraph graph;
1.37 -
1.38 - //Ahuja könyv példája
1.39 -
1.40 - Node s=graph.addNode();
1.41 - Node v2=graph.addNode();
1.42 - Node v3=graph.addNode();
1.43 - Node v4=graph.addNode();
1.44 - Node v5=graph.addNode();
1.45 - Node t=graph.addNode();
1.46 -
1.47 - Edge s_v2=graph.addEdge(s, v2);
1.48 - Edge s_v3=graph.addEdge(s, v3);
1.49 - Edge v2_v4=graph.addEdge(v2, v4);
1.50 - Edge v2_v5=graph.addEdge(v2, v5);
1.51 - Edge v3_v5=graph.addEdge(v3, v5);
1.52 - Edge v4_t=graph.addEdge(v4, t);
1.53 - Edge v5_t=graph.addEdge(v5, t);
1.54 -
1.55 -
1.56 - ListGraph::EdgeMap<int> length(graph);
1.57 -
1.58 - length.set(s_v2, 10);
1.59 - length.set(s_v3, 10);
1.60 - length.set(v2_v4, 5);
1.61 - length.set(v2_v5, 1);
1.62 - length.set(v3_v5, 5);
1.63 - length.set(v4_t, 8);
1.64 - length.set(v5_t, 8);
1.65 -
1.66 - std::cout << "Minlengthpaths algorithm test..." << std::endl;
1.67 -
1.68 -
1.69 - int k=3;
1.70 - MinLengthPaths<ListGraph, ListGraph::EdgeMap<int> >
1.71 - surb_test(graph, length);
1.72 -
1.73 - check( surb_test.run(s,t,k) == 2 && suurb_test.totalLength == 46,"Two paths, total length should be 46");
1.74 -
1.75 - k=1;
1.76 - check( surb_test.run(s,t,k) == 1 && suurb_test.totalLength == 19,"One path, total length should be 19");
1.77 -
1.78 - cout << (passed ? "All tests passed." : "Some of the tests failed!!!")
1.79 - << endl;
1.80 -
1.81 - return passed ? 0 : 1;
1.82 -
1.83 -}