BA / SerialCom

Fork of OmniWheels by Gustav Atmel

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /* mbed Microcontroller Library
00002  * Copyright (c) 2017 ARM Limited
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 #include "mbed.h"
00017 #include "greentea-client/test_env.h"
00018 #include "utest/utest.h"
00019 #include "unity/unity.h"
00020 #include "timeout_tests.h"
00021 
00022 using namespace utest::v1;
00023 
00024 utest::v1::status_t greentea_failure_handler(const Case * const source, const failure_t reason)
00025 {
00026     greentea_case_failure_abort_handler(source, reason);
00027     return STATUS_CONTINUE;
00028 }
00029 
00030 Case cases[] = {
00031     Case("Callback called once (attach)", test_single_call<AttachTester<Timeout> >),
00032     Case("Callback called once (attach_us)", test_single_call<AttachUSTester<Timeout> >),
00033 
00034     Case("Callback not called when cancelled (attach)", test_cancel<AttachTester<Timeout> >),
00035     Case("Callback not called when cancelled (attach_us)", test_cancel<AttachUSTester<Timeout> >),
00036 
00037     Case("Callback override (attach)", test_override<AttachTester<Timeout> >),
00038     Case("Callback override (attach_us)", test_override<AttachUSTester<Timeout> >),
00039 
00040     Case("Multiple timeouts running in parallel (attach)", test_multiple<AttachTester<Timeout> >),
00041     Case("Multiple timeouts running in parallel (attach_us)", test_multiple<AttachUSTester<Timeout> >),
00042 
00043     Case("Zero delay (attach)", test_no_wait<AttachTester<Timeout> >),
00044     Case("Zero delay (attach_us)", test_no_wait<AttachUSTester<Timeout> >),
00045 
00046     Case("10 ms delay accuracy (attach)", test_delay_accuracy<AttachTester<Timeout>, 10000, SHORT_DELTA_US>,
00047             greentea_failure_handler),
00048     Case("10 ms delay accuracy (attach_us)", test_delay_accuracy<AttachUSTester<Timeout>, 10000, SHORT_DELTA_US>,
00049             greentea_failure_handler),
00050 
00051     Case("1 s delay accuracy (attach)", test_delay_accuracy<AttachTester<Timeout>, 1000000, LONG_DELTA_US>,
00052             greentea_failure_handler),
00053     Case("1 s delay accuracy (attach_us)", test_delay_accuracy<AttachUSTester<Timeout>, 1000000, LONG_DELTA_US>,
00054             greentea_failure_handler),
00055 
00056     Case("5 s delay accuracy (attach)", test_delay_accuracy<AttachTester<Timeout>, 5000000, LONG_DELTA_US>,
00057             greentea_failure_handler),
00058     Case("5 s delay accuracy (attach_us)", test_delay_accuracy<AttachUSTester<Timeout>, 5000000, LONG_DELTA_US>,
00059             greentea_failure_handler),
00060 
00061 #if DEVICE_SLEEP
00062     Case("1 s delay during sleep (attach)", test_sleep<AttachTester<Timeout>, 1000000, LONG_DELTA_US>,
00063             greentea_failure_handler),
00064     Case("1 s delay during sleep (attach_us)", test_sleep<AttachUSTester<Timeout>, 1000000, LONG_DELTA_US>,
00065             greentea_failure_handler),
00066 #endif
00067 
00068     Case("Timing drift (attach)", test_drift<AttachTester<Timeout> >),
00069     Case("Timing drift (attach_us)", test_drift<AttachUSTester<Timeout> >),
00070 };
00071 
00072 utest::v1::status_t greentea_test_setup(const size_t number_of_cases)
00073 {
00074     GREENTEA_SETUP(240, "timing_drift_auto");
00075     return greentea_test_setup_handler(number_of_cases);
00076 }
00077 
00078 Specification specification(greentea_test_setup, cases, greentea_test_teardown_handler);
00079 
00080 int main()
00081 {
00082     Harness::run(specification);
00083 }