Completely removed typedefs
This commit is contained in:
1 parent
db61269d42
commit
33c33e8947
55 files changed
+8637
-8651
No files matched your search
+1
-1
@@ -18,7 +18,7 @@
|
||||
|
||||
int main(void)
|
||||
{
|
||||
cmc_timer timer;
|
||||
struct cmc_timer timer;
|
||||
|
||||
cmc_timer_start(timer);
|
||||
uintmax_t failed = 0;
|
||||
|
||||
@@ -9,7 +9,7 @@ CMC_GENERATE_BIDIMAP(bm, bidimap, size_t, size_t)
|
||||
|
||||
CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
CMC_CREATE_TEST(new, {
|
||||
bidimap *map = bm_new(100, 0.6, cmp, hash, cmp, hash);
|
||||
struct bidimap *map = bm_new(100, 0.6, cmp, hash, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -17,7 +17,7 @@ CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(clear[count], {
|
||||
bidimap *map = bm_new(100, 0.6, cmp, hash, cmp, hash);
|
||||
struct bidimap *map = bm_new(100, 0.6, cmp, hash, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -34,7 +34,7 @@ CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(buffer_growth[capacity = 1], {
|
||||
bidimap *map = bm_new(1, 0.7, cmp, hash, cmp, hash);
|
||||
struct bidimap *map = bm_new(1, 0.7, cmp, hash, cmp, hash);
|
||||
|
||||
for (size_t i = 1; i <= 10000; i++)
|
||||
cmc_assert(bm_insert(map, i, i));
|
||||
@@ -55,12 +55,12 @@ CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(copy_of, {
|
||||
bidimap *map1 = bm_new(100, 0.7, cmp, hash, cmp, hash);
|
||||
struct bidimap *map1 = bm_new(100, 0.7, cmp, hash, cmp, hash);
|
||||
|
||||
for (size_t i = 0; i < 100; i++)
|
||||
cmc_assert(bm_insert(map1, i, i));
|
||||
|
||||
bidimap *map2 = bm_copy_of(map1, NULL, NULL);
|
||||
struct bidimap *map2 = bm_copy_of(map1, NULL, NULL);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map2);
|
||||
cmc_assert_equals(size_t, bm_count(map1), bm_count(map2));
|
||||
@@ -76,8 +76,8 @@ CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(equals, {
|
||||
bidimap *map1 = bm_new(100, 0.7, cmp, hash, cmp, hash);
|
||||
bidimap *map2 = bm_new(1000, 0.9, cmp, hash, cmp, hash);
|
||||
struct bidimap *map1 = bm_new(100, 0.7, cmp, hash, cmp, hash);
|
||||
struct bidimap *map2 = bm_new(1000, 0.9, cmp, hash, cmp, hash);
|
||||
|
||||
for (size_t i = 0; i < 100; i++)
|
||||
{
|
||||
@@ -100,12 +100,12 @@ CMC_CREATE_UNIT(bidimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(equals[from copy], {
|
||||
bidimap *map1 = bm_new(100, 0.7, cmp, hash, cmp, hash);
|
||||
struct bidimap *map1 = bm_new(100, 0.7, cmp, hash, cmp, hash);
|
||||
|
||||
for (size_t i = 0; i < 100; i++)
|
||||
cmc_assert(bm_insert(map1, i, i));
|
||||
|
||||
bidimap *map2 = bm_copy_of(map1, NULL, NULL);
|
||||
struct bidimap *map2 = bm_copy_of(map1, NULL, NULL);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map2);
|
||||
|
||||
|
||||
+36
-36
@@ -9,7 +9,7 @@ CMC_GENERATE_DEQUE(d, deque, size_t)
|
||||
|
||||
CMC_CREATE_UNIT(deque_test, true, {
|
||||
CMC_CREATE_TEST(new, {
|
||||
deque *d = d_new(1000000);
|
||||
struct deque *d = d_new(1000000);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
cmc_assert_not_equals(ptr, NULL, d->buffer);
|
||||
@@ -20,19 +20,19 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = 0], {
|
||||
deque *d = d_new(0);
|
||||
struct deque *d = d_new(0);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, d);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = UINT64_MAX], {
|
||||
deque *d = d_new(UINT64_MAX);
|
||||
struct deque *d = d_new(UINT64_MAX);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, d);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(clear[count capacity], {
|
||||
deque *d = d_new(100);
|
||||
struct deque *d = d_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -50,7 +50,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(buffer_growth[capacity = 1], {
|
||||
deque *d = d_new(1);
|
||||
struct deque *d = d_new(1);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -64,7 +64,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(buffer_growth[item preservation], {
|
||||
deque *d = d_new(100);
|
||||
struct deque *d = d_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -87,7 +87,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push_front[count capacity], {
|
||||
deque *d = d_new(100);
|
||||
struct deque *d = d_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -101,7 +101,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push_front[item preservation], {
|
||||
deque *d = d_new(100);
|
||||
struct deque *d = d_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -121,7 +121,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push_back[count capacity], {
|
||||
deque *d = d_new(100);
|
||||
struct deque *d = d_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -135,7 +135,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push_back[item preservation], {
|
||||
deque *d = d_new(100);
|
||||
struct deque *d = d_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -155,7 +155,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop_front[count capacity], {
|
||||
deque *d = d_new(100);
|
||||
struct deque *d = d_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -173,7 +173,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop_front[item preservation], {
|
||||
deque *d = d_new(100);
|
||||
struct deque *d = d_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -196,7 +196,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop_back[count capacity], {
|
||||
deque *d = d_new(100);
|
||||
struct deque *d = d_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -214,7 +214,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop_back[item preservation], {
|
||||
deque *d = d_new(100);
|
||||
struct deque *d = d_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -237,7 +237,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(Mixed IO, {
|
||||
deque *d = d_new(100);
|
||||
struct deque *d = d_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -301,7 +301,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(front[count = 0], {
|
||||
deque *d = d_new(100);
|
||||
struct deque *d = d_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -313,7 +313,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(front[sum], {
|
||||
deque *d = d_new(100);
|
||||
struct deque *d = d_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -342,7 +342,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(back[count = 0], {
|
||||
deque *d = d_new(100);
|
||||
struct deque *d = d_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -354,7 +354,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(back[sum], {
|
||||
deque *d = d_new(100);
|
||||
struct deque *d = d_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -383,7 +383,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(contains, {
|
||||
deque *d = d_new(100);
|
||||
struct deque *d = d_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -405,7 +405,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(contains[count = 0], {
|
||||
deque *d = d_new(100);
|
||||
struct deque *d = d_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -415,7 +415,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(contains[count = 1], {
|
||||
deque *d = d_new(100);
|
||||
struct deque *d = d_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -436,7 +436,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(empty, {
|
||||
deque *d = d_new(100);
|
||||
struct deque *d = d_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -450,7 +450,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(full, {
|
||||
deque *d = d_new(100);
|
||||
struct deque *d = d_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -465,7 +465,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(count, {
|
||||
deque *d = d_new(100);
|
||||
struct deque *d = d_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -480,7 +480,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(capacity, {
|
||||
deque *d = d_new(100);
|
||||
struct deque *d = d_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -490,7 +490,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(resize, {
|
||||
deque *d = d_new(100);
|
||||
struct deque *d = d_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -510,7 +510,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(resize[item preservation], {
|
||||
deque *d = d_new(100);
|
||||
struct deque *d = d_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d);
|
||||
|
||||
@@ -537,7 +537,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(copy_of, {
|
||||
deque *d1 = d_new(100);
|
||||
struct deque *d1 = d_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d1);
|
||||
|
||||
@@ -549,7 +549,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
cmc_assert(d_push_front(d1, i));
|
||||
}
|
||||
|
||||
deque *d2 = d_copy_of(d1, NULL);
|
||||
struct deque *d2 = d_copy_of(d1, NULL);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d2);
|
||||
cmc_assert_equals(size_t, d_count(d1), d_count(d2));
|
||||
@@ -567,8 +567,8 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(equals, {
|
||||
deque *d1 = d_new(100);
|
||||
deque *d2 = d_new(100);
|
||||
struct deque *d1 = d_new(100);
|
||||
struct deque *d2 = d_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d1);
|
||||
cmc_assert_not_equals(ptr, NULL, d2);
|
||||
@@ -594,7 +594,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(equals[from copy], {
|
||||
deque *d1 = d_new(100);
|
||||
struct deque *d1 = d_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d1);
|
||||
|
||||
@@ -606,7 +606,7 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
cmc_assert(d_push_front(d1, i));
|
||||
}
|
||||
|
||||
deque *d2 = d_copy_of(d1, NULL);
|
||||
struct deque *d2 = d_copy_of(d1, NULL);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d2);
|
||||
|
||||
@@ -617,11 +617,11 @@ CMC_CREATE_UNIT(deque_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(equals[count = 0], {
|
||||
deque *d1 = d_new(100);
|
||||
struct deque *d1 = d_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d1);
|
||||
|
||||
deque *d2 = d_copy_of(d1, NULL);
|
||||
struct deque *d2 = d_copy_of(d1, NULL);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d2);
|
||||
|
||||
|
||||
+33
-33
@@ -9,7 +9,7 @@ CMC_GENERATE_HASHMAP(hm, hashmap, size_t, size_t)
|
||||
|
||||
CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
CMC_CREATE_TEST(new, {
|
||||
hashmap *map = hm_new(943722, 0.6, cmp, hash);
|
||||
struct hashmap *map = hm_new(943722, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
cmc_assert_not_equals(ptr, NULL, map->buffer);
|
||||
@@ -20,19 +20,19 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = 0], {
|
||||
hashmap *map = hm_new(0, 0.6, cmp, hash);
|
||||
struct hashmap *map = hm_new(0, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, map);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = UINT64_MAX], {
|
||||
hashmap *map = hm_new(UINT64_MAX, 0.99, cmp, hash);
|
||||
struct hashmap *map = hm_new(UINT64_MAX, 0.99, cmp, hash);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, map);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(clear[count capacity], {
|
||||
hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -49,7 +49,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert, {
|
||||
hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -60,7 +60,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[smallest capacity], {
|
||||
hashmap *map = hm_new(1, 0.99, cmp, hash);
|
||||
struct hashmap *map = hm_new(1, 0.99, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -72,7 +72,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
|
||||
CMC_CREATE_TEST(insert[element position], {
|
||||
// Using the numhash the key is the hash itself
|
||||
hashmap *map = hm_new(1, 0.99, cmp, numhash);
|
||||
struct hashmap *map = hm_new(1, 0.99, cmp, numhash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -90,7 +90,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[distance], {
|
||||
hashmap *map = hm_new(500, 0.6, cmp, hash0);
|
||||
struct hashmap *map = hm_new(500, 0.6, cmp, hash0);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -105,7 +105,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[distance wrap], {
|
||||
hashmap *map = hm_new(1, 0.99, cmp, hashcapminus1);
|
||||
struct hashmap *map = hm_new(1, 0.99, cmp, hashcapminus1);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -125,7 +125,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[distances], {
|
||||
hashmap *map = hm_new(1, 0.99, cmp, hashcapminus4);
|
||||
struct hashmap *map = hm_new(1, 0.99, cmp, hashcapminus4);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -141,7 +141,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[buffer growth and item preservation], {
|
||||
hashmap *map = hm_new(1, 0.99, cmp, hash);
|
||||
struct hashmap *map = hm_new(1, 0.99, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -165,7 +165,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(update, {
|
||||
hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -180,7 +180,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(update[key not found], {
|
||||
hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -193,7 +193,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(remove, {
|
||||
hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -207,7 +207,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(remove[count = 0], {
|
||||
hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -218,7 +218,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(remove[key not found], {
|
||||
hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -232,7 +232,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(max, {
|
||||
hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -250,7 +250,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(max[count = 0], {
|
||||
hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -260,7 +260,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(min, {
|
||||
hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -278,7 +278,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(min[count = 0], {
|
||||
hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -288,7 +288,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(get, {
|
||||
hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -300,7 +300,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(get[count = 0], {
|
||||
hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -310,7 +310,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(get_ref, {
|
||||
hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -325,7 +325,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(get_ref[count = 0], {
|
||||
hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -335,7 +335,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(contains, {
|
||||
hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -347,7 +347,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(contains[count = 0], {
|
||||
hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -357,7 +357,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(contains[sum], {
|
||||
hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -375,7 +375,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(empty, {
|
||||
hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -389,7 +389,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(full, {
|
||||
hashmap *map = hm_new(cmc_hashtable_primes[0], 0.99999, cmp, hash);
|
||||
struct hashmap *map = hm_new(cmc_hashtable_primes[0], 0.99999, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -410,7 +410,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(count, {
|
||||
hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -424,7 +424,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(capacity, {
|
||||
hashmap *map = hm_new(2500, 0.6, cmp, hash);
|
||||
struct hashmap *map = hm_new(2500, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -434,7 +434,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(capacity[small], {
|
||||
hashmap *map = hm_new(1, 0.99, cmp, hash);
|
||||
struct hashmap *map = hm_new(1, 0.99, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -444,7 +444,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(load, {
|
||||
hashmap *map = hm_new(1, 0.99, cmp, hash);
|
||||
struct hashmap *map = hm_new(1, 0.99, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
|
||||
+26
-26
@@ -9,7 +9,7 @@ CMC_GENERATE_HASHSET(hs, hashset, size_t)
|
||||
|
||||
CMC_CREATE_UNIT(hashset_test, true, {
|
||||
CMC_CREATE_TEST(new, {
|
||||
hashset *set = hs_new(943722, 0.6, cmp, hash);
|
||||
struct hashset *set = hs_new(943722, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
cmc_assert_not_equals(ptr, NULL, set->buffer);
|
||||
@@ -20,19 +20,19 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = 0], {
|
||||
hashset *set = hs_new(0, 0.6, cmp, hash);
|
||||
struct hashset *set = hs_new(0, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, set);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = UINT64_MAX], {
|
||||
hashset *set = hs_new(UINT64_MAX, 0.99, cmp, hash);
|
||||
struct hashset *set = hs_new(UINT64_MAX, 0.99, cmp, hash);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, set);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(clear[count capacity], {
|
||||
hashset *set = hs_new(100, 0.6, cmp, hash);
|
||||
struct hashset *set = hs_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -49,7 +49,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert, {
|
||||
hashset *set = hs_new(100, 0.6, cmp, hash);
|
||||
struct hashset *set = hs_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -60,7 +60,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[smallest capacity], {
|
||||
hashset *set = hs_new(1, 0.99, cmp, hash);
|
||||
struct hashset *set = hs_new(1, 0.99, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -72,7 +72,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
|
||||
CMC_CREATE_TEST(insert[element position], {
|
||||
// Using the numhash the key is the hash itself
|
||||
hashset *set = hs_new(1, 0.99, cmp, numhash);
|
||||
struct hashset *set = hs_new(1, 0.99, cmp, numhash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -90,7 +90,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[distance], {
|
||||
hashset *set = hs_new(500, 0.6, cmp, hash0);
|
||||
struct hashset *set = hs_new(500, 0.6, cmp, hash0);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -105,7 +105,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[distance wrap], {
|
||||
hashset *set = hs_new(1, 0.99, cmp, hashcapminus1);
|
||||
struct hashset *set = hs_new(1, 0.99, cmp, hashcapminus1);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -125,7 +125,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[buffer growth and item preservation], {
|
||||
hashset *set = hs_new(1, 0.99, cmp, hash);
|
||||
struct hashset *set = hs_new(1, 0.99, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -149,7 +149,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(remove, {
|
||||
hashset *set = hs_new(100, 0.6, cmp, hash);
|
||||
struct hashset *set = hs_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -163,7 +163,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(remove[count = 0], {
|
||||
hashset *set = hs_new(100, 0.6, cmp, hash);
|
||||
struct hashset *set = hs_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -174,7 +174,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(remove[key not found], {
|
||||
hashset *set = hs_new(100, 0.6, cmp, hash);
|
||||
struct hashset *set = hs_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -188,7 +188,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(max, {
|
||||
hashset *set = hs_new(100, 0.6, cmp, hash);
|
||||
struct hashset *set = hs_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -204,7 +204,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(max[count = 0], {
|
||||
hashset *set = hs_new(100, 0.6, cmp, hash);
|
||||
struct hashset *set = hs_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -214,7 +214,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(min, {
|
||||
hashset *set = hs_new(100, 0.6, cmp, hash);
|
||||
struct hashset *set = hs_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -230,7 +230,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(min[count = 0], {
|
||||
hashset *set = hs_new(100, 0.6, cmp, hash);
|
||||
struct hashset *set = hs_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -240,7 +240,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(contains, {
|
||||
hashset *set = hs_new(100, 0.6, cmp, hash);
|
||||
struct hashset *set = hs_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -252,7 +252,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(contains[count = 0], {
|
||||
hashset *set = hs_new(100, 0.6, cmp, hash);
|
||||
struct hashset *set = hs_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -262,7 +262,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(contains[sum], {
|
||||
hashset *set = hs_new(100, 0.6, cmp, hash);
|
||||
struct hashset *set = hs_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -280,7 +280,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(empty, {
|
||||
hashset *set = hs_new(100, 0.6, cmp, hash);
|
||||
struct hashset *set = hs_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -294,7 +294,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(full, {
|
||||
hashset *set = hs_new(cmc_hashtable_primes[0], 0.99999, cmp, hash);
|
||||
struct hashset *set = hs_new(cmc_hashtable_primes[0], 0.99999, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -315,7 +315,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(count, {
|
||||
hashset *set = hs_new(100, 0.6, cmp, hash);
|
||||
struct hashset *set = hs_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -329,7 +329,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(capacity, {
|
||||
hashset *set = hs_new(2500, 0.6, cmp, hash);
|
||||
struct hashset *set = hs_new(2500, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -339,7 +339,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(capacity[small], {
|
||||
hashset *set = hs_new(1, 0.99, cmp, hash);
|
||||
struct hashset *set = hs_new(1, 0.99, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -349,7 +349,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(load, {
|
||||
hashset *set = hs_new(1, 0.99, cmp, hash);
|
||||
struct hashset *set = hs_new(1, 0.99, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
|
||||
+12
-12
@@ -9,7 +9,7 @@ CMC_GENERATE_HEAP(h, heap, size_t)
|
||||
|
||||
CMC_CREATE_UNIT(heap_test, true, {
|
||||
CMC_CREATE_TEST(new, {
|
||||
heap *h = h_new(1000000, cmc_max_heap, cmp);
|
||||
struct heap *h = h_new(1000000, cmc_max_heap, cmp);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, h);
|
||||
cmc_assert_not_equals(ptr, NULL, h->buffer);
|
||||
@@ -20,19 +20,19 @@ CMC_CREATE_UNIT(heap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[edge_case capacity = 0], {
|
||||
heap *h = h_new(0, cmc_max_heap, cmp);
|
||||
struct heap *h = h_new(0, cmc_max_heap, cmp);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, h);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[edge_case capacity = UINT64_MAX], {
|
||||
heap *h = h_new(UINT64_MAX, cmc_max_heap, cmp);
|
||||
struct heap *h = h_new(UINT64_MAX, cmc_max_heap, cmp);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, h);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(clear[count capacity], {
|
||||
heap *h = h_new(100, cmc_max_heap, cmp);
|
||||
struct heap *h = h_new(100, cmc_max_heap, cmp);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, h);
|
||||
|
||||
@@ -50,7 +50,7 @@ CMC_CREATE_UNIT(heap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(buffer_growth[edge_case capacity = 1], {
|
||||
heap *h = h_new(1, cmc_max_heap, cmp);
|
||||
struct heap *h = h_new(1, cmc_max_heap, cmp);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, h);
|
||||
|
||||
@@ -63,7 +63,7 @@ CMC_CREATE_UNIT(heap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert, {
|
||||
heap *h = h_new(100, cmc_max_heap, cmp);
|
||||
struct heap *h = h_new(100, cmc_max_heap, cmp);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, h);
|
||||
|
||||
@@ -73,7 +73,7 @@ CMC_CREATE_UNIT(heap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[item preservation], {
|
||||
heap *h = h_new(50, cmc_max_heap, cmp);
|
||||
struct heap *h = h_new(50, cmc_max_heap, cmp);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, h);
|
||||
|
||||
@@ -90,7 +90,7 @@ CMC_CREATE_UNIT(heap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(remove, {
|
||||
heap *h = h_new(50, cmc_max_heap, cmp);
|
||||
struct heap *h = h_new(50, cmc_max_heap, cmp);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, h);
|
||||
|
||||
@@ -106,7 +106,7 @@ CMC_CREATE_UNIT(heap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(remove[count = 0], {
|
||||
heap *h = h_new(100, cmc_max_heap, cmp);
|
||||
struct heap *h = h_new(100, cmc_max_heap, cmp);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, h);
|
||||
|
||||
@@ -117,7 +117,7 @@ CMC_CREATE_UNIT(heap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(remove[sorted], {
|
||||
heap *h = h_new(100, cmc_min_heap, cmp);
|
||||
struct heap *h = h_new(100, cmc_min_heap, cmp);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, h);
|
||||
|
||||
@@ -140,7 +140,7 @@ CMC_CREATE_UNIT(heap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(peek, {
|
||||
heap *h = h_new(100, cmc_max_heap, cmp);
|
||||
struct heap *h = h_new(100, cmc_max_heap, cmp);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, h);
|
||||
|
||||
@@ -153,7 +153,7 @@ CMC_CREATE_UNIT(heap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(peek[count = 0], {
|
||||
heap *h = h_new(100, cmc_max_heap, cmp);
|
||||
struct heap *h = h_new(100, cmc_max_heap, cmp);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, h);
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ CMC_GENERATE_INTERVALHEAP(ih, intervalheap, size_t)
|
||||
|
||||
CMC_CREATE_UNIT(intervalheap_test, true, {
|
||||
CMC_CREATE_TEST(new, {
|
||||
intervalheap *ih = ih_new(1000000, cmp);
|
||||
struct intervalheap *ih = ih_new(1000000, cmp);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, ih);
|
||||
cmc_assert_not_equals(ptr, NULL, ih->buffer);
|
||||
@@ -20,7 +20,7 @@ CMC_CREATE_UNIT(intervalheap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = 0], {
|
||||
intervalheap *ih = ih_new(0, cmp);
|
||||
struct intervalheap *ih = ih_new(0, cmp);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, ih);
|
||||
|
||||
@@ -29,7 +29,7 @@ CMC_CREATE_UNIT(intervalheap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity], {
|
||||
intervalheap *ih = ih_new(1, cmp);
|
||||
struct intervalheap *ih = ih_new(1, cmp);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, ih);
|
||||
cmc_assert_equals(size_t, 1, ih_capacity(ih));
|
||||
@@ -59,7 +59,7 @@ CMC_CREATE_UNIT(intervalheap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = UINT64_MAX], {
|
||||
intervalheap *ih = ih_new(UINT64_MAX, cmp);
|
||||
struct intervalheap *ih = ih_new(UINT64_MAX, cmp);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, ih);
|
||||
|
||||
@@ -68,7 +68,7 @@ CMC_CREATE_UNIT(intervalheap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(clear[count capacity], {
|
||||
intervalheap *ih = ih_new(100, cmp);
|
||||
struct intervalheap *ih = ih_new(100, cmp);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, ih);
|
||||
|
||||
@@ -86,7 +86,7 @@ CMC_CREATE_UNIT(intervalheap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(buffer_growth[capacity = 1], {
|
||||
intervalheap *ih = ih_new(1, cmp);
|
||||
struct intervalheap *ih = ih_new(1, cmp);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, ih);
|
||||
|
||||
@@ -100,7 +100,7 @@ CMC_CREATE_UNIT(intervalheap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[count], {
|
||||
intervalheap *ih = ih_new(100, cmp);
|
||||
struct intervalheap *ih = ih_new(100, cmp);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, ih);
|
||||
|
||||
@@ -113,7 +113,7 @@ CMC_CREATE_UNIT(intervalheap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[max min], {
|
||||
intervalheap *ih = ih_new(1, cmp);
|
||||
struct intervalheap *ih = ih_new(1, cmp);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, ih);
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ CMC_GENERATE_LINKEDLIST(ll, linkedlist, size_t)
|
||||
|
||||
CMC_CREATE_UNIT(linkedlist_test, true, {
|
||||
CMC_CREATE_TEST(new, {
|
||||
linkedlist *ll = ll_new();
|
||||
struct linkedlist *ll = ll_new();
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, ll);
|
||||
cmc_assert_equals(size_t, 0, ll_count(ll));
|
||||
@@ -20,7 +20,7 @@ CMC_CREATE_UNIT(linkedlist_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(clear[count capacity], {
|
||||
linkedlist *ll = ll_new();
|
||||
struct linkedlist *ll = ll_new();
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, ll);
|
||||
|
||||
@@ -37,7 +37,7 @@ CMC_CREATE_UNIT(linkedlist_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(clear[count = 0], {
|
||||
linkedlist *ll = ll_new();
|
||||
struct linkedlist *ll = ll_new();
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, ll);
|
||||
|
||||
@@ -49,7 +49,7 @@ CMC_CREATE_UNIT(linkedlist_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push_front[count], {
|
||||
linkedlist *ll = ll_new();
|
||||
struct linkedlist *ll = ll_new();
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, ll);
|
||||
|
||||
@@ -63,7 +63,7 @@ CMC_CREATE_UNIT(linkedlist_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push_front[item preservation], {
|
||||
linkedlist *ll = ll_new();
|
||||
struct linkedlist *ll = ll_new();
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, ll);
|
||||
|
||||
|
||||
+26
-26
@@ -9,7 +9,7 @@ CMC_GENERATE_LIST(l, list, size_t)
|
||||
|
||||
CMC_CREATE_UNIT(list_test, true, {
|
||||
CMC_CREATE_TEST(new, {
|
||||
list *l = l_new(1000000);
|
||||
struct list *l = l_new(1000000);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
cmc_assert_not_equals(ptr, NULL, l->buffer);
|
||||
@@ -20,13 +20,13 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = 0], {
|
||||
list *l = l_new(0);
|
||||
struct list *l = l_new(0);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, l);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = UINT64_MAX], {
|
||||
list *l = l_new(UINT64_MAX);
|
||||
struct list *l = l_new(UINT64_MAX);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, l);
|
||||
});
|
||||
@@ -39,7 +39,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
v[i] = i;
|
||||
}
|
||||
|
||||
list *l = l_new_from(v, 5);
|
||||
struct list *l = l_new_from(v, 5);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
|
||||
@@ -54,7 +54,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
|
||||
size_t *values = &a;
|
||||
|
||||
list *l = l_new_from(values, 1);
|
||||
struct list *l = l_new_from(values, 1);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
|
||||
@@ -62,7 +62,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(clear[count capacity], {
|
||||
list *l = l_new(100);
|
||||
struct list *l = l_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
|
||||
@@ -80,7 +80,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(buffer_growth[capacity = 1], {
|
||||
list *l = l_new(1);
|
||||
struct list *l = l_new(1);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
|
||||
@@ -96,7 +96,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push_front[count], {
|
||||
list *l = l_new(100);
|
||||
struct list *l = l_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
|
||||
@@ -109,7 +109,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push_front[capacity], {
|
||||
list *l = l_new(100);
|
||||
struct list *l = l_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
|
||||
@@ -122,7 +122,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push_front[item preservation], {
|
||||
list *l = l_new(100);
|
||||
struct list *l = l_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
|
||||
@@ -136,7 +136,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push_at[count], {
|
||||
list *l = l_new(100);
|
||||
struct list *l = l_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
|
||||
@@ -152,7 +152,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push_at[capacity], {
|
||||
list *l = l_new(100);
|
||||
struct list *l = l_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
|
||||
@@ -168,7 +168,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push_at[item preservation], {
|
||||
list *l = l_new(100);
|
||||
struct list *l = l_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
|
||||
@@ -185,7 +185,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push_back[count], {
|
||||
list *l = l_new(100);
|
||||
struct list *l = l_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
|
||||
@@ -198,7 +198,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push_back[capacity], {
|
||||
list *l = l_new(100);
|
||||
struct list *l = l_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
|
||||
@@ -211,7 +211,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push_back[item preservation], {
|
||||
list *l = l_new(100);
|
||||
struct list *l = l_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
|
||||
@@ -225,7 +225,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop_front[count], {
|
||||
list *l = l_new(100);
|
||||
struct list *l = l_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
|
||||
@@ -238,7 +238,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop_front[item preservation], {
|
||||
list *l = l_new(100);
|
||||
struct list *l = l_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
|
||||
@@ -254,7 +254,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop_front[count = 0], {
|
||||
list *l = l_new(100);
|
||||
struct list *l = l_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
cmc_assert(!l_pop_front(l));
|
||||
@@ -263,7 +263,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop_front[count = 1], {
|
||||
list *l = l_new(100);
|
||||
struct list *l = l_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
cmc_assert(l_push_back(l, 10));
|
||||
@@ -273,7 +273,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop_front[buffer_clear], {
|
||||
list *l = l_new(100);
|
||||
struct list *l = l_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
cmc_assert(l_push_back(l, 1));
|
||||
@@ -287,7 +287,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop_at[count = 0], {
|
||||
list *l = l_new(100);
|
||||
struct list *l = l_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
cmc_assert(!l_pop_at(l, 1));
|
||||
@@ -296,7 +296,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop_at[count = 1], {
|
||||
list *l = l_new(100);
|
||||
struct list *l = l_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
cmc_assert(l_push_back(l, 1));
|
||||
@@ -308,7 +308,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop_at[buffer_clear], {
|
||||
list *l = l_new(100);
|
||||
struct list *l = l_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
cmc_assert(l_push_back(l, 1));
|
||||
@@ -320,7 +320,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop_back[count = 0], {
|
||||
list *l = l_new(100);
|
||||
struct list *l = l_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
cmc_assert(!l_pop_back(l));
|
||||
@@ -329,7 +329,7 @@ CMC_CREATE_UNIT(list_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop_back[count = 1], {
|
||||
list *l = l_new(100);
|
||||
struct list *l = l_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, l);
|
||||
cmc_assert(l_push_back(l, 10));
|
||||
|
||||
+10
-10
@@ -9,7 +9,7 @@ CMC_GENERATE_MULTIMAP(mm, multimap, size_t, size_t)
|
||||
|
||||
CMC_CREATE_UNIT(multimap_test, true, {
|
||||
CMC_CREATE_TEST(new, {
|
||||
multimap *map = mm_new(943722, 0.8, cmp, hash);
|
||||
struct multimap *map = mm_new(943722, 0.8, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
cmc_assert_not_equals(ptr, NULL, map->buffer);
|
||||
@@ -20,19 +20,19 @@ CMC_CREATE_UNIT(multimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = 0], {
|
||||
multimap *map = mm_new(0, 0.8, cmp, hash);
|
||||
struct multimap *map = mm_new(0, 0.8, cmp, hash);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, map);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = UINT64_MAX], {
|
||||
multimap *map = mm_new(UINT64_MAX, 0.99, cmp, hash);
|
||||
struct multimap *map = mm_new(UINT64_MAX, 0.99, cmp, hash);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, map);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(clear[count capacity], {
|
||||
multimap *map = mm_new(100, 0.8, cmp, hash);
|
||||
struct multimap *map = mm_new(100, 0.8, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -49,7 +49,7 @@ CMC_CREATE_UNIT(multimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[count], {
|
||||
multimap *map = mm_new(100, 0.8, cmp, hash);
|
||||
struct multimap *map = mm_new(100, 0.8, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -62,7 +62,7 @@ CMC_CREATE_UNIT(multimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(remove[count], {
|
||||
multimap *map = mm_new(100, 0.8, cmp, hash);
|
||||
struct multimap *map = mm_new(100, 0.8, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -80,7 +80,7 @@ CMC_CREATE_UNIT(multimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(remove[count = 0], {
|
||||
multimap *map = mm_new(100, 0.8, cmp, hash);
|
||||
struct multimap *map = mm_new(100, 0.8, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -92,7 +92,7 @@ CMC_CREATE_UNIT(multimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(remove[count = 1], {
|
||||
multimap *map = mm_new(100, 0.8, cmp, hash);
|
||||
struct multimap *map = mm_new(100, 0.8, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -105,7 +105,7 @@ CMC_CREATE_UNIT(multimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(get[key ordering], {
|
||||
multimap *map = mm_new(100, 0.8, cmp, hash);
|
||||
struct multimap *map = mm_new(100, 0.8, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -121,7 +121,7 @@ CMC_CREATE_UNIT(multimap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(key_count, {
|
||||
multimap *map = mm_new(50, 0.8, cmp, hash);
|
||||
struct multimap *map = mm_new(50, 0.8, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ CMC_GENERATE_MULTISET(ms, multiset, size_t)
|
||||
|
||||
CMC_CREATE_UNIT(multiset_test, true, {
|
||||
CMC_CREATE_TEST(new, {
|
||||
multiset *set = ms_new(943722, 0.6, cmp, hash);
|
||||
struct multiset *set = ms_new(943722, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
cmc_assert_not_equals(ptr, NULL, set->buffer);
|
||||
@@ -20,19 +20,19 @@ CMC_CREATE_UNIT(multiset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = 0], {
|
||||
multiset *set = ms_new(0, 0.6, cmp, hash);
|
||||
struct multiset *set = ms_new(0, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, set);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = UINT64_MAX], {
|
||||
multiset *set = ms_new(UINT64_MAX, 0.99, cmp, hash);
|
||||
struct multiset *set = ms_new(UINT64_MAX, 0.99, cmp, hash);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, set);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(clear[count capacity], {
|
||||
multiset *set = ms_new(100, 0.6, cmp, hash);
|
||||
struct multiset *set = ms_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -49,7 +49,7 @@ CMC_CREATE_UNIT(multiset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert[count cardinality multiplicity], {
|
||||
multiset *set = ms_new(100, 0.6, cmp, hash);
|
||||
struct multiset *set = ms_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -70,7 +70,7 @@ CMC_CREATE_UNIT(multiset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(remove[count cardinality multiplicity], {
|
||||
multiset *set = ms_new(100, 0.6, cmp, hash);
|
||||
struct multiset *set = ms_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -103,7 +103,7 @@ CMC_CREATE_UNIT(multiset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(remove_all[count cardinality multiplicity], {
|
||||
multiset *set = ms_new(100, 0.6, cmp, hash);
|
||||
struct multiset *set = ms_new(100, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -135,7 +135,7 @@ CMC_CREATE_UNIT(multiset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(multiplicity, {
|
||||
multiset *set = ms_new(50, 0.6, cmp, hash);
|
||||
struct multiset *set = ms_new(50, 0.6, cmp, hash);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
|
||||
+29
-29
@@ -9,7 +9,7 @@ CMC_GENERATE_QUEUE(q, queue, size_t)
|
||||
|
||||
CMC_CREATE_UNIT(queue_test, true, {
|
||||
CMC_CREATE_TEST(new, {
|
||||
queue *q = q_new(1000000);
|
||||
struct queue *q = q_new(1000000);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
cmc_assert_not_equals(ptr, NULL, q->buffer);
|
||||
@@ -21,19 +21,19 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = 0], {
|
||||
queue *q = q_new(0);
|
||||
struct queue *q = q_new(0);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, q);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = UINT64_MAX], {
|
||||
queue *q = q_new(UINT64_MAX);
|
||||
struct queue *q = q_new(UINT64_MAX);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, q);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(clear[count capacity], {
|
||||
queue *q = q_new(100);
|
||||
struct queue *q = q_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -51,7 +51,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(buffer_growth[capacity = 1], {
|
||||
queue *q = q_new(1);
|
||||
struct queue *q = q_new(1);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -64,7 +64,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(buffer_growth[item preservation], {
|
||||
queue *q = q_new(100);
|
||||
struct queue *q = q_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -84,7 +84,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(enqueue[count capacity], {
|
||||
queue *q = q_new(100);
|
||||
struct queue *q = q_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -98,7 +98,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(enqueue[item preservation], {
|
||||
queue *q = q_new(100);
|
||||
struct queue *q = q_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -118,7 +118,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(dequeue[count capacity], {
|
||||
queue *q = q_new(100);
|
||||
struct queue *q = q_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -136,7 +136,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(dequeue[item preservation], {
|
||||
queue *q = q_new(100);
|
||||
struct queue *q = q_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -159,7 +159,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(peek[count = 0], {
|
||||
queue *q = q_new(100);
|
||||
struct queue *q = q_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -171,7 +171,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(peek[sum], {
|
||||
queue *q = q_new(100);
|
||||
struct queue *q = q_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -195,7 +195,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(contains, {
|
||||
queue *q = q_new(100);
|
||||
struct queue *q = q_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -214,7 +214,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(contains[count = 0], {
|
||||
queue *q = q_new(100);
|
||||
struct queue *q = q_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -224,7 +224,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(contains[count = 1], {
|
||||
queue *q = q_new(100);
|
||||
struct queue *q = q_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -239,7 +239,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(empty, {
|
||||
queue *q = q_new(100);
|
||||
struct queue *q = q_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -253,7 +253,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(full, {
|
||||
queue *q = q_new(100);
|
||||
struct queue *q = q_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -268,7 +268,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(count, {
|
||||
queue *q = q_new(100);
|
||||
struct queue *q = q_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -283,7 +283,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(capacity, {
|
||||
queue *q = q_new(100);
|
||||
struct queue *q = q_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -293,7 +293,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(resize, {
|
||||
queue *q = q_new(100);
|
||||
struct queue *q = q_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -308,7 +308,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(resize[item preservation], {
|
||||
queue *q = q_new(100);
|
||||
struct queue *q = q_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, q);
|
||||
|
||||
@@ -330,14 +330,14 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(copy_of, {
|
||||
queue *d1 = q_new(100);
|
||||
struct queue *d1 = q_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d1);
|
||||
|
||||
for (size_t i = 1; i <= 150; i++)
|
||||
cmc_assert(q_enqueue(d1, i));
|
||||
|
||||
queue *d2 = q_copy_of(d1, NULL);
|
||||
struct queue *d2 = q_copy_of(d1, NULL);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d2);
|
||||
cmc_assert_equals(size_t, q_count(d1), q_count(d2));
|
||||
@@ -355,8 +355,8 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(equals, {
|
||||
queue *d1 = q_new(100);
|
||||
queue *d2 = q_new(100);
|
||||
struct queue *d1 = q_new(100);
|
||||
struct queue *d2 = q_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d1);
|
||||
cmc_assert_not_equals(ptr, NULL, d2);
|
||||
@@ -374,7 +374,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(equals[from copy], {
|
||||
queue *d1 = q_new(100);
|
||||
struct queue *d1 = q_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d1);
|
||||
|
||||
@@ -383,7 +383,7 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
cmc_assert(q_enqueue(d1, i));
|
||||
}
|
||||
|
||||
queue *d2 = q_copy_of(d1, NULL);
|
||||
struct queue *d2 = q_copy_of(d1, NULL);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d2);
|
||||
|
||||
@@ -394,11 +394,11 @@ CMC_CREATE_UNIT(queue_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(equals[count = 0], {
|
||||
queue *d1 = q_new(100);
|
||||
struct queue *d1 = q_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d1);
|
||||
|
||||
queue *d2 = q_copy_of(d1, NULL);
|
||||
struct queue *d2 = q_copy_of(d1, NULL);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, d2);
|
||||
|
||||
|
||||
+10
-10
@@ -9,7 +9,7 @@ CMC_GENERATE_SORTEDLIST(sl, sortedlist, size_t)
|
||||
|
||||
CMC_CREATE_UNIT(sortedlist_test, true, {
|
||||
CMC_CREATE_TEST(new, {
|
||||
sortedlist *sl = sl_new(1000000, cmp);
|
||||
struct sortedlist *sl = sl_new(1000000, cmp);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, sl);
|
||||
cmc_assert_not_equals(ptr, NULL, sl->buffer);
|
||||
@@ -21,19 +21,19 @@ CMC_CREATE_UNIT(sortedlist_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = 0], {
|
||||
sortedlist *sl = sl_new(0, cmp);
|
||||
struct sortedlist *sl = sl_new(0, cmp);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, sl);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = UINT64_MAX], {
|
||||
sortedlist *sl = sl_new(UINT64_MAX, cmp);
|
||||
struct sortedlist *sl = sl_new(UINT64_MAX, cmp);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, sl);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(clear[count capacity], {
|
||||
sortedlist *sl = sl_new(100, cmp);
|
||||
struct sortedlist *sl = sl_new(100, cmp);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, sl);
|
||||
|
||||
@@ -51,7 +51,7 @@ CMC_CREATE_UNIT(sortedlist_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(buffer_growth[capacity = 1], {
|
||||
sortedlist *sl = sl_new(1, cmp);
|
||||
struct sortedlist *sl = sl_new(1, cmp);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, sl);
|
||||
|
||||
@@ -67,7 +67,7 @@ CMC_CREATE_UNIT(sortedlist_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(insert, {
|
||||
sortedlist *sl = sl_new(100, cmp);
|
||||
struct sortedlist *sl = sl_new(100, cmp);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, sl);
|
||||
|
||||
@@ -77,7 +77,7 @@ CMC_CREATE_UNIT(sortedlist_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(remove, {
|
||||
sortedlist *sl = sl_new(100, cmp);
|
||||
struct sortedlist *sl = sl_new(100, cmp);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, sl);
|
||||
|
||||
@@ -89,7 +89,7 @@ CMC_CREATE_UNIT(sortedlist_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(remove[count = 0], {
|
||||
sortedlist *sl = sl_new(100, cmp);
|
||||
struct sortedlist *sl = sl_new(100, cmp);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, sl);
|
||||
|
||||
@@ -99,7 +99,7 @@ CMC_CREATE_UNIT(sortedlist_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(remove[out of range], {
|
||||
sortedlist *sl = sl_new(100, cmp);
|
||||
struct sortedlist *sl = sl_new(100, cmp);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, sl);
|
||||
|
||||
@@ -111,7 +111,7 @@ CMC_CREATE_UNIT(sortedlist_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(indexof, {
|
||||
sortedlist *sl = sl_new(1, cmp);
|
||||
struct sortedlist *sl = sl_new(1, cmp);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, sl);
|
||||
|
||||
|
||||
+60
-60
@@ -9,7 +9,7 @@ CMC_GENERATE_STACK(s, stack, size_t)
|
||||
|
||||
CMC_CREATE_UNIT(stack_test, true, {
|
||||
CMC_CREATE_TEST(new, {
|
||||
stack *s = s_new(1000000);
|
||||
struct stack *s = s_new(1000000);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
cmc_assert_not_equals(ptr, NULL, s->buffer);
|
||||
@@ -21,19 +21,19 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = 0], {
|
||||
stack *s = s_new(0);
|
||||
struct stack *s = s_new(0);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, s);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(new[capacity = UINT64_MAX], {
|
||||
stack *s = s_new(UINT64_MAX);
|
||||
struct stack *s = s_new(UINT64_MAX);
|
||||
|
||||
cmc_assert_equals(ptr, NULL, s);
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(clear[count capacity], {
|
||||
stack *s = s_new(100);
|
||||
struct stack *s = s_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -51,7 +51,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(buffer_growth[capacity = 1], {
|
||||
stack *s = s_new(1);
|
||||
struct stack *s = s_new(1);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -65,7 +65,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push[count], {
|
||||
stack *s = s_new(100);
|
||||
struct stack *s = s_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -78,7 +78,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push[capacity], {
|
||||
stack *s = s_new(100);
|
||||
struct stack *s = s_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -91,7 +91,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(push[item preservation], {
|
||||
stack *s = s_new(100);
|
||||
struct stack *s = s_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -105,7 +105,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop[count], {
|
||||
stack *s = s_new(100);
|
||||
struct stack *s = s_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -120,7 +120,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop[capacity], {
|
||||
stack *s = s_new(100);
|
||||
struct stack *s = s_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -135,7 +135,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop[item preservation], {
|
||||
stack *s = s_new(100);
|
||||
struct stack *s = s_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -152,7 +152,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(pop[count = 0], {
|
||||
stack *s = s_new(100);
|
||||
struct stack *s = s_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -162,7 +162,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(top, {
|
||||
stack *s = s_new(100);
|
||||
struct stack *s = s_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -178,7 +178,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(top[count = 0], {
|
||||
stack *s = s_new(100);
|
||||
struct stack *s = s_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -192,7 +192,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(top[count = 1], {
|
||||
stack *s = s_new(100);
|
||||
struct stack *s = s_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -204,7 +204,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(contains, {
|
||||
stack *s = s_new(100);
|
||||
struct stack *s = s_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -218,7 +218,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(contains[count = 0], {
|
||||
stack *s = s_new(100);
|
||||
struct stack *s = s_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -228,7 +228,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(empty, {
|
||||
stack *s = s_new(100);
|
||||
struct stack *s = s_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -238,7 +238,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(empty[after_io], {
|
||||
stack *s = s_new(100);
|
||||
struct stack *s = s_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -250,7 +250,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(full, {
|
||||
stack *s = s_new(100);
|
||||
struct stack *s = s_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -263,7 +263,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(full[capacity = 1], {
|
||||
stack *s = s_new(1);
|
||||
struct stack *s = s_new(1);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -275,11 +275,11 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(iter_alloc, {
|
||||
stack *s = s_new(100);
|
||||
struct stack *s = s_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
stack_iter *iter = s_iter_new(s);
|
||||
struct stack_iter *iter = s_iter_new(s);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, iter);
|
||||
|
||||
@@ -288,11 +288,11 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(iter_init[count = 0], {
|
||||
stack *s = s_new(100);
|
||||
struct stack *s = s_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
stack_iter iter;
|
||||
struct stack_iter iter;
|
||||
|
||||
s_iter_init(&iter, s);
|
||||
|
||||
@@ -305,11 +305,11 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(iter_start[count = 0], {
|
||||
stack *s = s_new(100);
|
||||
struct stack *s = s_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
stack_iter iter;
|
||||
struct stack_iter iter;
|
||||
|
||||
s_iter_init(&iter, s);
|
||||
|
||||
@@ -319,11 +319,11 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(iter_end[count = 0], {
|
||||
stack *s = s_new(100);
|
||||
struct stack *s = s_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
stack_iter iter;
|
||||
struct stack_iter iter;
|
||||
|
||||
s_iter_init(&iter, s);
|
||||
|
||||
@@ -333,7 +333,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(iteration, {
|
||||
stack *s = s_new(100);
|
||||
struct stack *s = s_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -342,14 +342,14 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
|
||||
size_t total = 0;
|
||||
|
||||
for (stack_iter it = s->it_start(s); !s_iter_end(&it); s_iter_next(&it))
|
||||
for (struct stack_iter it = s->it_start(s); !s_iter_end(&it); s_iter_next(&it))
|
||||
{
|
||||
total += s_iter_value(&it);
|
||||
}
|
||||
|
||||
cmc_assert_equals(size_t, 20100, total);
|
||||
|
||||
for (stack_iter it = s->it_end(s); !s_iter_start(&it); s_iter_prev(&it))
|
||||
for (struct stack_iter it = s->it_end(s); !s_iter_start(&it); s_iter_prev(&it))
|
||||
{
|
||||
total += s_iter_value(&it);
|
||||
}
|
||||
@@ -360,7 +360,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(iteration[while loop], {
|
||||
stack *s = s_new(100);
|
||||
struct stack *s = s_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -368,7 +368,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
cmc_assert(s_push(s, i));
|
||||
|
||||
size_t total = 0;
|
||||
stack_iter it = s->it_start(s);
|
||||
struct stack_iter it = s->it_start(s);
|
||||
|
||||
do
|
||||
{
|
||||
@@ -390,19 +390,19 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(iteration[count = 1], {
|
||||
stack *s = s_new(100);
|
||||
struct stack *s = s_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
cmc_assert(s_push(s, 10));
|
||||
|
||||
size_t total = 0;
|
||||
|
||||
for (stack_iter it = s->it_start(s); !s_iter_end(&it); s_iter_next(&it))
|
||||
for (struct stack_iter it = s->it_start(s); !s_iter_end(&it); s_iter_next(&it))
|
||||
{
|
||||
total += s_iter_value(&it);
|
||||
}
|
||||
|
||||
for (stack_iter it = s->it_end(s); !s_iter_start(&it); s_iter_prev(&it))
|
||||
for (struct stack_iter it = s->it_end(s); !s_iter_start(&it); s_iter_prev(&it))
|
||||
{
|
||||
total += s_iter_value(&it);
|
||||
}
|
||||
@@ -413,7 +413,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(iteration[count = capacity], {
|
||||
stack *s = s_new(100);
|
||||
struct stack *s = s_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -424,14 +424,14 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
|
||||
size_t total = 0;
|
||||
|
||||
for (stack_iter it = s->it_start(s); !s_iter_end(&it); s_iter_next(&it))
|
||||
for (struct stack_iter it = s->it_start(s); !s_iter_end(&it); s_iter_next(&it))
|
||||
{
|
||||
total += s_iter_value(&it);
|
||||
}
|
||||
|
||||
cmc_assert_equals(size_t, 1000, total);
|
||||
|
||||
for (stack_iter it = s->it_end(s); !s_iter_start(&it); s_iter_prev(&it))
|
||||
for (struct stack_iter it = s->it_end(s); !s_iter_start(&it); s_iter_prev(&it))
|
||||
{
|
||||
total += *s_iter_rvalue(&it);
|
||||
}
|
||||
@@ -442,18 +442,18 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(iteration[to_start = it_start and to_end = it_end], {
|
||||
stack *s = s_new(100);
|
||||
struct stack *s = s_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
for (size_t i = 0; i < 50; i++)
|
||||
cmc_assert(s_push(s, i));
|
||||
|
||||
stack_iter it1;
|
||||
stack_iter it2;
|
||||
struct stack_iter it1;
|
||||
struct stack_iter it2;
|
||||
|
||||
memset(&it1, 0, sizeof(stack_iter));
|
||||
memset(&it2, 0, sizeof(stack_iter));
|
||||
memset(&it1, 0, sizeof(struct stack_iter));
|
||||
memset(&it2, 0, sizeof(struct stack_iter));
|
||||
|
||||
s_iter_init(&it2, s);
|
||||
|
||||
@@ -477,11 +477,11 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(iteration[boundaries count = 0], {
|
||||
stack *s = s_new(100);
|
||||
struct stack *s = s_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
stack_iter iter;
|
||||
struct stack_iter iter;
|
||||
s_iter_init(&iter, s);
|
||||
|
||||
s_iter_to_end(&iter);
|
||||
@@ -496,14 +496,14 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(iteration[boundaries count > 0], {
|
||||
stack *s = s_new(100);
|
||||
struct stack *s = s_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
for (size_t i = 0; i < 200; i++)
|
||||
cmc_assert(s_push(s, i));
|
||||
|
||||
stack_iter iter;
|
||||
struct stack_iter iter;
|
||||
s_iter_init(&iter, s);
|
||||
|
||||
s_iter_to_end(&iter);
|
||||
@@ -518,11 +518,11 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(iter_value[count = 0], {
|
||||
stack *s = s_new(100);
|
||||
struct stack *s = s_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
stack_iter iter;
|
||||
struct stack_iter iter;
|
||||
|
||||
s_iter_init(&iter, s);
|
||||
|
||||
@@ -532,11 +532,11 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(iter_rvalue[count = 0], {
|
||||
stack *s = s_new(100);
|
||||
struct stack *s = s_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
stack_iter iter;
|
||||
struct stack_iter iter;
|
||||
|
||||
s_iter_init(&iter, s);
|
||||
|
||||
@@ -546,7 +546,7 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(index, {
|
||||
stack *s = s_new(100);
|
||||
struct stack *s = s_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
@@ -557,24 +557,24 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
|
||||
size_t total = 0;
|
||||
|
||||
for (stack_iter it = s->it_start(s); false;)
|
||||
for (struct stack_iter it = s->it_start(s); false;)
|
||||
{
|
||||
cmc_assert_equals(size_t, 0, s_iter_index(&it));
|
||||
}
|
||||
|
||||
for (stack_iter it = s->it_start(s); false;)
|
||||
for (struct stack_iter it = s->it_start(s); false;)
|
||||
{
|
||||
cmc_assert_equals(size_t, s_count(s) - 1, s_iter_index(&it));
|
||||
}
|
||||
|
||||
for (stack_iter it = s->it_start(s); !s_iter_end(&it); s_iter_next(&it))
|
||||
for (struct stack_iter it = s->it_start(s); !s_iter_end(&it); s_iter_next(&it))
|
||||
{
|
||||
total += s_iter_index(&it);
|
||||
}
|
||||
|
||||
cmc_assert_equals(size_t, 45, total);
|
||||
|
||||
for (stack_iter it = s->it_end(s); !s_iter_start(&it); s_iter_prev(&it))
|
||||
for (struct stack_iter it = s->it_end(s); !s_iter_start(&it); s_iter_prev(&it))
|
||||
{
|
||||
total += s_iter_index(&it);
|
||||
}
|
||||
@@ -585,11 +585,11 @@ CMC_CREATE_UNIT(stack_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(index[count = 0], {
|
||||
stack *s = s_new(100);
|
||||
struct stack *s = s_new(100);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, s);
|
||||
|
||||
stack_iter iter;
|
||||
struct stack_iter iter;
|
||||
s_iter_init(&iter, s);
|
||||
|
||||
cmc_assert_equals(size_t, 0, s_iter_index(&iter));
|
||||
|
||||
@@ -9,7 +9,7 @@ CMC_GENERATE_TREEMAP(tm, treemap, size_t, size_t)
|
||||
|
||||
CMC_CREATE_UNIT(treemap_test, true, {
|
||||
CMC_CREATE_TEST(new, {
|
||||
treemap *map = tm_new(cmp);
|
||||
struct treemap *map = tm_new(cmp);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
@@ -17,7 +17,7 @@ CMC_CREATE_UNIT(treemap_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(clear[count], {
|
||||
treemap *map = tm_new(cmp);
|
||||
struct treemap *map = tm_new(cmp);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, map);
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ CMC_GENERATE_TREESET(ts, treeset, size_t)
|
||||
|
||||
CMC_CREATE_UNIT(treeset_test, true, {
|
||||
CMC_CREATE_TEST(new, {
|
||||
treeset *set = ts_new(cmp);
|
||||
struct treeset *set = ts_new(cmp);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
@@ -17,7 +17,7 @@ CMC_CREATE_UNIT(treeset_test, true, {
|
||||
});
|
||||
|
||||
CMC_CREATE_TEST(clear[count], {
|
||||
treeset *set = ts_new(cmp);
|
||||
struct treeset *set = ts_new(cmp);
|
||||
|
||||
cmc_assert_not_equals(ptr, NULL, set);
|
||||
|
||||
|
||||
Reference in new issue
Block a user