WORKS

Dependencies:   MAX44000 PWM_Tone_Library nexpaq_mdk

Fork of LED_Demo by Maxim nexpaq

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

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