Add more tests

This commit is contained in:
Patrick Pelissier committed 2018-04-07 11:19:58 +02:00
1 parent 930a3c8637
commit 44209ed93e
2 files changed
+16 -1

No files matched your search

+1
View File
@@ -143,6 +143,7 @@
\
static inline bool M_C(name, _is_leaf)(node_t n) \
{ \
/* We consider the empty node as a leaf */ \
return n->num <= 0; \
} \
\
+15 -1
View File
@@ -136,9 +136,23 @@ static void test1(void)
btree_clear(b);
}
static void test2(void)
{
btree_t b;
btree_init(b);
for(int i = 0; i < 10; i++)
btree_set_at(b, i, 100*i);
for(int i = 0; i < 10; i++)
assert (*btree_cget(b, i) == 100*i);
btree_clean(b);
assert (btree_size(b) == 0);
assert (btree_empty_p(b));
btree_clear(b);
}
int main(void)
{
test1();
test2();
exit(0);
}