takashi kadono
/
Nucleo_446
Color Oled(SSD1331) connect to STMicroelectronics Nucleo-F466
mbed-os/TESTS/mbed_drivers/timeout/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 "mbed.h" |
kadonotakashi | 0:8fdf9a60065b | 17 | #include "greentea-client/test_env.h" |
kadonotakashi | 0:8fdf9a60065b | 18 | #include "utest/utest.h" |
kadonotakashi | 0:8fdf9a60065b | 19 | #include "unity/unity.h" |
kadonotakashi | 0:8fdf9a60065b | 20 | #include "timeout_tests.h" |
kadonotakashi | 0:8fdf9a60065b | 21 | |
kadonotakashi | 0:8fdf9a60065b | 22 | #if !DEVICE_USTICKER |
kadonotakashi | 0:8fdf9a60065b | 23 | #error [NOT_SUPPORTED] usticker not supported for this target. |
kadonotakashi | 0:8fdf9a60065b | 24 | #endif |
kadonotakashi | 0:8fdf9a60065b | 25 | |
kadonotakashi | 0:8fdf9a60065b | 26 | using namespace utest::v1; |
kadonotakashi | 0:8fdf9a60065b | 27 | |
kadonotakashi | 0:8fdf9a60065b | 28 | utest::v1::status_t greentea_failure_handler(const Case *const source, const failure_t reason) |
kadonotakashi | 0:8fdf9a60065b | 29 | { |
kadonotakashi | 0:8fdf9a60065b | 30 | greentea_case_failure_abort_handler(source, reason); |
kadonotakashi | 0:8fdf9a60065b | 31 | return STATUS_CONTINUE; |
kadonotakashi | 0:8fdf9a60065b | 32 | } |
kadonotakashi | 0:8fdf9a60065b | 33 | |
kadonotakashi | 0:8fdf9a60065b | 34 | Case cases[] = { |
kadonotakashi | 0:8fdf9a60065b | 35 | Case("Callback called once (attach)", test_single_call<AttachTester<Timeout> >), |
kadonotakashi | 0:8fdf9a60065b | 36 | Case("Callback called once (attach_us)", test_single_call<AttachUSTester<Timeout> >), |
kadonotakashi | 0:8fdf9a60065b | 37 | |
kadonotakashi | 0:8fdf9a60065b | 38 | Case("Callback not called when cancelled (attach)", test_cancel<AttachTester<Timeout> >), |
kadonotakashi | 0:8fdf9a60065b | 39 | Case("Callback not called when cancelled (attach_us)", test_cancel<AttachUSTester<Timeout> >), |
kadonotakashi | 0:8fdf9a60065b | 40 | |
kadonotakashi | 0:8fdf9a60065b | 41 | Case("Callback override (attach)", test_override<AttachTester<Timeout> >), |
kadonotakashi | 0:8fdf9a60065b | 42 | Case("Callback override (attach_us)", test_override<AttachUSTester<Timeout> >), |
kadonotakashi | 0:8fdf9a60065b | 43 | |
kadonotakashi | 0:8fdf9a60065b | 44 | Case("Multiple timeouts running in parallel (attach)", test_multiple<AttachTester<Timeout> >), |
kadonotakashi | 0:8fdf9a60065b | 45 | Case("Multiple timeouts running in parallel (attach_us)", test_multiple<AttachUSTester<Timeout> >), |
kadonotakashi | 0:8fdf9a60065b | 46 | |
kadonotakashi | 0:8fdf9a60065b | 47 | Case("Zero delay (attach)", test_no_wait<AttachTester<Timeout> >), |
kadonotakashi | 0:8fdf9a60065b | 48 | Case("Zero delay (attach_us)", test_no_wait<AttachUSTester<Timeout> >), |
kadonotakashi | 0:8fdf9a60065b | 49 | |
kadonotakashi | 0:8fdf9a60065b | 50 | Case("10 ms delay accuracy (attach)", test_delay_accuracy<AttachTester<Timeout>, 10000, SHORT_DELTA_US>, |
kadonotakashi | 0:8fdf9a60065b | 51 | greentea_failure_handler), |
kadonotakashi | 0:8fdf9a60065b | 52 | Case("10 ms delay accuracy (attach_us)", test_delay_accuracy<AttachUSTester<Timeout>, 10000, SHORT_DELTA_US>, |
kadonotakashi | 0:8fdf9a60065b | 53 | greentea_failure_handler), |
kadonotakashi | 0:8fdf9a60065b | 54 | |
kadonotakashi | 0:8fdf9a60065b | 55 | Case("1 s delay accuracy (attach)", test_delay_accuracy<AttachTester<Timeout>, 1000000, LONG_DELTA_US>, |
kadonotakashi | 0:8fdf9a60065b | 56 | greentea_failure_handler), |
kadonotakashi | 0:8fdf9a60065b | 57 | Case("1 s delay accuracy (attach_us)", test_delay_accuracy<AttachUSTester<Timeout>, 1000000, LONG_DELTA_US>, |
kadonotakashi | 0:8fdf9a60065b | 58 | greentea_failure_handler), |
kadonotakashi | 0:8fdf9a60065b | 59 | |
kadonotakashi | 0:8fdf9a60065b | 60 | Case("5 s delay accuracy (attach)", test_delay_accuracy<AttachTester<Timeout>, 5000000, LONG_DELTA_US>, |
kadonotakashi | 0:8fdf9a60065b | 61 | greentea_failure_handler), |
kadonotakashi | 0:8fdf9a60065b | 62 | Case("5 s delay accuracy (attach_us)", test_delay_accuracy<AttachUSTester<Timeout>, 5000000, LONG_DELTA_US>, |
kadonotakashi | 0:8fdf9a60065b | 63 | greentea_failure_handler), |
kadonotakashi | 0:8fdf9a60065b | 64 | |
kadonotakashi | 0:8fdf9a60065b | 65 | #if DEVICE_SLEEP |
kadonotakashi | 0:8fdf9a60065b | 66 | Case("1 s delay during sleep (attach)", test_sleep<AttachTester<Timeout>, 1000000, LONG_DELTA_US>, |
kadonotakashi | 0:8fdf9a60065b | 67 | greentea_failure_handler), |
kadonotakashi | 0:8fdf9a60065b | 68 | Case("1 s delay during sleep (attach_us)", test_sleep<AttachUSTester<Timeout>, 1000000, LONG_DELTA_US>, |
kadonotakashi | 0:8fdf9a60065b | 69 | greentea_failure_handler), |
kadonotakashi | 0:8fdf9a60065b | 70 | #endif |
kadonotakashi | 0:8fdf9a60065b | 71 | #if !defined(__ARM_FM) //FastModels not support time drifting test |
kadonotakashi | 0:8fdf9a60065b | 72 | Case("Timing drift (attach)", test_drift<AttachTester<Timeout> >), |
kadonotakashi | 0:8fdf9a60065b | 73 | Case("Timing drift (attach_us)", test_drift<AttachUSTester<Timeout> >), |
kadonotakashi | 0:8fdf9a60065b | 74 | #endif |
kadonotakashi | 0:8fdf9a60065b | 75 | }; |
kadonotakashi | 0:8fdf9a60065b | 76 | |
kadonotakashi | 0:8fdf9a60065b | 77 | utest::v1::status_t greentea_test_setup(const size_t number_of_cases) |
kadonotakashi | 0:8fdf9a60065b | 78 | { |
kadonotakashi | 0:8fdf9a60065b | 79 | GREENTEA_SETUP(240, "timing_drift_auto"); |
kadonotakashi | 0:8fdf9a60065b | 80 | return greentea_test_setup_handler(number_of_cases); |
kadonotakashi | 0:8fdf9a60065b | 81 | } |
kadonotakashi | 0:8fdf9a60065b | 82 | |
kadonotakashi | 0:8fdf9a60065b | 83 | Specification specification(greentea_test_setup, cases, greentea_test_teardown_handler); |
kadonotakashi | 0:8fdf9a60065b | 84 | |
kadonotakashi | 0:8fdf9a60065b | 85 | int main() |
kadonotakashi | 0:8fdf9a60065b | 86 | { |
kadonotakashi | 0:8fdf9a60065b | 87 | Harness::run(specification); |
kadonotakashi | 0:8fdf9a60065b | 88 | } |