ON Semiconductor / mbed-os

Dependents:   mbed-TFT-example-NCS36510 mbed-Accelerometer-example-NCS36510 mbed-Accelerometer-example-NCS36510

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include <stdio.h>
00002 #include <stdint.h>
00003 
00004 #include "toolchain.h"
00005 #include "greentea-client/test_env.h"
00006 #include "unity.h"
00007 #include "utest.h"
00008 
00009 using namespace utest::v1;
00010 
00011 
00012 // Test functions declared as C functions to avoid issues with name mangling
00013 extern "C" {
00014     int testPacked();
00015     int testAlign();
00016     int testUnused();
00017     int testWeak();
00018     int testPure();
00019     int testForceInline();
00020     int testNoReturn();
00021     int testUnreachable();
00022     int testDeprecated();
00023 }
00024 
00025 
00026 // Test wrapper and test cases for utest
00027 template <int (*F)()>
00028 void test_wrapper() {
00029     TEST_ASSERT_UNLESS(F());
00030 }
00031 
00032 utest::v1::status_t  test_setup(const size_t number_of_cases) {
00033     GREENTEA_SETUP(5, "default_auto");
00034     return verbose_test_setup_handler(number_of_cases);
00035 }
00036 
00037 Case cases[] = {
00038     Case("Testing PACKED attribute",        test_wrapper<testPacked>),
00039     Case("Testing ALIGN attribute",         test_wrapper<testAlign>),
00040     Case("Testing UNUSED attribute",        test_wrapper<testUnused>),
00041     Case("Testing WEAK attribute",          test_wrapper<testWeak>),
00042     Case("Testing PURE attribute",          test_wrapper<testPure>),
00043     Case("Testing FORCEINLINE attribute",   test_wrapper<testForceInline>),
00044     Case("Testing NORETURN attribute",      test_wrapper<testNoReturn>),
00045     Case("Testing UNREACHABLE attribute",   test_wrapper<testUnreachable>),
00046     Case("Testing DEPRECATED attribute",    test_wrapper<testDeprecated>),
00047 };
00048 
00049 Specification specification(test_setup, cases);
00050 
00051 int main() {
00052     return !Harness::run(specification);
00053 }