EL4121 Embedded System / mbed-os

Dependents:   cobaLCDJoyMotor_Thread odometry_omni_3roda_v3 odometry_omni_3roda_v1 odometry_omni_3roda_v2 ... more

Committer:
be_bryan
Date:
Mon Dec 11 17:54:04 2017 +0000
Revision:
0:b74591d5ab33
motor ++

Who changed what in which revision?

UserRevisionLine numberNew contents of line
be_bryan 0:b74591d5ab33 1 /* mbed Microcontroller Library
be_bryan 0:b74591d5ab33 2 * Copyright (c) 2017 ARM Limited
be_bryan 0:b74591d5ab33 3 *
be_bryan 0:b74591d5ab33 4 * Licensed under the Apache License, Version 2.0 (the "License");
be_bryan 0:b74591d5ab33 5 * you may not use this file except in compliance with the License.
be_bryan 0:b74591d5ab33 6 * You may obtain a copy of the License at
be_bryan 0:b74591d5ab33 7 *
be_bryan 0:b74591d5ab33 8 * http://www.apache.org/licenses/LICENSE-2.0
be_bryan 0:b74591d5ab33 9 *
be_bryan 0:b74591d5ab33 10 * Unless required by applicable law or agreed to in writing, software
be_bryan 0:b74591d5ab33 11 * distributed under the License is distributed on an "AS IS" BASIS,
be_bryan 0:b74591d5ab33 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
be_bryan 0:b74591d5ab33 13 * See the License for the specific language governing permissions and
be_bryan 0:b74591d5ab33 14 * limitations under the License.
be_bryan 0:b74591d5ab33 15 */
be_bryan 0:b74591d5ab33 16 #include <stdio.h>
be_bryan 0:b74591d5ab33 17 #include <stdint.h>
be_bryan 0:b74591d5ab33 18
be_bryan 0:b74591d5ab33 19 #include "mbed_toolchain.h"
be_bryan 0:b74591d5ab33 20 #include "greentea-client/test_env.h"
be_bryan 0:b74591d5ab33 21 #include "unity.h"
be_bryan 0:b74591d5ab33 22 #include "utest.h"
be_bryan 0:b74591d5ab33 23
be_bryan 0:b74591d5ab33 24 using namespace utest::v1;
be_bryan 0:b74591d5ab33 25
be_bryan 0:b74591d5ab33 26
be_bryan 0:b74591d5ab33 27 // Test functions declared as C functions to avoid issues with name mangling
be_bryan 0:b74591d5ab33 28 extern "C" {
be_bryan 0:b74591d5ab33 29 int testPacked();
be_bryan 0:b74591d5ab33 30 int testAlign();
be_bryan 0:b74591d5ab33 31 int testUnused();
be_bryan 0:b74591d5ab33 32 int testWeak();
be_bryan 0:b74591d5ab33 33 int testPure();
be_bryan 0:b74591d5ab33 34 int testForceInline();
be_bryan 0:b74591d5ab33 35 int testNoReturn();
be_bryan 0:b74591d5ab33 36 int testUnreachable();
be_bryan 0:b74591d5ab33 37 int testDeprecated();
be_bryan 0:b74591d5ab33 38 }
be_bryan 0:b74591d5ab33 39
be_bryan 0:b74591d5ab33 40
be_bryan 0:b74591d5ab33 41 // Test wrapper and test cases for utest
be_bryan 0:b74591d5ab33 42 template <int (*F)()>
be_bryan 0:b74591d5ab33 43 void test_wrapper() {
be_bryan 0:b74591d5ab33 44 TEST_ASSERT_UNLESS(F());
be_bryan 0:b74591d5ab33 45 }
be_bryan 0:b74591d5ab33 46
be_bryan 0:b74591d5ab33 47 utest::v1::status_t test_setup(const size_t number_of_cases) {
be_bryan 0:b74591d5ab33 48 GREENTEA_SETUP(5, "default_auto");
be_bryan 0:b74591d5ab33 49 return verbose_test_setup_handler(number_of_cases);
be_bryan 0:b74591d5ab33 50 }
be_bryan 0:b74591d5ab33 51
be_bryan 0:b74591d5ab33 52 Case cases[] = {
be_bryan 0:b74591d5ab33 53 Case("Testing PACKED attribute", test_wrapper<testPacked>),
be_bryan 0:b74591d5ab33 54 Case("Testing ALIGN attribute", test_wrapper<testAlign>),
be_bryan 0:b74591d5ab33 55 Case("Testing UNUSED attribute", test_wrapper<testUnused>),
be_bryan 0:b74591d5ab33 56 Case("Testing WEAK attribute", test_wrapper<testWeak>),
be_bryan 0:b74591d5ab33 57 Case("Testing PURE attribute", test_wrapper<testPure>),
be_bryan 0:b74591d5ab33 58 Case("Testing FORCEINLINE attribute", test_wrapper<testForceInline>),
be_bryan 0:b74591d5ab33 59 Case("Testing NORETURN attribute", test_wrapper<testNoReturn>),
be_bryan 0:b74591d5ab33 60 Case("Testing UNREACHABLE attribute", test_wrapper<testUnreachable>),
be_bryan 0:b74591d5ab33 61 Case("Testing DEPRECATED attribute", test_wrapper<testDeprecated>),
be_bryan 0:b74591d5ab33 62 };
be_bryan 0:b74591d5ab33 63
be_bryan 0:b74591d5ab33 64 Specification specification(test_setup, cases);
be_bryan 0:b74591d5ab33 65
be_bryan 0:b74591d5ab33 66 int main() {
be_bryan 0:b74591d5ab33 67 return !Harness::run(specification);
be_bryan 0:b74591d5ab33 68 }