5.2.1 - Updated I2C files
Dependents: mbed-TFT-example-NCS36510 mbed-Accelerometer-example-NCS36510 mbed-Accelerometer-example-NCS36510
TESTS/mbedmicro-mbed/attributes/main.cpp@0:098463de4c5d, 2017-01-25 (annotated)
- Committer:
- group-onsemi
- Date:
- Wed Jan 25 20:34:15 2017 +0000
- Revision:
- 0:098463de4c5d
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
group-onsemi | 0:098463de4c5d | 1 | #include <stdio.h> |
group-onsemi | 0:098463de4c5d | 2 | #include <stdint.h> |
group-onsemi | 0:098463de4c5d | 3 | |
group-onsemi | 0:098463de4c5d | 4 | #include "toolchain.h" |
group-onsemi | 0:098463de4c5d | 5 | #include "greentea-client/test_env.h" |
group-onsemi | 0:098463de4c5d | 6 | #include "unity.h" |
group-onsemi | 0:098463de4c5d | 7 | #include "utest.h" |
group-onsemi | 0:098463de4c5d | 8 | |
group-onsemi | 0:098463de4c5d | 9 | using namespace utest::v1; |
group-onsemi | 0:098463de4c5d | 10 | |
group-onsemi | 0:098463de4c5d | 11 | |
group-onsemi | 0:098463de4c5d | 12 | // Test functions declared as C functions to avoid issues with name mangling |
group-onsemi | 0:098463de4c5d | 13 | extern "C" { |
group-onsemi | 0:098463de4c5d | 14 | int testPacked(); |
group-onsemi | 0:098463de4c5d | 15 | int testAlign(); |
group-onsemi | 0:098463de4c5d | 16 | int testUnused(); |
group-onsemi | 0:098463de4c5d | 17 | int testWeak(); |
group-onsemi | 0:098463de4c5d | 18 | int testPure(); |
group-onsemi | 0:098463de4c5d | 19 | int testForceInline(); |
group-onsemi | 0:098463de4c5d | 20 | int testNoReturn(); |
group-onsemi | 0:098463de4c5d | 21 | int testUnreachable(); |
group-onsemi | 0:098463de4c5d | 22 | int testDeprecated(); |
group-onsemi | 0:098463de4c5d | 23 | } |
group-onsemi | 0:098463de4c5d | 24 | |
group-onsemi | 0:098463de4c5d | 25 | |
group-onsemi | 0:098463de4c5d | 26 | // Test wrapper and test cases for utest |
group-onsemi | 0:098463de4c5d | 27 | template <int (*F)()> |
group-onsemi | 0:098463de4c5d | 28 | void test_wrapper() { |
group-onsemi | 0:098463de4c5d | 29 | TEST_ASSERT_UNLESS(F()); |
group-onsemi | 0:098463de4c5d | 30 | } |
group-onsemi | 0:098463de4c5d | 31 | |
group-onsemi | 0:098463de4c5d | 32 | utest::v1::status_t test_setup(const size_t number_of_cases) { |
group-onsemi | 0:098463de4c5d | 33 | GREENTEA_SETUP(5, "default_auto"); |
group-onsemi | 0:098463de4c5d | 34 | return verbose_test_setup_handler(number_of_cases); |
group-onsemi | 0:098463de4c5d | 35 | } |
group-onsemi | 0:098463de4c5d | 36 | |
group-onsemi | 0:098463de4c5d | 37 | Case cases[] = { |
group-onsemi | 0:098463de4c5d | 38 | Case("Testing PACKED attribute", test_wrapper<testPacked>), |
group-onsemi | 0:098463de4c5d | 39 | Case("Testing ALIGN attribute", test_wrapper<testAlign>), |
group-onsemi | 0:098463de4c5d | 40 | Case("Testing UNUSED attribute", test_wrapper<testUnused>), |
group-onsemi | 0:098463de4c5d | 41 | Case("Testing WEAK attribute", test_wrapper<testWeak>), |
group-onsemi | 0:098463de4c5d | 42 | Case("Testing PURE attribute", test_wrapper<testPure>), |
group-onsemi | 0:098463de4c5d | 43 | Case("Testing FORCEINLINE attribute", test_wrapper<testForceInline>), |
group-onsemi | 0:098463de4c5d | 44 | Case("Testing NORETURN attribute", test_wrapper<testNoReturn>), |
group-onsemi | 0:098463de4c5d | 45 | Case("Testing UNREACHABLE attribute", test_wrapper<testUnreachable>), |
group-onsemi | 0:098463de4c5d | 46 | Case("Testing DEPRECATED attribute", test_wrapper<testDeprecated>), |
group-onsemi | 0:098463de4c5d | 47 | }; |
group-onsemi | 0:098463de4c5d | 48 | |
group-onsemi | 0:098463de4c5d | 49 | Specification specification(test_setup, cases); |
group-onsemi | 0:098463de4c5d | 50 | |
group-onsemi | 0:098463de4c5d | 51 | int main() { |
group-onsemi | 0:098463de4c5d | 52 | return !Harness::run(specification); |
group-onsemi | 0:098463de4c5d | 53 | } |