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 
test_serializer(const param_group_t * param_group,const ptest_func_t * test_func)11 void test_serializer(const param_group_t *param_group, const ptest_func_t* test_func)
12 {
13     ESP_LOGI("test", "run test: %s", param_group->name);
14     //in this test case, we want to make two devices as similar as possible, so use the same context
15     void *context = NULL;
16     test_func->pre_test(&context);
17 
18     void *pset = param_group->param_group;
19     for (int i = param_group->pset_num; i >0; i--) {
20         if (test_func->def_param) test_func->def_param(pset);
21         test_func->loop(pset, context);
22         pset+=param_group->pset_size;
23     }
24 
25     test_func->post_test(context);
26     free(context);
27     context = NULL;
28 }
29