Simplified name for functions table ftab_key to fkey and ftab_val to fval
This commit is contained in:
1 parent
5e13c7ba91
commit
eb13fcad01
46 files changed
+841
-856
No files matched your search
+40
-40
@@ -5,32 +5,32 @@
|
||||
|
||||
#include "../src/bidimap.c"
|
||||
|
||||
struct bidimap_ftab_key *bm_ftab_key =
|
||||
&(struct bidimap_ftab_key){ .cmp = cmp,
|
||||
struct bidimap_fkey *bm_fkey =
|
||||
&(struct bidimap_fkey){ .cmp = cmp,
|
||||
.cpy = copy,
|
||||
.str = str,
|
||||
.free = custom_free,
|
||||
.hash = hash,
|
||||
.pri = pri };
|
||||
|
||||
struct bidimap_ftab_val *bm_ftab_val =
|
||||
&(struct bidimap_ftab_val){ .cmp = cmp,
|
||||
struct bidimap_fval *bm_fval =
|
||||
&(struct bidimap_fval){ .cmp = cmp,
|
||||
.cpy = copy,
|
||||
.str = str,
|
||||
.free = custom_free,
|
||||
.hash = hash,
|
||||
.pri = pri };
|
||||
|
||||
struct bidimap_ftab_key *bm_ftab_key_counter =
|
||||
&(struct bidimap_ftab_key){ .cmp = k_c_cmp,
|
||||
struct bidimap_fkey *bm_fkey_counter =
|
||||
&(struct bidimap_fkey){ .cmp = k_c_cmp,
|
||||
.cpy = k_c_cpy,
|
||||
.str = k_c_str,
|
||||
.free = k_c_free,
|
||||
.hash = k_c_hash,
|
||||
.pri = k_c_pri };
|
||||
|
||||
struct bidimap_ftab_val *bm_ftab_val_counter =
|
||||
&(struct bidimap_ftab_val){ .cmp = v_c_cmp,
|
||||
struct bidimap_fval *bm_fval_counter =
|
||||
&(struct bidimap_fval){ .cmp = v_c_cmp,
|
||||
.cpy = v_c_cpy,
|
||||
.str = v_c_str,
|
||||
.free = v_c_free,
|
||||
@@ -39,7 +39,7 @@ struct bidimap_ftab_val *bm_ftab_val_counter =
|
||||
|
||||
CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
CMC_CREATE_TEST(new, {
|
||||
struct bidimap *map = bm_new(100, 0.6, bm_ftab_key, bm_ftab_val);
|
||||
struct bidimap *map = bm_new(100, 0.6, bm_fkey, bm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -49,7 +49,7 @@ CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[null buffer], {
|
||||
struct bidimap *map = bm_new(100, 0.6, bm_ftab_key, bm_ftab_val);
|
||||
struct bidimap *map = bm_new(100, 0.6, bm_fkey, bm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -64,7 +64,7 @@ CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
|
||||
CMC_CREATE_TEST(new_custom, {
|
||||
struct bidimap *map =
|
||||
bm_new_custom(100, 0.6, bm_ftab_key, bm_ftab_val,
|
||||
bm_new_custom(100, 0.6, bm_fkey, bm_fval,
|
||||
&(struct cmc_alloc_node){ .malloc = malloc,
|
||||
.calloc = calloc,
|
||||
.realloc = realloc,
|
||||
@@ -78,7 +78,7 @@ CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
|
||||
CMC_CREATE_TEST(new_custom[insert remove], {
|
||||
struct bidimap *map =
|
||||
bm_new_custom(500, 0.6, bm_ftab_key, bm_ftab_val,
|
||||
bm_new_custom(500, 0.6, bm_fkey, bm_fval,
|
||||
&(struct cmc_alloc_node){ .malloc = malloc,
|
||||
.calloc = calloc,
|
||||
.realloc = realloc,
|
||||
@@ -111,7 +111,7 @@ CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
|
||||
CMC_CREATE_TEST(clear[ftab free calls], {
|
||||
struct bidimap *map =
|
||||
bm_new(1000, 0.6, bm_ftab_key_counter, bm_ftab_val_counter);
|
||||
bm_new(1000, 0.6, bm_fkey_counter, bm_fval_counter);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -131,7 +131,7 @@ CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
cmc_assert_equals(int32_t, 1000, k_total_free);
|
||||
cmc_assert_equals(int32_t, 1000, v_total_free);
|
||||
|
||||
bm_ftab_val_counter->free = NULL;
|
||||
bm_fval_counter->free = NULL;
|
||||
|
||||
for (size_t i = 0; i < 1000; i++)
|
||||
cmc_assert(bm_insert(map, i, i));
|
||||
@@ -141,8 +141,8 @@ CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
cmc_assert_equals(int32_t, 2000, k_total_free);
|
||||
cmc_assert_equals(int32_t, 1000, v_total_free);
|
||||
|
||||
bm_ftab_val_counter->free = v_c_free;
|
||||
bm_ftab_key_counter->free = NULL;
|
||||
bm_fval_counter->free = v_c_free;
|
||||
bm_fkey_counter->free = NULL;
|
||||
|
||||
for (size_t i = 0; i < 1000; i++)
|
||||
cmc_assert(bm_insert(map, i, i));
|
||||
@@ -152,7 +152,7 @@ CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
cmc_assert_equals(int32_t, 2000, k_total_free);
|
||||
cmc_assert_equals(int32_t, 2000, v_total_free);
|
||||
|
||||
bm_ftab_key_counter->free = k_c_free;
|
||||
bm_fkey_counter->free = k_c_free;
|
||||
|
||||
bm_free(map);
|
||||
|
||||
@@ -161,7 +161,7 @@ CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(clear[count], {
|
||||
struct bidimap *map = bm_new(100, 0.6, bm_ftab_key, bm_ftab_val);
|
||||
struct bidimap *map = bm_new(100, 0.6, bm_fkey, bm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -179,7 +179,7 @@ CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
|
||||
CMC_CREATE_TEST(customize, {
|
||||
struct bidimap *map =
|
||||
bm_new_custom(100, 0.6, bm_ftab_key, bm_ftab_val, NULL, NULL);
|
||||
bm_new_custom(100, 0.6, bm_fkey, bm_fval, NULL, NULL);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -195,7 +195,7 @@ CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
node.calloc = calloc;
|
||||
|
||||
map =
|
||||
bm_new_custom(100, 0.6, bm_ftab_key, bm_ftab_val, &node, callbacks);
|
||||
bm_new_custom(100, 0.6, bm_fkey, bm_fval, &node, callbacks);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -206,7 +206,7 @@ CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(buffer_growth[capacity = 1], {
|
||||
struct bidimap *map = bm_new(1, 0.7, bm_ftab_key, bm_ftab_val);
|
||||
struct bidimap *map = bm_new(1, 0.7, bm_fkey, bm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -229,7 +229,7 @@ CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert, {
|
||||
struct bidimap *map = bm_new(100, 0.7, bm_ftab_key, bm_ftab_val);
|
||||
struct bidimap *map = bm_new(100, 0.7, bm_fkey, bm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -243,7 +243,7 @@ CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[duplicate], {
|
||||
struct bidimap *map = bm_new(100, 0.7, bm_ftab_key, bm_ftab_val);
|
||||
struct bidimap *map = bm_new(100, 0.7, bm_fkey, bm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -259,7 +259,7 @@ CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[references], {
|
||||
struct bidimap *map = bm_new(500, 0.7, bm_ftab_key, bm_ftab_val);
|
||||
struct bidimap *map = bm_new(500, 0.7, bm_fkey, bm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -281,7 +281,7 @@ CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[growth remove clear], {
|
||||
struct bidimap *map = bm_new(100, 0.7, bm_ftab_key, bm_ftab_val);
|
||||
struct bidimap *map = bm_new(100, 0.7, bm_fkey, bm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -315,7 +315,7 @@ CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
|
||||
CMC_CREATE_TEST(insert[ftab hash calls], {
|
||||
struct bidimap *map =
|
||||
bm_new(100, 0.7, bm_ftab_key_counter, bm_ftab_val_counter);
|
||||
bm_new(100, 0.7, bm_fkey_counter, bm_fval_counter);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -335,7 +335,7 @@ CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(update_key, {
|
||||
struct bidimap *map = bm_new(100, 0.7, bm_ftab_key, bm_ftab_val);
|
||||
struct bidimap *map = bm_new(100, 0.7, bm_fkey, bm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -358,7 +358,7 @@ CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(update_key[empty], {
|
||||
struct bidimap *map = bm_new(100, 0.7, bm_ftab_key, bm_ftab_val);
|
||||
struct bidimap *map = bm_new(100, 0.7, bm_fkey, bm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -372,7 +372,7 @@ CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(update_key[not_found duplicate], {
|
||||
struct bidimap *map = bm_new(100, 0.7, bm_ftab_key, bm_ftab_val);
|
||||
struct bidimap *map = bm_new(100, 0.7, bm_fkey, bm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -402,7 +402,7 @@ CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(update_val, {
|
||||
struct bidimap *map = bm_new(100, 0.7, bm_ftab_key, bm_ftab_val);
|
||||
struct bidimap *map = bm_new(100, 0.7, bm_fkey, bm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -425,7 +425,7 @@ CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(update_val[empty], {
|
||||
struct bidimap *map = bm_new(100, 0.7, bm_ftab_key, bm_ftab_val);
|
||||
struct bidimap *map = bm_new(100, 0.7, bm_fkey, bm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -439,7 +439,7 @@ CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(update_val[not_found duplicate], {
|
||||
struct bidimap *map = bm_new(100, 0.7, bm_ftab_key, bm_ftab_val);
|
||||
struct bidimap *map = bm_new(100, 0.7, bm_fkey, bm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -470,7 +470,7 @@ CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
|
||||
CMC_CREATE_TEST(remove_by_key[cleanup custom], {
|
||||
struct bidimap *map =
|
||||
bm_new_custom(10000, 0.6, bm_ftab_key, bm_ftab_val,
|
||||
bm_new_custom(10000, 0.6, bm_fkey, bm_fval,
|
||||
&(struct cmc_alloc_node){ .malloc = malloc,
|
||||
.calloc = calloc,
|
||||
.realloc = realloc,
|
||||
@@ -503,7 +503,7 @@ CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
|
||||
CMC_CREATE_TEST(remove_by_val[cleanup custom], {
|
||||
struct bidimap *map =
|
||||
bm_new_custom(10000, 0.6, bm_ftab_key, bm_ftab_val,
|
||||
bm_new_custom(10000, 0.6, bm_fkey, bm_fval,
|
||||
&(struct cmc_alloc_node){ .malloc = malloc,
|
||||
.calloc = calloc,
|
||||
.realloc = realloc,
|
||||
@@ -535,7 +535,7 @@ CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(copy_of, {
|
||||
struct bidimap *map1 = bm_new(100, 0.7, bm_ftab_key, bm_ftab_val);
|
||||
struct bidimap *map1 = bm_new(100, 0.7, bm_fkey, bm_fval);
|
||||
|
||||
for (size_t i = 0; i < 100; i++)
|
||||
cmc_assert(bm_insert(map1, i, i));
|
||||
@@ -556,8 +556,8 @@ CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(equals, {
|
||||
struct bidimap *map1 = bm_new(100, 0.7, bm_ftab_key, bm_ftab_val);
|
||||
struct bidimap *map2 = bm_new(1000, 0.9, bm_ftab_key, bm_ftab_val);
|
||||
struct bidimap *map1 = bm_new(100, 0.7, bm_fkey, bm_fval);
|
||||
struct bidimap *map2 = bm_new(1000, 0.9, bm_fkey, bm_fval);
|
||||
|
||||
for (size_t i = 0; i < 100; i++)
|
||||
{
|
||||
@@ -580,7 +580,7 @@ CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(equals[from copy], {
|
||||
struct bidimap *map1 = bm_new(100, 0.7, bm_ftab_key, bm_ftab_val);
|
||||
struct bidimap *map1 = bm_new(100, 0.7, bm_fkey, bm_fval);
|
||||
|
||||
for (size_t i = 0; i < 100; i++)
|
||||
cmc_assert(bm_insert(map1, i, i));
|
||||
@@ -596,7 +596,7 @@ CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(flags, {
|
||||
struct bidimap *map = bm_new(100, 0.7, bm_ftab_key, bm_ftab_val);
|
||||
struct bidimap *map = bm_new(100, 0.7, bm_fkey, bm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
cmc_assert_equals(int32_t, cmc_flags.OK, bm_flag(map));
|
||||
@@ -733,7 +733,7 @@ CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
|
||||
CMC_CREATE_TEST(callbacks, {
|
||||
struct bidimap *map =
|
||||
bm_new_custom(100, 0.7, bm_ftab_key, bm_ftab_val, NULL, callbacks);
|
||||
bm_new_custom(100, 0.7, bm_fkey, bm_fval, NULL, callbacks);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
cmc_assert_equals(ptr, callbacks, map->callbacks);
|
||||
|
||||
+37
-37
@@ -5,8 +5,8 @@
|
||||
|
||||
#include "../src/deque.c"
|
||||
|
||||
struct deque_ftab_val *d_ftab_val =
|
||||
&(struct deque_ftab_val){ .cmp = cmp,
|
||||
struct deque_fval *d_fval =
|
||||
&(struct deque_fval){ .cmp = cmp,
|
||||
.cpy = copy,
|
||||
.str = str,
|
||||
.free = custom_free,
|
||||
@@ -15,7 +15,7 @@ struct deque_ftab_val *d_ftab_val =
|
||||
|
||||
CMC_CREATE_UNIT(deque_test, true, {
|
||||
CMC_CREATE_TEST(new, {
|
||||
struct deque *d = d_new(1000000, d_ftab_val);
|
||||
struct deque *d = d_new(1000000, d_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
cmc_assert_not_equals(ptr, NULL, d->buffer);
|
||||
@@ -26,19 +26,19 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = 0], {
|
||||
struct deque *d = d_new(0, d_ftab_val);
|
||||
struct deque *d = d_new(0, d_fval);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, d);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = UINT64_MAX], {
|
||||
struct deque *d = d_new(UINT64_MAX, d_ftab_val);
|
||||
struct deque *d = d_new(UINT64_MAX, d_fval);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, d);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(clear[count capacity], {
|
||||
struct deque *d = d_new(100, d_ftab_val);
|
||||
struct deque *d = d_new(100, d_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -56,7 +56,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(buffer_growth[capacity = 1], {
|
||||
struct deque *d = d_new(1, d_ftab_val);
|
||||
struct deque *d = d_new(1, d_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -70,7 +70,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(buffer_growth[item preservation], {
|
||||
struct deque *d = d_new(100, d_ftab_val);
|
||||
struct deque *d = d_new(100, d_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -94,7 +94,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push_front[count capacity], {
|
||||
struct deque *d = d_new(100, d_ftab_val);
|
||||
struct deque *d = d_new(100, d_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -108,7 +108,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push_front[item preservation], {
|
||||
struct deque *d = d_new(100, d_ftab_val);
|
||||
struct deque *d = d_new(100, d_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -129,7 +129,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push_back[count capacity], {
|
||||
struct deque *d = d_new(100, d_ftab_val);
|
||||
struct deque *d = d_new(100, d_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -143,7 +143,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push_back[item preservation], {
|
||||
struct deque *d = d_new(100, d_ftab_val);
|
||||
struct deque *d = d_new(100, d_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -164,7 +164,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop_front[count capacity], {
|
||||
struct deque *d = d_new(100, d_ftab_val);
|
||||
struct deque *d = d_new(100, d_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -182,7 +182,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop_front[item preservation], {
|
||||
struct deque *d = d_new(100, d_ftab_val);
|
||||
struct deque *d = d_new(100, d_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -206,7 +206,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop_back[count capacity], {
|
||||
struct deque *d = d_new(100, d_ftab_val);
|
||||
struct deque *d = d_new(100, d_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -224,7 +224,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop_back[item preservation], {
|
||||
struct deque *d = d_new(100, d_ftab_val);
|
||||
struct deque *d = d_new(100, d_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -248,7 +248,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(Mixed IO, {
|
||||
struct deque *d = d_new(100, d_ftab_val);
|
||||
struct deque *d = d_new(100, d_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -312,7 +312,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(front[count = 0], {
|
||||
struct deque *d = d_new(100, d_ftab_val);
|
||||
struct deque *d = d_new(100, d_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -324,7 +324,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(front[sum], {
|
||||
struct deque *d = d_new(100, d_ftab_val);
|
||||
struct deque *d = d_new(100, d_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -353,7 +353,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(back[count = 0], {
|
||||
struct deque *d = d_new(100, d_ftab_val);
|
||||
struct deque *d = d_new(100, d_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -365,7 +365,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(back[sum], {
|
||||
struct deque *d = d_new(100, d_ftab_val);
|
||||
struct deque *d = d_new(100, d_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -394,7 +394,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(contains, {
|
||||
struct deque *d = d_new(100, d_ftab_val);
|
||||
struct deque *d = d_new(100, d_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -416,7 +416,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(contains[count = 0], {
|
||||
struct deque *d = d_new(100, d_ftab_val);
|
||||
struct deque *d = d_new(100, d_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -426,7 +426,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(contains[count = 1], {
|
||||
struct deque *d = d_new(100, d_ftab_val);
|
||||
struct deque *d = d_new(100, d_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -447,7 +447,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(empty, {
|
||||
struct deque *d = d_new(100, d_ftab_val);
|
||||
struct deque *d = d_new(100, d_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -461,7 +461,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(full, {
|
||||
struct deque *d = d_new(100, d_ftab_val);
|
||||
struct deque *d = d_new(100, d_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -476,7 +476,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(count, {
|
||||
struct deque *d = d_new(100, d_ftab_val);
|
||||
struct deque *d = d_new(100, d_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -491,7 +491,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(capacity, {
|
||||
struct deque *d = d_new(100, d_ftab_val);
|
||||
struct deque *d = d_new(100, d_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -501,7 +501,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(resize, {
|
||||
struct deque *d = d_new(100, d_ftab_val);
|
||||
struct deque *d = d_new(100, d_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -521,7 +521,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(resize[item preservation], {
|
||||
struct deque *d = d_new(100, d_ftab_val);
|
||||
struct deque *d = d_new(100, d_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -549,7 +549,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(copy_of, {
|
||||
struct deque *d1 = d_new(100, d_ftab_val);
|
||||
struct deque *d1 = d_new(100, d_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d1);
|
||||
|
||||
@@ -586,8 +586,8 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(equals, {
|
||||
struct deque *d1 = d_new(100, d_ftab_val);
|
||||
struct deque *d2 = d_new(100, d_ftab_val);
|
||||
struct deque *d1 = d_new(100, d_fval);
|
||||
struct deque *d2 = d_new(100, d_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d1);
|
||||
cmc_assert_not_equals(ptr, NULL, d2);
|
||||
@@ -613,7 +613,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(equals[from copy], {
|
||||
struct deque *d1 = d_new(100, d_ftab_val);
|
||||
struct deque *d1 = d_new(100, d_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d1);
|
||||
|
||||
@@ -636,7 +636,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(equals[count = 0], {
|
||||
struct deque *d1 = d_new(100, d_ftab_val);
|
||||
struct deque *d1 = d_new(100, d_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d1);
|
||||
|
||||
@@ -651,7 +651,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(flags, {
|
||||
struct deque *d = d_new(100, d_ftab_val);
|
||||
struct deque *d = d_new(100, d_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
cmc_assert_equals(int32_t, cmc_flags.OK, d_flag(d));
|
||||
@@ -736,7 +736,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(callbacks, {
|
||||
struct deque *d = d_new_custom(100, d_ftab_val, NULL, callbacks);
|
||||
struct deque *d = d_new_custom(100, d_fval, NULL, callbacks);
|
||||
|
||||
total_create = 0;
|
||||
total_read = 0;
|
||||
|
||||
+47
-47
@@ -5,16 +5,16 @@
|
||||
|
||||
#include "../src/hashmap.c"
|
||||
|
||||
struct hashmap_ftab_key *hm_ftab_key =
|
||||
&(struct hashmap_ftab_key){ .cmp = cmp,
|
||||
struct hashmap_fkey *hm_fkey =
|
||||
&(struct hashmap_fkey){ .cmp = cmp,
|
||||
.cpy = copy,
|
||||
.str = str,
|
||||
.free = custom_free,
|
||||
.hash = hash,
|
||||
.pri = pri };
|
||||
|
||||
struct hashmap_ftab_val *hm_ftab_val =
|
||||
&(struct hashmap_ftab_val){ .cmp = cmp,
|
||||
struct hashmap_fval *hm_fval =
|
||||
&(struct hashmap_fval){ .cmp = cmp,
|
||||
.cpy = copy,
|
||||
.str = str,
|
||||
.free = custom_free,
|
||||
@@ -23,7 +23,7 @@ struct hashmap_ftab_val *hm_ftab_val =
|
||||
|
||||
CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
CMC_CREATE_TEST(new, {
|
||||
struct hashmap *map = hm_new(943722, 0.6, hm_ftab_key, hm_ftab_val);
|
||||
struct hashmap *map = hm_new(943722, 0.6, hm_fkey, hm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
cmc_assert_not_equals(ptr, NULL, map->buffer);
|
||||
@@ -34,20 +34,20 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = 0], {
|
||||
struct hashmap *map = hm_new(0, 0.6, hm_ftab_key, hm_ftab_val);
|
||||
struct hashmap *map = hm_new(0, 0.6, hm_fkey, hm_fval);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, map);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = UINT64_MAX], {
|
||||
struct hashmap *map =
|
||||
hm_new(UINT64_MAX, 0.99, hm_ftab_key, hm_ftab_val);
|
||||
hm_new(UINT64_MAX, 0.99, hm_fkey, hm_fval);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, map);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(clear[count capacity], {
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_ftab_key, hm_ftab_val);
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_fkey, hm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -64,7 +64,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert, {
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_ftab_key, hm_ftab_val);
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_fkey, hm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -75,7 +75,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[smallest capacity], {
|
||||
struct hashmap *map = hm_new(1, 0.99, hm_ftab_key, hm_ftab_val);
|
||||
struct hashmap *map = hm_new(1, 0.99, hm_fkey, hm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -86,11 +86,11 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[element position], {
|
||||
struct hashmap *map = hm_new(1, 0.99, hm_ftab_key, hm_ftab_val);
|
||||
struct hashmap *map = hm_new(1, 0.99, hm_fkey, hm_fval);
|
||||
|
||||
// Temporary change
|
||||
// Using the numhash the key is the hash itself
|
||||
hm_ftab_key->hash = numhash;
|
||||
hm_fkey->hash = numhash;
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -104,16 +104,16 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
cmc_assert_equals(size_t, capacity - 1, map->buffer[capacity - 1].key);
|
||||
cmc_assert_equals(size_t, capacity, map->buffer[0].key);
|
||||
|
||||
hm_ftab_key->hash = hash;
|
||||
hm_fkey->hash = hash;
|
||||
|
||||
hm_free(map);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[distance], {
|
||||
struct hashmap *map = hm_new(500, 0.6, hm_ftab_key, hm_ftab_val);
|
||||
struct hashmap *map = hm_new(500, 0.6, hm_fkey, hm_fval);
|
||||
|
||||
// Temporary change
|
||||
hm_ftab_key->hash = hash0;
|
||||
hm_fkey->hash = hash0;
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -125,16 +125,16 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
for (size_t i = 0; i < 200; i++)
|
||||
cmc_assert_equals(size_t, i, map->buffer[i].dist);
|
||||
|
||||
hm_ftab_key->hash = hash;
|
||||
hm_fkey->hash = hash;
|
||||
|
||||
hm_free(map);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[distance wrap], {
|
||||
struct hashmap *map = hm_new(1, 0.99, hm_ftab_key, hm_ftab_val);
|
||||
struct hashmap *map = hm_new(1, 0.99, hm_fkey, hm_fval);
|
||||
|
||||
// Temporary change
|
||||
hm_ftab_key->hash = hashcapminus1;
|
||||
hm_fkey->hash = hashcapminus1;
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -151,16 +151,16 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
cmc_assert_equals(size_t, 0, map->buffer[capacity - 1].dist);
|
||||
cmc_assert_equals(size_t, 1, map->buffer[0].dist);
|
||||
|
||||
hm_ftab_key->hash = hash;
|
||||
hm_fkey->hash = hash;
|
||||
|
||||
hm_free(map);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[distances], {
|
||||
struct hashmap *map = hm_new(1, 0.99, hm_ftab_key, hm_ftab_val);
|
||||
struct hashmap *map = hm_new(1, 0.99, hm_fkey, hm_fval);
|
||||
|
||||
// Temporary change
|
||||
hm_ftab_key->hash = hashcapminus4;
|
||||
hm_fkey->hash = hashcapminus4;
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -172,13 +172,13 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
for (size_t i = 0; i < 6; i++)
|
||||
cmc_assert_equals(size_t, i, hm_impl_get_entry(map, i)->dist);
|
||||
|
||||
hm_ftab_key->hash = hash;
|
||||
hm_fkey->hash = hash;
|
||||
|
||||
hm_free(map);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[buffer growth and item preservation], {
|
||||
struct hashmap *map = hm_new(1, 0.99, hm_ftab_key, hm_ftab_val);
|
||||
struct hashmap *map = hm_new(1, 0.99, hm_fkey, hm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -202,7 +202,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(update, {
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_ftab_key, hm_ftab_val);
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_fkey, hm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -217,7 +217,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(update[key not found], {
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_ftab_key, hm_ftab_val);
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_fkey, hm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -230,7 +230,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(remove, {
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_ftab_key, hm_ftab_val);
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_fkey, hm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -244,7 +244,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(remove[count = 0], {
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_ftab_key, hm_ftab_val);
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_fkey, hm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -255,7 +255,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(remove[key not found], {
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_ftab_key, hm_ftab_val);
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_fkey, hm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -269,7 +269,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(max, {
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_ftab_key, hm_ftab_val);
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_fkey, hm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -287,7 +287,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(max[count = 0], {
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_ftab_key, hm_ftab_val);
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_fkey, hm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -297,7 +297,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(min, {
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_ftab_key, hm_ftab_val);
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_fkey, hm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -315,7 +315,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(min[count = 0], {
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_ftab_key, hm_ftab_val);
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_fkey, hm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -325,7 +325,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(get, {
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_ftab_key, hm_ftab_val);
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_fkey, hm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -337,7 +337,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(get[count = 0], {
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_ftab_key, hm_ftab_val);
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_fkey, hm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -347,7 +347,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(get_ref, {
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_ftab_key, hm_ftab_val);
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_fkey, hm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -362,7 +362,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(get_ref[count = 0], {
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_ftab_key, hm_ftab_val);
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_fkey, hm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -372,7 +372,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(contains, {
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_ftab_key, hm_ftab_val);
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_fkey, hm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -384,7 +384,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(contains[count = 0], {
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_ftab_key, hm_ftab_val);
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_fkey, hm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -394,7 +394,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(contains[sum], {
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_ftab_key, hm_ftab_val);
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_fkey, hm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -412,7 +412,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(empty, {
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_ftab_key, hm_ftab_val);
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_fkey, hm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -427,7 +427,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
|
||||
CMC_CREATE_TEST(full, {
|
||||
struct hashmap *map =
|
||||
hm_new(cmc_hashtable_primes[0], 0.99999, hm_ftab_key, hm_ftab_val);
|
||||
hm_new(cmc_hashtable_primes[0], 0.99999, hm_fkey, hm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -448,7 +448,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(count, {
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_ftab_key, hm_ftab_val);
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_fkey, hm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -462,7 +462,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(capacity, {
|
||||
struct hashmap *map = hm_new(2500, 0.6, hm_ftab_key, hm_ftab_val);
|
||||
struct hashmap *map = hm_new(2500, 0.6, hm_fkey, hm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -473,7 +473,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(capacity[small], {
|
||||
struct hashmap *map = hm_new(1, 0.99, hm_ftab_key, hm_ftab_val);
|
||||
struct hashmap *map = hm_new(1, 0.99, hm_fkey, hm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -483,7 +483,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(load, {
|
||||
struct hashmap *map = hm_new(1, 0.99, hm_ftab_key, hm_ftab_val);
|
||||
struct hashmap *map = hm_new(1, 0.99, hm_fkey, hm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -493,7 +493,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(flags, {
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_ftab_key, hm_ftab_val);
|
||||
struct hashmap *map = hm_new(100, 0.6, hm_fkey, hm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
cmc_assert_equals(int32_t, cmc_flags.OK, hm_flag(map));
|
||||
@@ -603,7 +603,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
|
||||
CMC_CREATE_TEST(callbacks, {
|
||||
struct hashmap *map =
|
||||
hm_new_custom(100, 0.6, hm_ftab_key, hm_ftab_val, NULL, callbacks);
|
||||
hm_new_custom(100, 0.6, hm_fkey, hm_fval, NULL, callbacks);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
|
||||
+39
-39
@@ -5,8 +5,8 @@
|
||||
|
||||
#include "../src/hashset.c"
|
||||
|
||||
struct hashset_ftab_val *hs_ftab_val =
|
||||
&(struct hashset_ftab_val){ .cmp = cmp,
|
||||
struct hashset_fval *hs_fval =
|
||||
&(struct hashset_fval){ .cmp = cmp,
|
||||
.cpy = copy,
|
||||
.str = str,
|
||||
.free = custom_free,
|
||||
@@ -15,7 +15,7 @@ struct hashset_ftab_val *hs_ftab_val =
|
||||
|
||||
CMC_CREATE_UNIT(hashset_test, true, {
|
||||
CMC_CREATE_TEST(new, {
|
||||
struct hashset *set = hs_new(943722, 0.6, hs_ftab_val);
|
||||
struct hashset *set = hs_new(943722, 0.6, hs_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
cmc_assert_not_equals(ptr, NULL, set->buffer);
|
||||
@@ -26,19 +26,19 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = 0], {
|
||||
struct hashset *set = hs_new(0, 0.6, hs_ftab_val);
|
||||
struct hashset *set = hs_new(0, 0.6, hs_fval);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, set);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = UINT64_MAX], {
|
||||
struct hashset *set = hs_new(UINT64_MAX, 0.99, hs_ftab_val);
|
||||
struct hashset *set = hs_new(UINT64_MAX, 0.99, hs_fval);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, set);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(clear[count capacity], {
|
||||
struct hashset *set = hs_new(100, 0.6, hs_ftab_val);
|
||||
struct hashset *set = hs_new(100, 0.6, hs_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -55,7 +55,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert, {
|
||||
struct hashset *set = hs_new(100, 0.6, hs_ftab_val);
|
||||
struct hashset *set = hs_new(100, 0.6, hs_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -66,7 +66,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[smallest capacity], {
|
||||
struct hashset *set = hs_new(1, 0.99, hs_ftab_val);
|
||||
struct hashset *set = hs_new(1, 0.99, hs_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -77,11 +77,11 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[element position], {
|
||||
struct hashset *set = hs_new(1, 0.99, hs_ftab_val);
|
||||
struct hashset *set = hs_new(1, 0.99, hs_fval);
|
||||
|
||||
// Temporary change
|
||||
// Using the numhash the key is the hash itself
|
||||
hs_ftab_val->hash = numhash;
|
||||
hs_fval->hash = numhash;
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -96,16 +96,16 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
set->buffer[capacity - 1].value);
|
||||
cmc_assert_equals(size_t, capacity, set->buffer[0].value);
|
||||
|
||||
hs_ftab_val->hash = hash;
|
||||
hs_fval->hash = hash;
|
||||
|
||||
hs_free(set);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[distance], {
|
||||
struct hashset *set = hs_new(500, 0.6, hs_ftab_val);
|
||||
struct hashset *set = hs_new(500, 0.6, hs_fval);
|
||||
|
||||
// Temporary change
|
||||
hs_ftab_val->hash = hash0;
|
||||
hs_fval->hash = hash0;
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -117,16 +117,16 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
for (size_t i = 0; i < 200; i++)
|
||||
cmc_assert_equals(size_t, i, set->buffer[i].dist);
|
||||
|
||||
hs_ftab_val->hash = hash;
|
||||
hs_fval->hash = hash;
|
||||
|
||||
hs_free(set);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[distance wrap], {
|
||||
struct hashset *set = hs_new(1, 0.99, hs_ftab_val);
|
||||
struct hashset *set = hs_new(1, 0.99, hs_fval);
|
||||
|
||||
// Temporary change
|
||||
hs_ftab_val->hash = hashcapminus1;
|
||||
hs_fval->hash = hashcapminus1;
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -143,16 +143,16 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
cmc_assert_equals(size_t, 0, set->buffer[capacity - 1].dist);
|
||||
cmc_assert_equals(size_t, 1, set->buffer[0].dist);
|
||||
|
||||
hs_ftab_val->hash = hash;
|
||||
hs_fval->hash = hash;
|
||||
|
||||
hs_free(set);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[distances], {
|
||||
struct hashset *set = hs_new(1, 0.99, hs_ftab_val);
|
||||
struct hashset *set = hs_new(1, 0.99, hs_fval);
|
||||
|
||||
// Temporary change
|
||||
hs_ftab_val->hash = hashcapminus4;
|
||||
hs_fval->hash = hashcapminus4;
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -164,13 +164,13 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
for (size_t i = 0; i < 6; i++)
|
||||
cmc_assert_equals(size_t, i, hs_impl_get_entry(set, i)->dist);
|
||||
|
||||
hs_ftab_val->hash = hash;
|
||||
hs_fval->hash = hash;
|
||||
|
||||
hs_free(set);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[buffer growth and item preservation], {
|
||||
struct hashset *set = hs_new(1, 0.99, hs_ftab_val);
|
||||
struct hashset *set = hs_new(1, 0.99, hs_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -194,7 +194,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(remove, {
|
||||
struct hashset *set = hs_new(100, 0.6, hs_ftab_val);
|
||||
struct hashset *set = hs_new(100, 0.6, hs_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -208,7 +208,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(remove[count = 0], {
|
||||
struct hashset *set = hs_new(100, 0.6, hs_ftab_val);
|
||||
struct hashset *set = hs_new(100, 0.6, hs_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -219,7 +219,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(remove[key not found], {
|
||||
struct hashset *set = hs_new(100, 0.6, hs_ftab_val);
|
||||
struct hashset *set = hs_new(100, 0.6, hs_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -233,7 +233,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(max, {
|
||||
struct hashset *set = hs_new(100, 0.6, hs_ftab_val);
|
||||
struct hashset *set = hs_new(100, 0.6, hs_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -249,7 +249,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(max[count = 0], {
|
||||
struct hashset *set = hs_new(100, 0.6, hs_ftab_val);
|
||||
struct hashset *set = hs_new(100, 0.6, hs_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -259,7 +259,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(min, {
|
||||
struct hashset *set = hs_new(100, 0.6, hs_ftab_val);
|
||||
struct hashset *set = hs_new(100, 0.6, hs_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -275,7 +275,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(min[count = 0], {
|
||||
struct hashset *set = hs_new(100, 0.6, hs_ftab_val);
|
||||
struct hashset *set = hs_new(100, 0.6, hs_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -285,7 +285,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(contains, {
|
||||
struct hashset *set = hs_new(100, 0.6, hs_ftab_val);
|
||||
struct hashset *set = hs_new(100, 0.6, hs_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -297,7 +297,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(contains[count = 0], {
|
||||
struct hashset *set = hs_new(100, 0.6, hs_ftab_val);
|
||||
struct hashset *set = hs_new(100, 0.6, hs_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -307,7 +307,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(contains[sum], {
|
||||
struct hashset *set = hs_new(100, 0.6, hs_ftab_val);
|
||||
struct hashset *set = hs_new(100, 0.6, hs_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -325,7 +325,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(empty, {
|
||||
struct hashset *set = hs_new(100, 0.6, hs_ftab_val);
|
||||
struct hashset *set = hs_new(100, 0.6, hs_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -340,7 +340,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
|
||||
CMC_CREATE_TEST(full, {
|
||||
struct hashset *set =
|
||||
hs_new(cmc_hashtable_primes[0], 0.99999, hs_ftab_val);
|
||||
hs_new(cmc_hashtable_primes[0], 0.99999, hs_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -361,7 +361,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(count, {
|
||||
struct hashset *set = hs_new(100, 0.6, hs_ftab_val);
|
||||
struct hashset *set = hs_new(100, 0.6, hs_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -375,7 +375,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(capacity, {
|
||||
struct hashset *set = hs_new(2500, 0.6, hs_ftab_val);
|
||||
struct hashset *set = hs_new(2500, 0.6, hs_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -386,7 +386,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(capacity[small], {
|
||||
struct hashset *set = hs_new(1, 0.99, hs_ftab_val);
|
||||
struct hashset *set = hs_new(1, 0.99, hs_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -396,7 +396,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(load, {
|
||||
struct hashset *set = hs_new(1, 0.99, hs_ftab_val);
|
||||
struct hashset *set = hs_new(1, 0.99, hs_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -406,7 +406,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(flags, {
|
||||
struct hashset *set = hs_new(1, 0.99, hs_ftab_val);
|
||||
struct hashset *set = hs_new(1, 0.99, hs_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
cmc_assert_equals(int32_t, cmc_flags.OK, hs_flag(set));
|
||||
@@ -482,7 +482,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
|
||||
CMC_CREATE_TEST(callbacks, {
|
||||
struct hashset *set =
|
||||
hs_new_custom(100, 0.6, hs_ftab_val, NULL, callbacks);
|
||||
hs_new_custom(100, 0.6, hs_fval, NULL, callbacks);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
|
||||
+15
-15
@@ -5,7 +5,7 @@
|
||||
|
||||
#include "../src/heap.c"
|
||||
|
||||
struct heap_ftab_val *h_ftab_val = &(struct heap_ftab_val){ .cmp = cmp,
|
||||
struct heap_fval *h_fval = &(struct heap_fval){ .cmp = cmp,
|
||||
.cpy = copy,
|
||||
.str = str,
|
||||
.free = custom_free,
|
||||
@@ -14,7 +14,7 @@ struct heap_ftab_val *h_ftab_val = &(struct heap_ftab_val){ .cmp = cmp,
|
||||
|
||||
CMC_CREATE_UNIT(heap_test, true, {
|
||||
CMC_CREATE_TEST(new, {
|
||||
struct heap *h = h_new(1000000, cmc_max_heap, h_ftab_val);
|
||||
struct heap *h = h_new(1000000, cmc_max_heap, h_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, h);
|
||||
cmc_assert_not_equals(ptr, NULL, h->buffer);
|
||||
@@ -25,19 +25,19 @@ CMC_CREATE_UNIT(heap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[edge_case capacity = 0], {
|
||||
struct heap *h = h_new(0, cmc_max_heap, h_ftab_val);
|
||||
struct heap *h = h_new(0, cmc_max_heap, h_fval);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, h);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[edge_case capacity = UINT64_MAX], {
|
||||
struct heap *h = h_new(UINT64_MAX, cmc_max_heap, h_ftab_val);
|
||||
struct heap *h = h_new(UINT64_MAX, cmc_max_heap, h_fval);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, h);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(clear[count capacity], {
|
||||
struct heap *h = h_new(100, cmc_max_heap, h_ftab_val);
|
||||
struct heap *h = h_new(100, cmc_max_heap, h_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, h);
|
||||
|
||||
@@ -55,7 +55,7 @@ CMC_CREATE_UNIT(heap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(buffer_growth[edge_case capacity = 1], {
|
||||
struct heap *h = h_new(1, cmc_max_heap, h_ftab_val);
|
||||
struct heap *h = h_new(1, cmc_max_heap, h_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, h);
|
||||
|
||||
@@ -68,7 +68,7 @@ CMC_CREATE_UNIT(heap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert, {
|
||||
struct heap *h = h_new(100, cmc_max_heap, h_ftab_val);
|
||||
struct heap *h = h_new(100, cmc_max_heap, h_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, h);
|
||||
|
||||
@@ -78,7 +78,7 @@ CMC_CREATE_UNIT(heap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[item preservation], {
|
||||
struct heap *h = h_new(50, cmc_max_heap, h_ftab_val);
|
||||
struct heap *h = h_new(50, cmc_max_heap, h_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, h);
|
||||
|
||||
@@ -95,7 +95,7 @@ CMC_CREATE_UNIT(heap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(remove, {
|
||||
struct heap *h = h_new(50, cmc_max_heap, h_ftab_val);
|
||||
struct heap *h = h_new(50, cmc_max_heap, h_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, h);
|
||||
|
||||
@@ -110,7 +110,7 @@ CMC_CREATE_UNIT(heap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(remove[count = 0], {
|
||||
struct heap *h = h_new(100, cmc_max_heap, h_ftab_val);
|
||||
struct heap *h = h_new(100, cmc_max_heap, h_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, h);
|
||||
|
||||
@@ -120,7 +120,7 @@ CMC_CREATE_UNIT(heap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(remove[sorted], {
|
||||
struct heap *h = h_new(100, cmc_min_heap, h_ftab_val);
|
||||
struct heap *h = h_new(100, cmc_min_heap, h_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, h);
|
||||
|
||||
@@ -142,7 +142,7 @@ CMC_CREATE_UNIT(heap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(peek, {
|
||||
struct heap *h = h_new(100, cmc_max_heap, h_ftab_val);
|
||||
struct heap *h = h_new(100, cmc_max_heap, h_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, h);
|
||||
|
||||
@@ -155,7 +155,7 @@ CMC_CREATE_UNIT(heap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(peek[count = 0], {
|
||||
struct heap *h = h_new(100, cmc_max_heap, h_ftab_val);
|
||||
struct heap *h = h_new(100, cmc_max_heap, h_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, h);
|
||||
|
||||
@@ -165,7 +165,7 @@ CMC_CREATE_UNIT(heap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(flags, {
|
||||
struct heap *h = h_new(100, cmc_max_heap, h_ftab_val);
|
||||
struct heap *h = h_new(100, cmc_max_heap, h_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, h);
|
||||
cmc_assert_equals(int32_t, cmc_flags.OK, h_flag(h));
|
||||
@@ -224,7 +224,7 @@ CMC_CREATE_UNIT(heap_test, true, {
|
||||
|
||||
CMC_CREATE_TEST(callbacks, {
|
||||
struct heap *h =
|
||||
h_new_custom(100, cmc_max_heap, h_ftab_val, NULL, callbacks);
|
||||
h_new_custom(100, cmc_max_heap, h_fval, NULL, callbacks);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, h);
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
|
||||
#include "../src/intervalheap.c"
|
||||
|
||||
struct intervalheap_ftab_val *ih_ftab_val =
|
||||
&(struct intervalheap_ftab_val){ .cmp = cmp,
|
||||
struct intervalheap_fval *ih_fval =
|
||||
&(struct intervalheap_fval){ .cmp = cmp,
|
||||
.cpy = copy,
|
||||
.str = str,
|
||||
.free = custom_free,
|
||||
@@ -15,7 +15,7 @@ struct intervalheap_ftab_val *ih_ftab_val =
|
||||
|
||||
CMC_CREATE_UNIT(intervalheap_test, true, {
|
||||
CMC_CREATE_TEST(new, {
|
||||
struct intervalheap *ih = ih_new(1000000, ih_ftab_val);
|
||||
struct intervalheap *ih = ih_new(1000000, ih_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, ih);
|
||||
cmc_assert_not_equals(ptr, NULL, ih->buffer);
|
||||
@@ -26,7 +26,7 @@ CMC_CREATE_UNIT(intervalheap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = 0], {
|
||||
struct intervalheap *ih = ih_new(0, ih_ftab_val);
|
||||
struct intervalheap *ih = ih_new(0, ih_fval);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, ih);
|
||||
|
||||
@@ -35,28 +35,28 @@ CMC_CREATE_UNIT(intervalheap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity], {
|
||||
struct intervalheap *ih = ih_new(1, ih_ftab_val);
|
||||
struct intervalheap *ih = ih_new(1, ih_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, ih);
|
||||
cmc_assert_equals(size_t, 1, ih_capacity(ih));
|
||||
|
||||
ih_free(ih);
|
||||
|
||||
ih = ih_new(2, ih_ftab_val);
|
||||
ih = ih_new(2, ih_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, ih);
|
||||
cmc_assert_equals(size_t, 1, ih_capacity(ih));
|
||||
|
||||
ih_free(ih);
|
||||
|
||||
ih = ih_new(3, ih_ftab_val);
|
||||
ih = ih_new(3, ih_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, ih);
|
||||
cmc_assert_equals(size_t, 2, ih_capacity(ih));
|
||||
|
||||
ih_free(ih);
|
||||
|
||||
ih = ih_new(4, ih_ftab_val);
|
||||
ih = ih_new(4, ih_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, ih);
|
||||
cmc_assert_equals(size_t, 2, ih_capacity(ih));
|
||||
@@ -65,7 +65,7 @@ CMC_CREATE_UNIT(intervalheap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = UINT64_MAX], {
|
||||
struct intervalheap *ih = ih_new(UINT64_MAX, ih_ftab_val);
|
||||
struct intervalheap *ih = ih_new(UINT64_MAX, ih_fval);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, ih);
|
||||
|
||||
@@ -74,7 +74,7 @@ CMC_CREATE_UNIT(intervalheap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(clear[count capacity], {
|
||||
struct intervalheap *ih = ih_new(100, ih_ftab_val);
|
||||
struct intervalheap *ih = ih_new(100, ih_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, ih);
|
||||
|
||||
@@ -92,7 +92,7 @@ CMC_CREATE_UNIT(intervalheap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(buffer_growth[capacity = 1], {
|
||||
struct intervalheap *ih = ih_new(1, ih_ftab_val);
|
||||
struct intervalheap *ih = ih_new(1, ih_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, ih);
|
||||
|
||||
@@ -106,7 +106,7 @@ CMC_CREATE_UNIT(intervalheap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[count], {
|
||||
struct intervalheap *ih = ih_new(100, ih_ftab_val);
|
||||
struct intervalheap *ih = ih_new(100, ih_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, ih);
|
||||
|
||||
@@ -119,7 +119,7 @@ CMC_CREATE_UNIT(intervalheap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[max], {
|
||||
struct intervalheap *ih = ih_new(1, ih_ftab_val);
|
||||
struct intervalheap *ih = ih_new(1, ih_fval);
|
||||
|
||||
cmc_assert(ih_insert(ih, 0));
|
||||
cmc_assert(ih_insert(ih, 1));
|
||||
@@ -131,7 +131,7 @@ CMC_CREATE_UNIT(intervalheap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[min], {
|
||||
struct intervalheap *ih = ih_new(1, ih_ftab_val);
|
||||
struct intervalheap *ih = ih_new(1, ih_fval);
|
||||
|
||||
cmc_assert(ih_insert(ih, 0));
|
||||
cmc_assert(ih_insert(ih, 1));
|
||||
@@ -143,7 +143,7 @@ CMC_CREATE_UNIT(intervalheap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[remove_max remove_min], {
|
||||
struct intervalheap *ih = ih_new(100, ih_ftab_val);
|
||||
struct intervalheap *ih = ih_new(100, ih_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, ih);
|
||||
|
||||
@@ -168,7 +168,7 @@ CMC_CREATE_UNIT(intervalheap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(flags, {
|
||||
struct intervalheap *ih = ih_new(100, ih_ftab_val);
|
||||
struct intervalheap *ih = ih_new(100, ih_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, ih);
|
||||
cmc_assert_equals(int32_t, cmc_flags.OK, ih_flag(ih));
|
||||
@@ -261,7 +261,7 @@ CMC_CREATE_UNIT(intervalheap_test, true, {
|
||||
|
||||
CMC_CREATE_TEST(callbacks, {
|
||||
struct intervalheap *ih =
|
||||
ih_new_custom(100, ih_ftab_val, NULL, callbacks);
|
||||
ih_new_custom(100, ih_fval, NULL, callbacks);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, ih);
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
|
||||
#include "../src/linkedlist.c"
|
||||
|
||||
struct linkedlist_ftab_val *ll_ftab_val =
|
||||
&(struct linkedlist_ftab_val){ .cmp = cmp,
|
||||
struct linkedlist_fval *ll_fval =
|
||||
&(struct linkedlist_fval){ .cmp = cmp,
|
||||
.cpy = copy,
|
||||
.str = str,
|
||||
.free = custom_free,
|
||||
@@ -15,7 +15,7 @@ struct linkedlist_ftab_val *ll_ftab_val =
|
||||
|
||||
CMC_CREATE_UNIT(linkedlist_test, true, {
|
||||
CMC_CREATE_TEST(new, {
|
||||
struct linkedlist *ll = ll_new(ll_ftab_val);
|
||||
struct linkedlist *ll = ll_new(ll_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, ll);
|
||||
cmc_assert_equals(size_t, 0, ll_count(ll));
|
||||
@@ -26,7 +26,7 @@ CMC_CREATE_UNIT(linkedlist_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(clear[count capacity], {
|
||||
struct linkedlist *ll = ll_new(ll_ftab_val);
|
||||
struct linkedlist *ll = ll_new(ll_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, ll);
|
||||
|
||||
@@ -43,7 +43,7 @@ CMC_CREATE_UNIT(linkedlist_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(clear[count = 0], {
|
||||
struct linkedlist *ll = ll_new(ll_ftab_val);
|
||||
struct linkedlist *ll = ll_new(ll_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, ll);
|
||||
|
||||
@@ -55,7 +55,7 @@ CMC_CREATE_UNIT(linkedlist_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push_front[count], {
|
||||
struct linkedlist *ll = ll_new(ll_ftab_val);
|
||||
struct linkedlist *ll = ll_new(ll_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, ll);
|
||||
|
||||
@@ -69,7 +69,7 @@ CMC_CREATE_UNIT(linkedlist_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push_front[item preservation], {
|
||||
struct linkedlist *ll = ll_new(ll_ftab_val);
|
||||
struct linkedlist *ll = ll_new(ll_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, ll);
|
||||
|
||||
@@ -83,7 +83,7 @@ CMC_CREATE_UNIT(linkedlist_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(flags, {
|
||||
struct linkedlist *ll = ll_new(ll_ftab_val);
|
||||
struct linkedlist *ll = ll_new(ll_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, ll);
|
||||
cmc_assert_equals(int32_t, cmc_flags.OK, ll_flag(ll));
|
||||
@@ -256,7 +256,7 @@ CMC_CREATE_UNIT(linkedlist_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(callbacks, {
|
||||
struct linkedlist *ll = ll_new_custom(ll_ftab_val, NULL, callbacks);
|
||||
struct linkedlist *ll = ll_new_custom(ll_fval, NULL, callbacks);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, ll);
|
||||
|
||||
|
||||
+27
-27
@@ -5,7 +5,7 @@
|
||||
|
||||
#include "../src/list.c"
|
||||
|
||||
struct list_ftab_val *l_ftab_val = &(struct list_ftab_val){ .cmp = cmp,
|
||||
struct list_fval *l_fval = &(struct list_fval){ .cmp = cmp,
|
||||
.cpy = copy,
|
||||
.str = str,
|
||||
.free = custom_free,
|
||||
@@ -14,7 +14,7 @@ struct list_ftab_val *l_ftab_val = &(struct list_ftab_val){ .cmp = cmp,
|
||||
|
||||
CMC_CREATE_UNIT(list_test, true, {
|
||||
CMC_CREATE_TEST(new, {
|
||||
struct list *l = l_new(1000000, l_ftab_val);
|
||||
struct list *l = l_new(1000000, l_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
cmc_assert_not_equals(ptr, NULL, l->buffer);
|
||||
@@ -25,19 +25,19 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = 0], {
|
||||
struct list *l = l_new(0, l_ftab_val);
|
||||
struct list *l = l_new(0, l_fval);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, l);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = UINT64_MAX], {
|
||||
struct list *l = l_new(UINT64_MAX, l_ftab_val);
|
||||
struct list *l = l_new(UINT64_MAX, l_fval);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, l);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(clear[count capacity], {
|
||||
struct list *l = l_new(100, l_ftab_val);
|
||||
struct list *l = l_new(100, l_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
|
||||
@@ -55,7 +55,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(buffer_growth[capacity = 1], {
|
||||
struct list *l = l_new(1, l_ftab_val);
|
||||
struct list *l = l_new(1, l_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
|
||||
@@ -71,7 +71,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push_front[count], {
|
||||
struct list *l = l_new(100, l_ftab_val);
|
||||
struct list *l = l_new(100, l_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
|
||||
@@ -84,7 +84,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push_front[capacity], {
|
||||
struct list *l = l_new(100, l_ftab_val);
|
||||
struct list *l = l_new(100, l_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
|
||||
@@ -97,7 +97,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push_front[item preservation], {
|
||||
struct list *l = l_new(100, l_ftab_val);
|
||||
struct list *l = l_new(100, l_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
|
||||
@@ -111,7 +111,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push_at[count], {
|
||||
struct list *l = l_new(100, l_ftab_val);
|
||||
struct list *l = l_new(100, l_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
|
||||
@@ -127,7 +127,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push_at[capacity], {
|
||||
struct list *l = l_new(100, l_ftab_val);
|
||||
struct list *l = l_new(100, l_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
|
||||
@@ -143,7 +143,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push_at[item preservation], {
|
||||
struct list *l = l_new(100, l_ftab_val);
|
||||
struct list *l = l_new(100, l_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
|
||||
@@ -160,7 +160,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push_back[count], {
|
||||
struct list *l = l_new(100, l_ftab_val);
|
||||
struct list *l = l_new(100, l_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
|
||||
@@ -173,7 +173,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push_back[capacity], {
|
||||
struct list *l = l_new(100, l_ftab_val);
|
||||
struct list *l = l_new(100, l_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
|
||||
@@ -186,7 +186,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push_back[item preservation], {
|
||||
struct list *l = l_new(100, l_ftab_val);
|
||||
struct list *l = l_new(100, l_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
|
||||
@@ -200,7 +200,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop_front[count], {
|
||||
struct list *l = l_new(100, l_ftab_val);
|
||||
struct list *l = l_new(100, l_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
|
||||
@@ -213,7 +213,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop_front[item preservation], {
|
||||
struct list *l = l_new(100, l_ftab_val);
|
||||
struct list *l = l_new(100, l_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
|
||||
@@ -229,7 +229,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop_front[count = 0], {
|
||||
struct list *l = l_new(100, l_ftab_val);
|
||||
struct list *l = l_new(100, l_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
cmc_assert(!l_pop_front(l));
|
||||
@@ -238,7 +238,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop_front[count = 1], {
|
||||
struct list *l = l_new(100, l_ftab_val);
|
||||
struct list *l = l_new(100, l_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
cmc_assert(l_push_back(l, 10));
|
||||
@@ -248,7 +248,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop_front[buffer_clear], {
|
||||
struct list *l = l_new(100, l_ftab_val);
|
||||
struct list *l = l_new(100, l_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
cmc_assert(l_push_back(l, 1));
|
||||
@@ -262,7 +262,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop_at[count = 0], {
|
||||
struct list *l = l_new(100, l_ftab_val);
|
||||
struct list *l = l_new(100, l_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
cmc_assert(!l_pop_at(l, 1));
|
||||
@@ -271,7 +271,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop_at[count = 1], {
|
||||
struct list *l = l_new(100, l_ftab_val);
|
||||
struct list *l = l_new(100, l_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
cmc_assert(l_push_back(l, 1));
|
||||
@@ -283,7 +283,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop_at[buffer_clear], {
|
||||
struct list *l = l_new(100, l_ftab_val);
|
||||
struct list *l = l_new(100, l_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
cmc_assert(l_push_back(l, 1));
|
||||
@@ -295,7 +295,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop_back[count = 0], {
|
||||
struct list *l = l_new(100, l_ftab_val);
|
||||
struct list *l = l_new(100, l_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
cmc_assert(!l_pop_back(l));
|
||||
@@ -304,7 +304,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop_back[count = 1], {
|
||||
struct list *l = l_new(100, l_ftab_val);
|
||||
struct list *l = l_new(100, l_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
cmc_assert(l_push_back(l, 10));
|
||||
@@ -314,7 +314,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(flags, {
|
||||
struct list *l = l_new(100, l_ftab_val);
|
||||
struct list *l = l_new(100, l_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
cmc_assert_equals(int32_t, cmc_flags.OK, l_flag(l));
|
||||
@@ -496,7 +496,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(callbacks, {
|
||||
struct list *l = l_new_custom(100, l_ftab_val, NULL, callbacks);
|
||||
struct list *l = l_new_custom(100, l_fval, NULL, callbacks);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
|
||||
|
||||
+16
-16
@@ -5,16 +5,16 @@
|
||||
|
||||
#include "../src/multimap.c"
|
||||
|
||||
struct multimap_ftab_key *mm_ftab_key =
|
||||
&(struct multimap_ftab_key){ .cmp = cmp,
|
||||
struct multimap_fkey *mm_fkey =
|
||||
&(struct multimap_fkey){ .cmp = cmp,
|
||||
.cpy = copy,
|
||||
.str = str,
|
||||
.free = custom_free,
|
||||
.hash = hash,
|
||||
.pri = pri };
|
||||
|
||||
struct multimap_ftab_val *mm_ftab_val =
|
||||
&(struct multimap_ftab_val){ .cmp = cmp,
|
||||
struct multimap_fval *mm_fval =
|
||||
&(struct multimap_fval){ .cmp = cmp,
|
||||
.cpy = copy,
|
||||
.str = str,
|
||||
.free = custom_free,
|
||||
@@ -23,7 +23,7 @@ struct multimap_ftab_val *mm_ftab_val =
|
||||
|
||||
CMC_CREATE_UNIT(multimap_test, true, {
|
||||
CMC_CREATE_TEST(new, {
|
||||
struct multimap *map = mm_new(943722, 0.8, mm_ftab_key, mm_ftab_val);
|
||||
struct multimap *map = mm_new(943722, 0.8, mm_fkey, mm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
cmc_assert_not_equals(ptr, NULL, map->buffer);
|
||||
@@ -34,20 +34,20 @@ CMC_CREATE_UNIT(multimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = 0], {
|
||||
struct multimap *map = mm_new(0, 0.8, mm_ftab_key, mm_ftab_val);
|
||||
struct multimap *map = mm_new(0, 0.8, mm_fkey, mm_fval);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, map);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = UINT64_MAX], {
|
||||
struct multimap *map =
|
||||
mm_new(UINT64_MAX, 0.99, mm_ftab_key, mm_ftab_val);
|
||||
mm_new(UINT64_MAX, 0.99, mm_fkey, mm_fval);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, map);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(clear[count capacity], {
|
||||
struct multimap *map = mm_new(100, 0.8, mm_ftab_key, mm_ftab_val);
|
||||
struct multimap *map = mm_new(100, 0.8, mm_fkey, mm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -64,7 +64,7 @@ CMC_CREATE_UNIT(multimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[count], {
|
||||
struct multimap *map = mm_new(100, 0.8, mm_ftab_key, mm_ftab_val);
|
||||
struct multimap *map = mm_new(100, 0.8, mm_fkey, mm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -77,7 +77,7 @@ CMC_CREATE_UNIT(multimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(remove[count], {
|
||||
struct multimap *map = mm_new(100, 0.8, mm_ftab_key, mm_ftab_val);
|
||||
struct multimap *map = mm_new(100, 0.8, mm_fkey, mm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -95,7 +95,7 @@ CMC_CREATE_UNIT(multimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(remove[count = 0], {
|
||||
struct multimap *map = mm_new(100, 0.8, mm_ftab_key, mm_ftab_val);
|
||||
struct multimap *map = mm_new(100, 0.8, mm_fkey, mm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -107,7 +107,7 @@ CMC_CREATE_UNIT(multimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(remove[count = 1], {
|
||||
struct multimap *map = mm_new(100, 0.8, mm_ftab_key, mm_ftab_val);
|
||||
struct multimap *map = mm_new(100, 0.8, mm_fkey, mm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -120,7 +120,7 @@ CMC_CREATE_UNIT(multimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(get[key ordering], {
|
||||
struct multimap *map = mm_new(100, 0.8, mm_ftab_key, mm_ftab_val);
|
||||
struct multimap *map = mm_new(100, 0.8, mm_fkey, mm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -136,7 +136,7 @@ CMC_CREATE_UNIT(multimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(key_count, {
|
||||
struct multimap *map = mm_new(50, 0.8, mm_ftab_key, mm_ftab_val);
|
||||
struct multimap *map = mm_new(50, 0.8, mm_fkey, mm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -152,7 +152,7 @@ CMC_CREATE_UNIT(multimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(flags, {
|
||||
struct multimap *map = mm_new(100, 0.8, mm_ftab_key, mm_ftab_val);
|
||||
struct multimap *map = mm_new(100, 0.8, mm_fkey, mm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
cmc_assert_equals(int32_t, cmc_flags.OK, mm_flag(map));
|
||||
@@ -273,7 +273,7 @@ CMC_CREATE_UNIT(multimap_test, true, {
|
||||
|
||||
CMC_CREATE_TEST(callbacks, {
|
||||
struct multimap *map =
|
||||
mm_new_custom(100, 0.8, mm_ftab_key, mm_ftab_val, NULL, callbacks);
|
||||
mm_new_custom(100, 0.8, mm_fkey, mm_fval, NULL, callbacks);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
|
||||
+12
-12
@@ -5,8 +5,8 @@
|
||||
|
||||
#include "../src/multiset.c"
|
||||
|
||||
struct multiset_ftab_val *ms_ftab_val =
|
||||
&(struct multiset_ftab_val){ .cmp = cmp,
|
||||
struct multiset_fval *ms_fval =
|
||||
&(struct multiset_fval){ .cmp = cmp,
|
||||
.cpy = copy,
|
||||
.str = str,
|
||||
.free = custom_free,
|
||||
@@ -15,7 +15,7 @@ struct multiset_ftab_val *ms_ftab_val =
|
||||
|
||||
CMC_CREATE_UNIT(multiset_test, true, {
|
||||
CMC_CREATE_TEST(new, {
|
||||
struct multiset *set = ms_new(943722, 0.6, ms_ftab_val);
|
||||
struct multiset *set = ms_new(943722, 0.6, ms_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
cmc_assert_not_equals(ptr, NULL, set->buffer);
|
||||
@@ -27,19 +27,19 @@ CMC_CREATE_UNIT(multiset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = 0], {
|
||||
struct multiset *set = ms_new(0, 0.6, ms_ftab_val);
|
||||
struct multiset *set = ms_new(0, 0.6, ms_fval);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, set);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = UINT64_MAX], {
|
||||
struct multiset *set = ms_new(UINT64_MAX, 0.99, ms_ftab_val);
|
||||
struct multiset *set = ms_new(UINT64_MAX, 0.99, ms_fval);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, set);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(clear[count capacity], {
|
||||
struct multiset *set = ms_new(100, 0.6, ms_ftab_val);
|
||||
struct multiset *set = ms_new(100, 0.6, ms_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -56,7 +56,7 @@ CMC_CREATE_UNIT(multiset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[count cardinality multiplicity], {
|
||||
struct multiset *set = ms_new(100, 0.6, ms_ftab_val);
|
||||
struct multiset *set = ms_new(100, 0.6, ms_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -77,7 +77,7 @@ CMC_CREATE_UNIT(multiset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(remove[count cardinality multiplicity], {
|
||||
struct multiset *set = ms_new(100, 0.6, ms_ftab_val);
|
||||
struct multiset *set = ms_new(100, 0.6, ms_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -110,7 +110,7 @@ CMC_CREATE_UNIT(multiset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(remove_all[count cardinality multiplicity], {
|
||||
struct multiset *set = ms_new(100, 0.6, ms_ftab_val);
|
||||
struct multiset *set = ms_new(100, 0.6, ms_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -142,7 +142,7 @@ CMC_CREATE_UNIT(multiset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(multiplicity, {
|
||||
struct multiset *set = ms_new(50, 0.6, ms_ftab_val);
|
||||
struct multiset *set = ms_new(50, 0.6, ms_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -159,7 +159,7 @@ CMC_CREATE_UNIT(multiset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(flags, {
|
||||
struct multiset *set = ms_new(100, 0.6, ms_ftab_val);
|
||||
struct multiset *set = ms_new(100, 0.6, ms_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
cmc_assert_equals(int32_t, cmc_flags.OK, ms_flag(set));
|
||||
@@ -263,7 +263,7 @@ CMC_CREATE_UNIT(multiset_test, true, {
|
||||
|
||||
CMC_CREATE_TEST(callbacks, {
|
||||
struct multiset *set =
|
||||
ms_new_custom(100, 0.8, ms_ftab_val, NULL, callbacks);
|
||||
ms_new_custom(100, 0.8, ms_fval, NULL, callbacks);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
|
||||
+30
-30
@@ -5,8 +5,8 @@
|
||||
|
||||
#include "../src/queue.c"
|
||||
|
||||
struct queue_ftab_val *q_ftab_val =
|
||||
&(struct queue_ftab_val){ .cmp = cmp,
|
||||
struct queue_fval *q_fval =
|
||||
&(struct queue_fval){ .cmp = cmp,
|
||||
.cpy = copy,
|
||||
.str = str,
|
||||
.free = custom_free,
|
||||
@@ -15,7 +15,7 @@ struct queue_ftab_val *q_ftab_val =
|
||||
|
||||
CMC_CREATE_UNIT(queue_test, true, {
|
||||
CMC_CREATE_TEST(new, {
|
||||
struct queue *q = q_new(1000000, q_ftab_val);
|
||||
struct queue *q = q_new(1000000, q_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
cmc_assert_not_equals(ptr, NULL, q->buffer);
|
||||
@@ -27,19 +27,19 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = 0], {
|
||||
struct queue *q = q_new(0, q_ftab_val);
|
||||
struct queue *q = q_new(0, q_fval);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, q);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = UINT64_MAX], {
|
||||
struct queue *q = q_new(UINT64_MAX, q_ftab_val);
|
||||
struct queue *q = q_new(UINT64_MAX, q_fval);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, q);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(clear[count capacity], {
|
||||
struct queue *q = q_new(100, q_ftab_val);
|
||||
struct queue *q = q_new(100, q_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -57,7 +57,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(buffer_growth[capacity = 1], {
|
||||
struct queue *q = q_new(1, q_ftab_val);
|
||||
struct queue *q = q_new(1, q_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -70,7 +70,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(buffer_growth[item preservation], {
|
||||
struct queue *q = q_new(100, q_ftab_val);
|
||||
struct queue *q = q_new(100, q_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -91,7 +91,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(enqueue[count capacity], {
|
||||
struct queue *q = q_new(100, q_ftab_val);
|
||||
struct queue *q = q_new(100, q_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -105,7 +105,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(enqueue[item preservation], {
|
||||
struct queue *q = q_new(100, q_ftab_val);
|
||||
struct queue *q = q_new(100, q_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -126,7 +126,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(dequeue[count capacity], {
|
||||
struct queue *q = q_new(100, q_ftab_val);
|
||||
struct queue *q = q_new(100, q_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -144,7 +144,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(dequeue[item preservation], {
|
||||
struct queue *q = q_new(100, q_ftab_val);
|
||||
struct queue *q = q_new(100, q_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -168,7 +168,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(peek[count = 0], {
|
||||
struct queue *q = q_new(100, q_ftab_val);
|
||||
struct queue *q = q_new(100, q_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -180,7 +180,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(peek[sum], {
|
||||
struct queue *q = q_new(100, q_ftab_val);
|
||||
struct queue *q = q_new(100, q_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -204,7 +204,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(contains, {
|
||||
struct queue *q = q_new(100, q_ftab_val);
|
||||
struct queue *q = q_new(100, q_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -223,7 +223,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(contains[count = 0], {
|
||||
struct queue *q = q_new(100, q_ftab_val);
|
||||
struct queue *q = q_new(100, q_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -233,7 +233,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(contains[count = 1], {
|
||||
struct queue *q = q_new(100, q_ftab_val);
|
||||
struct queue *q = q_new(100, q_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -248,7 +248,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(empty, {
|
||||
struct queue *q = q_new(100, q_ftab_val);
|
||||
struct queue *q = q_new(100, q_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -262,7 +262,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(full, {
|
||||
struct queue *q = q_new(100, q_ftab_val);
|
||||
struct queue *q = q_new(100, q_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -277,7 +277,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(count, {
|
||||
struct queue *q = q_new(100, q_ftab_val);
|
||||
struct queue *q = q_new(100, q_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -292,7 +292,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(capacity, {
|
||||
struct queue *q = q_new(100, q_ftab_val);
|
||||
struct queue *q = q_new(100, q_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -302,7 +302,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(resize, {
|
||||
struct queue *q = q_new(100, q_ftab_val);
|
||||
struct queue *q = q_new(100, q_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -317,7 +317,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(resize[item preservation], {
|
||||
struct queue *q = q_new(100, q_ftab_val);
|
||||
struct queue *q = q_new(100, q_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -340,7 +340,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(copy_of, {
|
||||
struct queue *d1 = q_new(100, q_ftab_val);
|
||||
struct queue *d1 = q_new(100, q_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d1);
|
||||
|
||||
@@ -365,8 +365,8 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(equals, {
|
||||
struct queue *d1 = q_new(100, q_ftab_val);
|
||||
struct queue *d2 = q_new(100, q_ftab_val);
|
||||
struct queue *d1 = q_new(100, q_fval);
|
||||
struct queue *d2 = q_new(100, q_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d1);
|
||||
cmc_assert_not_equals(ptr, NULL, d2);
|
||||
@@ -384,7 +384,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(equals[from copy], {
|
||||
struct queue *d1 = q_new(100, q_ftab_val);
|
||||
struct queue *d1 = q_new(100, q_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d1);
|
||||
|
||||
@@ -404,7 +404,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(equals[count = 0], {
|
||||
struct queue *d1 = q_new(100, q_ftab_val);
|
||||
struct queue *d1 = q_new(100, q_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d1);
|
||||
|
||||
@@ -419,7 +419,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(flag, {
|
||||
struct queue *q = q_new(100, q_ftab_val);
|
||||
struct queue *q = q_new(100, q_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
cmc_assert_equals(int32_t, cmc_flags.OK, q_flag(q));
|
||||
@@ -478,7 +478,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(callbacks, {
|
||||
struct queue *q = q_new_custom(100, q_ftab_val, NULL, callbacks);
|
||||
struct queue *q = q_new_custom(100, q_fval, NULL, callbacks);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
|
||||
+14
-14
@@ -5,8 +5,8 @@
|
||||
|
||||
#include "../src/sortedlist.c"
|
||||
|
||||
struct sortedlist_ftab_val *sl_ftab_val =
|
||||
&(struct sortedlist_ftab_val){ .cmp = cmp,
|
||||
struct sortedlist_fval *sl_fval =
|
||||
&(struct sortedlist_fval){ .cmp = cmp,
|
||||
.cpy = copy,
|
||||
.str = str,
|
||||
.free = custom_free,
|
||||
@@ -15,7 +15,7 @@ struct sortedlist_ftab_val *sl_ftab_val =
|
||||
|
||||
CMC_CREATE_UNIT(sortedlist_test, true, {
|
||||
CMC_CREATE_TEST(new, {
|
||||
struct sortedlist *sl = sl_new(1000000, sl_ftab_val);
|
||||
struct sortedlist *sl = sl_new(1000000, sl_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, sl);
|
||||
cmc_assert_not_equals(ptr, NULL, sl->buffer);
|
||||
@@ -27,19 +27,19 @@ CMC_CREATE_UNIT(sortedlist_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = 0], {
|
||||
struct sortedlist *sl = sl_new(0, sl_ftab_val);
|
||||
struct sortedlist *sl = sl_new(0, sl_fval);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, sl);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = UINT64_MAX], {
|
||||
struct sortedlist *sl = sl_new(UINT64_MAX, sl_ftab_val);
|
||||
struct sortedlist *sl = sl_new(UINT64_MAX, sl_fval);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, sl);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(clear[count capacity], {
|
||||
struct sortedlist *sl = sl_new(100, sl_ftab_val);
|
||||
struct sortedlist *sl = sl_new(100, sl_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, sl);
|
||||
|
||||
@@ -57,7 +57,7 @@ CMC_CREATE_UNIT(sortedlist_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(buffer_growth[capacity = 1], {
|
||||
struct sortedlist *sl = sl_new(1, sl_ftab_val);
|
||||
struct sortedlist *sl = sl_new(1, sl_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, sl);
|
||||
|
||||
@@ -73,7 +73,7 @@ CMC_CREATE_UNIT(sortedlist_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert, {
|
||||
struct sortedlist *sl = sl_new(100, sl_ftab_val);
|
||||
struct sortedlist *sl = sl_new(100, sl_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, sl);
|
||||
|
||||
@@ -83,7 +83,7 @@ CMC_CREATE_UNIT(sortedlist_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(remove, {
|
||||
struct sortedlist *sl = sl_new(100, sl_ftab_val);
|
||||
struct sortedlist *sl = sl_new(100, sl_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, sl);
|
||||
|
||||
@@ -95,7 +95,7 @@ CMC_CREATE_UNIT(sortedlist_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(remove[count = 0], {
|
||||
struct sortedlist *sl = sl_new(100, sl_ftab_val);
|
||||
struct sortedlist *sl = sl_new(100, sl_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, sl);
|
||||
|
||||
@@ -105,7 +105,7 @@ CMC_CREATE_UNIT(sortedlist_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(remove[out of range], {
|
||||
struct sortedlist *sl = sl_new(100, sl_ftab_val);
|
||||
struct sortedlist *sl = sl_new(100, sl_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, sl);
|
||||
|
||||
@@ -117,7 +117,7 @@ CMC_CREATE_UNIT(sortedlist_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(index_of, {
|
||||
struct sortedlist *sl = sl_new(1, sl_ftab_val);
|
||||
struct sortedlist *sl = sl_new(1, sl_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, sl);
|
||||
|
||||
@@ -145,7 +145,7 @@ CMC_CREATE_UNIT(sortedlist_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(flags, {
|
||||
struct sortedlist *sl = sl_new(100, sl_ftab_val);
|
||||
struct sortedlist *sl = sl_new(100, sl_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, sl);
|
||||
cmc_assert_equals(int32_t, cmc_flags.OK, sl_flag(sl));
|
||||
@@ -236,7 +236,7 @@ CMC_CREATE_UNIT(sortedlist_test, true, {
|
||||
|
||||
CMC_CREATE_TEST(callbacks, {
|
||||
struct sortedlist *sl =
|
||||
sl_new_custom(100, sl_ftab_val, NULL, callbacks);
|
||||
sl_new_custom(100, sl_fval, NULL, callbacks);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, sl);
|
||||
|
||||
|
||||
+40
-40
@@ -5,8 +5,8 @@
|
||||
|
||||
#include "../src/stack.c"
|
||||
|
||||
struct stack_ftab_val *s_ftab_val =
|
||||
&(struct stack_ftab_val){ .cmp = cmp,
|
||||
struct stack_fval *s_fval =
|
||||
&(struct stack_fval){ .cmp = cmp,
|
||||
.cpy = copy,
|
||||
.str = str,
|
||||
.free = custom_free,
|
||||
@@ -15,7 +15,7 @@ struct stack_ftab_val *s_ftab_val =
|
||||
|
||||
CMC_CREATE_UNIT(stack_test, true, {
|
||||
CMC_CREATE_TEST(new, {
|
||||
struct stack *s = s_new(1000000, s_ftab_val);
|
||||
struct stack *s = s_new(1000000, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
cmc_assert_not_equals(ptr, NULL, s->buffer);
|
||||
@@ -27,19 +27,19 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = 0], {
|
||||
struct stack *s = s_new(0, s_ftab_val);
|
||||
struct stack *s = s_new(0, s_fval);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, s);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = UINT64_MAX], {
|
||||
struct stack *s = s_new(UINT64_MAX, s_ftab_val);
|
||||
struct stack *s = s_new(UINT64_MAX, s_fval);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, s);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(clear[count capacity], {
|
||||
struct stack *s = s_new(100, s_ftab_val);
|
||||
struct stack *s = s_new(100, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -57,7 +57,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(buffer_growth[capacity = 1], {
|
||||
struct stack *s = s_new(1, s_ftab_val);
|
||||
struct stack *s = s_new(1, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -71,7 +71,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push[count], {
|
||||
struct stack *s = s_new(100, s_ftab_val);
|
||||
struct stack *s = s_new(100, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -84,7 +84,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push[capacity], {
|
||||
struct stack *s = s_new(100, s_ftab_val);
|
||||
struct stack *s = s_new(100, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -97,7 +97,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push[item preservation], {
|
||||
struct stack *s = s_new(100, s_ftab_val);
|
||||
struct stack *s = s_new(100, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -111,7 +111,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop[count], {
|
||||
struct stack *s = s_new(100, s_ftab_val);
|
||||
struct stack *s = s_new(100, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -126,7 +126,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop[capacity], {
|
||||
struct stack *s = s_new(100, s_ftab_val);
|
||||
struct stack *s = s_new(100, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -141,7 +141,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop[item preservation], {
|
||||
struct stack *s = s_new(100, s_ftab_val);
|
||||
struct stack *s = s_new(100, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -158,7 +158,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop[count = 0], {
|
||||
struct stack *s = s_new(100, s_ftab_val);
|
||||
struct stack *s = s_new(100, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -168,7 +168,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(top, {
|
||||
struct stack *s = s_new(100, s_ftab_val);
|
||||
struct stack *s = s_new(100, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -184,7 +184,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(top[count = 0], {
|
||||
struct stack *s = s_new(100, s_ftab_val);
|
||||
struct stack *s = s_new(100, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -198,7 +198,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(top[count = 1], {
|
||||
struct stack *s = s_new(100, s_ftab_val);
|
||||
struct stack *s = s_new(100, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -210,7 +210,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(contains, {
|
||||
struct stack *s = s_new(100, s_ftab_val);
|
||||
struct stack *s = s_new(100, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -224,7 +224,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(contains[count = 0], {
|
||||
struct stack *s = s_new(100, s_ftab_val);
|
||||
struct stack *s = s_new(100, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -234,7 +234,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(empty, {
|
||||
struct stack *s = s_new(100, s_ftab_val);
|
||||
struct stack *s = s_new(100, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -244,7 +244,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(empty[after_io], {
|
||||
struct stack *s = s_new(100, s_ftab_val);
|
||||
struct stack *s = s_new(100, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -256,7 +256,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(full, {
|
||||
struct stack *s = s_new(100, s_ftab_val);
|
||||
struct stack *s = s_new(100, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -269,7 +269,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(full[capacity = 1], {
|
||||
struct stack *s = s_new(1, s_ftab_val);
|
||||
struct stack *s = s_new(1, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -281,7 +281,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(iter_alloc, {
|
||||
struct stack *s = s_new(100, s_ftab_val);
|
||||
struct stack *s = s_new(100, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -294,7 +294,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(iter_init[count = 0], {
|
||||
struct stack *s = s_new(100, s_ftab_val);
|
||||
struct stack *s = s_new(100, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -311,7 +311,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(iter_start[count = 0], {
|
||||
struct stack *s = s_new(100, s_ftab_val);
|
||||
struct stack *s = s_new(100, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -325,7 +325,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(iter_end[count = 0], {
|
||||
struct stack *s = s_new(100, s_ftab_val);
|
||||
struct stack *s = s_new(100, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -339,7 +339,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(iteration, {
|
||||
struct stack *s = s_new(100, s_ftab_val);
|
||||
struct stack *s = s_new(100, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -368,7 +368,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(iteration[while loop], {
|
||||
struct stack *s = s_new(100, s_ftab_val);
|
||||
struct stack *s = s_new(100, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -398,7 +398,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(iteration[count = 1], {
|
||||
struct stack *s = s_new(100, s_ftab_val);
|
||||
struct stack *s = s_new(100, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
cmc_assert(s_push(s, 10));
|
||||
@@ -423,7 +423,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(iteration[count = capacity], {
|
||||
struct stack *s = s_new(100, s_ftab_val);
|
||||
struct stack *s = s_new(100, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -454,7 +454,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(iteration[to_start = it_start and to_end = it_end], {
|
||||
struct stack *s = s_new(100, s_ftab_val);
|
||||
struct stack *s = s_new(100, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -489,7 +489,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(iteration[boundaries count = 0], {
|
||||
struct stack *s = s_new(100, s_ftab_val);
|
||||
struct stack *s = s_new(100, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -508,7 +508,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(iteration[boundaries count > 0], {
|
||||
struct stack *s = s_new(100, s_ftab_val);
|
||||
struct stack *s = s_new(100, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -530,7 +530,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(iter_value[count = 0], {
|
||||
struct stack *s = s_new(100, s_ftab_val);
|
||||
struct stack *s = s_new(100, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -544,7 +544,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(iter_rvalue[count = 0], {
|
||||
struct stack *s = s_new(100, s_ftab_val);
|
||||
struct stack *s = s_new(100, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -558,7 +558,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(index, {
|
||||
struct stack *s = s_new(100, s_ftab_val);
|
||||
struct stack *s = s_new(100, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -599,7 +599,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(index[count = 0], {
|
||||
struct stack *s = s_new(100, s_ftab_val);
|
||||
struct stack *s = s_new(100, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -612,7 +612,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(flags, {
|
||||
struct stack *s = s_new(100, s_ftab_val);
|
||||
struct stack *s = s_new(100, s_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
cmc_assert_equals(int32_t, cmc_flags.OK, s_flag(s));
|
||||
@@ -671,7 +671,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(callbacks, {
|
||||
struct stack *s = s_new_custom(100, s_ftab_val, NULL, callbacks);
|
||||
struct stack *s = s_new_custom(100, s_fval, NULL, callbacks);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
|
||||
@@ -5,16 +5,16 @@
|
||||
|
||||
#include "../src/treemap.c"
|
||||
|
||||
struct treemap_ftab_key *tm_ftab_key =
|
||||
&(struct treemap_ftab_key){ .cmp = cmp,
|
||||
struct treemap_fkey *tm_fkey =
|
||||
&(struct treemap_fkey){ .cmp = cmp,
|
||||
.cpy = copy,
|
||||
.str = str,
|
||||
.free = custom_free,
|
||||
.hash = hash,
|
||||
.pri = pri };
|
||||
|
||||
struct treemap_ftab_val *tm_ftab_val =
|
||||
&(struct treemap_ftab_val){ .cmp = cmp,
|
||||
struct treemap_fval *tm_fval =
|
||||
&(struct treemap_fval){ .cmp = cmp,
|
||||
.cpy = copy,
|
||||
.str = str,
|
||||
.free = custom_free,
|
||||
@@ -23,7 +23,7 @@ struct treemap_ftab_val *tm_ftab_val =
|
||||
|
||||
CMC_CREATE_UNIT(treemap_test, true, {
|
||||
CMC_CREATE_TEST(new, {
|
||||
struct treemap *map = tm_new(tm_ftab_key, tm_ftab_val);
|
||||
struct treemap *map = tm_new(tm_fkey, tm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -31,7 +31,7 @@ CMC_CREATE_UNIT(treemap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(clear[count], {
|
||||
struct treemap *map = tm_new(tm_ftab_key, tm_ftab_val);
|
||||
struct treemap *map = tm_new(tm_fkey, tm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -49,7 +49,7 @@ CMC_CREATE_UNIT(treemap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(flags, {
|
||||
struct treemap *map = tm_new(tm_ftab_key, tm_ftab_val);
|
||||
struct treemap *map = tm_new(tm_fkey, tm_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
cmc_assert_equals(int32_t, cmc_flags.OK, tm_flag(map));
|
||||
@@ -140,7 +140,7 @@ CMC_CREATE_UNIT(treemap_test, true, {
|
||||
|
||||
CMC_CREATE_TEST(callbacks, {
|
||||
struct treemap *map =
|
||||
tm_new_custom(tm_ftab_key, tm_ftab_val, NULL, callbacks);
|
||||
tm_new_custom(tm_fkey, tm_fval, NULL, callbacks);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
|
||||
#include "../src/treeset.c"
|
||||
|
||||
struct treeset_ftab_val *ts_ftab_val =
|
||||
&(struct treeset_ftab_val){ .cmp = cmp,
|
||||
struct treeset_fval *ts_fval =
|
||||
&(struct treeset_fval){ .cmp = cmp,
|
||||
.cpy = copy,
|
||||
.str = str,
|
||||
.free = custom_free,
|
||||
@@ -15,7 +15,7 @@ struct treeset_ftab_val *ts_ftab_val =
|
||||
|
||||
CMC_CREATE_UNIT(treeset_test, true, {
|
||||
CMC_CREATE_TEST(new, {
|
||||
struct treeset *set = ts_new(ts_ftab_val);
|
||||
struct treeset *set = ts_new(ts_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -23,7 +23,7 @@ CMC_CREATE_UNIT(treeset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(clear[count], {
|
||||
struct treeset *set = ts_new(ts_ftab_val);
|
||||
struct treeset *set = ts_new(ts_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -41,7 +41,7 @@ CMC_CREATE_UNIT(treeset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(flags, {
|
||||
struct treeset *set = ts_new(ts_ftab_val);
|
||||
struct treeset *set = ts_new(ts_fval);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
cmc_assert_equals(int32_t, cmc_flags.OK, ts_flag(set));
|
||||
@@ -102,7 +102,7 @@ CMC_CREATE_UNIT(treeset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(callbacks, {
|
||||
struct treeset *set = ts_new_custom(ts_ftab_val, NULL, callbacks);
|
||||
struct treeset *set = ts_new_custom(ts_fval, NULL, callbacks);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
|
||||
Reference in new issue
Block a user