1 /* 2 * Copyright (c) 2020-2021 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 HCTEST_INTERNAL_H 17 #define HCTEST_INTERNAL_H 18 19 #include "common.h" 20 21 #ifdef __cplusplus 22 #if __cplusplus 23 extern "C" { 24 #endif 25 #endif 26 27 typedef struct TestResult TestResult; 28 struct TestResult { 29 const int8 result; 30 const char* messages; 31 }; 32 33 typedef struct CTestCase CTestCase; 34 struct CTestCase { 35 /** 36 * @brief test suite name 37 * */ 38 const char *suite_name; 39 40 /** 41 * @brief test case name 42 * */ 43 const char *case_name; 44 45 /** 46 * @brief test case flag 47 * */ 48 int32 flag; 49 50 /** 51 * @brief test case line number 52 * */ 53 int16 line_num; 54 55 /** 56 * @brief test case setup. 57 * @param the test case addr. 58 * @return TRUE success 59 * */ 60 BOOL (*lite_setup)(void); 61 62 /** 63 * @brief test case teardown. 64 * @param the test case addr. 65 * @return TRUE success 66 * */ 67 BOOL (*lite_teardown)(void); 68 69 /** 70 * @brief execute the test case. 71 * @param the test case addr. 72 * @return test results 73 * */ 74 void (*execute_func)(void); 75 }; 76 77 /** 78 * test type 79 */ 80 enum TestType { 81 Function = 1 << 8, 82 Performance = 2 << 8, 83 Power = 3 << 8, 84 Reliability = 4 << 8, 85 Security = 5 << 8, 86 Global = 6 << 8, 87 Compatibility = 7 << 8, 88 User = 8 << 8, 89 Standard = 9 << 8, 90 Safety = 10 << 8, 91 Resilience = 11 << 8 92 }; 93 94 /** 95 * test size 96 */ 97 enum TestSize { 98 SmallTest = 1 << 4, 99 MediumTest = 2 << 4, 100 LargeTest = 3 << 4 101 }; 102 103 /** 104 * test case level 105 */ 106 enum TestRank { 107 Level0 = 1, 108 Level1 = 2, 109 Level2 = 3, 110 Level3 = 4, 111 Level4 = 5 112 }; 113 114 /** 115 * test case level 116 */ 117 enum TestLevel { 118 LEVEL0 = 1, 119 LEVEL1 = 2, 120 LEVEL2 = 3, 121 LEVEL3 = 4, 122 LEVEL4 = 5 123 }; 124 125 typedef struct CTestSuite CTestSuite; 126 struct CTestSuite { 127 const char* subsystem_name; 128 const char* module_name; 129 const char* suite_name; 130 const char* file; 131 int16 times; 132 Vector test_cases; 133 }; 134 135 #define HCTEST_SERVICE "HCTEST" 136 #define TEST_FLAG 0x02 137 #define MSG_START_TEST 1 138 #define MAXIMUM_TRY_TIMES 3 139 #define TASK_QUEUE_SIZE 20 140 141 #ifdef __cplusplus 142 #if __cplusplus 143 } 144 #endif 145 #endif 146 147 #endif 148 149