# HG changeset patch # User athos # Date 1083661211 0 # Node ID fcdb561b8c7841f58211e718481461701f3f500c # Parent 1380377682ab6a138fca9cb12a9e42f84ea5d3fa Started minlengthpaths_test, but it should not be here diff -r 1380377682ab -r fcdb561b8c78 src/test/minlengthpaths_test.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/minlengthpaths_test.cc Tue May 04 09:00:11 2004 +0000 @@ -0,0 +1,80 @@ +#include +#include +#include +using namespace std; +using namespace hugo; + + + +int main() +{ + + + +bool passed = true; + +void check(bool rc, char *msg="") { + passed = passed && rc; + if(!rc) { + std::cerr << "Test failed! ("<< msg << ")" << std::endl; \ + + + } +} + + + +int main() +{ + + typedef ListGraph::Node Node; + typedef ListGraph::Edge Edge; + + ListGraph graph; + + //Ahuja könyv példája + + Node s=graph.addNode(); + Node v2=graph.addNode(); + Node v3=graph.addNode(); + Node v4=graph.addNode(); + Node v5=graph.addNode(); + Node t=graph.addNode(); + + Edge s_v2=graph.addEdge(s, v2); + Edge s_v3=graph.addEdge(s, v3); + Edge v2_v4=graph.addEdge(v2, v4); + Edge v2_v5=graph.addEdge(v2, v5); + Edge v3_v5=graph.addEdge(v3, v5); + Edge v4_t=graph.addEdge(v4, t); + Edge v5_t=graph.addEdge(v5, t); + + + ListGraph::EdgeMap length(graph); + + length.set(s_v2, 10); + length.set(s_v3, 10); + length.set(v2_v4, 5); + length.set(v2_v5, 1); + length.set(v3_v5, 5); + length.set(v4_t, 8); + length.set(v5_t, 8); + + std::cout << "Minlengthpaths algorithm test..." << std::endl; + + + int k=3; + MinLengthPaths > + surb_test(graph, length); + + check( surb_test.run(s,t,k) == 2 && suurb_test.totalLength == 46,"Two paths, total length should be 46"); + + k=1; + check( surb_test.run(s,t,k) == 1 && suurb_test.totalLength == 19,"One path, total length should be 19"); + + cout << (passed ? "All tests passed." : "Some of the tests failed!!!") + << endl; + + return passed ? 0 : 1; + +} diff -r 1380377682ab -r fcdb561b8c78 src/test/xy_test.cc --- a/src/test/xy_test.cc Tue May 04 08:34:01 2004 +0000 +++ b/src/test/xy_test.cc Tue May 04 09:00:11 2004 +0000 @@ -19,7 +19,7 @@ int main() { - + cout << "Testing classes xy and boundingbox." << endl; typedef xy XY;