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