VSF Documented
Functions
vsf_test.c File Reference
#include "./vsf_test.h"

Functions

void vsf_test_init (vsf_test_t *test, vsf_test_case_t *test_case_array, uint32_t test_case_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_str)
 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_str)
 Add to add a test case of VSF_TEST_TYPE_BOOL_FN type.
 
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 *condition)
 reboot, usually called inside an exception.
 
void vsf_test_run_tests (vsf_test_t *test)
 Run all tests. Should be called after all use cases have been initialized.
 

Function Documentation

◆ vsf_test_init()

void vsf_test_init ( vsf_test_t test,
vsf_test_case_t tc_array,
uint32_t  array_size 
)

initialize vsf test

Parameters
[in]testa pointer to structure vsf_test_t
[in]tc_arraya pointer to array vsf_test_case_t
[in]array_sizesize of tc_array

◆ vsf_test_add_ex()

bool vsf_test_add_ex ( vsf_test_t test,
vsf_test_case_t test_case 
)

Add to add a test case of any type.

Parameters
[in]testa pointer to structure vsf_test_t
[in]test_casea pointer to array vsf_test_case_t
Returns
bool: true if add was successfully, or false

◆ vsf_test_add()

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.

Parameters
[in]testa pointer to structure vsf_test_t
[in]jmp_fna pointer to function vsf_test_jmp_fn_t
[in]cfga string of request information for the test case
Returns
bool: true if add was successfully, or false

◆ vsf_test_add_bool_fn()

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.

Parameters
[in]testa pointer to structure vsf_test_t
[in]b_fna pointer to function vsf_test_bool_fn_t
[in]cfga string of request information for the test case
Returns
bool: true if add was successfully, or false

◆ __vsf_test_longjmp()

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

Parameters
[in]testa pointer to structure vsf_test_t
[in]resulttest result, vsf_test_result_t
[in]file_namethen name of the file where the assertion occurred
[in]linethe line number of the code where the assertion occurred
[in]function_namethe name of the function where the assertion occurred
[in]conditionString of asserted code
Note
This function will be called when the test case asserts that the condition is not satisfied.

◆ vsf_test_reboot()

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.

Parameters
[in]testa pointer to structure vsf_test_t
[in]resulttest result, vsf_test_result_t
[in]file_namethen name of the file where the assertion occurred
[in]linethe line number of the code where the assertion occurred
[in]function_namethe name of the function where the assertion occurred
[in]additional_strprovide additional exception information

◆ vsf_test_run_tests()

void vsf_test_run_tests ( vsf_test_t test)

Run all tests. Should be called after all use cases have been initialized.

Parameters
[in]testa pointer to structure vsf_test_t