param_test.c 830 B

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