summaryrefslogtreecommitdiff
path: root/tests/sptree.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/sptree.c')
-rw-r--r--tests/sptree.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/sptree.c b/tests/sptree.c
index b8d1e5a..6ab3d6a 100644
--- a/tests/sptree.c
+++ b/tests/sptree.c
@@ -1,16 +1,34 @@
#include <assert.h>
#include <stdio.h>
+#include "test.h"
+/* required defs */
#define SPTREE_TYPE int
#define SPTREE_CMP(a, b) ((b) - (a))
#define SPTREE_NAME ints
+
+/* optional defs */
+#define SPTREE_MALLOC mallocc
+#define SPTREE_CALLOC callocc
+#define SPTREE_REALLOC reallocc
+#define SPTREE_FREE free
+
#include <conts/sptree.h>
int main()
{
+#if defined(COVERAGE)
+ assert(!covsrv_init());
+ atexit(covsrv_destroy);
+#endif
+
struct ints ints = ints_create();
for (int i = 0; i < 1000000; ++i) {
- ints_insert(&ints, i);
+ if (!ints_insert(&ints, i)) {
+ fprintf(stderr, "failed inserting %d\n", i);
+ ints_destroy(&ints);
+ return -1;
+ }
}
assert(ints_len(&ints) == 1000000);