4 #include <path_skeleton.h>
 
     5 #include <list_graph.h>
 
     9 using namespace concept;
 
    14   passed = passed && rc;
 
    16     cout << "Test failed!" << endl;
 
    21 const bool debug = true;
 
    23 const bool debug = false;
 
    31     typedef ListGraph::Node Node;
 
    32     typedef ListGraph::Edge Edge;
 
    43     Edge e1 = G.addEdge(s, v1);
 
    44     Edge e2 = G.addEdge(s, v2);
 
    45     Edge e3 = G.addEdge(v1, v2);
 
    46     Edge e4 = G.addEdge(v2, v1);
 
    47     Edge e5 = G.addEdge(v1, v3);
 
    48     Edge e6 = G.addEdge(v3, v2);
 
    49     Edge e7 = G.addEdge(v2, v4);
 
    50     Edge e8 = G.addEdge(v4, v3);
 
    51     Edge e9 = G.addEdge(v3, t);
 
    52     Edge e10 = G.addEdge(v4, t);
 
    57       cout << "\n\n\nDirPath tesztelese...\n";
 
    60       cout << "Ures path letrehozasa" << endl;
 
    61       //typedef DirPath<ListGraph> DPath;
 
    62       typedef Path <ListGraph> DPath;
 
    65       cout << "P.length() == " << P.length() << endl;
 
    66       check(P.length() == 0);
 
    69       cout << "P.source() valid? " << (P.source()!=INVALID) << endl;
 
    70       check(! (P.source()!=INVALID));
 
    72       cout << "P.source() valid? " << (P.from()!=INVALID) << endl;
 
    73       check(! (P.to()!=INVALID));
 
    76 	cout << "Builder objektum letrehozasa" << endl;
 
    79 	cout << "Hozzaadunk az elejehez ket elet..." << endl;
 
    82 	cout << "P.length() == " << P.length() << endl;
 
    83 	check(P.length() == 0);
 
    85 	cout << "Commitolunk..." << endl;
 
    88 	cout << "P.length() == " << P.length() << endl;
 
    89 	check(P.length() == 2);
 
    92 	cout << "P.source() valid? " << (P.source()!=INVALID) << endl;
 
    93 	check(P.source()!=INVALID);
 
    94 	cout << "P.source()==v1 ? " << (P.source()==v1) << endl;
 
    95 	check(P.source() == v1);
 
    97 	cout << "P.source() valid? " << (P.from()!=INVALID) << endl;
 
    98 	check(P.from()!=INVALID);
 
    99 	cout << "P.source()==v1 ? " << (P.from()==v1) << endl;
 
   100 	check(P.from() == v1);
 
   103 	// Na ja, ez igy nem igazi, mindket esetet le kene tesztelni,
 
   104 	// de legalabb valami:
 
   106 	cout << "Hozzaadunk az elejehez egy nem illeszkedo elet..." << endl;
 
   111 	catch(const Exception &e) {
 
   112 	  cout << "E: " << e.what() << endl;
 
   118 	cout << "Hozzaadunk a vegehez ket elet..." << endl;
 
   121 	cout << "P.length() == " << P.length() << endl;
 
   122 	check(P.length() == 2);
 
   124 	cout << "Es commitolunk...\n";
 
   127       cout << "P.length() == " << P.length() << endl;
 
   128       check(P.length() == 4);
 
   131       cout << "P.target()==v3 ? " << (P.target()==v3) << endl;
 
   132       check(P.target() == v3);
 
   134       cout << "P.target()==v3 ? " << (P.to()==v3) << endl;
 
   138       cout << "Vegigiteralunk az eleken." << endl;
 
   139       typedef DPath::NodeIt NodeIt;
 
   140       typedef DPath::EdgeIt EdgeIt;
 
   143       for(P.first(e); e!=INVALID; ++e, ++i) {
 
   144 	cout << i << ". el: " <</* e << */endl;
 
   148       // Na ja, ez igy nem igazi, mindket esetet le kene tesztelni,
 
   149       // de legalabb valami:
 
   154 	cout << "Setting an edgeiter to a nonexistant edge." << endl;
 
   158       catch(const Exception &e) {
 
   159 	cout << "E: " << e.what() << endl;
 
   167   catch(const std::exception &e) {
 
   168     cout << "Uncaught exception: " << e.what() << endl;
 
   172     cout << "Something horrible happened: an exception which isn't "
 
   173 	 << "std::exception" << endl;
 
   178   cout << (passed ? "All tests passed." : "Some of the tests failed!!!")
 
   181   return passed ? 0 : 1;