[Avl-cvs] avl/src test.cpp,1.2,1.3 test.h,1.4,1.5
Brought to you by:
hetfield666,
jah2003
From: Patrizio B. <het...@us...> - 2004-07-17 14:13:08
|
Update of /cvsroot/avl/avl/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3937 Modified Files: test.cpp test.h Log Message: initialization, no more freezes (workaround, bug must be fixed) Index: test.h =================================================================== RCS file: /cvsroot/avl/avl/src/test.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test.h 17 Jul 2004 12:38:44 -0000 1.4 --- test.h 17 Jul 2004 14:12:59 -0000 1.5 *************** *** 16,20 **** Test(); ~Test(); ! Test(int,int); mytime getTimer(); Avlt* getAvlt(); --- 16,20 ---- Test(); ~Test(); ! Test(int,int,int=150); mytime getTimer(); Avlt* getAvlt(); *************** *** 24,27 **** --- 24,28 ---- void Avl_Test(int); void Bst_Test(int); + void Test_Init(int); Avlt* avlt; Bst* bst; Index: test.cpp =================================================================== RCS file: /cvsroot/avl/avl/src/test.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test.cpp 17 Jul 2004 12:34:55 -0000 1.2 --- test.cpp 17 Jul 2004 14:12:59 -0000 1.3 *************** *** 1,7 **** #include "test.h" #include <list> - #include <iostream> - Test::Test() { } --- 1,14 ---- #include "test.h" #include <list> + Test::~Test() { + + if (avlt) delete avlt; + if (bst) delete bst; + } + + + Test::Test() { + Test(0,60,150); } *************** *** 16,19 **** --- 23,43 ---- } + void Test::Test_Init(int base_limit) { + + int random; + + srand ( time(NULL) ); + if (avlt) { + + for (int i=0;i<base_limit;i++) { + random=rand()%1000; + avlt=avlt->insert(random); + } + + } + + } + + void Test::Avl_Test(int upper_limit){ *************** *** 38,45 **** random_erase=rand()%insertion_list.size(); ! //for ( list<int>::iterator IT=insertion_list.begin(), int x=0; x<random_erase; IT++, x++) ! //list<int>::iterator IT = find(insertion_list.begin(),insertion_list.end(),random_erase); ! //insertion_list.erase(IT); ! for ( IT=insertion_list.begin(), x=0; x<=random_erase && IT!=insertion_list.end(); IT++, x++) --- 62,66 ---- random_erase=rand()%insertion_list.size(); ! for ( IT=insertion_list.begin(), x=0; x<=random_erase && IT!=insertion_list.end(); IT++, x++) *************** *** 65,76 **** ! Test::Test(int kind, int upperbound) { switch (kind){ case 0: avlt=new Avlt(); Avl_Test(upperbound); break; case 1: bst=new Bst(); Bst_Test(upperbound); break; --- 86,100 ---- ! Test::Test(int kind, int upperbound, int base_tree_size=150) { ! switch (kind){ case 0: avlt=new Avlt(); + Test_Init(base_tree_size); Avl_Test(upperbound); break; case 1: bst=new Bst(); + //Test_Init(); not ready for both Bst_Test(upperbound); break; |