Some modifications and another testfile.
5 #include <list_graph.h>
13 passed = passed && rc;
15 cout << "Test failed!" << endl;
20 const bool debug = true;
22 const bool debug = false;
30 typedef ListGraph::Node Node;
31 typedef ListGraph::Edge Edge;
42 Edge e1 = G.addEdge(s, v1);
43 Edge e2 = G.addEdge(s, v2);
44 Edge e3 = G.addEdge(v1, v2);
45 Edge e4 = G.addEdge(v2, v1);
46 Edge e5 = G.addEdge(v1, v3);
47 Edge e6 = G.addEdge(v3, v2);
48 Edge e7 = G.addEdge(v2, v4);
49 Edge e8 = G.addEdge(v4, v3);
50 Edge e9 = G.addEdge(v3, t);
51 Edge e10 = G.addEdge(v4, t);
56 cout << "\n\n\nDirPath tesztelese...\n";
59 cout << "Ures path letrehozasa" << endl;
60 typedef DirPath<ListGraph> DPath;
63 cout << "P.length() == " << P.length() << endl;
64 check(P.length() == 0);
66 cout << "P.from() valid? " << G.valid(P.from()) << endl;
67 check(! G.valid(P.from()));
70 cout << "Builder objektum letrehozasa" << endl;
73 cout << "Hozzaadunk az elejehez ket elet..." << endl;
76 cout << "P.length() == " << P.length() << endl;
77 check(P.length() == 0);
79 cout << "Commitolunk..." << endl;
82 cout << "P.length() == " << P.length() << endl;
83 check(P.length() == 2);
84 cout << "P.from() valid? " << G.valid(P.from()) << endl;
85 check(G.valid(P.from()));
86 cout << "P.from()==v1 ? " << (P.from()==v1) << endl;
87 check(P.from() == v1);
89 // Na ja, ez igy nem igazi, mindket esetet le kene tesztelni,
90 // de legalabb valami:
92 cout << "Hozzaadunk az elejehez egy nem illeszkedo elet..." << endl;
97 catch(const Exception &e) {
98 cout << "E: " << e.what() << endl;
104 cout << "Hozzaadunk a vegehez ket elet..." << endl;
107 cout << "P.length() == " << P.length() << endl;
108 check(P.length() == 2);
110 cout << "Es commitolunk...\n";
113 cout << "P.length() == " << P.length() << endl;
114 check(P.length() == 4);
115 cout << "P.to()==v3 ? " << (P.to()==v3) << endl;
118 cout << "Vegigiteralunk az eleken." << endl;
119 typedef DPath::NodeIt NodeIt;
120 typedef DPath::EdgeIt EdgeIt;
123 for(P.first(e); P.valid(e); P.next(e), ++i) {
124 cout << i << ". el: " << e << endl;
128 // Na ja, ez igy nem igazi, mindket esetet le kene tesztelni,
129 // de legalabb valami:
132 cout << "Setting an edgeiter to a nonexistant edge." << endl;
136 catch(const Exception &e) {
137 cout << "E: " << e.what() << endl;
145 catch(const std::exception &e) {
146 cout << "Uncaught exception: " << e.what() << endl;
150 cout << "Something horrible happened: an exception which isn't "
151 << "std::exception" << endl;
156 cout << (passed ? "All tests passed." : "Some of the tests failed!!!")
159 return passed ? 0 : 1;