diff --git "a/frameworks\\utest/source/default_handlers.cpp" "b/frameworks\\utest/source/default_handlers.cpp" index ad027b2afc..ce7d0792f1 100644 --- "a/frameworks\\utest/source/default_handlers.cpp" +++ "b/frameworks\\utest/source/default_handlers.cpp" @@ -21,30 +21,6 @@ using namespace mbed::test::v0; -const char* failureToString(failure_t failure) -{ - switch(failure) - { - case FAILURE_NONE: - return "No Failure"; - case FAILURE: - return "Unspecified Failure"; - case FAILURE_CASES: - return "Test Cases Failed"; - case FAILURE_EMPTY_CASE: - return "Test Case is Empty"; - case FAILURE_SETUP: - return "Setup Failed"; - case FAILURE_TEARDOWN: - return "Teardown Failed"; - case FAILURE_TIMEOUT: - return "Timed Out"; - case FAILURE_ASSERTION: - return "Assertion Failed"; - } - return "Unknown Failure"; -} - status_t mbed::test::v0::verbose_test_setup_handler(const size_t number_of_cases) { printf(">>> Running %u test cases...\n", number_of_cases); @@ -57,7 +33,7 @@ void mbed::test::v0::verbose_test_teardown_handler(const size_t passed, const si if (failure == FAILURE_NONE) { printf("\n"); } else { - printf(" with reason '%s'\n", failureToString(failure)); + printf(" with reason '%s'\n", stringify(failure)); } if (failed) printf(">>> TESTS FAILED!\n"); } @@ -74,7 +50,7 @@ status_t mbed::test::v0::verbose_case_teardown_handler(const Case *const source, if (failure == FAILURE_NONE) { printf("\n"); } else { - printf(" with reason '%s'\n", failureToString(failure)); + printf(" with reason '%s'\n", stringify(failure)); } return STATUS_CONTINUE; } @@ -84,7 +60,7 @@ status_t mbed::test::v0::verbose_case_failure_handler(const Case *const /*source if (reason == FAILURE_ASSERTION) { printf("\n"); } else { - printf(">>> failed with reason '%s'\n", failureToString(reason)); + printf(">>> failed with reason '%s'\n", stringify(reason)); } return (reason == FAILURE_TEARDOWN) ? STATUS_ABORT : STATUS_CONTINUE; } diff --git "a/frameworks\\utest/source/types.cpp" "b/frameworks\\utest/source/types.cpp" new file mode 100644 index 0000000000..9c08fb95bb --- /dev/null +++ "b/frameworks\\utest/source/types.cpp" @@ -0,0 +1,43 @@ +/**************************************************************************** + * Copyright (c) 2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **************************************************************************** + */ + + #include "mbed-test-async/types.h" + +const char* mbed::test::v0::stringify(mbed::test::v0::failure_t failure) +{ + switch(failure) + { + case FAILURE_NONE: + return "No Failure"; + case FAILURE: + return "Unspecified Failure"; + case FAILURE_CASES: + return "Test Cases Failed"; + case FAILURE_EMPTY_CASE: + return "Test Case is Empty"; + case FAILURE_SETUP: + return "Setup Failed"; + case FAILURE_TEARDOWN: + return "Teardown Failed"; + case FAILURE_TIMEOUT: + return "Timed Out"; + case FAILURE_ASSERTION: + return "Assertion Failed"; + } + return "Unknown Failure"; +}