Marco Zecchini
/
Example_RTOS
Rtos API example
Embed:
(wiki syntax)
Show/hide line numbers
test_env.h
00001 #ifndef TEST_ENV_H_ 00002 #define TEST_ENV_H_ 00003 00004 #include <stdio.h> 00005 #include "mbed.h" 00006 00007 #define NL "\n" 00008 #define RCNL "\r\n" 00009 00010 // Const strings used in test_end 00011 extern const char* TEST_ENV_START; 00012 extern const char* TEST_ENV_SUCCESS; 00013 extern const char* TEST_ENV_FAILURE; 00014 extern const char* TEST_ENV_MEASURE; 00015 extern const char* TEST_ENV_END; 00016 00017 // Test result related notification functions 00018 void notify_start(); 00019 void notify_completion(bool success); 00020 bool notify_completion_str(bool success, char* buffer); 00021 void notify_performance_coefficient(const char* measurement_name, const int value); 00022 void notify_performance_coefficient(const char* measurement_name, const unsigned int value); 00023 void notify_performance_coefficient(const char* measurement_name, const double value); 00024 00025 // Host test auto-detection API 00026 void notify_host_test_name(const char *host_test); 00027 void notify_timeout(int timeout); 00028 void notify_test_id(const char *test_id); 00029 void notify_test_description(const char *description); 00030 00031 // Host test auto-detection API 00032 #define MBED_HOSTTEST_START(TESTID) notify_test_id(TESTID); notify_start() 00033 #define MBED_HOSTTEST_SELECT(NAME) notify_host_test_name(#NAME) 00034 #define MBED_HOSTTEST_TIMEOUT(SECONDS) notify_timeout(SECONDS) 00035 #define MBED_HOSTTEST_DESCRIPTION(DESC) notify_test_description(#DESC) 00036 #define MBED_HOSTTEST_RESULT(RESULT) notify_completion(RESULT) 00037 00038 /** 00039 Test auto-detection preamble example: 00040 main() { 00041 MBED_HOSTTEST_TIMEOUT(10); 00042 MBED_HOSTTEST_SELECT( host_test ); 00043 MBED_HOSTTEST_DESCRIPTION(Hello World); 00044 MBED_HOSTTEST_START("MBED_10"); 00045 // Proper 'host_test.py' should take over supervising of this test 00046 00047 // Test code 00048 bool result = ...; 00049 00050 MBED_HOSTTEST_RESULT(result); 00051 } 00052 */ 00053 00054 00055 // Test functionality useful during testing 00056 unsigned int testenv_randseed(); 00057 00058 // Macros, unit test like to provide basic comparisons 00059 #define TESTENV_STRCMP(GIVEN,EXPECTED) (strcmp(GIVEN,EXPECTED) == 0) 00060 00061 // macros passed via test suite 00062 #ifndef TEST_SUITE_TARGET_NAME 00063 #define TEST_SUITE_TARGET_NAME "Unknown" 00064 #endif 00065 00066 #ifndef TEST_SUITE_TEST_ID 00067 #define TEST_SUITE_TEST_ID "Unknown" 00068 #endif 00069 00070 #ifndef TEST_SUITE_UUID 00071 #define TEST_SUITE_UUID "Unknown" 00072 #endif 00073 00074 #endif
Generated on Sun Jul 17 2022 08:25:32 by 1.7.2