


// Simple tests of the B-tree methods

#include "base/tbtree.h"
#include "base/memory.h"

#include <iostream.h>

typedef CL_BTree<CL_String>           CL_StringBTree;

void main ()
{
    CL_MemoryLeakChecker ck (cout);

    CL_StringBTree tree;
    CL_String s;
    char* t = new char [44]; // Deliberate memory leak
    
    s = "Hello";
    cout << s << " Add returned " << (tree.Add (s) ? "TRUE" : "FALSE") << endl;
    cout << s << " Add returned " << (tree.Add (s) ? "TRUE" : "FALSE") << endl;
    cout << s << " Find returned '" << tree.Find (s) << "'\n";
    
    s = "Goodbye";
    cout << s << " Add returned " << (tree.Add (s) ? "TRUE" : "FALSE") << endl;
    cout << s << " Find returned '" << tree.Find (s) << "'\n";
    
    cout << s << " Remove returned '" << tree.Remove (s) << "'\n";
    cout << s << " Find returned '" << tree.Find (s) << "'\n";
    cout << s << " Remove returned '" << tree.Remove (s) << "'\n";
}
