Improve docs.
3 //#include <hugo/path.h>
4 #include <hugo/skeletons/path.h>
5 #include <hugo/list_graph.h>
10 using namespace skeleton;
16 passed = passed && rc;
18 cout << "Test failed!" << endl;
23 const bool debug = true;
25 const bool debug = false;
33 typedef ListGraph::Node Node;
34 typedef ListGraph::Edge Edge;
45 Edge e1 = G.addEdge(s, v1);
46 Edge e2 = G.addEdge(s, v2);
47 Edge e3 = G.addEdge(v1, v2);
48 Edge e4 = G.addEdge(v2, v1);
49 Edge e5 = G.addEdge(v1, v3);
50 Edge e6 = G.addEdge(v3, v2);
51 Edge e7 = G.addEdge(v2, v4);
52 Edge e8 = G.addEdge(v4, v3);
53 Edge e9 = G.addEdge(v3, t);
54 Edge e10 = G.addEdge(v4, t);
61 cout << "\n\n\nDirPath tesztelese...\n";
64 cout << "Ures path letrehozasa" << endl;
66 typedef Path <ListGraph> DPath;
68 typedef DirPath<ListGraph> DPath;
72 cout << "P.length() == " << P.length() << endl;
73 check(P.length() == 0);
76 cout << "P.tail() valid? " << (P.tail()!=INVALID) << endl;
77 check(! (P.tail()!=INVALID));
79 cout << "P.tail() valid? " << (P.from()!=INVALID) << endl;
80 check(! (P.to()!=INVALID));
83 cout << "Builder objektum letrehozasa" << endl;
86 cout << "Hozzaadunk az elejehez ket elet..." << endl;
89 cout << "P.length() == " << P.length() << endl;
90 check(P.length() == 0);
92 cout << "Commitolunk..." << endl;
95 cout << "P.length() == " << P.length() << endl;
96 check(P.length() == 2);
99 cout << "P.tail() valid? " << (P.tail()!=INVALID) << endl;
100 check(P.tail()!=INVALID);
101 cout << "P.tail()==v1 ? " << (P.tail()==v1) << endl;
102 check(P.tail() == v1);
104 cout << "P.tail() valid? " << (P.from()!=INVALID) << endl;
105 check(P.from()!=INVALID);
106 cout << "P.tail()==v1 ? " << (P.from()==v1) << endl;
107 check(P.from() == v1);
110 // Na ja, ez igy nem igazi, mindket esetet le kene tesztelni,
111 // de legalabb valami:
113 cout << "Hozzaadunk az elejehez egy nem illeszkedo elet..." << endl;
118 catch(const Exception &e) {
119 cout << "E: " << e.what() << endl;
125 cout << "Hozzaadunk a vegehez ket elet..." << endl;
128 cout << "P.length() == " << P.length() << endl;
129 check(P.length() == 2);
131 cout << "Es commitolunk...\n";
134 cout << "P.length() == " << P.length() << endl;
135 check(P.length() == 4);
138 cout << "P.head()==v3 ? " << (P.head()==v3) << endl;
139 check(P.head() == v3);
141 cout << "P.head()==v3 ? " << (P.to()==v3) << endl;
146 cout << "Vegigiteralunk az eleken." << endl;
147 typedef DPath::NodeIt NodeIt;
148 typedef DPath::EdgeIt EdgeIt;
151 for(P.first(e); e!=INVALID; ++e, ++i) {
152 cout << i << ". el: " <</* e << */endl;
156 // Na ja, ez igy nem igazi, mindket esetet le kene tesztelni,
157 // de legalabb valami:
162 cout << "Setting an edgeiter to a nonexistant edge." << endl;
166 catch(const Exception &e) {
167 cout << "E: " << e.what() << endl;
175 catch(const std::exception &e) {
176 cout << "Uncaught exception: " << e.what() << endl;
180 cout << "Something horrible happened: an exception which isn't "
181 << "std::exception" << endl;
186 cout << (passed ? "All tests passed." : "Some of the tests failed!!!")
189 return passed ? 0 : 1;