1 /* 2 * Copyright (c) 2022 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 #include "gtest/gtest.h" 17 #include <securec.h> 18 #include "softbus_errcode.h" 19 #include "softbus_adapter_hisysevent.h" 20 21 using namespace testing::ext; 22 namespace OHOS { 23 class DsoftbusDfxTest : public testing::Test { 24 protected: SetUpTestCase()25 static void SetUpTestCase() {} TearDownTestCase()26 static void TearDownTestCase() {} SetUp()27 void SetUp() override {} TearDown()28 void TearDown() override {} 29 }; 30 31 /* 32 * @tc.name: HiSysEventParamDeInitTest001 33 * @tc.desc: paramType is SOFTBUS_EVT_PARAMTYPE_STRING 34 * @tc.type: FUNC 35 * @tc.require: 1 36 */ 37 HWTEST_F(DsoftbusDfxTest, HiSysEventParamDeInitTest001, TestSize.Level1) 38 { 39 SoftBusEvtParam evtParam; 40 strcpy_s(evtParam.paramName, sizeof(evtParam.paramName), "test"); 41 evtParam.paramType = SOFTBUS_EVT_PARAMTYPE_STRING; 42 strcpy_s(evtParam.paramValue.str, sizeof(evtParam.paramValue.str), "test"); 43 44 SoftBusEvtReportMsg reportMsg; 45 reportMsg.paramArray = &evtParam; 46 reportMsg.paramNum = 1; 47 int32_t ret = SoftbusWriteHisEvt(&reportMsg); 48 EXPECT_EQ(SOFTBUS_OK, ret); 49 } 50 }