Add missing _empty_p methods for dictionnaries.
This commit is contained in:
1 parent
8e042435e5
commit
28f6a7d399
2 files changed
+19
-3
No files matched your search
@@ -228,7 +228,14 @@
|
||||
map->used = 0; \
|
||||
DICTI_CONTRACT(name, map); \
|
||||
} \
|
||||
\
|
||||
\
|
||||
static inline bool \
|
||||
M_C(name,_empty_p)(const dict_t map) \
|
||||
{ \
|
||||
DICTI_CONTRACT(name, map); \
|
||||
return map->used == 0; \
|
||||
} \
|
||||
\
|
||||
static inline size_t \
|
||||
M_C(name,_size)(const dict_t map) \
|
||||
{ \
|
||||
@@ -1064,7 +1071,14 @@ typedef enum {
|
||||
DICTI_OA_CONTRACT(dict); \
|
||||
return true; \
|
||||
} \
|
||||
\
|
||||
\
|
||||
static inline bool \
|
||||
M_C(name,_empty_p)(const dict_t dict) \
|
||||
{ \
|
||||
DICTI_OA_CONTRACT(dict); \
|
||||
return dict->count == 0; \
|
||||
} \
|
||||
\
|
||||
static inline size_t \
|
||||
M_C(name,_size)(const dict_t dict) \
|
||||
{ \
|
||||
|
||||
+3
-1
@@ -69,10 +69,12 @@ static void test_data(void)
|
||||
{
|
||||
dict_str_t dict;
|
||||
int data_size = (int) array_string_size(v_str);
|
||||
|
||||
|
||||
dict_str_init (dict);
|
||||
assert(dict_str_empty_p(dict));
|
||||
for (int i = 0; i < data_size; ++i) {
|
||||
dict_str_set_at(dict, *array_string_cget(v_str, i), *array_string_cget(v_str, (i+1) % data_size));
|
||||
assert(!dict_str_empty_p(dict));
|
||||
}
|
||||
assert(dict_str_size(dict) == 1227176);
|
||||
|
||||
|
||||
Reference in new issue
Block a user