Changeset 9b20126 in mainline for uspace/lib/pcut/include/pcut/datadef.h
- Timestamp:
- 2014-09-19T08:23:01Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c85a57f
- Parents:
- 15d0046
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/pcut/include/pcut/datadef.h
r15d0046 r9b20126 39 39 /** @cond devel */ 40 40 41 #if defined(__GNUC__) || defined(__clang__) 42 #define PCUT_CC_UNUSED_VARIABLE(name, initializer) \ 43 name __attribute__((unused)) = initializer 44 #else 45 #define PCUT_CC_UNUSED_VARIABLE(name, initializer) \ 46 name = initializer 47 #endif 48 49 41 50 enum { 42 51 PCUT_KIND_SKIP, … … 54 63 }; 55 64 65 enum { 66 PCUT_MAIN_EXTRA_PREINIT_HOOK, 67 PCUT_MAIN_EXTRA_INIT_HOOK, 68 PCUT_MAIN_EXTRA_REPORT_XML, 69 PCUT_MAIN_EXTRA_LAST 70 }; 71 56 72 /** Generic wrapper for test cases, test suites etc. */ 57 73 typedef struct pcut_item pcut_item_t; … … 59 75 /** Extra information about a test. */ 60 76 typedef struct pcut_extra pcut_extra_t; 77 78 /** Extra information for the main() function. */ 79 typedef struct pcut_main_extra pcut_main_extra_t; 61 80 62 81 /** Test method type. */ … … 73 92 */ 74 93 int type; 75 union { 76 /** Test-specific time-out in seconds. */ 77 int timeout; 78 }; 94 /** Test-specific time-out in seconds. */ 95 int timeout; 96 }; 97 98 /** @copydoc pcut_main_extra_t */ 99 struct pcut_main_extra { 100 /** Discriminator for the union. 101 * 102 * Use PCUT_MAIN_EXTRA_* to determine which field of the union is used. 103 */ 104 int type; 105 /** Callback once PCUT initializes itself. */ 106 void (*init_hook)(void); 107 /** Callback even before command-line arguments are processed. */ 108 void (*preinit_hook)(int *, char ***); 79 109 }; 80 110 … … 89 119 int id; 90 120 91 /** Discriminator for the union. 92 * 93 * Use PCUT_KIND_* to determine which field of the union is used. 94 */ 121 /** Discriminator for this item. */ 95 122 int kind; 96 union { 97 struct { 98 const char *name; 99 pcut_setup_func_t setup; 100 pcut_setup_func_t teardown; 101 } suite; 102 struct { 103 const char *name; 104 pcut_test_func_t func; 105 pcut_extra_t *extras; 106 } test; 107 /* setup is used for both set-up and tear-down */ 108 struct { 109 pcut_setup_func_t func; 110 } setup; 111 struct { 112 pcut_item_t *last; 113 } nested; 114 struct { 115 int dummy; 116 } meta; 117 }; 123 124 /** Name of this item. */ 125 const char *name; 126 127 /** Test-case function. */ 128 pcut_test_func_t test_func; 129 130 /** Set-up function of a suite. */ 131 pcut_setup_func_t setup_func; 132 /** Tear-down function of a suite. */ 133 pcut_setup_func_t teardown_func; 134 135 /** Extra attributes. */ 136 pcut_extra_t *extras; 137 138 /** Extra attributes for main() function. */ 139 pcut_main_extra_t *main_extras; 140 141 /** Nested lists. */ 142 pcut_item_t *nested; 118 143 }; 119 120 #ifdef PCUT_DEBUG_BUILD121 #define PCUT_DEBUG(msg, ...) \122 printf("[PCUT]: Debug: " msg "\n", ##__VA_ARGS__)123 #else124 125 /** Debug printing.126 *127 * By default, this macro does nothing. Define PCUT_DEBUG_BUILD to128 * actually print the messages to the console.129 *130 * @param msg Printf-like formatting message.131 * @param ... Extra arguments for printf.132 */133 #define PCUT_DEBUG(msg, ...) (void)0134 #endif135 144 136 145 /** @endcond */
Note:
See TracChangeset
for help on using the changeset viewer.