1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
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 UNITTEST_UTILS_H
17 #define UNITTEST_UTILS_H
18 
19 #include <cstdint>
20 #include <string>
21 
22 #define AVCODEC_GTEST_RUN_TASK(testSuit, testCase)                                                                     \
23     do {                                                                                                               \
24         MultiThreadTest _test(g_thread_count);                                                                         \
25         _test.runTask(_test.m_threadNum, TC_##testSuit##_##testCase, #testSuit, #testCase);                            \
26     } while (0)
27 
28 #define AVCODEC_MTEST_P(testSuit, testCase, level, tnum)                                                               \
29     void TC_##testSuit##_##testCase();                                                                                 \
30     HWTEST_P(testSuit, testCase, level)                                                                                \
31     {                                                                                                                  \
32         SET_THREAD_NUM(tnum);                                                                                          \
33         AVCODEC_GTEST_RUN_TASK(testSuit, testCase);                                                                    \
34     }                                                                                                                  \
35     void TC_##testSuit##_##testCase()
36 
37 namespace OHOS {
38 namespace MediaAVCodec {
39 [[maybe_unused]] void DecArgv(int &index, int &argc, char **argv);
40 [[maybe_unused]] int32_t GetNum(const char *str, const std::string key);
41 
42 } // namespace MediaAVCodec
43 } // namespace OHOS
44 #endif // UNITTEST_UTILS_H