11401458bSopenharmony_ci/*
21401458bSopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd.
31401458bSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
41401458bSopenharmony_ci * you may not use this file except in compliance with the License.
51401458bSopenharmony_ci * You may obtain a copy of the License at
61401458bSopenharmony_ci *
71401458bSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
81401458bSopenharmony_ci *
91401458bSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
101401458bSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
111401458bSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
121401458bSopenharmony_ci * See the License for the specific language governing permissions and
131401458bSopenharmony_ci * limitations under the License.
141401458bSopenharmony_ci */
151401458bSopenharmony_ci
161401458bSopenharmony_ci#include "hisysevent_easy_test.h"
171401458bSopenharmony_ci
181401458bSopenharmony_ci#include "easy_def.h"
191401458bSopenharmony_ci#include "easy_event_builder.h"
201401458bSopenharmony_ci#include "easy_event_encoder.h"
211401458bSopenharmony_ci#include "easy_socket_writer.h"
221401458bSopenharmony_ci#include "easy_util.h"
231401458bSopenharmony_ci#include "hisysevent_easy.h"
241401458bSopenharmony_ci
251401458bSopenharmony_ciusing namespace testing::ext;
261401458bSopenharmony_ci
271401458bSopenharmony_civoid HiSysEventEasyTest::SetUp()
281401458bSopenharmony_ci{}
291401458bSopenharmony_ci
301401458bSopenharmony_civoid HiSysEventEasyTest::TearDown()
311401458bSopenharmony_ci{}
321401458bSopenharmony_ci
331401458bSopenharmony_ci/**
341401458bSopenharmony_ci * @tc.name: HiSysEventEasyTest001
351401458bSopenharmony_ci * @tc.desc: Test writing event with valid content.
361401458bSopenharmony_ci * @tc.type: FUNC
371401458bSopenharmony_ci * @tc.require: issueIAKQGU
381401458bSopenharmony_ci */
391401458bSopenharmony_ciHWTEST_F(HiSysEventEasyTest, HiSysEventEasyTest001, TestSize.Level3)
401401458bSopenharmony_ci{
411401458bSopenharmony_ci    int ret = OH_HiSysEvent_Easy_Write("KERNEL_VENDOR", "POWER_KEY", EASY_EVENT_TYPE_FAULT, "TEST_DATA");
421401458bSopenharmony_ci    ASSERT_EQ(ret, SUCCESS);
431401458bSopenharmony_ci}
441401458bSopenharmony_ci
451401458bSopenharmony_ci/**
461401458bSopenharmony_ci * @tc.name: HiSysEventEasyTest002
471401458bSopenharmony_ci * @tc.desc: Test writing event with invalid domain.
481401458bSopenharmony_ci * @tc.type: FUNC
491401458bSopenharmony_ci * @tc.require: issueIAKQGU
501401458bSopenharmony_ci */
511401458bSopenharmony_ciHWTEST_F(HiSysEventEasyTest, HiSysEventEasyTest002, TestSize.Level3)
521401458bSopenharmony_ci{
531401458bSopenharmony_ci    // write null domain
541401458bSopenharmony_ci    int ret = OH_HiSysEvent_Easy_Write(nullptr, "POWER_KEY", EASY_EVENT_TYPE_FAULT, "TEST_DATA");
551401458bSopenharmony_ci    ASSERT_EQ(ret, ERR_DOMAIN_INVALID);
561401458bSopenharmony_ci    // length of domain is too long
571401458bSopenharmony_ci    ret = OH_HiSysEvent_Easy_Write("KERNEL_VENDORKERNEL_VENDOR", "POWER_KEY", EASY_EVENT_TYPE_FAULT, "TEST_DATA");
581401458bSopenharmony_ci    ASSERT_EQ(ret, ERR_DOMAIN_INVALID);
591401458bSopenharmony_ci}
601401458bSopenharmony_ci
611401458bSopenharmony_ci/**
621401458bSopenharmony_ci * @tc.name: HiSysEventEasyTest003
631401458bSopenharmony_ci * @tc.desc: Test writing event with different event type.
641401458bSopenharmony_ci * @tc.type: FUNC
651401458bSopenharmony_ci * @tc.require: issueIAKQGU
661401458bSopenharmony_ci */
671401458bSopenharmony_ciHWTEST_F(HiSysEventEasyTest, HiSysEventEasyTest003, TestSize.Level3)
681401458bSopenharmony_ci{
691401458bSopenharmony_ci    // event type which value is lower than 1
701401458bSopenharmony_ci    enum HiSysEventEasyType invalidType = (enum HiSysEventEasyType)0;
711401458bSopenharmony_ci    int ret = OH_HiSysEvent_Easy_Write("KERNEL_VENDOR", "POWER_KEY", invalidType, "TEST_DATA"); // 0 is invalid type
721401458bSopenharmony_ci    ASSERT_EQ(ret, ERR_TYPE_INVALID);
731401458bSopenharmony_ci    // event type which value is greater than 4
741401458bSopenharmony_ci    invalidType = (enum HiSysEventEasyType)5;
751401458bSopenharmony_ci    ret = OH_HiSysEvent_Easy_Write("KERNEL_VENDOR", "POWER_KEY", invalidType, "TEST_DATA");
761401458bSopenharmony_ci    ASSERT_EQ(ret, ERR_TYPE_INVALID);
771401458bSopenharmony_ci    // write event with fault type
781401458bSopenharmony_ci    ret = OH_HiSysEvent_Easy_Write("KERNEL_VENDOR", "POWER_KEY", EASY_EVENT_TYPE_FAULT, "TEST_DATA");
791401458bSopenharmony_ci    ASSERT_EQ(ret, SUCCESS);
801401458bSopenharmony_ci    // write event with statistic type
811401458bSopenharmony_ci    ret = OH_HiSysEvent_Easy_Write("KERNEL_VENDOR", "POWER_KEY", EASY_EVENT_TYPE_STATISTIC, "TEST_DATA");
821401458bSopenharmony_ci    ASSERT_EQ(ret, SUCCESS);
831401458bSopenharmony_ci    // write event with security type
841401458bSopenharmony_ci    ret = OH_HiSysEvent_Easy_Write("KERNEL_VENDOR", "POWER_KEY", EASY_EVENT_TYPE_SECURITY, "TEST_DATA");
851401458bSopenharmony_ci    ASSERT_EQ(ret, SUCCESS);
861401458bSopenharmony_ci    // write event with behavior type
871401458bSopenharmony_ci    ret = OH_HiSysEvent_Easy_Write("KERNEL_VENDOR", "POWER_KEY", EASY_EVENT_TYPE_BEHAVIOR, "TEST_DATA");
881401458bSopenharmony_ci    ASSERT_EQ(ret, SUCCESS);
891401458bSopenharmony_ci}
901401458bSopenharmony_ci
911401458bSopenharmony_ci/**
921401458bSopenharmony_ci * @tc.name: HiSysEventEasyTest004
931401458bSopenharmony_ci * @tc.desc: Test writing event with invalid name.
941401458bSopenharmony_ci * @tc.type: FUNC
951401458bSopenharmony_ci * @tc.require: issueIAKQGU
961401458bSopenharmony_ci */
971401458bSopenharmony_ciHWTEST_F(HiSysEventEasyTest, HiSysEventEasyTest004, TestSize.Level3)
981401458bSopenharmony_ci{
991401458bSopenharmony_ci    // write null name
1001401458bSopenharmony_ci    int ret = OH_HiSysEvent_Easy_Write("KERNEL_VENDOR", nullptr, EASY_EVENT_TYPE_FAULT, "TEST_DATA");
1011401458bSopenharmony_ci    ASSERT_EQ(ret, ERR_NAME_INVALID);
1021401458bSopenharmony_ci    // length of name is too long
1031401458bSopenharmony_ci    ret = OH_HiSysEvent_Easy_Write("KERNEL_VENDOR", "POWER_KEYPOWER_KEYPOWER_KEYPOWER_KEY", EASY_EVENT_TYPE_FAULT,
1041401458bSopenharmony_ci        "TEST_DATA");
1051401458bSopenharmony_ci    ASSERT_EQ(ret, ERR_NAME_INVALID);
1061401458bSopenharmony_ci}
1071401458bSopenharmony_ci
1081401458bSopenharmony_ci/**
1091401458bSopenharmony_ci * @tc.name: HiSysEventEasyTest005
1101401458bSopenharmony_ci * @tc.desc: Test writing event with invalid customized string.
1111401458bSopenharmony_ci * @tc.type: FUNC
1121401458bSopenharmony_ci * @tc.require: issueIAKQGU
1131401458bSopenharmony_ci */
1141401458bSopenharmony_ciHWTEST_F(HiSysEventEasyTest, HiSysEventEasyTest005, TestSize.Level3)
1151401458bSopenharmony_ci{
1161401458bSopenharmony_ci    // write a string with 1025 bytes
1171401458bSopenharmony_ci    std::string strContent;
1181401458bSopenharmony_ci    for (int i = 0; i < 102; i++) {
1191401458bSopenharmony_ci        strContent = strContent + std::string("0123456789");
1201401458bSopenharmony_ci    }
1211401458bSopenharmony_ci    strContent = strContent + "01234";
1221401458bSopenharmony_ci    int ret = OH_HiSysEvent_Easy_Write("KERNEL_VENDOR", "POWER_KEY", EASY_EVENT_TYPE_FAULT, strContent.c_str());
1231401458bSopenharmony_ci    ASSERT_EQ(ret, ERR_PARAM_VALUE_INVALID);
1241401458bSopenharmony_ci    // write null string
1251401458bSopenharmony_ci    ret = OH_HiSysEvent_Easy_Write("KERNEL_VENDOR", "POWER_KEY", EASY_EVENT_TYPE_FAULT, nullptr);
1261401458bSopenharmony_ci    ASSERT_EQ(ret, ERR_PARAM_VALUE_INVALID);
1271401458bSopenharmony_ci}
1281401458bSopenharmony_ci
1291401458bSopenharmony_ci/**
1301401458bSopenharmony_ci * @tc.name: HiSysEventEasyTest006
1311401458bSopenharmony_ci * @tc.desc: Test AppendHeader
1321401458bSopenharmony_ci * @tc.type: FUNC
1331401458bSopenharmony_ci * @tc.require: issueIAKQGU
1341401458bSopenharmony_ci */
1351401458bSopenharmony_ciHWTEST_F(HiSysEventEasyTest, HiSysEventEasyTest006, TestSize.Level3)
1361401458bSopenharmony_ci{
1371401458bSopenharmony_ci    size_t offset = 0;
1381401458bSopenharmony_ci    struct HiSysEventEasyHeader header;
1391401458bSopenharmony_ci    int ret = MemoryInit((uint8_t*)(&header), sizeof(struct HiSysEventEasyHeader));
1401401458bSopenharmony_ci    ASSERT_EQ(ret, SUCCESS);
1411401458bSopenharmony_ci    ret = AppendHeader(nullptr, EVENT_BUFF_LEN, &offset, &header);
1421401458bSopenharmony_ci    ASSERT_EQ(ret, ERR_EVENT_BUF_INVALID);
1431401458bSopenharmony_ci    const int eventBufLen = 100;
1441401458bSopenharmony_ci    uint8_t testEventBuff[eventBufLen];
1451401458bSopenharmony_ci    ret = AppendHeader(testEventBuff, EVENT_BUFF_LEN, nullptr, &header);
1461401458bSopenharmony_ci    ASSERT_EQ(ret, ERR_EVENT_BUF_INVALID);
1471401458bSopenharmony_ci    ret = AppendHeader(testEventBuff, EVENT_BUFF_LEN, &offset, nullptr);
1481401458bSopenharmony_ci    ASSERT_EQ(ret, ERR_EVENT_BUF_INVALID);
1491401458bSopenharmony_ci    offset = EVENT_BUFF_LEN - 2; // 2 is a test value
1501401458bSopenharmony_ci    ret = AppendHeader(testEventBuff, EVENT_BUFF_LEN, &offset, &header);
1511401458bSopenharmony_ci    ASSERT_EQ(ret, ERR_MEM_OPT_FAILED);
1521401458bSopenharmony_ci    offset = 0;
1531401458bSopenharmony_ci    ret = AppendHeader(testEventBuff, EVENT_BUFF_LEN, &offset, &header);
1541401458bSopenharmony_ci    ASSERT_EQ(ret, SUCCESS);
1551401458bSopenharmony_ci}
1561401458bSopenharmony_ci
1571401458bSopenharmony_ci/**
1581401458bSopenharmony_ci * @tc.name: HiSysEventEasyTest007
1591401458bSopenharmony_ci * @tc.desc: Test AppendStringParam
1601401458bSopenharmony_ci * @tc.type: FUNC
1611401458bSopenharmony_ci * @tc.require: issueIAKQGU
1621401458bSopenharmony_ci */
1631401458bSopenharmony_ciHWTEST_F(HiSysEventEasyTest, HiSysEventEasyTest007, TestSize.Level3)
1641401458bSopenharmony_ci{
1651401458bSopenharmony_ci    size_t offset = 0;
1661401458bSopenharmony_ci    int ret = AppendStringParam(nullptr, EVENT_BUFF_LEN, &offset, nullptr, nullptr);
1671401458bSopenharmony_ci    ASSERT_EQ(ret, ERR_EVENT_BUF_INVALID);
1681401458bSopenharmony_ci    uint8_t testEventBuff[EVENT_BUFF_LEN];
1691401458bSopenharmony_ci    ret = AppendStringParam(testEventBuff, EVENT_BUFF_LEN, nullptr, nullptr, nullptr);
1701401458bSopenharmony_ci    ASSERT_EQ(ret, ERR_EVENT_BUF_INVALID);
1711401458bSopenharmony_ci    ret = AppendStringParam(testEventBuff, EVENT_BUFF_LEN, &offset, nullptr, nullptr);
1721401458bSopenharmony_ci    ASSERT_EQ(ret, ERR_EVENT_BUF_INVALID);
1731401458bSopenharmony_ci    ret = AppendStringParam(testEventBuff, EVENT_BUFF_LEN, &offset, "TEST_KEY", nullptr);
1741401458bSopenharmony_ci    ASSERT_EQ(ret, ERR_PARAM_VALUE_INVALID);
1751401458bSopenharmony_ci    offset = EVENT_BUFF_LEN;
1761401458bSopenharmony_ci    ret = AppendStringParam(testEventBuff, EVENT_BUFF_LEN, &offset, "TEST_KEY", "TEST_VAL");
1771401458bSopenharmony_ci    ASSERT_EQ(ret, ERR_ENCODE_STR_FAILED);
1781401458bSopenharmony_ci    offset = EVENT_BUFF_LEN - 9; // 9 is a test value
1791401458bSopenharmony_ci    ret = AppendStringParam(testEventBuff, EVENT_BUFF_LEN, &offset, "TEST_KEY", "TEST_VAL");
1801401458bSopenharmony_ci    ASSERT_EQ(ret, ERR_ENCODE_VALUE_TYPE_FAILED);
1811401458bSopenharmony_ci    offset = 0;
1821401458bSopenharmony_ci    ret = AppendStringParam(testEventBuff, EVENT_BUFF_LEN, &offset, "TEST_KEY", "TEST_VAL");
1831401458bSopenharmony_ci    ASSERT_EQ(ret, SUCCESS);
1841401458bSopenharmony_ci}
1851401458bSopenharmony_ci
1861401458bSopenharmony_ci/**
1871401458bSopenharmony_ci * @tc.name: HiSysEventEasyTest008
1881401458bSopenharmony_ci * @tc.desc: Test EncodeValueType
1891401458bSopenharmony_ci * @tc.type: FUNC
1901401458bSopenharmony_ci * @tc.require: issueIAKQGU
1911401458bSopenharmony_ci */
1921401458bSopenharmony_ciHWTEST_F(HiSysEventEasyTest, HiSysEventEasyTest008, TestSize.Level3)
1931401458bSopenharmony_ci{
1941401458bSopenharmony_ci    size_t offset = 0;
1951401458bSopenharmony_ci    struct HiSysEventEasyParamValueType valueType;
1961401458bSopenharmony_ci    valueType.isArray = 0;
1971401458bSopenharmony_ci    valueType.valueType = 0;
1981401458bSopenharmony_ci    valueType.valueByteCnt = 0;
1991401458bSopenharmony_ci    int ret = EncodeValueType(nullptr, EVENT_BUFF_LEN, &offset, &valueType);
2001401458bSopenharmony_ci    ASSERT_EQ(ret, ERR_EVENT_BUF_INVALID);
2011401458bSopenharmony_ci    uint8_t data[EVENT_BUFF_LEN];
2021401458bSopenharmony_ci    ret = EncodeValueType(data, EVENT_BUFF_LEN, nullptr, &valueType);
2031401458bSopenharmony_ci    ASSERT_EQ(ret, ERR_EVENT_BUF_INVALID);
2041401458bSopenharmony_ci    ret = EncodeValueType(data, EVENT_BUFF_LEN, &offset, nullptr);
2051401458bSopenharmony_ci    ASSERT_EQ(ret, ERR_EVENT_BUF_INVALID);
2061401458bSopenharmony_ci    offset = EVENT_BUFF_LEN; // 2 is a test value
2071401458bSopenharmony_ci    ret = EncodeValueType(data, EVENT_BUFF_LEN, &offset, &valueType);
2081401458bSopenharmony_ci    ASSERT_EQ(ret, ERR_ENCODE_VALUE_TYPE_FAILED);
2091401458bSopenharmony_ci    offset = 0;
2101401458bSopenharmony_ci    ret = EncodeValueType(data, EVENT_BUFF_LEN, &offset, &valueType);
2111401458bSopenharmony_ci    ASSERT_EQ(ret, SUCCESS);
2121401458bSopenharmony_ci}
2131401458bSopenharmony_ci
2141401458bSopenharmony_ci/**
2151401458bSopenharmony_ci * @tc.name: HiSysEventEasyTest009
2161401458bSopenharmony_ci * @tc.desc: Test EncodeStringValue
2171401458bSopenharmony_ci * @tc.type: FUNC
2181401458bSopenharmony_ci * @tc.require: issueIAKQGU
2191401458bSopenharmony_ci */
2201401458bSopenharmony_ciHWTEST_F(HiSysEventEasyTest, HiSysEventEasyTest009, TestSize.Level3)
2211401458bSopenharmony_ci{
2221401458bSopenharmony_ci    size_t offset = 0;
2231401458bSopenharmony_ci    int ret = EncodeStringValue(nullptr, EVENT_BUFF_LEN, &offset, nullptr);
2241401458bSopenharmony_ci    ASSERT_EQ(ret, ERR_EVENT_BUF_INVALID);
2251401458bSopenharmony_ci    uint8_t data[EVENT_BUFF_LEN];
2261401458bSopenharmony_ci    ret = EncodeStringValue(data, EVENT_BUFF_LEN, nullptr, nullptr);
2271401458bSopenharmony_ci    ASSERT_EQ(ret, ERR_EVENT_BUF_INVALID);
2281401458bSopenharmony_ci    ret = EncodeStringValue(data, EVENT_BUFF_LEN, &offset, nullptr);
2291401458bSopenharmony_ci    ASSERT_EQ(ret, ERR_EVENT_BUF_INVALID);
2301401458bSopenharmony_ci    std::string val = "TEST";
2311401458bSopenharmony_ci    offset = EVENT_BUFF_LEN - val.size() + 1; // 1 is a test value
2321401458bSopenharmony_ci    ret = EncodeStringValue(data, EVENT_BUFF_LEN, &offset, val.c_str());
2331401458bSopenharmony_ci    ASSERT_EQ(ret, ERR_ENCODE_STR_FAILED);
2341401458bSopenharmony_ci    offset = EVENT_BUFF_LEN - val.size() + 3; // 3 is a test offset value
2351401458bSopenharmony_ci    ret = EncodeStringValue(data, EVENT_BUFF_LEN, &offset, val.c_str());
2361401458bSopenharmony_ci    ASSERT_EQ(ret, ERR_ENCODE_STR_FAILED);
2371401458bSopenharmony_ci    offset = EVENT_BUFF_LEN - 30; // 30 is a test offset value
2381401458bSopenharmony_ci    ret = EncodeStringValue(data, EVENT_BUFF_LEN, &offset, val.c_str());
2391401458bSopenharmony_ci    ASSERT_EQ(ret, SUCCESS);
2401401458bSopenharmony_ci    offset = 0;
2411401458bSopenharmony_ci    ret = EncodeStringValue(data, EVENT_BUFF_LEN, &offset, val.c_str());
2421401458bSopenharmony_ci    ASSERT_EQ(ret, SUCCESS);
2431401458bSopenharmony_ci}
2441401458bSopenharmony_ci
2451401458bSopenharmony_ci/**
2461401458bSopenharmony_ci * @tc.name: HiSysEventEasyTest010
2471401458bSopenharmony_ci * @tc.desc: Test Write
2481401458bSopenharmony_ci * @tc.type: FUNC
2491401458bSopenharmony_ci * @tc.require: issueIAKQGU
2501401458bSopenharmony_ci */
2511401458bSopenharmony_ciHWTEST_F(HiSysEventEasyTest, HiSysEventEasyTest010, TestSize.Level3)
2521401458bSopenharmony_ci{
2531401458bSopenharmony_ci    int ret = Write(nullptr, 0);
2541401458bSopenharmony_ci    ASSERT_EQ(ret, ERR_EVENT_BUF_INVALID);
2551401458bSopenharmony_ci    uint8_t data[EVENT_BUFF_LEN];
2561401458bSopenharmony_ci    ret = Write(data, EVENT_BUFF_LEN);
2571401458bSopenharmony_ci    ASSERT_EQ(ret, SUCCESS);
2581401458bSopenharmony_ci}
2591401458bSopenharmony_ci
2601401458bSopenharmony_ci/**
2611401458bSopenharmony_ci * @tc.name: HiSysEventEasyTest011
2621401458bSopenharmony_ci * @tc.desc: Test MemoryInit
2631401458bSopenharmony_ci * @tc.type: FUNC
2641401458bSopenharmony_ci * @tc.require: issueIAKQGU
2651401458bSopenharmony_ci */
2661401458bSopenharmony_ciHWTEST_F(HiSysEventEasyTest, HiSysEventEasyTest011, TestSize.Level3)
2671401458bSopenharmony_ci{
2681401458bSopenharmony_ci    int ret = MemoryInit(nullptr, 0);
2691401458bSopenharmony_ci    ASSERT_EQ(ret, ERR_MEM_OPT_FAILED);
2701401458bSopenharmony_ci    ret = MemoryInit(nullptr, EVENT_BUFF_LEN);
2711401458bSopenharmony_ci    ASSERT_EQ(ret, ERR_MEM_OPT_FAILED);
2721401458bSopenharmony_ci    uint8_t data[EVENT_BUFF_LEN];
2731401458bSopenharmony_ci    ret = MemoryInit(data, EVENT_BUFF_LEN);
2741401458bSopenharmony_ci    ASSERT_EQ(ret, SUCCESS);
2751401458bSopenharmony_ci}
2761401458bSopenharmony_ci
2771401458bSopenharmony_ci/**
2781401458bSopenharmony_ci * @tc.name: HiSysEventEasyTest012
2791401458bSopenharmony_ci * @tc.desc: Test MemoryCopy
2801401458bSopenharmony_ci * @tc.type: FUNC
2811401458bSopenharmony_ci * @tc.require: issueIAKQGU
2821401458bSopenharmony_ci */
2831401458bSopenharmony_ciHWTEST_F(HiSysEventEasyTest, HiSysEventEasyTest012, TestSize.Level3)
2841401458bSopenharmony_ci{
2851401458bSopenharmony_ci    uint8_t data[EVENT_BUFF_LEN];
2861401458bSopenharmony_ci    int ret = MemoryCopy(nullptr, 0, data, 0);
2871401458bSopenharmony_ci    ASSERT_EQ(ret, ERR_MEM_OPT_FAILED);
2881401458bSopenharmony_ci    ret = MemoryCopy(data, 0, nullptr, 0);
2891401458bSopenharmony_ci    ASSERT_EQ(ret, ERR_MEM_OPT_FAILED);
2901401458bSopenharmony_ci    uint8_t dataNew[EVENT_BUFF_LEN];
2911401458bSopenharmony_ci    ret = MemoryCopy(data, EVENT_BUFF_LEN - 1, dataNew, EVENT_BUFF_LEN); // 1 is a test value
2921401458bSopenharmony_ci    ASSERT_EQ(ret, ERR_MEM_OPT_FAILED);
2931401458bSopenharmony_ci    ret = MemoryCopy(data, EVENT_BUFF_LEN, dataNew, EVENT_BUFF_LEN);
2941401458bSopenharmony_ci    ASSERT_EQ(ret, SUCCESS);
2951401458bSopenharmony_ci}