+
+
+#include "btree.h"
+#include "clave_fija.h"
+#include "random.h"
+
+int main (int argc, char *argv[])
+{
+ std::list<int> lst;
+
+ BTree tree ("test.idx", 512);
+
+
+ Random::Init ();
+
+ Random::Ints (lst, 10);
+
+ std::list<int>::iterator it = lst.begin ();
+ while (it != lst.end ()) {
+ ClaveFija c(*it);
+
+ std::cout << "Agregando " << (*it) << std::endl;
+ tree.AddKey (c);
+ it++;
+ }
+
+ it = lst.begin ();
+ BTreeFindResult *r;
+ while (it != lst.end ()) {
+ ClaveFija c(*it);
+
+ r = tree.FindKey (c);
+ if (r) {
+ std::cout << (*it) << " encontrada\n";
+ delete r;
+ } else
+ std::cout << (*it) << " NO encontrada\n";
+ it++;
+ }
+
+ it = lst.begin ();
+ while (it != lst.end ()) {
+ ClaveFija c(*it);
+
+ std::cout << "========= Borro : " << (*it)<< "============\n";
+ tree.PrintNode (0);
+ tree.DelKey (c);
+ std::cout << std::endl;
+ tree.PrintNode (0);
+ it++;
+ std::cout << "=============================\n";
+ }
+
+
+ return 0;
+}
+