mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #102 from adbridge/utest_namespace
Added full namespacing to instances of status_t to prevent namespace
commit
c24e3e4178
|
@ -46,7 +46,7 @@ static void test_failure_handler(const failure_t failure) {
|
|||
}
|
||||
|
||||
// --- VERBOSE TEST HANDLERS ---
|
||||
status_t utest::v1::verbose_test_setup_handler(const size_t number_of_cases)
|
||||
utest::v1::status_t utest::v1::verbose_test_setup_handler(const size_t number_of_cases)
|
||||
{
|
||||
UTEST_LOG_FUNCTION
|
||||
printf(">>> Running %u test cases...\n", number_of_cases);
|
||||
|
@ -72,14 +72,14 @@ void utest::v1::verbose_test_failure_handler(const failure_t failure)
|
|||
}
|
||||
|
||||
// --- VERBOSE CASE HANDLERS ---
|
||||
status_t utest::v1::verbose_case_setup_handler(const Case *const source, const size_t index_of_case)
|
||||
utest::v1::status_t utest::v1::verbose_case_setup_handler(const Case *const source, const size_t index_of_case)
|
||||
{
|
||||
UTEST_LOG_FUNCTION
|
||||
printf("\n>>> Running case #%u: '%s'...\n", index_of_case + 1, source->get_description());
|
||||
return STATUS_CONTINUE;
|
||||
}
|
||||
|
||||
status_t utest::v1::verbose_case_teardown_handler(const Case *const source, const size_t passed, const size_t failed, const failure_t failure)
|
||||
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)
|
||||
{
|
||||
UTEST_LOG_FUNCTION
|
||||
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
|
|||
return STATUS_CONTINUE;
|
||||
}
|
||||
|
||||
status_t utest::v1::verbose_case_failure_handler(const Case *const /*source*/, const failure_t failure)
|
||||
utest::v1::status_t utest::v1::verbose_case_failure_handler(const Case *const /*source*/, const failure_t failure)
|
||||
{
|
||||
UTEST_LOG_FUNCTION
|
||||
if (!(failure.reason & REASON_ASSERTION)) {
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
using namespace utest::v1;
|
||||
|
||||
static status_t unknown_test_setup_handler(const size_t);
|
||||
static utest::v1::status_t unknown_test_setup_handler(const size_t);
|
||||
static void selftest_failure_handler(const failure_t);
|
||||
static void test_failure_handler(const failure_t);
|
||||
|
||||
|
@ -57,7 +57,7 @@ const handlers_t utest::v1::selftest_handlers = {
|
|||
|
||||
|
||||
// --- SPECIAL HANDLERS ---
|
||||
static status_t unknown_test_setup_handler(const size_t) {
|
||||
static utest::v1::status_t unknown_test_setup_handler(const size_t) {
|
||||
UTEST_LOG_FUNCTION
|
||||
printf(">>> I do not know how to tell greentea that the test started, since\n");
|
||||
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) {
|
|||
}
|
||||
|
||||
// --- GREENTEA HANDLERS ---
|
||||
status_t utest::v1::greentea_test_setup_handler(const size_t number_of_cases)
|
||||
utest::v1::status_t utest::v1::greentea_test_setup_handler(const size_t number_of_cases)
|
||||
{
|
||||
UTEST_LOG_FUNCTION
|
||||
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)
|
|||
}
|
||||
|
||||
// --- GREENTEA CASE HANDLERS ---
|
||||
status_t utest::v1::greentea_case_setup_handler(const Case *const source, const size_t index_of_case)
|
||||
utest::v1::status_t utest::v1::greentea_case_setup_handler(const Case *const source, const size_t index_of_case)
|
||||
{
|
||||
UTEST_LOG_FUNCTION
|
||||
status_t status = verbose_case_setup_handler(source, index_of_case);
|
||||
utest::v1::status_t status = verbose_case_setup_handler(source, index_of_case);
|
||||
greentea_send_kv(TEST_ENV_TESTCASE_START, source->get_description());
|
||||
return status;
|
||||
}
|
||||
|
||||
status_t utest::v1::greentea_case_teardown_handler(const Case *const source, const size_t passed, const size_t failed, const failure_t failure)
|
||||
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)
|
||||
{
|
||||
UTEST_LOG_FUNCTION
|
||||
greentea_send_kv(TEST_ENV_TESTCASE_FINISH, source->get_description(), passed, failed);
|
||||
return verbose_case_teardown_handler(source, passed, failed, failure);
|
||||
}
|
||||
|
||||
status_t utest::v1::greentea_case_failure_abort_handler(const Case *const source, const failure_t failure)
|
||||
utest::v1::status_t utest::v1::greentea_case_failure_abort_handler(const Case *const source, const failure_t failure)
|
||||
{
|
||||
UTEST_LOG_FUNCTION
|
||||
status_t status = verbose_case_failure_handler(source, failure);
|
||||
utest::v1::status_t status = verbose_case_failure_handler(source, failure);
|
||||
return (status == STATUS_IGNORE) ? STATUS_IGNORE : STATUS_ABORT;
|
||||
}
|
||||
|
||||
status_t utest::v1::greentea_case_failure_continue_handler(const Case *const source, const failure_t failure)
|
||||
utest::v1::status_t utest::v1::greentea_case_failure_continue_handler(const Case *const source, const failure_t failure)
|
||||
{
|
||||
UTEST_LOG_FUNCTION
|
||||
return verbose_case_failure_handler(source, failure);
|
||||
|
|
|
@ -154,7 +154,7 @@ void Harness::raise_failure(const failure_reason_t reason)
|
|||
// this allows using unity assertion macros without setting up utest.
|
||||
if (test_cases == NULL) return;
|
||||
|
||||
status_t fail_status = STATUS_ABORT;
|
||||
utest::v1::status_t fail_status = STATUS_ABORT;
|
||||
{
|
||||
UTEST_ENTER_CRITICAL_SECTION;
|
||||
|
||||
|
@ -175,7 +175,7 @@ void Harness::raise_failure(const failure_reason_t reason)
|
|||
location_t fail_loc(location);
|
||||
location = LOCATION_CASE_TEARDOWN;
|
||||
|
||||
status_t teardown_status = handlers.case_teardown(case_current, case_passed, case_failed, failure_t(reason, fail_loc));
|
||||
utest::v1::status_t teardown_status = handlers.case_teardown(case_current, case_passed, case_failed, failure_t(reason, fail_loc));
|
||||
if (teardown_status < STATUS_CONTINUE) raise_failure(REASON_CASE_TEARDOWN);
|
||||
else if (teardown_status > signed(test_length)) raise_failure(REASON_CASE_INDEX);
|
||||
else if (teardown_status >= 0) case_index = teardown_status - 1;
|
||||
|
@ -205,7 +205,7 @@ void Harness::schedule_next_case()
|
|||
|
||||
if (handlers.case_teardown) {
|
||||
// printf("Schedule next case: case_passed = %d, case_failed = %d\n", case_passed, case_failed);
|
||||
status_t status = handlers.case_teardown(case_current, case_passed, case_failed,
|
||||
utest::v1::status_t status = handlers.case_teardown(case_current, case_passed, case_failed,
|
||||
case_failed ? failure_t(REASON_CASES, LOCATION_UNKNOWN) : failure_t(REASON_NONE));
|
||||
if (status < STATUS_CONTINUE) raise_failure(REASON_CASE_TEARDOWN);
|
||||
else if (status > signed(test_length)) raise_failure(REASON_CASE_INDEX);
|
||||
|
|
|
@ -126,34 +126,34 @@ namespace v1 {
|
|||
};
|
||||
|
||||
/// Prints the number of tests to run and continues.
|
||||
status_t verbose_test_setup_handler (const size_t number_of_cases);
|
||||
utest::v1::status_t verbose_test_setup_handler (const size_t number_of_cases);
|
||||
/// Prints the number of tests that passed and failed with a reason if provided.
|
||||
void verbose_test_teardown_handler(const size_t passed, const size_t failed, const failure_t failure);
|
||||
/// Prints the failure for `REASON_TEST_SETUP` and `REASON_TEST_TEARDOWN` and then dies.
|
||||
void verbose_test_failure_handler (const failure_t failure);
|
||||
|
||||
/// Prints the index and description of the case being run and continues.
|
||||
status_t verbose_case_setup_handler (const Case *const source, const size_t index_of_case);
|
||||
utest::v1::status_t verbose_case_setup_handler (const Case *const source, const size_t index_of_case);
|
||||
/// Prints the number of tests that passed and failed with a reason if provided within this case and continues.
|
||||
status_t verbose_case_teardown_handler(const Case *const source, const size_t passed, const size_t failed, const failure_t failure);
|
||||
utest::v1::status_t verbose_case_teardown_handler(const Case *const source, const size_t passed, const size_t failed, const failure_t failure);
|
||||
/// Prints the reason of the failure and continues, unless the teardown handler failed, for which it aborts.
|
||||
status_t verbose_case_failure_handler (const Case *const source, const failure_t reason);
|
||||
utest::v1::status_t verbose_case_failure_handler (const Case *const source, const failure_t reason);
|
||||
|
||||
/// Requests the start test case from greentea and continues.
|
||||
status_t greentea_test_setup_handler (const size_t number_of_cases);
|
||||
utest::v1::status_t greentea_test_setup_handler (const size_t number_of_cases);
|
||||
/// Reports the test results to greentea.
|
||||
void greentea_test_teardown_handler(const size_t passed, const size_t failed, const failure_t failure);
|
||||
/// Reports the failure for `REASON_TEST_SETUP` and `REASON_TEST_TEARDOWN` to greentea and then dies.
|
||||
void greentea_test_failure_handler (const failure_t failure);
|
||||
|
||||
/// Registers the test case setup with greentea.
|
||||
status_t greentea_case_setup_handler (const Case *const source, const size_t index_of_case);
|
||||
utest::v1::status_t greentea_case_setup_handler (const Case *const source, const size_t index_of_case);
|
||||
/// Registers the test case teardown with greentea.
|
||||
status_t greentea_case_teardown_handler(const Case *const source, const size_t passed, const size_t failed, const failure_t failure);
|
||||
utest::v1::status_t greentea_case_teardown_handler(const Case *const source, const size_t passed, const size_t failed, const failure_t failure);
|
||||
/// Reports the failure to greentea and then aborts.
|
||||
status_t greentea_case_failure_abort_handler (const Case *const source, const failure_t reason);
|
||||
utest::v1::status_t greentea_case_failure_abort_handler (const Case *const source, const failure_t reason);
|
||||
/// Reports the failure to greentea and then continues.
|
||||
status_t greentea_case_failure_continue_handler(const Case *const source, const failure_t reason);
|
||||
utest::v1::status_t greentea_case_failure_continue_handler(const Case *const source, const failure_t reason);
|
||||
|
||||
/// The verbose default handlers that always continue on failure
|
||||
extern const handlers_t verbose_continue_handlers;
|
||||
|
|
|
@ -111,7 +111,7 @@ namespace v1 {
|
|||
/// Stringifies a location.
|
||||
const char* stringify(location_t location);
|
||||
/// Stringifies a status.
|
||||
const char* stringify(status_t status);
|
||||
const char* stringify(utest::v1::status_t status);
|
||||
|
||||
/** Control class for specifying test case attributes
|
||||
*
|
||||
|
@ -231,7 +231,7 @@ namespace v1 {
|
|||
* You can return `STATUS_ABORT` if you initialization failed and the test teardown handler will
|
||||
* then be called with the `REASON_SETUP`.
|
||||
*/
|
||||
typedef status_t (*test_setup_handler_t)(const size_t number_of_cases);
|
||||
typedef utest::v1::status_t (*test_setup_handler_t)(const size_t number_of_cases);
|
||||
|
||||
/** Test teardown handler.
|
||||
*
|
||||
|
@ -270,7 +270,7 @@ namespace v1 {
|
|||
* failure handler with `REASON_SETUP` and then the case teardown handler with `REASON_SETUP`.
|
||||
* This gives the teardown handler a chance to clean up a failed setup.
|
||||
*/
|
||||
typedef status_t (*case_setup_handler_t)(const Case *const source, const size_t index_of_case);
|
||||
typedef utest::v1::status_t (*case_setup_handler_t)(const Case *const source, const size_t index_of_case);
|
||||
|
||||
/** Primitive test case handler
|
||||
*
|
||||
|
@ -316,7 +316,7 @@ namespace v1 {
|
|||
* You can return `STATUS_ABORT` to indicate that your teardown failed, which will call the case
|
||||
* failure handler with `REASON_TEARDOWN`.
|
||||
*/
|
||||
typedef status_t (*case_teardown_handler_t)(const Case *const source, const size_t passed, const size_t failed, const failure_t reason);
|
||||
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);
|
||||
|
||||
/** Test case failure handler.
|
||||
*
|
||||
|
@ -330,7 +330,7 @@ namespace v1 {
|
|||
* teardown handler with reason. If a failure occurs during teardown, the teardown will not be called again.
|
||||
* You may return `STATUS_IGNORE` which will cause the harness to ignore and not count the failure.
|
||||
*/
|
||||
typedef status_t (*case_failure_handler_t)(const Case *const source, const failure_t reason);
|
||||
typedef utest::v1::status_t (*case_failure_handler_t)(const Case *const source, const failure_t reason);
|
||||
|
||||
|
||||
// deprecations
|
||||
|
|
Loading…
Reference in New Issue