Added preview of bidimap

This commit is contained in:
Leonardo committed 2019-10-14 22:37:39 -03:00
1 parent e41fe14502
commit 1f11b6d2da
4 files changed
+932 -3

No files matched your search

+2
View File
@@ -11,6 +11,7 @@
#include "unt/treemap.c"
#include "unt/treeset.c"
#include "unt/bidimap.c"
#include "unt/intervalheap.c"
#include "unt/multimap.c"
#include "unt/multiset.c"
@@ -35,6 +36,7 @@ int main(void)
failed += treeset_test();
/* ext */
failed += bidimap_test();
failed += intervalheap_test();
failed += multimap_test();
failed += multiset_test();
+35
View File
@@ -0,0 +1,35 @@
#include "utl.c"
#include <utl/assert.h>
#include <utl/log.h>
#include <utl/test.h>
#include <ext/bidimap.h>
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);
cmc_assert_not_equals(ptr, NULL, map);
bm_free(map, NULL);
});
CMC_CREATE_TEST(clear[count], {
bidimap *map = bm_new(100, 0.6, cmp, hash, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
for (size_t i = 0; i < 50; i++)
cmc_assert(bm_insert(map, i, i));
cmc_assert_equals(size_t, 50, bm_count(map));
bm_clear(map, NULL);
cmc_assert_equals(size_t, 0, bm_count(map));
bm_free(map, NULL);
});
});