home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / yacl-012.zip / basedemo / btree / simple.cxx < prev    next >
C/C++ Source or Header  |  1994-10-14  |  970b  |  35 lines

  1.  
  2.  
  3.  
  4. // Simple tests of the B-tree methods
  5.  
  6. #include "base/tbtree.h"
  7. #include "base/memory.h"
  8. #include <iostream.h>
  9.  
  10. typedef CL_BTree<CL_String>           CL_StringBTree;
  11.  
  12. void main ()
  13. {
  14.     CL_MemoryLeakChecker checker (cout);
  15.     CL_StringBTree tree;
  16.     CL_String s;
  17.     char* t = new char [44];
  18.     
  19.     s = "Hello";
  20.     cout << s << " Add returned " << (tree.Add (s) ? "TRUE" : "FALSE") << endl;
  21.     cout << s << " Add returned " << (tree.Add (s) ? "TRUE" : "FALSE") << endl;
  22.     cout << s << " Find returned '" << tree.Find (s) << "'\n";
  23.     
  24.     s = "Goodbye";
  25.     cout << s << " Add returned " << (tree.Add (s) ? "TRUE" : "FALSE") << endl;
  26.     cout << s << " Find returned '" << tree.Find (s) << "'\n";
  27.     
  28.     cout << s << " Remove returned " << (tree.Remove (s) ? "TRUE" : "FALSE")
  29.          << endl;
  30.     cout << s << " Find returned '" << tree.Find (s) << "'\n";
  31.     cout << s << " Remove returned " << (tree.Remove (s) ? "TRUE" : "FALSE")
  32.          << endl;
  33.  
  34. }
  35.