From 4140df5bfc3e92c25ae815387d8b012b0e8fee52 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Fri, 24 Feb 2023 19:56:56 +0100 Subject: [PATCH] Improve test suite --- tests/test-mrbtree.c | 2 ++ tests/test-msnapshot.c | 7 +++++++ tests/test-mtree.c | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/test-mrbtree.c b/tests/test-mrbtree.c index f8c27918..fe3b6cf3 100644 --- a/tests/test-mrbtree.c +++ b/tests/test-mrbtree.c @@ -98,6 +98,7 @@ static void test_uint(void) for M_EACH(item, tree, UINT_OPLIST) { assert (*item == tab2[k] ); k ++; + assert(k <= 2); } assert(k == 2); @@ -109,6 +110,7 @@ static void test_uint(void) for M_EACH(item, tree, UINT_OPLIST) { assert (*item == tab3[k] ); k ++; + assert(k <= 3); } assert(k == 3); diff --git a/tests/test-msnapshot.c b/tests/test-msnapshot.c index edbc8722..63374501 100644 --- a/tests/test-msnapshot.c +++ b/tests/test-msnapshot.c @@ -354,7 +354,9 @@ static void test_double(void) double *p = SnapshotDouble_get_write_buffer(s); *p = 42.0; p = SnapshotDouble_write(s); + assert(p != NULL); const double *q = SnapshotDouble_read(s); + assert(q != NULL); assert (*q == 42.0); SnapshotDouble_clear(s); } @@ -364,9 +366,12 @@ static void test_doubleSPMC(void) SnapshotDoubleSPMC s; SnapshotDoubleSPMC_init(s, 1); double *p = SnapshotDoubleSPMC_get_write_buffer(s); + assert(p != NULL); *p = 42.0; p = SnapshotDoubleSPMC_write(s); + assert(p != NULL); const double *q = SnapshotDoubleSPMC_read_start(s); + assert(q != NULL); assert (*q == 42.0); SnapshotDoubleSPMC_read_end(s, q); SnapshotDoubleSPMC_clear(s); @@ -377,9 +382,11 @@ static void test_doubleMPMC(void) SnapshotDoubleMPMC s; SnapshotDoubleMPMC_init(s, 1, 1); double *p = SnapshotDoubleMPMC_write_start(s); + assert(p != NULL); *p = 42.0; SnapshotDoubleMPMC_write_end(s, p); const double *q = SnapshotDoubleMPMC_read_start(s); + assert(q != NULL); assert (*q == 42.0); SnapshotDoubleMPMC_read_end(s, q); SnapshotDoubleMPMC_clear(s); diff --git a/tests/test-mtree.c b/tests/test-mtree.c index 7b1cb0bf..06f54d27 100644 --- a/tests/test-mtree.c +++ b/tests/test-mtree.c @@ -467,7 +467,7 @@ static void test_io(void) tree_insert_down(root, 1); tree_insert_left(it, 3); tree_it_t it4 = tree_insert_right(it, 4); - root = tree_insert_up(root, -1); + tree_insert_up(root, -1); tree_insert_up(it, 5); tree_insert_child(it4, 6); tree_it_t it7 = tree_insert_child(it4, 7);