mbed-rtos test programs for DISCO_F746NG. #Test for thread, mutex, semaphore, signals, queues, mail, ISR
Dependencies: BSP_DISCO_F746NG HC06Bluetooth I2Cdev LCD_DISCO_F746NG MCP2515 MD25 MPU9150 TS_DISCO_F746NG emwin mbed-dev mbed-rtos pca9685 ppCANOpen ros_lib_kinetic
Fork of DISCO-F746NG_rtos_test by
Diff: test_env.h
- Revision:
- 0:225c1da086a1
diff -r 000000000000 -r 225c1da086a1 test_env.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test_env.h Wed Nov 11 07:53:46 2015 +0000 @@ -0,0 +1,75 @@ +#ifndef TEST_ENV_H_ +#define TEST_ENV_H_ + +#include <stdio.h> +#include "mbed.h" + +#define NL "\n" +#define RCNL "\r\n" + +// Const strings used in test_end +extern const char* TEST_ENV_START; +extern const char* TEST_ENV_SUCCESS; +extern const char* TEST_ENV_FAILURE; +extern const char* TEST_ENV_MEASURE; +extern const char* TEST_ENV_END; + +// Test result related notification functions +void notify_start(); +void notify_completion(bool success); +bool notify_completion_str(bool success, char* buffer); +void notify_performance_coefficient(const char* measurement_name, const int value); +void notify_performance_coefficient(const char* measurement_name, const unsigned int value); +void notify_performance_coefficient(const char* measurement_name, const double value); + +// Host test auto-detection API +void notify_host_test_name(const char *host_test); +void notify_timeout(int timeout); +void notify_test_id(const char *test_id); +void notify_test_description(const char *description); + +// Host test auto-detection API +#define MBED_HOSTTEST_START(TESTID) notify_test_id(TESTID); notify_start() +#define MBED_HOSTTEST_SELECT(NAME) notify_host_test_name(#NAME) +#define MBED_HOSTTEST_TIMEOUT(SECONDS) notify_timeout(SECONDS) +#define MBED_HOSTTEST_DESCRIPTION(DESC) notify_test_description(#DESC) +#define MBED_HOSTTEST_RESULT(RESULT) notify_completion(RESULT) + +/** + Test auto-detection preamble example: + main() { + MBED_HOSTTEST_TIMEOUT(10); + MBED_HOSTTEST_SELECT( host_test ); + MBED_HOSTTEST_DESCRIPTION(Hello World); + MBED_HOSTTEST_START("MBED_10"); + // Proper 'host_test.py' should take over supervising of this test + + // Test code + bool result = ...; + + MBED_HOSTTEST_RESULT(result); + } +*/ + + +// Test functionality useful during testing +unsigned int testenv_randseed(); + +// Macros, unit test like to provide basic comparisons +#define TESTENV_STRCMP(GIVEN,EXPECTED) (strcmp(GIVEN,EXPECTED) == 0) + +// macros passed via test suite +#ifndef TEST_SUITE_TARGET_NAME +#define TEST_SUITE_TARGET_NAME "Unknown" +#endif + +#ifndef TEST_SUITE_TEST_ID +#define TEST_SUITE_TEST_ID "Unknown" +#endif + +#ifndef TEST_SUITE_UUID +#define TEST_SUITE_UUID "Unknown" +#endif + +#endif +