graph_test.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* This software is distributed under the GNU Lesser General Public License */
  2. //==========================================================================
  3. //
  4. // graph_test.cpp
  5. //
  6. //==========================================================================
  7. // $Id: graph_test.cpp,v 1.1 2003/01/14 16:50:46 raitner Exp $
  8. #include <iostream>
  9. #include <GTL/graph.h>
  10. #include <GTL/node_map.h>
  11. #ifdef __GTL_MSVCC
  12. # ifdef _DEBUG
  13. # define new DEBUG_NEW
  14. # undef THIS_FILE
  15. static char THIS_FILE[] = __FILE__;
  16. # endif // _DEBUG
  17. #endif // __GTL_MSVCC
  18. int main (int argc, char* argv[])
  19. {
  20. cout << "Loading graph and preserving ids" << endl;
  21. graph G;
  22. if (G.load("test.gml", true).err_num != GML_OK) {
  23. cout << "Loading failed" << endl;
  24. exit(1);
  25. }
  26. cout << "Loading OK" << endl;
  27. if (G.number_of_ids(node()) != 20) {
  28. cout << "1: Wrong number of ids: " << G.number_of_ids(node()) << endl;
  29. exit(1);
  30. }
  31. cout << "Number of ids OK" << endl;
  32. cout << "Loading graph and preserving ids" << endl;
  33. graph G1;
  34. if (G.load("test.gml", false).err_num != GML_OK) {
  35. cout << "Loading failed" << endl;
  36. exit(1);
  37. }
  38. cout << "Loading OK" << endl;
  39. if (G.number_of_ids(node()) != 19) {
  40. cout << "2: Wrong number of ids: " << G.number_of_ids(node()) << endl;
  41. exit(1);
  42. }
  43. cout << "Number of ids OK" << endl;
  44. }