]> git.gir.st - tmk_keyboard.git/blob - tool/mbed/mbed-sdk/libraries/tests/mbed/env/test_env.h
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[tmk_keyboard.git] / tool / mbed / mbed-sdk / libraries / tests / mbed / env / test_env.h
1 #ifndef TEST_ENV_H_
2 #define TEST_ENV_H_
3
4 #include <stdio.h>
5 #include "mbed.h"
6
7 #define NL "\n"
8 #define RCNL "\r\n"
9
10 // Const strings used in test_end
11 extern const char* TEST_ENV_START;
12 extern const char* TEST_ENV_SUCCESS;
13 extern const char* TEST_ENV_FAILURE;
14 extern const char* TEST_ENV_MEASURE;
15 extern const char* TEST_ENV_END;
16
17 // Test result related notification functions
18 void notify_start();
19 void notify_completion(bool success);
20 bool notify_completion_str(bool success, char* buffer);
21 void notify_performance_coefficient(const char* measurement_name, const int value);
22 void notify_performance_coefficient(const char* measurement_name, const unsigned int value);
23 void notify_performance_coefficient(const char* measurement_name, const double value);
24
25 // Host test auto-detection API
26 void notify_host_test_name(const char *host_test);
27 void notify_timeout(int timeout);
28 void notify_test_id(const char *test_id);
29 void notify_test_description(const char *description);
30
31 // Host test auto-detection API
32 #define MBED_HOSTTEST_START(TESTID) notify_test_id(TESTID); notify_start()
33 #define MBED_HOSTTEST_SELECT(NAME) notify_host_test_name(#NAME)
34 #define MBED_HOSTTEST_TIMEOUT(SECONDS) notify_timeout(SECONDS)
35 #define MBED_HOSTTEST_DESCRIPTION(DESC) notify_test_description(#DESC)
36 #define MBED_HOSTTEST_RESULT(RESULT) notify_completion(RESULT)
37
38 /**
39 Test auto-detection preamble example:
40 main() {
41 MBED_HOSTTEST_TIMEOUT(10);
42 MBED_HOSTTEST_SELECT( host_test );
43 MBED_HOSTTEST_DESCRIPTION(Hello World);
44 MBED_HOSTTEST_START("MBED_10");
45 // Proper 'host_test.py' should take over supervising of this test
46
47 // Test code
48 bool result = ...;
49
50 MBED_HOSTTEST_RESULT(result);
51 }
52 */
53
54
55 // Test functionality useful during testing
56 unsigned int testenv_randseed();
57
58 // Macros, unit test like to provide basic comparisons
59 #define TESTENV_STRCMP(GIVEN,EXPECTED) (strcmp(GIVEN,EXPECTED) == 0)
60
61 // macros passed via test suite
62 #ifndef TEST_SUITE_TARGET_NAME
63 #define TEST_SUITE_TARGET_NAME "Unknown"
64 #endif
65
66 #ifndef TEST_SUITE_TEST_ID
67 #define TEST_SUITE_TEST_ID "Unknown"
68 #endif
69
70 #ifndef TEST_SUITE_UUID
71 #define TEST_SUITE_UUID "Unknown"
72 #endif
73
74 #endif
Imprint / Impressum