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 COMMON_TOOL_H 17 #define COMMON_TOOL_H 18 19 #include <iostream> 20 #include <string> 21 #include <ctime> 22 #include <sys/time.h> 23 #include <stdint.h> 24 25 #include "nocopyable.h" 26 27 namespace OHOS { 28 namespace MediaAVCodec { 29 constexpr int32_t FUZZ_TEST_NUM = 2000; 30 constexpr int32_t REPEAT_CALL_NUM = 2000; 31 constexpr int32_t RUN_TIME = 2 * 3600; 32 constexpr int32_t CONSTASNTS = 256; 33 constexpr int32_t STRING_LEN = 65535; 34 constexpr int32_t RAND_INT_MIN = -1000000; 35 constexpr int32_t RAND_INT_MAX = 1000000; 36 constexpr double DOUBLE_MIN = -10000; 37 constexpr double DOUBLE_MAX = 10000; 38 39 class CommonTool : public NoCopyable { 40 public: 41 CommonTool(); 42 ~CommonTool() = default; 43 44 std::string GetRandString(); 45 int32_t GetRandInt(); 46 int64_t GetRandLong(); 47 float GetRandFloat(); 48 double GetRandDouble(); 49 }; 50 } // namespace MediaAVCodec 51 } // namespace OHOS 52 53 #endif // COMMON_TOOL_H