mbed-os for GR-LYCHEE

Dependents:   mbed-os-example-blinky-gr-lychee GR-Boads_Camera_sample GR-Boards_Audio_Recoder GR-Boads_Camera_DisplayApp ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /* This is a copy of the basic_test unit test without a custom setup handler being provided.
00002 */
00003 
00004 #include "mbed.h"
00005 #include "greentea-client/test_env.h"
00006 #include "utest/utest.h"
00007 #include "unity/unity.h"
00008 #include "utest/utest_stack_trace.h"
00009 
00010 using namespace utest::v1;
00011 
00012 void test_simple() {
00013     UTEST_LOG_FUNCTION();
00014     TEST_ASSERT_EQUAL(0, 0);
00015 }
00016 
00017 utest::v1::status_t  test_repeats_setup(const Case *const source, const size_t index_of_case) {
00018     UTEST_LOG_FUNCTION();
00019     // Call the default handler for proper reporting
00020     utest::v1::status_t  status = greentea_case_setup_handler(source, index_of_case);
00021     utest_printf("Setting up for '%s'\n", source->get_description ());
00022     return status;
00023 }
00024 control_t test_repeats(const size_t call_count) {
00025     UTEST_LOG_FUNCTION();
00026     TEST_ASSERT_NOT_EQUAL(3, call_count);
00027     // Specify how often this test is repeated ie. n total calls
00028     return (call_count < 2) ? CaseRepeatAll : CaseNext;
00029 }
00030 
00031 
00032 // Specify all your test cases here
00033 Case cases[] = {
00034     Case("Simple Test", test_simple),
00035     Case("Repeating Test", test_repeats_setup, test_repeats)
00036 };
00037 
00038 // Declare your test specification. If no custom setup handler is provided then
00039 // the default handler will be used.
00040 Specification specification(cases);
00041 
00042 extern void utest_run(const Specification& specification);
00043 
00044 int main()
00045 {
00046     UTEST_LOG_FUNCTION();
00047     Harness::run(specification);
00048 }