1060ff233Sopenharmony_ci/*
2060ff233Sopenharmony_ci * Copyright (c) 2022-2024 Huawei Device Co., Ltd.
3060ff233Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4060ff233Sopenharmony_ci * you may not use this file except in compliance with the License.
5060ff233Sopenharmony_ci * You may obtain a copy of the License at
6060ff233Sopenharmony_ci *
7060ff233Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8060ff233Sopenharmony_ci *
9060ff233Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10060ff233Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11060ff233Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12060ff233Sopenharmony_ci * See the License for the specific language governing permissions and
13060ff233Sopenharmony_ci * limitations under the License.
14060ff233Sopenharmony_ci */
15060ff233Sopenharmony_ci
16060ff233Sopenharmony_ci#include "gtest/gtest.h"
17060ff233Sopenharmony_ci#include <securec.h>
18060ff233Sopenharmony_ci#include "softbus_errcode.h"
19060ff233Sopenharmony_ci#include "softbus_adapter_hisysevent.h"
20060ff233Sopenharmony_ci
21060ff233Sopenharmony_ciusing namespace testing::ext;
22060ff233Sopenharmony_ci
23060ff233Sopenharmony_cinamespace OHOS {
24060ff233Sopenharmony_ci
25060ff233Sopenharmony_ciclass AdapterDsoftbusDfxTest : public testing::Test {
26060ff233Sopenharmony_ciprotected:
27060ff233Sopenharmony_ci    static void SetUpTestCase() {}
28060ff233Sopenharmony_ci    static void TearDownTestCase() {}
29060ff233Sopenharmony_ci    void SetUp() override {}
30060ff233Sopenharmony_ci    void TearDown() override {}
31060ff233Sopenharmony_ci};
32060ff233Sopenharmony_ci
33060ff233Sopenharmony_ci/*
34060ff233Sopenharmony_ci* @tc.name: SoftbusWriteHisEvtTest001
35060ff233Sopenharmony_ci* @tc.desc: ParamType is SOFTBUS_EVT_PARAMTYPE_BOOL
36060ff233Sopenharmony_ci* @tc.type: FUNC
37060ff233Sopenharmony_ci* @tc.require: 1
38060ff233Sopenharmony_ci*/
39060ff233Sopenharmony_ciHWTEST_F(AdapterDsoftbusDfxTest, SoftbusWriteHisEvtTest001, TestSize.Level1)
40060ff233Sopenharmony_ci{
41060ff233Sopenharmony_ci    SoftBusEvtParam evtParam;
42060ff233Sopenharmony_ci    strcpy_s(evtParam.paramName, sizeof(evtParam.paramName), "testParamName");
43060ff233Sopenharmony_ci    evtParam.paramType = SOFTBUS_EVT_PARAMTYPE_BOOL;
44060ff233Sopenharmony_ci    evtParam.paramValue.b = false;
45060ff233Sopenharmony_ci
46060ff233Sopenharmony_ci    SoftBusEvtReportMsg reportMsg;
47060ff233Sopenharmony_ci    reportMsg.evtType = SOFTBUS_EVT_TYPE_FAULT;
48060ff233Sopenharmony_ci    reportMsg.paramArray = &evtParam;
49060ff233Sopenharmony_ci    reportMsg.paramNum = 1;
50060ff233Sopenharmony_ci    strcpy_s(reportMsg.evtName, sizeof(evtParam.paramName), "testEvent");
51060ff233Sopenharmony_ci    int32_t ret = SoftbusWriteHisEvt(&reportMsg);
52060ff233Sopenharmony_ci    EXPECT_EQ(SOFTBUS_OK, ret);
53060ff233Sopenharmony_ci}
54060ff233Sopenharmony_ci
55060ff233Sopenharmony_ci/*
56060ff233Sopenharmony_ci* @tc.name: SoftbusWriteHisEvtTest002
57060ff233Sopenharmony_ci* @tc.desc: ParamType is SOFTBUS_EVT_PARAMTYPE_UINT8
58060ff233Sopenharmony_ci* @tc.type: FUNC
59060ff233Sopenharmony_ci* @tc.require: 1
60060ff233Sopenharmony_ci*/
61060ff233Sopenharmony_ciHWTEST_F(AdapterDsoftbusDfxTest, SoftbusWriteHisEvtTest002, TestSize.Level1)
62060ff233Sopenharmony_ci{
63060ff233Sopenharmony_ci    SoftBusEvtParam evtParam;
64060ff233Sopenharmony_ci    strcpy_s(evtParam.paramName, sizeof(evtParam.paramName), "testParamName");
65060ff233Sopenharmony_ci    evtParam.paramType = SOFTBUS_EVT_PARAMTYPE_UINT8;
66060ff233Sopenharmony_ci    evtParam.paramValue.u8v = UINT8_MAX;
67060ff233Sopenharmony_ci
68060ff233Sopenharmony_ci    SoftBusEvtReportMsg reportMsg;
69060ff233Sopenharmony_ci    reportMsg.evtType = SOFTBUS_EVT_TYPE_FAULT;
70060ff233Sopenharmony_ci    reportMsg.paramArray = &evtParam;
71060ff233Sopenharmony_ci    reportMsg.paramNum = 1;
72060ff233Sopenharmony_ci    strcpy_s(reportMsg.evtName, sizeof(evtParam.paramName), "testEvent");
73060ff233Sopenharmony_ci    int32_t ret = SoftbusWriteHisEvt(&reportMsg);
74060ff233Sopenharmony_ci    EXPECT_EQ(SOFTBUS_OK, ret);
75060ff233Sopenharmony_ci}
76060ff233Sopenharmony_ci
77060ff233Sopenharmony_ci/*
78060ff233Sopenharmony_ci* @tc.name: SoftbusWriteHisEvtTest003
79060ff233Sopenharmony_ci* @tc.desc: ParamType is SOFTBUS_EVT_PARAMTYPE_UINT16
80060ff233Sopenharmony_ci* @tc.type: FUNC
81060ff233Sopenharmony_ci* @tc.require: 1
82060ff233Sopenharmony_ci*/
83060ff233Sopenharmony_ciHWTEST_F(AdapterDsoftbusDfxTest, SoftbusWriteHisEvtTest003, TestSize.Level1)
84060ff233Sopenharmony_ci{
85060ff233Sopenharmony_ci    SoftBusEvtParam evtParam;
86060ff233Sopenharmony_ci    strcpy_s(evtParam.paramName, sizeof(evtParam.paramName), "testParamName");
87060ff233Sopenharmony_ci    evtParam.paramType = SOFTBUS_EVT_PARAMTYPE_UINT16;
88060ff233Sopenharmony_ci    evtParam.paramValue.u16v = UINT16_MAX;
89060ff233Sopenharmony_ci
90060ff233Sopenharmony_ci    SoftBusEvtReportMsg reportMsg;
91060ff233Sopenharmony_ci    reportMsg.evtType = SOFTBUS_EVT_TYPE_FAULT;
92060ff233Sopenharmony_ci    reportMsg.paramArray = &evtParam;
93060ff233Sopenharmony_ci    reportMsg.paramNum = 1;
94060ff233Sopenharmony_ci    strcpy_s(reportMsg.evtName, sizeof(evtParam.paramName), "testEvent");
95060ff233Sopenharmony_ci    int32_t ret = SoftbusWriteHisEvt(&reportMsg);
96060ff233Sopenharmony_ci    EXPECT_EQ(SOFTBUS_OK, ret);
97060ff233Sopenharmony_ci}
98060ff233Sopenharmony_ci
99060ff233Sopenharmony_ci/*
100060ff233Sopenharmony_ci* @tc.name: SoftbusWriteHisEvtTest004
101060ff233Sopenharmony_ci* @tc.desc: ParamType is SOFTBUS_EVT_PARAMTYPE_INT32
102060ff233Sopenharmony_ci* @tc.type: FUNC
103060ff233Sopenharmony_ci* @tc.require: 1
104060ff233Sopenharmony_ci*/
105060ff233Sopenharmony_ciHWTEST_F(AdapterDsoftbusDfxTest, SoftbusWriteHisEvtTest004, TestSize.Level1)
106060ff233Sopenharmony_ci{
107060ff233Sopenharmony_ci    SoftBusEvtParam evtParam;
108060ff233Sopenharmony_ci    strcpy_s(evtParam.paramName, sizeof(evtParam.paramName), "testParamName");
109060ff233Sopenharmony_ci    evtParam.paramType = SOFTBUS_EVT_PARAMTYPE_INT32;
110060ff233Sopenharmony_ci    evtParam.paramValue.i32v = INT32_MAX;
111060ff233Sopenharmony_ci
112060ff233Sopenharmony_ci    SoftBusEvtReportMsg reportMsg;
113060ff233Sopenharmony_ci    reportMsg.evtType = SOFTBUS_EVT_TYPE_FAULT;
114060ff233Sopenharmony_ci    reportMsg.paramArray = &evtParam;
115060ff233Sopenharmony_ci    reportMsg.paramNum = 1;
116060ff233Sopenharmony_ci    strcpy_s(reportMsg.evtName, sizeof(evtParam.paramName), "testEvent");
117060ff233Sopenharmony_ci    int32_t ret = SoftbusWriteHisEvt(&reportMsg);
118060ff233Sopenharmony_ci    EXPECT_EQ(SOFTBUS_OK, ret);
119060ff233Sopenharmony_ci}
120060ff233Sopenharmony_ci
121060ff233Sopenharmony_ci/*
122060ff233Sopenharmony_ci* @tc.name: SoftbusWriteHisEvtTest005
123060ff233Sopenharmony_ci* @tc.desc: ParamType is SOFTBUS_EVT_PARAMTYPE_UINT32
124060ff233Sopenharmony_ci* @tc.type: FUNC
125060ff233Sopenharmony_ci* @tc.require: 1
126060ff233Sopenharmony_ci*/
127060ff233Sopenharmony_ciHWTEST_F(AdapterDsoftbusDfxTest, SoftbusWriteHisEvtTest005, TestSize.Level1)
128060ff233Sopenharmony_ci{
129060ff233Sopenharmony_ci    SoftBusEvtParam evtParam;
130060ff233Sopenharmony_ci    strcpy_s(evtParam.paramName, sizeof(evtParam.paramName), "testParamName");
131060ff233Sopenharmony_ci    evtParam.paramType = SOFTBUS_EVT_PARAMTYPE_UINT32;
132060ff233Sopenharmony_ci    evtParam.paramValue.u32v = UINT32_MAX;
133060ff233Sopenharmony_ci
134060ff233Sopenharmony_ci    SoftBusEvtReportMsg reportMsg;
135060ff233Sopenharmony_ci    reportMsg.evtType = SOFTBUS_EVT_TYPE_FAULT;
136060ff233Sopenharmony_ci    reportMsg.paramArray = &evtParam;
137060ff233Sopenharmony_ci    reportMsg.paramNum = 1;
138060ff233Sopenharmony_ci    strcpy_s(reportMsg.evtName, sizeof(evtParam.paramName), "testEvent");
139060ff233Sopenharmony_ci    int32_t ret = SoftbusWriteHisEvt(&reportMsg);
140060ff233Sopenharmony_ci    EXPECT_EQ(SOFTBUS_OK, ret);
141060ff233Sopenharmony_ci}
142060ff233Sopenharmony_ci
143060ff233Sopenharmony_ci/*
144060ff233Sopenharmony_ci* @tc.name: SoftbusWriteHisEvtTest006
145060ff233Sopenharmony_ci* @tc.desc: ParamType is SOFTBUS_EVT_PARAMTYPE_UINT64
146060ff233Sopenharmony_ci* @tc.type: FUNC
147060ff233Sopenharmony_ci* @tc.require: 1
148060ff233Sopenharmony_ci*/
149060ff233Sopenharmony_ciHWTEST_F(AdapterDsoftbusDfxTest, SoftbusWriteHisEvtTest006, TestSize.Level1)
150060ff233Sopenharmony_ci{
151060ff233Sopenharmony_ci    SoftBusEvtParam evtParam;
152060ff233Sopenharmony_ci    strcpy_s(evtParam.paramName, sizeof(evtParam.paramName), "testParamName");
153060ff233Sopenharmony_ci    evtParam.paramType = SOFTBUS_EVT_PARAMTYPE_UINT64;
154060ff233Sopenharmony_ci    evtParam.paramValue.u64v = UINT64_MAX;
155060ff233Sopenharmony_ci
156060ff233Sopenharmony_ci    SoftBusEvtReportMsg reportMsg;
157060ff233Sopenharmony_ci    reportMsg.evtType = SOFTBUS_EVT_TYPE_FAULT;
158060ff233Sopenharmony_ci    reportMsg.paramArray = &evtParam;
159060ff233Sopenharmony_ci    reportMsg.paramNum = 1;
160060ff233Sopenharmony_ci    strcpy_s(reportMsg.evtName, sizeof(evtParam.paramName), "testEvent");
161060ff233Sopenharmony_ci    int32_t ret = SoftbusWriteHisEvt(&reportMsg);
162060ff233Sopenharmony_ci    EXPECT_EQ(SOFTBUS_OK, ret);
163060ff233Sopenharmony_ci}
164060ff233Sopenharmony_ci
165060ff233Sopenharmony_ci/*
166060ff233Sopenharmony_ci* @tc.name: SoftbusWriteHisEvtTest007
167060ff233Sopenharmony_ci* @tc.desc: ParamType is SOFTBUS_EVT_PARAMTYPE_FLOAT
168060ff233Sopenharmony_ci* @tc.type: FUNC
169060ff233Sopenharmony_ci* @tc.require: 1
170060ff233Sopenharmony_ci*/
171060ff233Sopenharmony_ciHWTEST_F(AdapterDsoftbusDfxTest, SoftbusWriteHisEvtTest007, TestSize.Level1)
172060ff233Sopenharmony_ci{
173060ff233Sopenharmony_ci    SoftBusEvtParam evtParam;
174060ff233Sopenharmony_ci    strcpy_s(evtParam.paramName, sizeof(evtParam.paramName), "testParamName");
175060ff233Sopenharmony_ci    evtParam.paramType = SOFTBUS_EVT_PARAMTYPE_FLOAT;
176060ff233Sopenharmony_ci    evtParam.paramValue.f = 0.1f;
177060ff233Sopenharmony_ci
178060ff233Sopenharmony_ci    SoftBusEvtReportMsg reportMsg;
179060ff233Sopenharmony_ci    reportMsg.evtType = SOFTBUS_EVT_TYPE_FAULT;
180060ff233Sopenharmony_ci    reportMsg.paramArray = &evtParam;
181060ff233Sopenharmony_ci    reportMsg.paramNum = 1;
182060ff233Sopenharmony_ci    strcpy_s(reportMsg.evtName, sizeof(evtParam.paramName), "testEvent");
183060ff233Sopenharmony_ci    int32_t ret = SoftbusWriteHisEvt(&reportMsg);
184060ff233Sopenharmony_ci    EXPECT_EQ(SOFTBUS_OK, ret);
185060ff233Sopenharmony_ci}
186060ff233Sopenharmony_ci
187060ff233Sopenharmony_ci/*
188060ff233Sopenharmony_ci* @tc.name: SoftbusWriteHisEvtTest008
189060ff233Sopenharmony_ci* @tc.desc: ParamType is SOFTBUS_EVT_PARAMTYPE_DOUBLE
190060ff233Sopenharmony_ci* @tc.type: FUNC
191060ff233Sopenharmony_ci* @tc.require: 1
192060ff233Sopenharmony_ci*/
193060ff233Sopenharmony_ciHWTEST_F(AdapterDsoftbusDfxTest, SoftbusWriteHisEvtTest008, TestSize.Level1)
194060ff233Sopenharmony_ci{
195060ff233Sopenharmony_ci    SoftBusEvtParam evtParam;
196060ff233Sopenharmony_ci    strcpy_s(evtParam.paramName, sizeof(evtParam.paramName), "testParamName");
197060ff233Sopenharmony_ci    evtParam.paramType = SOFTBUS_EVT_PARAMTYPE_DOUBLE;
198060ff233Sopenharmony_ci    evtParam.paramValue.d = 0.2;
199060ff233Sopenharmony_ci
200060ff233Sopenharmony_ci    SoftBusEvtReportMsg reportMsg;
201060ff233Sopenharmony_ci    reportMsg.evtType = SOFTBUS_EVT_TYPE_FAULT;
202060ff233Sopenharmony_ci    reportMsg.paramArray = &evtParam;
203060ff233Sopenharmony_ci    reportMsg.paramNum = 1;
204060ff233Sopenharmony_ci    strcpy_s(reportMsg.evtName, sizeof(evtParam.paramName), "testEvent");
205060ff233Sopenharmony_ci    int32_t ret = SoftbusWriteHisEvt(&reportMsg);
206060ff233Sopenharmony_ci    EXPECT_EQ(SOFTBUS_OK, ret);
207060ff233Sopenharmony_ci}
208060ff233Sopenharmony_ci
209060ff233Sopenharmony_ci/*
210060ff233Sopenharmony_ci* @tc.name: SoftbusWriteHisEvtTest009
211060ff233Sopenharmony_ci* @tc.desc: ParamType is SOFTBUS_EVT_PARAMTYPE_STRING
212060ff233Sopenharmony_ci* @tc.type: FUNC
213060ff233Sopenharmony_ci* @tc.require: 1
214060ff233Sopenharmony_ci*/
215060ff233Sopenharmony_ciHWTEST_F(AdapterDsoftbusDfxTest, SoftbusWriteHisEvtTest009, TestSize.Level1)
216060ff233Sopenharmony_ci{
217060ff233Sopenharmony_ci    SoftBusEvtParam evtParam;
218060ff233Sopenharmony_ci    strcpy_s(evtParam.paramName, sizeof(evtParam.paramName), "testParamName");
219060ff233Sopenharmony_ci    evtParam.paramType = SOFTBUS_EVT_PARAMTYPE_STRING;
220060ff233Sopenharmony_ci    strcpy_s(evtParam.paramValue.str, sizeof(evtParam.paramValue.str), "testParamValue");
221060ff233Sopenharmony_ci
222060ff233Sopenharmony_ci    SoftBusEvtReportMsg reportMsg;
223060ff233Sopenharmony_ci    reportMsg.evtType = SOFTBUS_EVT_TYPE_FAULT;
224060ff233Sopenharmony_ci    reportMsg.paramArray = &evtParam;
225060ff233Sopenharmony_ci    reportMsg.paramNum = 1;
226060ff233Sopenharmony_ci    strcpy_s(reportMsg.evtName, sizeof(evtParam.paramName), "testevent");
227060ff233Sopenharmony_ci    int32_t ret = SoftbusWriteHisEvt(&reportMsg);
228060ff233Sopenharmony_ci    EXPECT_EQ(SOFTBUS_OK, ret);
229060ff233Sopenharmony_ci}
230060ff233Sopenharmony_ci
231060ff233Sopenharmony_ci/*
232060ff233Sopenharmony_ci* @tc.name: SoftbusWriteHisEvtTest010
233060ff233Sopenharmony_ci* @tc.desc: ParamType is SOFTBUS_EVT_PARAMTYPE_BUTT
234060ff233Sopenharmony_ci* @tc.type: FUNC
235060ff233Sopenharmony_ci* @tc.require: 1
236060ff233Sopenharmony_ci*/
237060ff233Sopenharmony_ciHWTEST_F(AdapterDsoftbusDfxTest, SoftbusWriteHisEvtTest010, TestSize.Level1)
238060ff233Sopenharmony_ci{
239060ff233Sopenharmony_ci    SoftBusEvtParam evtParam;
240060ff233Sopenharmony_ci    strcpy_s(evtParam.paramName, sizeof(evtParam.paramName), "testParamName");
241060ff233Sopenharmony_ci    evtParam.paramType = SOFTBUS_EVT_PARAMTYPE_BUTT;
242060ff233Sopenharmony_ci    strcpy_s(evtParam.paramValue.str, sizeof(evtParam.paramValue.str), "testParamValue");
243060ff233Sopenharmony_ci
244060ff233Sopenharmony_ci    SoftBusEvtReportMsg reportMsg;
245060ff233Sopenharmony_ci    reportMsg.evtType = SOFTBUS_EVT_TYPE_FAULT;
246060ff233Sopenharmony_ci    reportMsg.paramArray = &evtParam;
247060ff233Sopenharmony_ci    reportMsg.paramNum = 1;
248060ff233Sopenharmony_ci    strcpy_s(reportMsg.evtName, sizeof(evtParam.paramName), "testevent");
249060ff233Sopenharmony_ci    int32_t ret = SoftbusWriteHisEvt(&reportMsg);
250060ff233Sopenharmony_ci    EXPECT_EQ(SOFTBUS_OK, ret);
251060ff233Sopenharmony_ci}
252060ff233Sopenharmony_ci
253060ff233Sopenharmony_ci/*
254060ff233Sopenharmony_ci* @tc.name: SoftbusWriteHisEvtTest021
255060ff233Sopenharmony_ci* @tc.desc: evtType is SOFTBUS_EVT_TYPE_STATISTIC
256060ff233Sopenharmony_ci* @tc.type: FUNC
257060ff233Sopenharmony_ci* @tc.require: 1
258060ff233Sopenharmony_ci*/
259060ff233Sopenharmony_ciHWTEST_F(AdapterDsoftbusDfxTest, SoftbusWriteHisEvtTest021, TestSize.Level1)
260060ff233Sopenharmony_ci{
261060ff233Sopenharmony_ci    SoftBusEvtParam evtParam;
262060ff233Sopenharmony_ci    strcpy_s(evtParam.paramName, sizeof(evtParam.paramName), "testParamName");
263060ff233Sopenharmony_ci    evtParam.paramType = SOFTBUS_EVT_PARAMTYPE_STRING;
264060ff233Sopenharmony_ci    strcpy_s(evtParam.paramValue.str, sizeof(evtParam.paramValue.str), "testParamValue");
265060ff233Sopenharmony_ci
266060ff233Sopenharmony_ci    SoftBusEvtReportMsg reportMsg;
267060ff233Sopenharmony_ci    reportMsg.evtType = SOFTBUS_EVT_TYPE_STATISTIC;
268060ff233Sopenharmony_ci    reportMsg.paramArray = &evtParam;
269060ff233Sopenharmony_ci    reportMsg.paramNum = 1;
270060ff233Sopenharmony_ci    strcpy_s(reportMsg.evtName, sizeof(evtParam.paramName), "testevent");
271060ff233Sopenharmony_ci    int32_t ret = SoftbusWriteHisEvt(&reportMsg);
272060ff233Sopenharmony_ci    EXPECT_EQ(SOFTBUS_OK, ret);
273060ff233Sopenharmony_ci}
274060ff233Sopenharmony_ci
275060ff233Sopenharmony_ci
276060ff233Sopenharmony_ci/*
277060ff233Sopenharmony_ci* @tc.name: SoftbusWriteHisEvtTest022
278060ff233Sopenharmony_ci* @tc.desc: evtType is SOFTBUS_EVT_TYPE_SECURITY
279060ff233Sopenharmony_ci* @tc.type: FUNC
280060ff233Sopenharmony_ci* @tc.require: 1
281060ff233Sopenharmony_ci*/
282060ff233Sopenharmony_ciHWTEST_F(AdapterDsoftbusDfxTest, SoftbusWriteHisEvtTest022, TestSize.Level1)
283060ff233Sopenharmony_ci{
284060ff233Sopenharmony_ci    SoftBusEvtParam evtParam;
285060ff233Sopenharmony_ci    strcpy_s(evtParam.paramName, sizeof(evtParam.paramName), "testParamName");
286060ff233Sopenharmony_ci    evtParam.paramType = SOFTBUS_EVT_PARAMTYPE_STRING;
287060ff233Sopenharmony_ci    strcpy_s(evtParam.paramValue.str, sizeof(evtParam.paramValue.str), "testParamValue");
288060ff233Sopenharmony_ci
289060ff233Sopenharmony_ci    SoftBusEvtReportMsg reportMsg;
290060ff233Sopenharmony_ci    reportMsg.evtType = SOFTBUS_EVT_TYPE_SECURITY;
291060ff233Sopenharmony_ci    reportMsg.paramArray = &evtParam;
292060ff233Sopenharmony_ci    reportMsg.paramNum = 1;
293060ff233Sopenharmony_ci    strcpy_s(reportMsg.evtName, sizeof(evtParam.paramName), "testevent");
294060ff233Sopenharmony_ci    int32_t ret = SoftbusWriteHisEvt(&reportMsg);
295060ff233Sopenharmony_ci    EXPECT_EQ(SOFTBUS_OK, ret);
296060ff233Sopenharmony_ci}
297060ff233Sopenharmony_ci
298060ff233Sopenharmony_ci
299060ff233Sopenharmony_ci/*
300060ff233Sopenharmony_ci* @tc.name: SoftbusWriteHisEvtTest023
301060ff233Sopenharmony_ci* @tc.desc: evtType is SOFTBUS_EVT_TYPE_BEHAVIOR
302060ff233Sopenharmony_ci* @tc.type: FUNC
303060ff233Sopenharmony_ci* @tc.require: 1
304060ff233Sopenharmony_ci*/
305060ff233Sopenharmony_ciHWTEST_F(AdapterDsoftbusDfxTest, SoftbusWriteHisEvtTest023, TestSize.Level1)
306060ff233Sopenharmony_ci{
307060ff233Sopenharmony_ci    SoftBusEvtParam evtParam;
308060ff233Sopenharmony_ci    strcpy_s(evtParam.paramName, sizeof(evtParam.paramName), "testParamName");
309060ff233Sopenharmony_ci    evtParam.paramType = SOFTBUS_EVT_PARAMTYPE_STRING;
310060ff233Sopenharmony_ci    strcpy_s(evtParam.paramValue.str, sizeof(evtParam.paramValue.str), "testParamValue");
311060ff233Sopenharmony_ci
312060ff233Sopenharmony_ci    SoftBusEvtReportMsg reportMsg;
313060ff233Sopenharmony_ci    reportMsg.evtType = SOFTBUS_EVT_TYPE_BEHAVIOR;
314060ff233Sopenharmony_ci    reportMsg.paramArray = &evtParam;
315060ff233Sopenharmony_ci    reportMsg.paramNum = 1;
316060ff233Sopenharmony_ci    strcpy_s(reportMsg.evtName, sizeof(evtParam.paramName), "testevent");
317060ff233Sopenharmony_ci    int32_t ret = SoftbusWriteHisEvt(&reportMsg);
318060ff233Sopenharmony_ci    EXPECT_EQ(SOFTBUS_OK, ret);
319060ff233Sopenharmony_ci}
320060ff233Sopenharmony_ci
321060ff233Sopenharmony_ci
322060ff233Sopenharmony_ci/*
323060ff233Sopenharmony_ci* @tc.name: SoftbusWriteHisEvtTest024
324060ff233Sopenharmony_ci* @tc.desc: evtType is SOFTBUS_EVT_TYPE_BUTT
325060ff233Sopenharmony_ci* @tc.type: FUNC
326060ff233Sopenharmony_ci* @tc.require: 1
327060ff233Sopenharmony_ci*/
328060ff233Sopenharmony_ciHWTEST_F(AdapterDsoftbusDfxTest, SoftbusWriteHisEvtTest024, TestSize.Level1)
329060ff233Sopenharmony_ci{
330060ff233Sopenharmony_ci    SoftBusEvtParam evtParam;
331060ff233Sopenharmony_ci    strcpy_s(evtParam.paramName, sizeof(evtParam.paramName), "testParamName");
332060ff233Sopenharmony_ci    evtParam.paramType = SOFTBUS_EVT_PARAMTYPE_STRING;
333060ff233Sopenharmony_ci    strcpy_s(evtParam.paramValue.str, sizeof(evtParam.paramValue.str), "testParamValue");
334060ff233Sopenharmony_ci
335060ff233Sopenharmony_ci    SoftBusEvtReportMsg reportMsg;
336060ff233Sopenharmony_ci    reportMsg.evtType = SOFTBUS_EVT_TYPE_BUTT;
337060ff233Sopenharmony_ci    reportMsg.paramArray = &evtParam;
338060ff233Sopenharmony_ci    reportMsg.paramNum = 1;
339060ff233Sopenharmony_ci    strcpy_s(reportMsg.evtName, sizeof(evtParam.paramName), "testevent");
340060ff233Sopenharmony_ci    int32_t ret = SoftbusWriteHisEvt(&reportMsg);
341060ff233Sopenharmony_ci    EXPECT_EQ(SOFTBUS_OK, ret);
342060ff233Sopenharmony_ci}
343060ff233Sopenharmony_ci
344060ff233Sopenharmony_ci/*
345060ff233Sopenharmony_ci* @tc.name: SoftbusWriteHisEvtTest031
346060ff233Sopenharmony_ci* @tc.desc: paramNum is -1
347060ff233Sopenharmony_ci* @tc.type: FUNC
348060ff233Sopenharmony_ci* @tc.require: 1
349060ff233Sopenharmony_ci*/
350060ff233Sopenharmony_ciHWTEST_F(AdapterDsoftbusDfxTest, SoftbusWriteHisEvtTest031, TestSize.Level1)
351060ff233Sopenharmony_ci{
352060ff233Sopenharmony_ci    int32_t paramNum = -1;
353060ff233Sopenharmony_ci    SoftBusEvtReportMsg* msg = SoftbusCreateEvtReportMsg(paramNum);
354060ff233Sopenharmony_ci    int32_t ret = SoftbusWriteHisEvt(msg);
355060ff233Sopenharmony_ci    EXPECT_EQ(SOFTBUS_ERR, ret);
356060ff233Sopenharmony_ci    SoftbusFreeEvtReportMsg(msg);
357060ff233Sopenharmony_ci}
358060ff233Sopenharmony_ci
359060ff233Sopenharmony_ci/*
360060ff233Sopenharmony_ci* @tc.name: SoftbusCreateEvtReportMsgTest001
361060ff233Sopenharmony_ci* @tc.desc: Create softbus event report message nllptr
362060ff233Sopenharmony_ci* @tc.type: FUNC
363060ff233Sopenharmony_ci* @tc.require: 1
364060ff233Sopenharmony_ci*/
365060ff233Sopenharmony_ciHWTEST_F(AdapterDsoftbusDfxTest, SoftbusCreateEvtReportMsgTest001, TestSize.Level1)
366060ff233Sopenharmony_ci{
367060ff233Sopenharmony_ci    int32_t paramNum = -1;
368060ff233Sopenharmony_ci    SoftBusEvtReportMsg* msg = SoftbusCreateEvtReportMsg(paramNum);
369060ff233Sopenharmony_ci    EXPECT_EQ(nullptr, msg);
370060ff233Sopenharmony_ci    SoftbusFreeEvtReportMsg(msg);
371060ff233Sopenharmony_ci}
372060ff233Sopenharmony_ci
373060ff233Sopenharmony_ci/*
374060ff233Sopenharmony_ci* @tc.name: SoftbusCreateEvtReportMsgTest002
375060ff233Sopenharmony_ci* @tc.desc: Create softbus event report message nllptr
376060ff233Sopenharmony_ci* @tc.type: FUNC
377060ff233Sopenharmony_ci* @tc.require: 1
378060ff233Sopenharmony_ci*/
379060ff233Sopenharmony_ciHWTEST_F(AdapterDsoftbusDfxTest, SoftbusCreateEvtReportMsgTest002, TestSize.Level1)
380060ff233Sopenharmony_ci{
381060ff233Sopenharmony_ci    int32_t paramNum = SOFTBUS_EVT_PARAM_ZERO;
382060ff233Sopenharmony_ci    SoftBusEvtReportMsg* msg = SoftbusCreateEvtReportMsg(paramNum);
383060ff233Sopenharmony_ci    EXPECT_EQ(nullptr, msg);
384060ff233Sopenharmony_ci    SoftbusFreeEvtReportMsg(msg);
385060ff233Sopenharmony_ci}
386060ff233Sopenharmony_ci
387060ff233Sopenharmony_ci/*
388060ff233Sopenharmony_ci* @tc.name: SoftbusCreateEvtReportMsgTest003
389060ff233Sopenharmony_ci* @tc.desc: Create softbus event report message nllptr
390060ff233Sopenharmony_ci* @tc.type: FUNC
391060ff233Sopenharmony_ci* @tc.require: 1
392060ff233Sopenharmony_ci*/
393060ff233Sopenharmony_ciHWTEST_F(AdapterDsoftbusDfxTest, SoftbusCreateEvtReportMsgTest003, TestSize.Level1)
394060ff233Sopenharmony_ci{
395060ff233Sopenharmony_ci    int32_t paramNum = INT32_MAX;
396060ff233Sopenharmony_ci    SoftBusEvtReportMsg* msg = SoftbusCreateEvtReportMsg(paramNum);
397060ff233Sopenharmony_ci    EXPECT_EQ(nullptr, msg);
398060ff233Sopenharmony_ci    SoftbusFreeEvtReportMsg(msg);
399060ff233Sopenharmony_ci}
400060ff233Sopenharmony_ci
401060ff233Sopenharmony_ci/*
402060ff233Sopenharmony_ci* @tc.name: SoftbusCreateEvtReportMsgTest004
403060ff233Sopenharmony_ci* @tc.desc: Create softbus event report message nllptr
404060ff233Sopenharmony_ci* @tc.type: FUNC
405060ff233Sopenharmony_ci* @tc.require: 1
406060ff233Sopenharmony_ci*/
407060ff233Sopenharmony_ciHWTEST_F(AdapterDsoftbusDfxTest, SoftbusCreateEvtReportMsgTest004, TestSize.Level1)
408060ff233Sopenharmony_ci{
409060ff233Sopenharmony_ci    int32_t paramNum = SOFTBUS_EVT_PARAM_BUTT;
410060ff233Sopenharmony_ci    SoftBusEvtReportMsg* msg = SoftbusCreateEvtReportMsg(paramNum);
411060ff233Sopenharmony_ci    EXPECT_EQ(nullptr, msg);
412060ff233Sopenharmony_ci    // free nullptr message
413060ff233Sopenharmony_ci    SoftbusFreeEvtReportMsg(msg);
414060ff233Sopenharmony_ci}
415060ff233Sopenharmony_ci
416060ff233Sopenharmony_ci/*
417060ff233Sopenharmony_ci* @tc.name: SoftbusCreateEvtReportMsgTest005
418060ff233Sopenharmony_ci* @tc.desc: Create softbus event report message
419060ff233Sopenharmony_ci* @tc.type: FUNC
420060ff233Sopenharmony_ci* @tc.require: 1
421060ff233Sopenharmony_ci*/
422060ff233Sopenharmony_ciHWTEST_F(AdapterDsoftbusDfxTest, SoftbusCreateEvtReportMsgTest005, TestSize.Level1)
423060ff233Sopenharmony_ci{
424060ff233Sopenharmony_ci    int32_t paramNum = SOFTBUS_EVT_PARAM_ONE;
425060ff233Sopenharmony_ci    SoftBusEvtReportMsg* msg = SoftbusCreateEvtReportMsg(paramNum);
426060ff233Sopenharmony_ci    EXPECT_NE(nullptr, msg);
427060ff233Sopenharmony_ci    SoftbusFreeEvtReportMsg(msg);
428060ff233Sopenharmony_ci}
429060ff233Sopenharmony_ci
430060ff233Sopenharmony_ci}