summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/main.c1
-rw-r--r--tests/mock_queue.c14
-rw-r--r--tests/tests.h1
3 files changed, 16 insertions, 0 deletions
diff --git a/tests/main.c b/tests/main.c
index f3f1f06..44dd6a4 100644
--- a/tests/main.c
+++ b/tests/main.c
@@ -23,6 +23,7 @@ int main()
run_test(test_mock_enqueue_dequeue_heterogenous);
run_test(test_LILY_NARGS);
run_test(test_lily_mock_call);
+ run_test(test_lily_mock_use);
return 0;
}
diff --git a/tests/mock_queue.c b/tests/mock_queue.c
index 493d397..07a5379 100644
--- a/tests/mock_queue.c
+++ b/tests/mock_queue.c
@@ -118,3 +118,17 @@ const char* test_lily_mock_call()
lily_mock_destroy(m);
return 0;
}
+
+
+const char * test_lily_mock_use()
+{
+ lily_mock_t *m = NULL;
+ lily_mock_use(&m);
+ if (m == NULL) return "m was still null!";
+ m->n_calls = 5;
+ lily_mock_use(&m);
+ if (m == NULL) return "m was later null!";
+ if (m->n_calls != 0) return "m was not re-allocated!";
+ lily_mock_destroy(m);
+ return 0;
+}
diff --git a/tests/tests.h b/tests/tests.h
index 9584cac..cbee06e 100644
--- a/tests/tests.h
+++ b/tests/tests.h
@@ -22,5 +22,6 @@ const char* test_mock_enqueue_dequeue_int();
const char* test_mock_enqueue_dequeue_heterogenous();
const char* test_LILY_NARGS();
const char* test_lily_mock_call();
+const char* test_lily_mock_use();
#endif