Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | mjames | 1 | #ifndef _JTEST_GROUP_H_ |
2 | #define _JTEST_GROUP_H_ |
||
3 | |||
4 | /*--------------------------------------------------------------------------------*/ |
||
5 | /* Includes */ |
||
6 | /*--------------------------------------------------------------------------------*/ |
||
7 | |||
8 | #include "jtest_pf.h" |
||
9 | #include "jtest_util.h" |
||
10 | |||
11 | /*--------------------------------------------------------------------------------*/ |
||
12 | /* Type Definitions */ |
||
13 | /*--------------------------------------------------------------------------------*/ |
||
14 | |||
15 | /** |
||
16 | * A struct which represents a group of #JTEST_TEST_t structs. This struct is |
||
17 | * used to run the group of tests, and report on their outcomes. |
||
18 | */ |
||
19 | typedef struct JTEST_GROUP_struct |
||
20 | { |
||
21 | void (* group_fn_ptr) (void); /**< Pointer to the test group */ |
||
22 | char * name_str; /**< Name of the group */ |
||
23 | |||
24 | /* Extend the #JTEST_GROUP_t with Pass/Fail information.*/ |
||
25 | JTEST_PF_MEMBERS; |
||
26 | } JTEST_GROUP_t; |
||
27 | |||
28 | /*--------------------------------------------------------------------------------*/ |
||
29 | /* Macros and Defines */ |
||
30 | /*--------------------------------------------------------------------------------*/ |
||
31 | |||
32 | /** |
||
33 | * Set the name of JTEST_GROUP_t. |
||
34 | */ |
||
35 | #define JTEST_GROUP_SET_NAME(group_ptr, name) \ |
||
36 | JTEST_SET_STRUCT_ATTRIBUTE(group_ptr, name_str, name) |
||
37 | |||
38 | #define JTEST_GROUP_SET_FN(group_ptr, fn_ptr) \ |
||
39 | JTEST_SET_STRUCT_ATTRIBUTE(group_ptr, group_fn_ptr, fn_ptr) |
||
40 | |||
41 | /** |
||
42 | * Increment the number of tests passed in the JTEST_GROUP_t pointed to by |
||
43 | * group_ptr. |
||
44 | */ |
||
45 | #define JTEST_GROUP_INC_PASSED(group_ptr, amount) \ |
||
46 | JTEST_PF_INC_PASSED(group_ptr, amount) |
||
47 | |||
48 | /** |
||
49 | * Increment the number of tests failed in the JTEST_GROUP_t pointed to by |
||
50 | * group_ptr. |
||
51 | */ |
||
52 | #define JTEST_GROUP_INC_FAILED(group_ptr, amount) \ |
||
53 | JTEST_PF_INC_FAILED(group_ptr, amount) |
||
54 | |||
55 | /** |
||
56 | * Reset the pass/fail information of the #JTEST_GROUP_t pointed to by |
||
57 | * group_ptr. |
||
58 | */ |
||
59 | #define JTEST_GROUP_RESET_PF(group_ptr) \ |
||
60 | do \ |
||
61 | { \ |
||
62 | JTEST_PF_RESET_PASSED(group_ptr); \ |
||
63 | JTEST_PF_RESET_FAILED(group_ptr); \ |
||
64 | } while (0) |
||
65 | |||
66 | #endif /* _JTEST_GROUP_H_ */ |