Skip to content

Commit 3de4514

Browse files
committed
Added full namespacing to instances of status_t to prevent namespace
collisions with the same type in global C namespace.
1 parent cde78ec commit 3de4514

File tree

5 files changed

+30
-30
lines changed

5 files changed

+30
-30
lines changed

frameworks/utest/source/default_handlers.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ static void test_failure_handler(const failure_t failure) {
4646
}
4747

4848
// --- VERBOSE TEST HANDLERS ---
49-
status_t utest::v1::verbose_test_setup_handler(const size_t number_of_cases)
49+
utest::v1::status_t utest::v1::verbose_test_setup_handler(const size_t number_of_cases)
5050
{
5151
UTEST_LOG_FUNCTION
5252
printf(">>> Running %u test cases...\n", number_of_cases);
@@ -72,14 +72,14 @@ void utest::v1::verbose_test_failure_handler(const failure_t failure)
7272
}
7373

7474
// --- VERBOSE CASE HANDLERS ---
75-
status_t utest::v1::verbose_case_setup_handler(const Case *const source, const size_t index_of_case)
75+
utest::v1::status_t utest::v1::verbose_case_setup_handler(const Case *const source, const size_t index_of_case)
7676
{
7777
UTEST_LOG_FUNCTION
7878
printf("\n>>> Running case #%u: '%s'...\n", index_of_case + 1, source->get_description());
7979
return STATUS_CONTINUE;
8080
}
8181

82-
status_t utest::v1::verbose_case_teardown_handler(const Case *const source, const size_t passed, const size_t failed, const failure_t failure)
82+
utest::v1::status_t utest::v1::verbose_case_teardown_handler(const Case *const source, const size_t passed, const size_t failed, const failure_t failure)
8383
{
8484
UTEST_LOG_FUNCTION
8585
printf(">>> '%s': %u passed, %u failed", source->get_description(), passed, failed);
@@ -91,7 +91,7 @@ status_t utest::v1::verbose_case_teardown_handler(const Case *const source, cons
9191
return STATUS_CONTINUE;
9292
}
9393

94-
status_t utest::v1::verbose_case_failure_handler(const Case *const /*source*/, const failure_t failure)
94+
utest::v1::status_t utest::v1::verbose_case_failure_handler(const Case *const /*source*/, const failure_t failure)
9595
{
9696
UTEST_LOG_FUNCTION
9797
if (!(failure.reason & REASON_ASSERTION)) {

frameworks/utest/source/greentea_handlers.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
using namespace utest::v1;
2525

26-
static status_t unknown_test_setup_handler(const size_t);
26+
static utest::v1::status_t unknown_test_setup_handler(const size_t);
2727
static void selftest_failure_handler(const failure_t);
2828
static void test_failure_handler(const failure_t);
2929

@@ -57,7 +57,7 @@ const handlers_t utest::v1::selftest_handlers = {
5757

5858

5959
// --- SPECIAL HANDLERS ---
60-
static status_t unknown_test_setup_handler(const size_t) {
60+
static utest::v1::status_t unknown_test_setup_handler(const size_t) {
6161
UTEST_LOG_FUNCTION
6262
printf(">>> I do not know how to tell greentea that the test started, since\n");
6363
printf(">>> you forgot to override the `test_setup_handler` in your specification.\n");
@@ -87,7 +87,7 @@ static void test_failure_handler(const failure_t failure) {
8787
}
8888

8989
// --- GREENTEA HANDLERS ---
90-
status_t utest::v1::greentea_test_setup_handler(const size_t number_of_cases)
90+
utest::v1::status_t utest::v1::greentea_test_setup_handler(const size_t number_of_cases)
9191
{
9292
UTEST_LOG_FUNCTION
9393
greentea_send_kv(TEST_ENV_TESTCASE_COUNT, number_of_cases);
@@ -110,29 +110,29 @@ void utest::v1::greentea_test_failure_handler(const failure_t failure)
110110
}
111111

112112
// --- GREENTEA CASE HANDLERS ---
113-
status_t utest::v1::greentea_case_setup_handler(const Case *const source, const size_t index_of_case)
113+
utest::v1::status_t utest::v1::greentea_case_setup_handler(const Case *const source, const size_t index_of_case)
114114
{
115115
UTEST_LOG_FUNCTION
116-
status_t status = verbose_case_setup_handler(source, index_of_case);
116+
utest::v1::status_t status = verbose_case_setup_handler(source, index_of_case);
117117
greentea_send_kv(TEST_ENV_TESTCASE_START, source->get_description());
118118
return status;
119119
}
120120

121-
status_t utest::v1::greentea_case_teardown_handler(const Case *const source, const size_t passed, const size_t failed, const failure_t failure)
121+
utest::v1::status_t utest::v1::greentea_case_teardown_handler(const Case *const source, const size_t passed, const size_t failed, const failure_t failure)
122122
{
123123
UTEST_LOG_FUNCTION
124124
greentea_send_kv(TEST_ENV_TESTCASE_FINISH, source->get_description(), passed, failed);
125125
return verbose_case_teardown_handler(source, passed, failed, failure);
126126
}
127127

128-
status_t utest::v1::greentea_case_failure_abort_handler(const Case *const source, const failure_t failure)
128+
utest::v1::status_t utest::v1::greentea_case_failure_abort_handler(const Case *const source, const failure_t failure)
129129
{
130130
UTEST_LOG_FUNCTION
131-
status_t status = verbose_case_failure_handler(source, failure);
131+
utest::v1::status_t status = verbose_case_failure_handler(source, failure);
132132
return (status == STATUS_IGNORE) ? STATUS_IGNORE : STATUS_ABORT;
133133
}
134134

135-
status_t utest::v1::greentea_case_failure_continue_handler(const Case *const source, const failure_t failure)
135+
utest::v1::status_t utest::v1::greentea_case_failure_continue_handler(const Case *const source, const failure_t failure)
136136
{
137137
UTEST_LOG_FUNCTION
138138
return verbose_case_failure_handler(source, failure);

frameworks/utest/source/harness.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ void Harness::raise_failure(const failure_reason_t reason)
154154
// this allows using unity assertion macros without setting up utest.
155155
if (test_cases == NULL) return;
156156

157-
status_t fail_status = STATUS_ABORT;
157+
utest::v1::status_t fail_status = STATUS_ABORT;
158158
{
159159
UTEST_ENTER_CRITICAL_SECTION;
160160

@@ -175,7 +175,7 @@ void Harness::raise_failure(const failure_reason_t reason)
175175
location_t fail_loc(location);
176176
location = LOCATION_CASE_TEARDOWN;
177177

178-
status_t teardown_status = handlers.case_teardown(case_current, case_passed, case_failed, failure_t(reason, fail_loc));
178+
utest::v1::status_t teardown_status = handlers.case_teardown(case_current, case_passed, case_failed, failure_t(reason, fail_loc));
179179
if (teardown_status < STATUS_CONTINUE) raise_failure(REASON_CASE_TEARDOWN);
180180
else if (teardown_status > signed(test_length)) raise_failure(REASON_CASE_INDEX);
181181
else if (teardown_status >= 0) case_index = teardown_status - 1;
@@ -205,7 +205,7 @@ void Harness::schedule_next_case()
205205

206206
if (handlers.case_teardown) {
207207
// printf("Schedule next case: case_passed = %d, case_failed = %d\n", case_passed, case_failed);
208-
status_t status = handlers.case_teardown(case_current, case_passed, case_failed,
208+
utest::v1::status_t status = handlers.case_teardown(case_current, case_passed, case_failed,
209209
case_failed ? failure_t(REASON_CASES, LOCATION_UNKNOWN) : failure_t(REASON_NONE));
210210
if (status < STATUS_CONTINUE) raise_failure(REASON_CASE_TEARDOWN);
211211
else if (status > signed(test_length)) raise_failure(REASON_CASE_INDEX);

frameworks/utest/utest/default_handlers.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -126,34 +126,34 @@ namespace v1 {
126126
};
127127

128128
/// Prints the number of tests to run and continues.
129-
status_t verbose_test_setup_handler (const size_t number_of_cases);
129+
utest::v1::status_t verbose_test_setup_handler (const size_t number_of_cases);
130130
/// Prints the number of tests that passed and failed with a reason if provided.
131131
void verbose_test_teardown_handler(const size_t passed, const size_t failed, const failure_t failure);
132132
/// Prints the failure for `REASON_TEST_SETUP` and `REASON_TEST_TEARDOWN` and then dies.
133133
void verbose_test_failure_handler (const failure_t failure);
134134

135135
/// Prints the index and description of the case being run and continues.
136-
status_t verbose_case_setup_handler (const Case *const source, const size_t index_of_case);
136+
utest::v1::status_t verbose_case_setup_handler (const Case *const source, const size_t index_of_case);
137137
/// Prints the number of tests that passed and failed with a reason if provided within this case and continues.
138-
status_t verbose_case_teardown_handler(const Case *const source, const size_t passed, const size_t failed, const failure_t failure);
138+
utest::v1::status_t verbose_case_teardown_handler(const Case *const source, const size_t passed, const size_t failed, const failure_t failure);
139139
/// Prints the reason of the failure and continues, unless the teardown handler failed, for which it aborts.
140-
status_t verbose_case_failure_handler (const Case *const source, const failure_t reason);
140+
utest::v1::status_t verbose_case_failure_handler (const Case *const source, const failure_t reason);
141141

142142
/// Requests the start test case from greentea and continues.
143-
status_t greentea_test_setup_handler (const size_t number_of_cases);
143+
utest::v1::status_t greentea_test_setup_handler (const size_t number_of_cases);
144144
/// Reports the test results to greentea.
145145
void greentea_test_teardown_handler(const size_t passed, const size_t failed, const failure_t failure);
146146
/// Reports the failure for `REASON_TEST_SETUP` and `REASON_TEST_TEARDOWN` to greentea and then dies.
147147
void greentea_test_failure_handler (const failure_t failure);
148148

149149
/// Registers the test case setup with greentea.
150-
status_t greentea_case_setup_handler (const Case *const source, const size_t index_of_case);
150+
utest::v1::status_t greentea_case_setup_handler (const Case *const source, const size_t index_of_case);
151151
/// Registers the test case teardown with greentea.
152-
status_t greentea_case_teardown_handler(const Case *const source, const size_t passed, const size_t failed, const failure_t failure);
152+
utest::v1::status_t greentea_case_teardown_handler(const Case *const source, const size_t passed, const size_t failed, const failure_t failure);
153153
/// Reports the failure to greentea and then aborts.
154-
status_t greentea_case_failure_abort_handler (const Case *const source, const failure_t reason);
154+
utest::v1::status_t greentea_case_failure_abort_handler (const Case *const source, const failure_t reason);
155155
/// Reports the failure to greentea and then continues.
156-
status_t greentea_case_failure_continue_handler(const Case *const source, const failure_t reason);
156+
utest::v1::status_t greentea_case_failure_continue_handler(const Case *const source, const failure_t reason);
157157

158158
/// The verbose default handlers that always continue on failure
159159
extern const handlers_t verbose_continue_handlers;

frameworks/utest/utest/types.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ namespace v1 {
111111
/// Stringifies a location.
112112
const char* stringify(location_t location);
113113
/// Stringifies a status.
114-
const char* stringify(status_t status);
114+
const char* stringify(utest::v1::status_t status);
115115

116116
/** Control class for specifying test case attributes
117117
*
@@ -231,7 +231,7 @@ namespace v1 {
231231
* You can return `STATUS_ABORT` if you initialization failed and the test teardown handler will
232232
* then be called with the `REASON_SETUP`.
233233
*/
234-
typedef status_t (*test_setup_handler_t)(const size_t number_of_cases);
234+
typedef utest::v1::status_t (*test_setup_handler_t)(const size_t number_of_cases);
235235

236236
/** Test teardown handler.
237237
*
@@ -270,7 +270,7 @@ namespace v1 {
270270
* failure handler with `REASON_SETUP` and then the case teardown handler with `REASON_SETUP`.
271271
* This gives the teardown handler a chance to clean up a failed setup.
272272
*/
273-
typedef status_t (*case_setup_handler_t)(const Case *const source, const size_t index_of_case);
273+
typedef utest::v1::status_t (*case_setup_handler_t)(const Case *const source, const size_t index_of_case);
274274

275275
/** Primitive test case handler
276276
*
@@ -316,7 +316,7 @@ namespace v1 {
316316
* You can return `STATUS_ABORT` to indicate that your teardown failed, which will call the case
317317
* failure handler with `REASON_TEARDOWN`.
318318
*/
319-
typedef status_t (*case_teardown_handler_t)(const Case *const source, const size_t passed, const size_t failed, const failure_t reason);
319+
typedef utest::v1::status_t (*case_teardown_handler_t)(const Case *const source, const size_t passed, const size_t failed, const failure_t reason);
320320

321321
/** Test case failure handler.
322322
*
@@ -330,7 +330,7 @@ namespace v1 {
330330
* teardown handler with reason. If a failure occurs during teardown, the teardown will not be called again.
331331
* You may return `STATUS_IGNORE` which will cause the harness to ignore and not count the failure.
332332
*/
333-
typedef status_t (*case_failure_handler_t)(const Case *const source, const failure_t reason);
333+
typedef utest::v1::status_t (*case_failure_handler_t)(const Case *const source, const failure_t reason);
334334

335335

336336
// deprecations

0 commit comments

Comments
 (0)