Go to the source code of this file.
|
#define | VSF_TEST_CFG_LONGJMP ENABLED |
| < Using longjmp/setjmp for assertions
|
|
#define | VSF_TEST_CFG_INTERNAL_TIMEOUT_MS 1000 |
| External Watchdog Default Timeout.
|
|
#define | VSF_TEST_CFG_EXTERNAL_TIMEOUT_MS 1500 |
| Using the hal wdt device.
|
|
#define | VSF_TEST_CFG_USE_HAL_WDT DISABLED |
| Using stdio to save persistent data to assist device.
|
|
#define | VSF_TEST_CFG_USE_STDIO_DATA_SYNC DISABLED |
|
#define | VSF_TEST_ASSERT(__t, __v) |
| Add an assertion to the test case.
|
|
#define | VSF_TEST_ADD_EX(__FN, __CFG, __TYPE, ...) {.jmp_fn = __FN, .cfg_str = __CFG, .type = __TYPE, __VA_ARGS__} |
| Initialize to add a test case of any type.
|
|
#define | VSF_TEST_ADD_BOOL_FN(__FN, __CFG, ...) |
| Initialize to add a test case of VSF_TEST_TYPE_BOOL_FN type.
|
|
#define | VSF_TEST_ADD(__FN, __CFG, ...) |
| Initialize to add a test case of VSF_TEST_TYPE_LONGJMP_FN type.
|
|
|
enum | vsf_test_status_t {
VSF_TEST_STATUS_IDLE = 0
,
VSF_TEST_STATUS_RUNNING = 1
} |
|
enum | vsf_test_req_t {
VSF_TEST_REQ_NO_SUPPORT = 0
,
VSF_TEST_REQ_SUPPORT = 1
} |
|
enum | vsf_test_result_t {
VSF_TEST_RESULT_PASS = 0x0u << 0
,
VSF_TEST_RESULT_SKIP = 0x1u << 0
,
VSF_TEST_RESULT_WDT_PASS = 0x2u << 0
,
VSF_TEST_RESULT_FAIL = 0x3u << 0
,
VSF_TEST_RESULT_ASSERT_FAIL = VSF_TEST_RESULT_FAIL
,
VSF_TEST_RESULT_WDT_FAIL = 0x4u << 0
,
VSF_TEST_RESULT_ASSIST_FAIL = 0x5u << 0
,
VSF_TEST_RESULT_FAULT_HANDLER_FAIL = 0x6u << 0
} |
|
enum | vsf_test_type_t {
VSF_TEST_TYPE_LONGJMP_FN = 0
,
VSF_TEST_TYPE_BOOL_FN
} |
| Test the type of the function,. More...
|
|
enum | vsf_test_data_cmd_t {
VSF_TEST_STATUS_READ
,
VSF_TEST_STATUS_WRITE
,
VSF_TEST_TESTCASE_INDEX_READ
,
VSF_TEST_TESTCASE_INDEX_WRITE
,
VSF_TEST_TESECASE_REQUEST_WRITE
,
VSF_TEST_TESTCASE_RESULT_WRITE
,
VSF_TEST_DONE
} |
| Device commands during data synchronization. More...
|
|
|
void | vsf_test_init (vsf_test_t *test, vsf_test_case_t *tc_array, uint32_t array_size) |
| initialize vsf test
|
|
bool | vsf_test_add_ex (vsf_test_t *test, vsf_test_case_t *test_case) |
| Add to add a test case of any type.
|
|
bool | vsf_test_add (vsf_test_t *test, vsf_test_jmp_fn_t *jmp_fn, char *cfg) |
| Add to add a test case of VSF_TEST_TYPE_LONGJMP_FN type.
|
|
bool | vsf_test_add_bool_fn (vsf_test_t *test, vsf_test_bool_fn_t *b_fn, char *cfg) |
| Add to add a test case of VSF_TEST_TYPE_BOOL_FN type.
|
|
void | vsf_test_run_tests (vsf_test_t *test) |
| Run all tests. Should be called after all use cases have been initialized.
|
|
void | __vsf_test_longjmp (vsf_test_t *test, vsf_test_result_t result, const char *file_name, uint32_t line, const char *function_name, const char *condition) |
| rong jump. the user does not need to directly call this API
|
|
void | vsf_test_reboot (vsf_test_t *test, vsf_test_result_t result, const char *file_name, uint32_t line, const char *function_name, const char *additional_str) |
| reboot, usually called inside an exception.
|
|
◆ VSF_TEST_CFG_LONGJMP
#define VSF_TEST_CFG_LONGJMP ENABLED |
< Using longjmp/setjmp for assertions
- Note
- do not move this pre-processor statement to other places Internal watchdog default timeout
◆ VSF_TEST_CFG_INTERNAL_TIMEOUT_MS
#define VSF_TEST_CFG_INTERNAL_TIMEOUT_MS 1000 |
External Watchdog Default Timeout.
◆ VSF_TEST_CFG_EXTERNAL_TIMEOUT_MS
#define VSF_TEST_CFG_EXTERNAL_TIMEOUT_MS 1500 |
Using the hal wdt device.
◆ VSF_TEST_CFG_USE_HAL_WDT
#define VSF_TEST_CFG_USE_HAL_WDT DISABLED |
Using stdio to save persistent data to assist device.
◆ VSF_TEST_CFG_USE_STDIO_DATA_SYNC
#define VSF_TEST_CFG_USE_STDIO_DATA_SYNC DISABLED |
◆ VSF_TEST_ASSERT
#define VSF_TEST_ASSERT |
( |
|
__t, |
|
|
|
__v |
|
) |
| |
Value: do { \
if (!(__v)) { \
__LINE__, __FUNCTION__, #__v); \
} \
} while (0)
@ VSF_TEST_RESULT_FAIL
Definition vsf_test.h:253
Add an assertion to the test case.
- Parameters
-
__t | pointer to vsf_test_t |
__v | expressions for test conditions |
◆ VSF_TEST_ADD_EX
#define VSF_TEST_ADD_EX |
( |
|
__FN, |
|
|
|
__CFG, |
|
|
|
__TYPE, |
|
|
|
... |
|
) |
| {.jmp_fn = __FN, .cfg_str = __CFG, .type = __TYPE, __VA_ARGS__} |
Initialize to add a test case of any type.
- Parameters
-
◆ VSF_TEST_ADD_BOOL_FN
#define VSF_TEST_ADD_BOOL_FN |
( |
|
__FN, |
|
|
|
__CFG, |
|
|
|
... |
|
) |
| |
Value: {.jmp_fn = __FN, \
.cfg_str = __CFG, \
__VA_ARGS__}
@ VSF_TEST_TYPE_BOOL_FN
Definition vsf_test.h:267
Initialize to add a test case of VSF_TEST_TYPE_BOOL_FN type.
- Parameters
-
__FN | pointer to vsf_test_bool_fn_t or vsf_test_jmp_fn_t |
__CFG | qequest string for test cases |
... | More configuration options, such as expect_wdt for whether to expect a watchdog reset or not |
◆ VSF_TEST_ADD
#define VSF_TEST_ADD |
( |
|
__FN, |
|
|
|
__CFG, |
|
|
|
... |
|
) |
| |
Value: {.jmp_fn = __FN, \
.cfg_str = __CFG, \
__VA_ARGS__}
@ VSF_TEST_TYPE_LONGJMP_FN
Definition vsf_test.h:264
Initialize to add a test case of VSF_TEST_TYPE_LONGJMP_FN type.
- Parameters
-
__FN | pointer to vsf_test_bool_fn_t or vsf_test_jmp_fn_t |
__CFG | qequest string for test cases |
... | More configuration options, such as expect_wdt for whether to expect a watchdog reset or not |
◆ vsf_test_status_t
◆ vsf_test_req_t
◆ vsf_test_result_t
◆ vsf_test_type_t
Test the type of the function,.
◆ vsf_test_reboot_t
typedef void vsf_test_reboot_t(void) |
◆ vsf_test_wdt_t
◆ vsf_test_data_cmd_t
Device commands during data synchronization.
◆ vsf_test_data_t
All data here needs to be synchronized with the assist device after modification. After powering up, we need to read the data from the assist device first.
◆ vsf_test_bool_fn_t
typedef bool vsf_test_bool_fn_t(void) |
◆ vsf_test_jmp_fn_t
typedef void vsf_test_jmp_fn_t(void) |
◆ vsf_test_case_t
◆ vsf_test_t
◆ vsf_test_status_t
Enumerator |
---|
VSF_TEST_STATUS_IDLE | |
VSF_TEST_STATUS_RUNNING | |
◆ vsf_test_req_t
Enumerator |
---|
VSF_TEST_REQ_NO_SUPPORT | |
VSF_TEST_REQ_SUPPORT | |
◆ vsf_test_result_t
Enumerator |
---|
VSF_TEST_RESULT_PASS | |
VSF_TEST_RESULT_SKIP | |
VSF_TEST_RESULT_WDT_PASS | |
VSF_TEST_RESULT_FAIL | |
VSF_TEST_RESULT_ASSERT_FAIL | |
VSF_TEST_RESULT_WDT_FAIL | |
VSF_TEST_RESULT_ASSIST_FAIL | |
VSF_TEST_RESULT_FAULT_HANDLER_FAIL | |
◆ vsf_test_type_t
Test the type of the function,.
Enumerator |
---|
VSF_TEST_TYPE_LONGJMP_FN | Functions with no return value can use VSF_TEST_ASSERT, which depends on setjmp/longjmp.
|
VSF_TEST_TYPE_BOOL_FN | Functions with boolean return values do not depend on longjmp but cannot use VSF_TEST_ASSERT
|
◆ vsf_test_data_cmd_t
Device commands during data synchronization.
Enumerator |
---|
VSF_TEST_STATUS_READ | Reading the current state requires a response from the assist device.
|
VSF_TEST_STATUS_WRITE | Write current state, no assist device response required.
|
VSF_TEST_TESTCASE_INDEX_READ | Reading the current index requires a response from the assist device.
|
VSF_TEST_TESTCASE_INDEX_WRITE | Write current index, no assist device response required.
|
VSF_TEST_TESECASE_REQUEST_WRITE | Send test request information, requires an assist device response.
|
VSF_TEST_TESTCASE_RESULT_WRITE | Write the result of the current test, does not require a response from the assist device.
|
VSF_TEST_DONE | All tests are completed without a response from the assist device. The Assist Device should output a test report and be ready for the next test.
|
◆ vsf_test_init()
initialize vsf test
- Parameters
-
◆ vsf_test_add_ex()
Add to add a test case of any type.
- Parameters
-
- Returns
- bool: true if add was successfully, or false
◆ vsf_test_add()
Add to add a test case of VSF_TEST_TYPE_LONGJMP_FN type.
- Parameters
-
[in] | test | a pointer to structure vsf_test_t |
[in] | jmp_fn | a pointer to function vsf_test_jmp_fn_t |
[in] | cfg | a string of request information for the test case |
- Returns
- bool: true if add was successfully, or false
◆ vsf_test_add_bool_fn()
Add to add a test case of VSF_TEST_TYPE_BOOL_FN type.
- Parameters
-
[in] | test | a pointer to structure vsf_test_t |
[in] | b_fn | a pointer to function vsf_test_bool_fn_t |
[in] | cfg | a string of request information for the test case |
- Returns
- bool: true if add was successfully, or false
◆ vsf_test_run_tests()
Run all tests. Should be called after all use cases have been initialized.
- Parameters
-
◆ __vsf_test_longjmp()
rong jump. the user does not need to directly call this API
- Parameters
-
[in] | test | a pointer to structure vsf_test_t |
[in] | result | test result, vsf_test_result_t |
[in] | file_name | then name of the file where the assertion occurred |
[in] | line | the line number of the code where the assertion occurred |
[in] | function_name | the name of the function where the assertion occurred |
[in] | condition | String of asserted code |
- Note
- This function will be called when the test case asserts that the condition is not satisfied.
◆ vsf_test_reboot()
reboot, usually called inside an exception.
- Parameters
-
[in] | test | a pointer to structure vsf_test_t |
[in] | result | test result, vsf_test_result_t |
[in] | file_name | then name of the file where the assertion occurred |
[in] | line | the line number of the code where the assertion occurred |
[in] | function_name | the name of the function where the assertion occurred |
[in] | additional_str | provide additional exception information |