From dc2ce18ea8e1686e61dce2b924e3607df69a2dcf Mon Sep 17 00:00:00 2001 From: Pixel <> Date: Sat, 3 Mar 2001 22:53:41 +0000 Subject: Plein de changements --- src/test.cc | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/test.cc') diff --git a/src/test.cc b/src/test.cc index 9dbc455..924cba3 100644 --- a/src/test.cc +++ b/src/test.cc @@ -3,6 +3,7 @@ #include "config.h" #include "BHeap.h" #include "FHeap.h" +#include "BinHeap.h" #include "PLList.h" char N[] = { @@ -19,7 +20,7 @@ void exception(int e, char *msg) PriorityList *newlist(void) { - return new FHeap; + return new BinHeap; } void DoCombTest(int number) @@ -29,10 +30,10 @@ void DoCombTest(int number) Datas_t Datas; PriorityList *T; - cerr << _("Creation of a priority list and adding ") << number << - _(" random entrie(s)..."); + cerr << _("Creation of a priority list and adding ") << number << _(" random entrie(s)..."); T = newlist(); for (i = 1; i <= number; i++) { + T->Dump(cerr); T->Insert(rand() % P_INFINITY, NULL); } cerr << _("Ok.\nDeleting the list..."); @@ -40,14 +41,11 @@ void DoCombTest(int number) for (i = number; i >= 1; i--) { T->Dump(cerr); if (T->n() != i) { - cerr << _("List has ") << T-> - n() << _(" keys. Expecting ") << i << endl; + cerr << _("List has ") << T->n() << _(" keys. Expecting ") << i << endl; exception(1, _("List corrupted.")); } if ((n = T->rn()) != i) { - cerr << _("List has ") << T-> - rn() << _(" keys (real count). Expecting ") << - i << endl; + cerr << _("List has ") << T->rn() << _(" keys (real count). Expecting ") << i << endl; exception(1, _("List corrupted.")); } K = T->Extract_Min(Datas); @@ -68,17 +66,20 @@ void FullTest(void) Key_t K; int i; - cerr << _("Size of a PriorityList cell: ") << sizeof(PriorityList) << - endl; + cerr << _("Size of a PriorityList cell: ") << sizeof(PriorityList) << endl; cerr << _("Size of a BHeap cell : ") << sizeof(BHeap) << endl; cerr << _("Size of a FHeap cell : ") << sizeof(FHeap) << endl; - cerr << _("Size of a PList header : ") << sizeof(PLList) << endl; + cerr << _("Size of a PLList header : ") << sizeof(PLList) << endl; cerr << _("Size of a CList cell : ") << sizeof(CList) << endl; cerr << _("Size of a SList cell : ") << sizeof(SList) << endl; + cerr << _("Size of a BinHeap header : ") << sizeof(BinHeap) << endl; + cerr << _("Size of a BinHeap cell : ") << sizeof(binheap_t) << endl; +/* DoCombTest(0); DoCombTest(10); DoCombTest(70); +*/ // DoCombTest(1000); // DoCombTest(10000); #ifdef BT @@ -91,7 +92,8 @@ void FullTest(void) cerr << _("Creating a priority list and adding keys:\n"); T = newlist(); for (i = 0; i < 30; i++) { - fprintf(stderr, "%i ", N[i]); + T->Dump(cerr); + fprintf(stderr, "%i \n", N[i]); T->Insert(N[i], NULL); } @@ -117,9 +119,7 @@ void FullTest(void) cerr << T->Extract_Min(Datas) << endl; cerr << _("Ok.\nExtracting datas...\n"); for (i = 1; i <= 30; i++) { - cerr << _("Minimum #") << i << " = " << (K = - (T-> - Extract_Min(Datas))) + cerr << _("Minimum #") << i << " = " << (K = (T->Extract_Min(Datas))) << endl; if (K != i) exception(1, _("Incorrect order.")); -- cgit v1.2.3