X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/56fa1c897b84e3ae4c2849285def19575dd27611..10da10992e717ff220b7443d171e07559d45b3e4:/src/xbt/dict.c diff --git a/src/xbt/dict.c b/src/xbt/dict.c index a51a2abe1f..227347b76a 100644 --- a/src/xbt/dict.c +++ b/src/xbt/dict.c @@ -368,6 +368,10 @@ void xbt_dict_reset(xbt_dict_t dict) { int i; xbt_dictelm_t current, previous = NULL; + + if (dict->count == 0) + return; + for (i = 0; i < dict->table_size; i++) { current = dict->table[i]; while (current != NULL) { @@ -567,8 +571,20 @@ char *data; XBT_TEST_UNIT("basic",test_dict_basic,"Basic usage: change, retrieve, traverse"){ - xbt_test_add0("Traversal the empty dictionnary"); + xbt_test_add0("Traversal the null dictionnary"); + traverse(head); + + xbt_test_add0("Traversal and search the empty dictionnary"); + head = xbt_dict_new(); traverse(head); + TRY { + debuged_remove(head,"12346"); + } CATCH(e) { + if (e.category != not_found_error) + xbt_test_exception(e); + xbt_ex_free(e); + } + xbt_dict_free(&head); xbt_test_add0("Traverse the full dictionnary"); fill(&head); @@ -744,7 +760,7 @@ XBT_TEST_UNIT("crash",test_dict_crash,"Crash test"){ for (i=0;i<10;i++) { head=xbt_dict_new(); - // if (i%10) printf("."); else printf("%d",i/10); fflush(stdout); + /* if (i%10) printf("."); else printf("%d",i/10); fflush(stdout); */ nb=0; for (j=0;j<1000;j++) { key=xbt_malloc(SIZEOFKEY); @@ -767,7 +783,7 @@ XBT_TEST_UNIT("crash",test_dict_crash,"Crash test"){ head=xbt_dict_new(); xbt_test_add1("Fill %d elements, with keys being the number of element",NB_ELM); for (j=0;j