summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2013-07-29 19:35:34 +0200
committerAndreas Schneider <asn@cryptomilk.org>2013-07-29 19:40:12 +0200
commitd684142a3c8147daafe51686243536212a753c96 (patch)
tree49609c55a1c4c40e35947b6ba049e6a663e8ef7f
parentc69d643581fd9eea780429a0fb77fb8993181044 (diff)
downloadcmocka-d684142a3c8147daafe51686243536212a753c96.tar.gz
cmocka-d684142a3c8147daafe51686243536212a753c96.tar.bz2
cmocka-d684142a3c8147daafe51686243536212a753c96.zip
include: Correctly define unit_test_setup() and unit_test_teardown().
Thanks to James Grenning <james@grenning.net>.
-rw-r--r--include/cmocka.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/include/cmocka.h b/include/cmocka.h
index 985f246..9cd37ea 100644
--- a/include/cmocka.h
+++ b/include/cmocka.h
@@ -1299,22 +1299,31 @@ int run_test(#function);
/** Initializes a UnitTest structure. */
#define unit_test(f) { #f, f, UNIT_TEST_FUNCTION_TYPE_TEST }
+#define _unit_test_setup(test, setup) \
+ { #test "_" #setup, setup, UNIT_TEST_FUNCTION_TYPE_SETUP }
+
/** Initializes a UnitTest structure with a setup function. */
#define unit_test_setup(test, setup) \
- { #test "_" #setup, setup, UNIT_TEST_FUNCTION_TYPE_SETUP }
+ _unit_test_setup(test, setup), \
+ unit_test(test)
+
+#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) \
- { #test "_" #teardown, teardown, UNIT_TEST_FUNCTION_TYPE_TEARDOWN }
+ _unit_test_setup(test, setup), \
+ unit_test(test), \
+ _unit_test_teardown(test, teardown)
/**
* Initialize an array of UnitTest structures with a setup function for a test
* and a teardown function. Either setup or teardown can be NULL.
*/
#define unit_test_setup_teardown(test, setup, teardown) \
- unit_test_setup(test, setup), \
+ _unit_test_setup(test, setup), \
unit_test(test), \
- unit_test_teardown(test, teardown)
+ _unit_test_teardown(test, teardown)
#ifdef DOXYGEN
/**