/[ascend]/branches/shaun/test/common.h
ViewVC logotype

Contents of /branches/shaun/test/common.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2825 - (show annotations) (download) (as text)
Tue Feb 17 06:57:06 2015 UTC (7 years, 9 months ago) by jpye
File MIME type: text/x-chdr
File size: 1064 byte(s)
branch for shaun

1 #ifndef TEST_CONFIG_H
2 #define TEST_CONFIG_H
3
4 #include "CUnit/CUnit.h"
5 #include "test_globals.h"
6
7 #define DEFINE_SUITE_SIMPLE(NAME) \
8 int res = 0; \
9 CU_pSuite s = CU_add_suite(#NAME,NULL,NULL); \
10 if(NULL == s){ \
11 return CUE_NOSUITE; \
12 } \
13
14 #define ADD_TEST_SIMPLE(NAME) \
15 res = res || (NULL == CU_add_test(s, #NAME, test_##NAME));
16
17 #define SUITE_DONE \
18 if(res){ \
19 return CUE_NOTEST; \
20 } \
21 return CUE_SUCCESS;
22
23 /* register tests that don't need Init/Clean/SetUp/TearDown routines */
24 #define REGISTER_TESTS_SIMPLE(SUITE,TESTS) \
25 CU_ErrorCode test_register_##SUITE(void){ \
26 DEFINE_SUITE_SIMPLE(SUITE); \
27 TESTS(ADD_TEST_SIMPLE) \
28 SUITE_DONE; \
29 }
30
31 #define PROTO(SUITE,NAME) CU_ErrorCode test_register_##SUITE##_##NAME(void);
32
33 #define TESTREGISTER(SUITE,NAME) test_register_##SUITE##_##NAME()
34
35 #define PROTO_SUITE(SUITE) CU_ErrorCode test_register_##SUITE(void);
36
37 #define REGISTER_SUITE(SUITENAME,TESTS) \
38 CU_ErrorCode test_register_##SUITENAME(void){ \
39 CU_ErrorCode result = CUE_SUCCESS; \
40 TESTS(REGISTER_TEST) \
41 return result; \
42 }
43
44 #endif
45

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22