Magnificent7 / Hackathon
Committer:
bryantaylor
Date:
Tue Sep 20 21:26:12 2016 +0000
Revision:
0:eafc3fd41f75
hackathon

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bryantaylor 0:eafc3fd41f75 1 #include <stdio.h>
bryantaylor 0:eafc3fd41f75 2 #include <stdint.h>
bryantaylor 0:eafc3fd41f75 3
bryantaylor 0:eafc3fd41f75 4 #include "toolchain.h"
bryantaylor 0:eafc3fd41f75 5 #include "greentea-client/test_env.h"
bryantaylor 0:eafc3fd41f75 6 #include "unity.h"
bryantaylor 0:eafc3fd41f75 7 #include "utest.h"
bryantaylor 0:eafc3fd41f75 8
bryantaylor 0:eafc3fd41f75 9 using namespace utest::v1;
bryantaylor 0:eafc3fd41f75 10
bryantaylor 0:eafc3fd41f75 11
bryantaylor 0:eafc3fd41f75 12 // Test functions declared as C functions to avoid issues with name mangling
bryantaylor 0:eafc3fd41f75 13 extern "C" {
bryantaylor 0:eafc3fd41f75 14 int testPacked();
bryantaylor 0:eafc3fd41f75 15 int testAlign();
bryantaylor 0:eafc3fd41f75 16 int testUnused();
bryantaylor 0:eafc3fd41f75 17 int testWeak();
bryantaylor 0:eafc3fd41f75 18 int testPure();
bryantaylor 0:eafc3fd41f75 19 int testForceInline();
bryantaylor 0:eafc3fd41f75 20 int testNoReturn();
bryantaylor 0:eafc3fd41f75 21 int testUnreachable();
bryantaylor 0:eafc3fd41f75 22 int testDeprecated();
bryantaylor 0:eafc3fd41f75 23 }
bryantaylor 0:eafc3fd41f75 24
bryantaylor 0:eafc3fd41f75 25
bryantaylor 0:eafc3fd41f75 26 // Test wrapper and test cases for utest
bryantaylor 0:eafc3fd41f75 27 template <int (*F)()>
bryantaylor 0:eafc3fd41f75 28 void test_wrapper() {
bryantaylor 0:eafc3fd41f75 29 TEST_ASSERT_UNLESS(F());
bryantaylor 0:eafc3fd41f75 30 }
bryantaylor 0:eafc3fd41f75 31
bryantaylor 0:eafc3fd41f75 32 utest::v1::status_t test_setup(const size_t number_of_cases) {
bryantaylor 0:eafc3fd41f75 33 GREENTEA_SETUP(5, "default_auto");
bryantaylor 0:eafc3fd41f75 34 return verbose_test_setup_handler(number_of_cases);
bryantaylor 0:eafc3fd41f75 35 }
bryantaylor 0:eafc3fd41f75 36
bryantaylor 0:eafc3fd41f75 37 Case cases[] = {
bryantaylor 0:eafc3fd41f75 38 Case("Testing PACKED attribute", test_wrapper<testPacked>),
bryantaylor 0:eafc3fd41f75 39 Case("Testing ALIGN attribute", test_wrapper<testAlign>),
bryantaylor 0:eafc3fd41f75 40 Case("Testing UNUSED attribute", test_wrapper<testUnused>),
bryantaylor 0:eafc3fd41f75 41 Case("Testing WEAK attribute", test_wrapper<testWeak>),
bryantaylor 0:eafc3fd41f75 42 Case("Testing PURE attribute", test_wrapper<testPure>),
bryantaylor 0:eafc3fd41f75 43 Case("Testing FORCEINLINE attribute", test_wrapper<testForceInline>),
bryantaylor 0:eafc3fd41f75 44 Case("Testing NORETURN attribute", test_wrapper<testNoReturn>),
bryantaylor 0:eafc3fd41f75 45 Case("Testing UNREACHABLE attribute", test_wrapper<testUnreachable>),
bryantaylor 0:eafc3fd41f75 46 Case("Testing DEPRECATED attribute", test_wrapper<testDeprecated>),
bryantaylor 0:eafc3fd41f75 47 };
bryantaylor 0:eafc3fd41f75 48
bryantaylor 0:eafc3fd41f75 49 Specification specification(test_setup, cases);
bryantaylor 0:eafc3fd41f75 50
bryantaylor 0:eafc3fd41f75 51 int main() {
bryantaylor 0:eafc3fd41f75 52 return !Harness::run(specification);
bryantaylor 0:eafc3fd41f75 53 }