summaryrefslogtreecommitdiff
path: root/include/cmocka.h
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2014-04-10 11:22:16 +0200
committerAndreas Schneider <asn@cryptomilk.org>2014-04-10 11:22:16 +0200
commitf67534a5dab41134e1a117a49f438b8c9a89ae42 (patch)
tree0f5b3d3713502140146ad7acfd51f4788001a069 /include/cmocka.h
parent1704824a0b343a70ca8149a20dad36752cb3d341 (diff)
downloadcmocka-f67534a5dab41134e1a117a49f438b8c9a89ae42.tar.gz
cmocka-f67534a5dab41134e1a117a49f438b8c9a89ae42.tar.bz2
cmocka-f67534a5dab41134e1a117a49f438b8c9a89ae42.zip
cmocka: Add a dummy function for setup and teardown.
We need a matching number for setup and teardown functions else we can run in an assert. So this adds a dummy which doesn't do anything.
Diffstat (limited to 'include/cmocka.h')
-rw-r--r--include/cmocka.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/include/cmocka.h b/include/cmocka.h
index 9b85359..b107f9f 100644
--- a/include/cmocka.h
+++ b/include/cmocka.h
@@ -1319,6 +1319,10 @@ int run_test(#function);
#define run_test(f) _run_test(#f, f, NULL, UNIT_TEST_FUNCTION_TYPE_TEST, NULL)
#endif
+static inline void _unit_test_dummy(void **state) {
+ (void)state;
+}
+
/** Initializes a UnitTest structure. */
#define unit_test(f) { #f, f, UNIT_TEST_FUNCTION_TYPE_TEST }
@@ -1328,13 +1332,15 @@ int run_test(#function);
/** Initializes a UnitTest structure with a setup function. */
#define unit_test_setup(test, setup) \
_unit_test_setup(test, setup), \
- unit_test(test)
+ unit_test(test), \
+ _unit_test_teardown(test, _unit_test_dummy)
#define _unit_test_teardown(test, teardown) \
{ #test "_" #teardown, teardown, UNIT_TEST_FUNCTION_TYPE_TEARDOWN }
/** Initializes a UnitTest structure with a teardown function. */
#define unit_test_teardown(test, teardown) \
+ _unit_test_setup(test, _unit_test_dummy), \
unit_test(test), \
_unit_test_teardown(test, teardown)