X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/4a18fb7c6c81b1f58a9f8111fcf0ade106c4746b..1005f2a4284dc2bd367dc5a4bf4609bc9ad06f94:/src/xbt/dict.c diff --git a/src/xbt/dict.c b/src/xbt/dict.c index e079770024..d97047947d 100644 --- a/src/xbt/dict.c +++ b/src/xbt/dict.c @@ -495,6 +495,7 @@ XBT_INLINE void xbt_dict_remove(xbt_dict_t dict, const char *key) xbt_dict_remove_ext(dict, key, strlen(key)); } +#ifdef XBT_USE_DEPRECATED /** * \brief Add data to the dict (arbitrary key) * \param dict the container @@ -529,7 +530,7 @@ XBT_INLINE void xbt_dicti_remove(xbt_dict_t dict, uintptr_t key) { xbt_dict_remove_ext(dict, (void *)&key, sizeof key); } - +#endif /** * \brief Remove all data from the dict @@ -1003,12 +1004,12 @@ static void basic_test(int homogeneous) traverse(head); } -XBT_TEST_UNIT("basic (heterogeneous)", test_dict_basic_heterogeneous, "Basic usage: change, retrieve, traverse: heterogeneous dictionary") +XBT_TEST_UNIT("basic_heterogeneous", test_dict_basic_heterogeneous, "Basic usage: change, retrieve, traverse: heterogeneous dict") { basic_test(0); } -XBT_TEST_UNIT("basic (homogeneous)", test_dict_basic_homogeneous, "Basic usage: change, retrieve, traverse: homogeneous dictionary") +XBT_TEST_UNIT("basic_homogeneous", test_dict_basic_homogeneous, "Basic usage: change, retrieve, traverse: homogeneous dict") { basic_test(1); } @@ -1083,12 +1084,12 @@ static void remove_test(int homogeneous) xbt_dict_free(&head); } -XBT_TEST_UNIT("remove (heterogeneous)", test_dict_remove_heterogeneous, "Removing some values: heterogeneous dictionary") +XBT_TEST_UNIT("remove_heterogeneous", test_dict_remove_heterogeneous, "Removing some values: heterogeneous dict") { remove_test(0); } -XBT_TEST_UNIT("remove (homogeneous)", test_dict_remove_homogeneous, "Removing some values: homogeneous dictionary") +XBT_TEST_UNIT("remove_homogeneous", test_dict_remove_homogeneous, "Removing some values: homogeneous dict") { remove_test(1); } @@ -1123,48 +1124,6 @@ XBT_TEST_UNIT("nulldata", test_dict_nulldata, "NULL data management") xbt_dict_free(&head); } -static void debuged_addi(xbt_dict_t head, uintptr_t key, uintptr_t data) -{ - uintptr_t stored_data = 0; - xbt_test_log("Add %zu under %zu", data, key); - - xbt_dicti_set(head, key, data); - if (XBT_LOG_ISENABLED(xbt_dict, xbt_log_priority_debug)) { - xbt_dict_dump(head, (void (*)(void *)) &printf); - fflush(stdout); - } - stored_data = xbt_dicti_get(head, key); - xbt_test_assert(stored_data == data, - "Retrieved data (%zu) is not what I just stored (%zu) under key %zu", - stored_data, data, key); -} - -XBT_TEST_UNIT("dicti", test_dict_scalar, "Scalar data and key management") -{ - xbt_test_add("Fill in the dictionnary"); - - head = xbt_dict_new(); - debuged_addi(head, 12, 12); - debuged_addi(head, 13, 13); - debuged_addi(head, 14, 14); - debuged_addi(head, 15, 15); - /* Change values */ - debuged_addi(head, 12, 15); - debuged_addi(head, 15, 2000); - debuged_addi(head, 15, 3000); - /* 0 as key */ - debuged_addi(head, 0, 1000); - debuged_addi(head, 0, 2000); - debuged_addi(head, 0, 3000); - /* 0 as value */ - debuged_addi(head, 12, 0); - debuged_addi(head, 13, 0); - debuged_addi(head, 12, 0); - debuged_addi(head, 0, 0); - - xbt_dict_free(&head); -} - #define NB_ELM 20000 #define SIZEOFKEY 1024 static int countelems(xbt_dict_t head) @@ -1277,14 +1236,17 @@ XBT_TEST_UNIT("crash", test_dict_crash, "Crash test") xbt_dict_free(&head); } +#ifdef XBT_USE_DEPRECATED static void str_free(void *s) { char *c = *(char **) s; free(c); } +#endif XBT_TEST_UNIT("multicrash", test_dict_multicrash, "Multi-dict crash test") { +#ifdef XBT_USE_DEPRECATED #undef NB_ELM #define NB_ELM 100 /*00 */ @@ -1349,11 +1311,10 @@ XBT_TEST_UNIT("multicrash", test_dict_multicrash, "Multi-dict crash test") xbt_dynar_free(&keys); - /* if (verbose>0) - xbt_dict_dump(mdict,&xbt_dict_print); */ - xbt_dict_free(&mdict); xbt_dynar_free(&keys); +#endif } + #endif /* SIMGRID_TEST */