dhgdh

Dependencies:   MAX44000 PWM_Tone_Library nexpaq_mdk

Fork of LED_Demo by joey shelton

Committer:
nexpaq
Date:
Sat Sep 17 16:32:05 2016 +0000
Revision:
1:55a6170b404f
checking in for sharing

Who changed what in which revision?

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