param_test.c 713 B

1234567891011121314151617181920212223
  1. #include <stddef.h>
  2. #include <stdlib.h>
  3. #include "param_test.h"
  4. #include "esp_log.h"
  5. void test_serializer(const param_group_t *param_group, const ptest_func_t* test_func)
  6. {
  7. ESP_LOGI("test", "run test: %s", param_group->name);
  8. //in this test case, we want to make two devices as similar as possible, so use the same context
  9. void *context = NULL;
  10. test_func->pre_test(&context);
  11. void *pset = param_group->param_group;
  12. for (int i = param_group->pset_num; i >0; i--) {
  13. if (test_func->def_param) test_func->def_param(pset);
  14. test_func->loop(pset, context);
  15. pset+=param_group->pset_size;
  16. }
  17. test_func->post_test(context);
  18. free(context);
  19. context = NULL;
  20. }