• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef TEST_SUITE_H
17 #define TEST_SUITE_H
18 
19 #include <stdint.h>
20 #include "common_def.h"
21 #include "errcode.h"
22 
23 #ifdef __cplusplus
24 #if __cplusplus
25 extern "C" {
26 #endif /* __cplusplus */
27 #endif /* __cplusplus */
28 
29 /**
30  * @defgroup test_common_testsuite_api API
31  * @ingroup  test_common_testsuite
32  * @{
33  */
34 #define TEST_PARAM_ARGC_1 1
35 #define TEST_PARAM_ARGC_2 2
36 #define TEST_PARAM_ARGC_3 3
37 #define TEST_PARAM_ARGC_4 4
38 #define TEST_PARAM_ARGC_5 5
39 #define TEST_PARAM_ARGC_6 6
40 #define TEST_PARAM_ARGC_7 7
41 #define TEST_PARAM_4_BYTES 4
42 #define TEST_PARAM_8_BYTES 8
43 
44 #define add_function(x, y, z) uapi_test_suite_add_function(x, y, z)
45 
46 /**
47  * @if Eng
48  * @brief  Test function pointer interface.
49  * @param  [in]  argc The input parameter number.
50  * @param  [in]  argv The input paramter list.
51  * @retval ERRCODE_SUCC Test success.
52  * @retval Other        Test failure. For details, see @ref errcode_t.
53  * @else
54  * @brief  功能测试函数回调指针。
55  * @param  [in]  argc 入参个数。
56  * @param  [in]  argv 入参列表。
57  * @retval ERRCODE_SUCC 测试成功。
58  * @retval Other        测试失败。 参考 see @ref errcode_t 。
59  * @endif
60  */
61 typedef int (*test_suite_function_callback_t)(int32_t argc, char *argv[]);
62 
63 /**
64  * @if Eng
65  * @brief  Initialize test suite resources.
66  * @else
67  * @brief  初始化测试套件资源。
68  * @endif
69  */
70 void uapi_test_suite_init(void);
71 
72 /**
73  * @if Eng
74  * @brief  Deinitialize test suite resources.
75  * @else
76  * @brief  去初始化测试套件资源。
77  * @endif
78  */
79 void uapi_test_suite_deinit(void);
80 
81 /**
82  * @if Eng
83  * @brief  Adds a function to the testsuite functions list.
84  * @param  [in]  name The external 'user' name of the function.
85  * @param  [in]  description A brief description of the function.
86  * @param  [in]  func function pointer to the function.
87  * @retval ERRCODE_SUCC The function has been added.
88  * @retval Other        Too many functions have been added. For details, see @ref errcode_t.
89  * @else
90  * @brief  添加需要功能测试到测试套件的列表中。
91  * @param  [in]  name 测试的功能函数名字。
92  * @param  [in]  description 简要的功能测试描述。
93  * @param  [in]  func 功能测试函数接口。
94  * @retval ERRCODE_SUCC 函数添加成功。
95  * @retval Other        函数添加超过最大数量。 参考 see @ref errcode_t 。
96  * @endif
97  */
98 errcode_t uapi_test_suite_add_function(char *name, char *description, test_suite_function_callback_t func);
99 
100 /**
101  * @}
102  */
103 
104 #ifdef __cplusplus
105 #if __cplusplus
106 }
107 #endif /* __cplusplus */
108 #endif /* __cplusplus */
109 
110 #endif