1 /*
2  * Copyright (c) 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 #define NAPI_VERSION 8
16 #ifndef NAPI_EXPERIMENTAL
17 #define NAPI_EXPERIMENTAL
18 #endif
19 #include <ctime>
20 #include <securec.h>
21 #ifdef FOR_JERRYSCRIPT_TEST
22 #include "jerryscript-core.h"
23 #endif
24 #include "js_native_api_types.h"
25 #define private public
26 #include "napi/native_api.h"
27 #include "napi/native_common.h"
28 #include "napi/native_node_api.h"
29 #include "native_value.h"
30 #include "test.h"
31 #include "utils/log.h"
32 #undef private
33 
34 struct CallJsCbData {
35     int32_t id = 0;
36 };
37 using CallJsCbData_t = struct CallJsCbData;
38 
39 struct Final_Cb_Data {
40     int32_t id = 0;
41 };
42 using FinalCbData_t = struct Final_Cb_Data;
43 
44 struct ThreadData {
45     napi_threadsafe_function tsfn = nullptr;
46     napi_threadsafe_function_call_mode isMode = napi_tsfn_nonblocking;
47 };
48 using ThreadData_t = struct ThreadData;
49 
50 struct Final_CbData {
51     int32_t id;
52 };
53 using FinalCbData = struct Final_CbData;
54 
55 struct Call_JsCbData_str {
56     int32_t id;
57     char strdata[12];
58 };
59 using CallJsCbData_str = struct Call_JsCbData_str;
60 
61 static constexpr int32_t SEND_DATA = 10;
62 static constexpr int32_t CALL_JSCB_DATA = 20;
63 static constexpr int32_t FINAL_CB_DATA = 30;
64 static constexpr size_t MAX_COUNT = 128;
65 static constexpr size_t OVER_MAX_COUNT = 129;
66 static uv_thread_t g_uvThread;
67 static FinalCbData finalData;
68 static CallJsCbData jsData;
69 static CallJsCbData_str jsData_str;
70 static int g_callJSCallBackCount = 0;
71 static int g_callCount = 0;
72 static bool g_bFailFlag = false;
73 static bool g_bIsFinish = false;
74 static napi_env g_stEnv;
75 static int iBlockCallTimes = 20;
76 static int iNoneBlockCallTimes = 30;
77 static CallJsCbData_t g_jsData;
78 static FinalCbData_t g_finalData;
79 static int g_threadDataContent = 608;
80 static int g_threadDataContent2 = 708;
81 static int g_threadDataContent3 = 808;
82 static int g_threadDataContent4 = 908;
83 static bool g_callFinalizeEnd = false;
84 
85 static int HOOK_ARG_ONE = 1;
86 static int HOOK_ARG_TWO = 2;
87 static int HOOK_ARG_THREE = 3;
88 static int HOOK_TAG = 0;
89 static int HOOK_TAGCP = 0;
90 
91 static constexpr int32_t CALL_JS_CB_DATA_TEST_ID = 101;
92 static constexpr int32_t FINAL_CB_DATA_TEST_ID = 201;
93 
94 #if  (defined(FOR_JERRYSCRIPT_TEST)) &&  (JERRY_API_MINOR_VERSION <= 3)
95     // jerryscript 2.3 do nothing
96 #else
97     // jerryscript 2.4 or quickjs or V8
98     static constexpr int UINT64_VALUE = 100;
99     static constexpr int INT64_VALUE = 100;
100 #endif
101 
102 static constexpr int INT_ZERO = 0;
103 static constexpr int INT_ONE = 1;
104 static constexpr int INT_TWO = 2;
105 static constexpr int INT_THREE = 3;
106 static constexpr int INT_FIVE = 5;
107 #if  (defined(FOR_JERRYSCRIPT_TEST)) &&  (JERRY_API_MINOR_VERSION <= 3)
108     // jerryscript 2.3 do nothing
109 #else
110     static constexpr int INT_FOUR = 4;
111 #endif
112 
113 
114 static constexpr size_t ARRAYBUFFER_SIZE_NULL = 0;
115 static constexpr size_t ARRAYBUFFER_SIZE = 1024;
116 static constexpr int64_t CHANGE_IN_BYTES = 1024;
117 static constexpr int64_t ADJUSTED_VALUE = 0;
118 static constexpr double CREATE_DATE_TIME = 11.11;
119 static constexpr double DATE_TIME_VALUE = 0;
120 static constexpr double GET_DATE_TIME = 11;
121 
122 static constexpr size_t BUFFER_OVERMAX_SIZE = 2147483648;
123 static char Text[] = "hello world";
124 
GetFinalizeStatus()125 static void GetFinalizeStatus()
126 {
127     while (!g_callFinalizeEnd) {
128         sleep(1);
129     }
130 }
NewChildThreadMuti(void * data)131 static void NewChildThreadMuti(void* data)
132 {
133     GTEST_LOG_(INFO) << "NewChildThreadMuti called start";
134     ThreadData_t* threadData = static_cast<ThreadData_t*>(data);
135     int testCount = 20;
136     for (int i = 0; i < testCount; i++) {
137         auto status = napi_call_threadsafe_function(threadData->tsfn, (void*)&g_threadDataContent2, threadData->isMode);
138         EXPECT_EQ(status, napi_ok);
139     }
140     GTEST_LOG_(INFO) << "NewChildThreadMuti called end";
141 }
NonBlockAndBlockNewChildThreadMuti(void * data)142 static void NonBlockAndBlockNewChildThreadMuti(void* data)
143 {
144     GTEST_LOG_(INFO) << "NonBlockAndBlockNewChildThreadMuti called start";
145     ThreadData_t* threadData = static_cast<ThreadData_t*>(data);
146     int testCount = 10;
147     for (int i = 0; i < testCount; i++) {
148         auto status = napi_call_threadsafe_function(threadData->tsfn, (void*)&g_threadDataContent3, napi_tsfn_blocking);
149         EXPECT_EQ(status, napi_ok);
150     }
151 
152     for (int i = 0; i < testCount; i++) {
153         auto status =
154             napi_call_threadsafe_function(threadData->tsfn, (void*)&g_threadDataContent3, napi_tsfn_nonblocking);
155         EXPECT_EQ(status, napi_ok);
156     }
157     GTEST_LOG_(INFO) << "NonBlockAndBlockNewChildThreadMuti called end";
158 }
159 
160 struct OneModeCallData {
161     napi_threadsafe_function tsfn = nullptr;
162     napi_threadsafe_function_call_mode mode = napi_tsfn_nonblocking;
163     int callCount = 0;
164 };
165 using OneModeCallData_t = struct OneModeCallData;
166 
OneModeCall(void * data)167 static void OneModeCall(void* data)
168 {
169     OneModeCallData_t* callData = static_cast<OneModeCallData_t*>(data);
170     if (callData == nullptr) {
171         return;
172     }
173     for (int i = 0; i < callData->callCount; i++) {
174         auto status = napi_call_threadsafe_function(callData->tsfn, (void*)&g_threadDataContent4, callData->mode);
175         EXPECT_EQ(status, napi_ok);
176     }
177 }
178 
MutiModeCallOne(void * data)179 static void MutiModeCallOne(void* data)
180 {
181     GTEST_LOG_(INFO) << "MutiModeCallOne called start";
182     OneModeCallData_t* callData = static_cast<OneModeCallData_t*>(data);
183     callData->mode = napi_tsfn_nonblocking;
184     int testCount = 10;
185     callData->callCount = testCount;
186     OneModeCall(data);
187 
188     callData->mode = napi_tsfn_blocking;
189     OneModeCall(data);
190 
191     callData->mode = napi_tsfn_nonblocking;
192     OneModeCall(data);
193 
194     GTEST_LOG_(INFO) << "MutiModeCallOne called end";
195 }
MutiModeCallTwo(void * data)196 static void MutiModeCallTwo(void* data)
197 {
198     GTEST_LOG_(INFO) << "MutiModeCallTwo called start";
199     OneModeCallData_t* callData = static_cast<OneModeCallData_t*>(data);
200     callData->mode = napi_tsfn_blocking;
201     int testCount = 10;
202     callData->callCount = testCount;
203     OneModeCall(data);
204 
205     callData->mode = napi_tsfn_nonblocking;
206     OneModeCall(data);
207 
208     callData->mode = napi_tsfn_blocking;
209     OneModeCall(data);
210 
211     GTEST_LOG_(INFO) << "MutiModeCallTwo called end";
212 }
MutiModeCallThree(void * data)213 static void MutiModeCallThree(void* data)
214 {
215     GTEST_LOG_(INFO) << "MutiModeCallThree called start";
216     OneModeCallData_t* callData = static_cast<OneModeCallData_t*>(data);
217     callData->mode = napi_tsfn_nonblocking;
218     int testCount = 30;
219     callData->callCount = testCount;
220     OneModeCall(data);
221 
222     GTEST_LOG_(INFO) << "MutiModeCallThree called end";
223 }
MutiModeCallFour(void * data)224 static void MutiModeCallFour(void* data)
225 {
226     GTEST_LOG_(INFO) << "MutiModeCallFour called start";
227     OneModeCallData_t* callData = static_cast<OneModeCallData_t*>(data);
228     callData->mode = napi_tsfn_blocking;
229     int testCount = 30;
230     callData->callCount = testCount;
231     OneModeCall(data);
232 
233     GTEST_LOG_(INFO) << "MutiModeCallFour called end";
234 }
NonBlockFinalizeThreadCallBack(napi_env env,void * finalizeData,void * hint)235 static void NonBlockFinalizeThreadCallBack(napi_env env, void* finalizeData, void* hint)
236 {
237     GTEST_LOG_(INFO) << "NonBlockFinalizeThreadCallBack called";
238 
239     int CallJSCallCount = 40;
240     EXPECT_EQ(g_callJSCallBackCount, CallJSCallCount);
241 
242     g_callFinalizeEnd = true;
243 }
244 
CallJSCallBack(napi_env env,napi_value tsfn_cb,void * context,void * data)245 static void CallJSCallBack(napi_env env, napi_value tsfn_cb, void* context, void* data)
246 {
247     GTEST_LOG_(INFO) << "CallJSCallBack called";
248     g_callJSCallBackCount++;
249 
250     EXPECT_EQ(((CallJsCbData_t*)context)->id, CALL_JS_CB_DATA_TEST_ID);
251     GTEST_LOG_(INFO) << "CallJSCallBack param:data =" << *((int*)data);
252 
253     GTEST_LOG_(INFO) << "CallJSCallBack Count=" << g_callJSCallBackCount;
254 }
255 
FinalizeThreadCallBack(napi_env env,void * finalizeData,void * hint)256 static void FinalizeThreadCallBack(napi_env env, void* finalizeData, void* hint)
257 {
258     GTEST_LOG_(INFO) << "FinalizeThreadCallBack called start";
259 
260     EXPECT_EQ(((FinalCbData_t*)finalizeData)->id, FINAL_CB_DATA_TEST_ID);
261 
262     int CallJSCallCount = 40;
263     EXPECT_EQ(g_callJSCallBackCount, CallJSCallCount);
264 
265     g_callFinalizeEnd = true;
266 }
267 
MutiModeFinalizeThreadCallBack(napi_env env,void * finalizeData,void * hint)268 static void MutiModeFinalizeThreadCallBack(napi_env env, void* finalizeData, void* hint)
269 {
270     GTEST_LOG_(INFO) << "MutiModeFinalizeThreadCallBack called start";
271 
272     EXPECT_EQ(((FinalCbData_t*)finalizeData)->id, FINAL_CB_DATA_TEST_ID);
273 
274     int CallJSCallCount = 120;
275     EXPECT_EQ(g_callJSCallBackCount, CallJSCallCount);
276 
277     g_callFinalizeEnd = true;
278 }
AllFinalizeThreadCallBack(napi_env env,void * finalizeData,void * hint)279 static void AllFinalizeThreadCallBack(napi_env env, void* finalizeData, void* hint)
280 {
281     GTEST_LOG_(INFO) << "AllFinalizeThreadCallBack called start";
282 
283     EXPECT_EQ(((FinalCbData_t*)finalizeData)->id, FINAL_CB_DATA_TEST_ID);
284 
285     int CallJSCallCount = 40;
286     EXPECT_EQ(g_callJSCallBackCount, CallJSCallCount);
287 
288     g_callFinalizeEnd = true;
289 }
OtherFinalizeThreadCallBack(napi_env env,void * finalizeData,void * hint)290 static void OtherFinalizeThreadCallBack(napi_env env, void* finalizeData, void* hint)
291 {
292     GTEST_LOG_(INFO) << "OtherFinalizeThreadCallBack called start";
293 
294     EXPECT_EQ(((FinalCbData_t*)finalizeData)->id, FINAL_CB_DATA_TEST_ID);
295 
296     int CallJSCallCount = 46;
297     EXPECT_EQ(g_callJSCallBackCount, CallJSCallCount);
298 
299     g_callFinalizeEnd = true;
300 }
BufferFinalizer(napi_env env,void * data,void * hint)301 static void BufferFinalizer(napi_env env, void* data, void* hint)
302 {}
303 
ExpectCheckCall(napi_status call)304 static void ExpectCheckCall(napi_status call)
305 {
306     EXPECT_EQ(call, napi_ok);
307 }
308 
AssertCheckValueType(napi_env env,napi_value value,napi_valuetype type)309 static void AssertCheckValueType(napi_env env, napi_value value, napi_valuetype type)
310 {
311     napi_valuetype valueType = napi_undefined;
312     EXPECT_TRUE(value != nullptr);
313     ExpectCheckCall(napi_typeof(env, value, &valueType));
314     EXPECT_EQ(valueType, type);
315 }
316 
NewChildRef(void * data)317 static void NewChildRef(void* data)
318 {
319     GTEST_LOG_(INFO) << "NewChildRef called ";
320     napi_threadsafe_function tsFunc = (napi_threadsafe_function)data;
321     auto status = napi_ref_threadsafe_function(g_stEnv, tsFunc);
322     EXPECT_NE(status, napi_ok);
323 }
NewChildUnRef(void * data)324 static void NewChildUnRef(void* data)
325 {
326     GTEST_LOG_(INFO) << "NewChildUnRef called ";
327     napi_threadsafe_function tsFunc = (napi_threadsafe_function)data;
328     auto status = napi_unref_threadsafe_function(g_stEnv, tsFunc);
329     EXPECT_NE(status, napi_ok);
330 }
NewChildThreadMutiCallBlocking(void * data)331 static void NewChildThreadMutiCallBlocking(void* data)
332 {
333     GTEST_LOG_(INFO) << "NewChildThreadMutiCallBlocking called start";
334     napi_threadsafe_function tsFunc = (napi_threadsafe_function)data;
335 
336     for (int i = 0; i < iBlockCallTimes; i++) {
337         auto status = napi_call_threadsafe_function(tsFunc, nullptr, napi_tsfn_blocking);
338         EXPECT_EQ(status, napi_ok);
339         g_callCount++;
340     }
341     GTEST_LOG_(INFO) << "NewChildThreadMutiCallBlocking called end";
342 }
343 
NewChildThreadMutiCallNoneBlocking(void * data)344 static void NewChildThreadMutiCallNoneBlocking(void* data)
345 {
346     GTEST_LOG_(INFO) << "NewChildThreadMutiCallNoneBlocking called start";
347     napi_threadsafe_function tsFunc = (napi_threadsafe_function)data;
348     int iFailTimes = 0;
349 
350     for (int i = 0; i < iNoneBlockCallTimes; i++) {
351         auto status = napi_call_threadsafe_function(tsFunc, nullptr, napi_tsfn_nonblocking);
352         if (napi_ok != status) {
353             iFailTimes++;
354         }
355     }
356     if (iFailTimes > 0) {
357         g_bFailFlag = true;
358     }
359     GTEST_LOG_(INFO) << "none block call fail times" << iFailTimes;
360     GTEST_LOG_(INFO) << "NewChildThreadMutiCallNoneBlocking called end";
361 }
362 
CallJSSlowCallBack(napi_env env,napi_value tsfn_cb,void * context,void * data)363 static void CallJSSlowCallBack(napi_env env, napi_value tsfn_cb, void* context, void* data)
364 {
365     GTEST_LOG_(INFO) << "CallJSSlowCallBack called";
366     sleep(1);
367     g_callJSCallBackCount++;
368     GTEST_LOG_(INFO) << "CallJSSlowCallBack Count=" << g_callJSCallBackCount;
369 }
370 
FinalCallBack(napi_env env,void * finalizeData,void * hint)371 static void FinalCallBack(napi_env env, void* finalizeData, void* hint)
372 {
373     GTEST_LOG_(INFO) << "FinalCallBack called";
374     g_bIsFinish = true;
375 }
376 
WaitForFinish()377 static void WaitForFinish()
378 {
379     while (!g_bIsFinish) {
380         sleep(1);
381     }
382 }
383 
ThreadSafeCallJs(napi_env env,napi_value tsfn_cb,void * context,void * data)384 static void ThreadSafeCallJs(napi_env env, napi_value tsfn_cb, void* context, void* data)
385 {
386     GTEST_LOG_(INFO) << "ThreadSafeCallJs start";
387 
388     CallJsCbData* jsData = nullptr;
389     jsData = (CallJsCbData*)context;
390     GTEST_LOG_(INFO) << "jsData->id is" << jsData->id;
391     EXPECT_EQ(jsData->id, CALL_JSCB_DATA);
392     int32_t* pData = nullptr;
393     pData = (int32_t*)data;
394     EXPECT_EQ((*pData), SEND_DATA);
395 
396     GTEST_LOG_(INFO) << "ThreadSafeCallJs end";
397 }
398 
Threadfinalcb(napi_env env,void * finalizeData,void * context)399 static void Threadfinalcb(napi_env env, void* finalizeData, void* context)
400 {
401     GTEST_LOG_(INFO) << "Threadfinalcb called";
402 
403     uv_thread_join(&g_uvThread);
404     GTEST_LOG_(INFO) << "context->id" << ((FinalCbData*)context)->id;
405     CallJsCbData* jsData = nullptr;
406     jsData = (CallJsCbData*)context;
407     GTEST_LOG_(INFO) << "jsData->id" << jsData->id;
408     EXPECT_EQ(jsData->id, CALL_JSCB_DATA);
409     int32_t* pData = nullptr;
410     pData = (int32_t*)finalizeData;
411     EXPECT_EQ((*pData), FINAL_CB_DATA);
412     g_callFinalizeEnd = true;
413     GTEST_LOG_(INFO) << "Threadfinalcb end";
414 }
415 
TsFuncDataSourceThread0200(void * data)416 static void TsFuncDataSourceThread0200(void* data)
417 {
418     GTEST_LOG_(INFO) << "TsFuncDataSourceThread0200 called!";
419 
420     napi_threadsafe_function func = (napi_threadsafe_function)data;
421     napi_threadsafe_function_call_mode is_blocking = napi_tsfn_nonblocking;
422     int32_t sendData = SEND_DATA;
423     napi_status callresult = napi_call_threadsafe_function(func, &sendData, is_blocking);
424     GTEST_LOG_(INFO) << "napi_call_threadsafe_function finish!";
425     EXPECT_EQ(callresult, napi_status::napi_ok);
426     for (size_t i = 0; i < MAX_COUNT; i++) {
427         napi_release_threadsafe_function(func, napi_tsfn_release);
428     }
429     GTEST_LOG_(INFO) << "napi_release_threadsafe_function finish!";
430 
431     GTEST_LOG_(INFO) << "TsFuncDataSourceThread0200 end!";
432 }
433 
TsFuncreleaseThread(void * data)434 static void TsFuncreleaseThread(void* data)
435 {
436     GTEST_LOG_(INFO) << "TsFuncreleaseThread called!";
437 
438     napi_threadsafe_function func = (napi_threadsafe_function)data;
439     napi_status releaseresultone = napi_release_threadsafe_function(func, napi_tsfn_release);
440     EXPECT_EQ(releaseresultone, napi_status::napi_ok);
441     napi_status releaseresulttwo = napi_release_threadsafe_function(func, napi_tsfn_release);
442     EXPECT_EQ(releaseresulttwo, napi_status::napi_generic_failure);
443     GTEST_LOG_(INFO) << "napi_release_threadsafe_function finish!";
444 
445     GTEST_LOG_(INFO) << "TsFuncreleaseThread end!";
446 }
447 
TsFuncabortThread(void * data)448 static void TsFuncabortThread(void* data)
449 {
450     GTEST_LOG_(INFO) << "TsFuncabortThread called!";
451 
452     napi_threadsafe_function func = (napi_threadsafe_function)data;
453     napi_threadsafe_function_call_mode is_blocking = napi_tsfn_nonblocking;
454     int32_t sendData = SEND_DATA;
455     napi_status callresultone = napi_call_threadsafe_function(func, &sendData, is_blocking);
456     EXPECT_EQ(callresultone, napi_status::napi_ok);
457     sleep(1);
458     napi_status releaseresult = napi_release_threadsafe_function(func, napi_tsfn_abort);
459     EXPECT_EQ(releaseresult, napi_status::napi_ok);
460     napi_status callresulttwo = napi_call_threadsafe_function(func, &sendData, is_blocking);
461     EXPECT_EQ(callresulttwo, napi_status::napi_closing);
462     GTEST_LOG_(INFO) << "napi_release_threadsafe_function finish!";
463 
464     GTEST_LOG_(INFO) << "TsFuncabortThread end!";
465 }
466 
TsFuncreleasefiveThread(void * data)467 static void TsFuncreleasefiveThread(void* data)
468 {
469     GTEST_LOG_(INFO) << "TsFuncreleasefiveThread called!";
470 
471     napi_threadsafe_function func = (napi_threadsafe_function)data;
472     napi_status releaseresult;
473     size_t loopCount = 5;
474     for (size_t i = 0; i < loopCount; i++) {
475         releaseresult = napi_release_threadsafe_function(func, napi_tsfn_release);
476         EXPECT_EQ(releaseresult, napi_status::napi_ok);
477     }
478     releaseresult = napi_release_threadsafe_function(func, napi_tsfn_release);
479     EXPECT_EQ(releaseresult, napi_status::napi_generic_failure);
480     GTEST_LOG_(INFO) << "napi_release_threadsafe_function finish!";
481 
482     GTEST_LOG_(INFO) << "TsFuncreleasefiveThread end!";
483 }
484 
TsFuncErrReleaseThread(void * data)485 static void TsFuncErrReleaseThread(void* data)
486 {
487     GTEST_LOG_(INFO) << "TsFuncErrReleaseThread called!";
488 
489     napi_status releaseresult = napi_release_threadsafe_function(nullptr, napi_tsfn_release);
490     GTEST_LOG_(INFO) << "napi_release_threadsafe_function finish!";
491     EXPECT_EQ(releaseresult, napi_status::napi_invalid_arg);
492 
493     GTEST_LOG_(INFO) << "TsFuncErrReleaseThread end!";
494 }
495 
496 /*
497  * @tc.number    : ACE_Napi_Create_String_Utf16_0100
498  * @tc.name      : Test the normal value of NAPi_CREATE_string_UTf16
499  * @tc.desc      : 1.The environment engine is created
500  *                 2.Set test variables
501  *                 3.The function of napi_create_string_utf16 is called
502  *                 4.Return value of function is napi_ok
503  *                 5.The function of napi_get_value_string_utf16 is called
504  *                 6.Check whether the obtained parameters meet requirements
505  */
506 HWTEST_F(NativeEngineTest, ACE_Napi_Create_String_Utf16_0100, testing::ext::TestSize.Level1)
507 {
508     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_String_Utf16_0100 start";
509 
510     napi_env env = (napi_env)engine_;
511 
512     char16_t testStr[] = u"system.test.content.!@#%中^&*()6666";
513     size_t testStrLength = static_cast<size_t>(std::char_traits<char16_t>::length(testStr));
514     char16_t buffer[testStrLength + 1];
515     size_t copied = INT_ZERO;
516     napi_value result = nullptr;
517 
518     ExpectCheckCall(napi_create_string_utf16(env, testStr, testStrLength, &result));
519     ExpectCheckCall(napi_get_value_string_utf16(env, result, buffer, testStrLength + 1, &copied));
520 
521     EXPECT_EQ(testStrLength, copied);
522     for (size_t i = INT_ZERO; i < copied + 1; i++) {
523         EXPECT_EQ(testStr[i], buffer[i]);
524     }
525 
526     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_String_Utf16_0100 end";
527 }
528 
529 /*
530  * @tc.number    : ACE_Napi_Create_String_Utf16_0200
531  * @tc.name      : Tests whether napi_CREATE_string_UTf16 returns an exception if STR is empty
532  * @tc.desc      : 1.The environment engine is created
533  *                 2.Set test variables
534  *                 3.The function of napi_create_string_utf16 is called
535  *                 4.Return value of function is napi_invalid_arg
536  */
537 HWTEST_F(NativeEngineTest, ACE_Napi_Create_String_Utf16_0200, testing::ext::TestSize.Level2)
538 {
539     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_String_Utf16_0200 start";
540     napi_env env = (napi_env)engine_;
541 
542     size_t buffer_size = INT_ONE;
543     napi_value result = nullptr;
544     napi_status ret = napi_ok;
545 
546     ret = napi_create_string_utf16(env, nullptr, buffer_size, &result);
547 
548     EXPECT_EQ(ret, napi_invalid_arg);
549     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_String_Utf16_0200 end";
550 }
551 
552 /*
553  * @tc.number    : ACE_Napi_Create_String_Utf16_0300
554  * @tc.name      : Test napi_CREATE_string_UTf16 when length is empty
555  * @tc.desc      : 1.The environment engine is created
556  *                 2.Set test variables
557  *                 3.The function of napi_create_string_utf16 is called
558  *                 4.Return value of function is napi_ok
559  *                 5.The function of napi_get_value_string_utf16 is called
560  *                 6.Check whether the obtained parameters meet requirements
561  */
562 HWTEST_F(NativeEngineTest, ACE_Napi_Create_String_Utf16_0300, testing::ext::TestSize.Level2)
563 {
564     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_String_Utf16_0300 start";
565     napi_env env = (napi_env)engine_;
566 
567     char16_t testStr[] = u"system.test.content.abnormal.dd@#!#@$%999900";
568     napi_value result = nullptr;
569     napi_status status = napi_ok;
570     status = napi_create_string_utf16(env, testStr, 0, &result);
571     EXPECT_NE(status, napi_ok);
572     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_String_Utf16_0300 end";
573 }
574 
575 /*
576  * @tc.number    : ACE_Napi_Create_String_Utf16_0400
577  * @tc.name      : Test Napi_create_string_utf16 The string length is invalid
578  * @tc.desc      : 1.The environment engine is created
579  *                 2.Set test variables
580  *                 3.The function of napi_create_string_utf16 is called
581  *                 4.Return value of function is napi_invalid_arg
582  */
583 HWTEST_F(NativeEngineTest, ACE_Napi_Create_String_Utf16_0400, testing::ext::TestSize.Level2)
584 {
585     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_String_Utf16_0400 start";
586     napi_env env = (napi_env)engine_;
587 
588     char16_t testStr[] = u"system.test.content.size_max.abnormal";
589     napi_status ret = napi_ok;
590     napi_value result = nullptr;
591 
592     ret = napi_create_string_utf16(env, testStr, (size_t)INT_MAX + 1, &result);
593 
594     EXPECT_EQ(ret, napi_invalid_arg);
595     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_String_Utf16_0400 end";
596 }
597 
598 /*
599  * @tc.number    : ACE_Napi_Create_String_Utf16_0500
600  * @tc.name      : The napi_create_string_UTf16 returned object parameter is invalid
601  * @tc.desc      : 1.The environment engine is created
602  *                 2.Set test variables
603  *                 3.The function of napi_create_string_utf16 is called
604  *                 4.Return value of function is napi_invalid_arg
605  */
606 HWTEST_F(NativeEngineTest, ACE_Napi_Create_String_Utf16_0500, testing::ext::TestSize.Level2)
607 {
608     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_String_Utf16_0500 start";
609     napi_env env = (napi_env)engine_;
610 
611     char16_t testStr[] = u"system.test.content.result.abnormal";
612     int testStrLength = static_cast<int>(std::char_traits<char16_t>::length(testStr));
613     napi_status ret = napi_ok;
614 
615     ret = napi_create_string_utf16(env, testStr, testStrLength, nullptr);
616     EXPECT_EQ(ret, napi_invalid_arg);
617     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_String_Utf16_0500 end";
618 }
619 
620 /*
621  * @tc.number    : ACE_Napi_Create_String_Utf16_0600
622  * @tc.name      : The napi_CREATE_string_UTf16 environment parameter is invalid
623  * @tc.desc      : 1.The environment engine is created
624  *                 2.Set test variables
625  *                 3.The function of napi_create_string_utf16 is called
626  *                 4.Return value of function is napi_invalid_arg
627  */
628 HWTEST_F(NativeEngineTest, ACE_Napi_Create_String_Utf16_0600, testing::ext::TestSize.Level2)
629 {
630     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_String_Utf16_0600 start";
631     char16_t testStr[] = u"system.test.content.env.abnormal";
632     int testStrLength = static_cast<int>(std::char_traits<char16_t>::length(testStr));
633     napi_status ret = napi_ok;
634     napi_value result = nullptr;
635 
636     ret = napi_create_string_utf16(nullptr, testStr, testStrLength, &result);
637     EXPECT_EQ(ret, napi_invalid_arg);
638     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_String_Utf16_0600 end";
639 }
640 
641 /*
642  * @tc.number    : ACE_Napi_Create_String_Utf16_0700
643  * @tc.name      : Test the special characters of NAPi_CREATE_string_UTf16
644  * @tc.desc      : 1.The environment engine is created
645  *                 2.Set test variables
646  *                 3.The function of napi_create_string_utf16 is called
647  *                 4.Return value of function is napi_ok
648  *                 5.The function of napi_get_value_string_utf16 is called
649  *                 6.Check whether the obtained parameters meet requirements
650  */
651 HWTEST_F(NativeEngineTest, ACE_Napi_Create_String_Utf16_0700, testing::ext::TestSize.Level1)
652 {
653     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_String_Utf16_0700 start";
654 
655     napi_env env = (napi_env)engine_;
656 
657     char16_t testStr[] = u"system.test.content.&*!@#¥%";
658     size_t testStrLength = static_cast<size_t>(std::char_traits<char16_t>::length(testStr));
659     char16_t buffer[testStrLength + 1];
660     size_t copied = INT_ZERO;
661     napi_value result = nullptr;
662 
663     ExpectCheckCall(napi_create_string_utf16(env, testStr, testStrLength, &result));
664     ExpectCheckCall(napi_get_value_string_utf16(env, result, buffer, testStrLength + 1, &copied));
665 
666     EXPECT_EQ(testStrLength, copied);
667     for (size_t i = INT_ZERO; i < copied + 1; i++) {
668         EXPECT_EQ(testStr[i], buffer[i]);
669     }
670 
671     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_String_Utf16_0700 end";
672 }
673 
674 /*
675  * @tc.number    : ACE_Napi_Create_String_Utf16_0800
676  * @tc.name      : Test NAPi_CREATE_string_UTf16 space
677  * @tc.desc      : 1.The environment engine is created
678  *                 2.Set test variables
679  *                 3.The function of napi_create_string_utf16 is called
680  *                 4.Return value of function is napi_ok
681  *                 5.The function of napi_get_value_string_utf16 is called
682  *                 6.Check whether the obtained parameters meet requirements
683  */
684 HWTEST_F(NativeEngineTest, ACE_Napi_Create_String_Utf16_0800, testing::ext::TestSize.Level1)
685 {
686     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_String_Utf16_0800 start";
687 
688     napi_env env = (napi_env)engine_;
689 
690     char16_t testStr[] = u"system.test.content.     ";
691     size_t testStrLength = static_cast<size_t>(std::char_traits<char16_t>::length(testStr));
692     char16_t buffer[testStrLength + 1];
693     size_t copied = INT_ZERO;
694     napi_value result = nullptr;
695 
696     ExpectCheckCall(napi_create_string_utf16(env, testStr, testStrLength, &result));
697     ExpectCheckCall(napi_get_value_string_utf16(env, result, buffer, testStrLength + 1, &copied));
698 
699     EXPECT_EQ(testStrLength, copied);
700     for (size_t i = INT_ZERO; i < copied + 1; i++) {
701         EXPECT_EQ(testStr[i], buffer[i]);
702     }
703 
704     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_String_Utf16_0800 end";
705 }
706 /*
707  * @tc.number    : ACE_Napi_Create_String_Utf16_0900
708  * @tc.name      : Test NAPi_CREATE_string_UTf16 incoming Chinese characters
709  * @tc.desc      : 1.The environment engine is created
710  *                 2.Set test variables
711  *                 3.The function of napi_create_string_utf16 is called
712  *                 4.Return value of function is napi_ok
713  *                 5.The function of napi_get_value_string_utf16 is called
714  *                 6.Check whether the obtained parameters meet requirements
715  */
716 HWTEST_F(NativeEngineTest, ACE_Napi_Create_String_Utf16_0900, testing::ext::TestSize.Level1)
717 {
718     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_String_Utf16_0900 start";
719 
720     napi_env env = (napi_env)engine_;
721 
722     char16_t testStr[] = u"system.test.content.汉字输入";
723     size_t testStrLength = static_cast<size_t>(std::char_traits<char16_t>::length(testStr));
724     char16_t buffer[testStrLength + 1];
725     size_t copied = INT_ZERO;
726     napi_value result = nullptr;
727 
728     ExpectCheckCall(napi_create_string_utf16(env, testStr, testStrLength, &result));
729     ExpectCheckCall(napi_get_value_string_utf16(env, result, buffer, testStrLength + 1, &copied));
730 
731     EXPECT_EQ(testStrLength, copied);
732     for (size_t i = INT_ZERO; i < copied + 1; i++) {
733         EXPECT_EQ(testStr[i], buffer[i]);
734     }
735 
736     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_String_Utf16_0900 end";
737 }
738 
739 /*
740  * @tc.number    : ACE_Napi_Get_Value_String_Utf16_0100
741  * @tc.name      : Test the normal value of napi_get_value_string_utf16
742  * @tc.desc      : 1.The environment engine is created
743  *                 2.Set test variables
744  *                 3.The function of napi_create_string_utf16 is called
745  *                 4.Return value of function is napi_ok
746  *                 5.The function of napi_get_value_string_utf16 is called
747  *                 6.Check whether the obtained parameters meet requirements
748  */
749 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Value_String_Utf16_0100, testing::ext::TestSize.Level1)
750 {
751     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_String_Utf16_0100 start";
752     napi_env env = (napi_env)engine_;
753 
754     char16_t testStr[] = u"system.test.content.&&&^^^^.中文9988";
755     size_t testStrLength = static_cast<size_t>(std::char_traits<char16_t>::length(testStr));
756     char16_t buffer[testStrLength];
757     size_t copied = INT_ZERO;
758     napi_value result = nullptr;
759 
760     ExpectCheckCall(napi_create_string_utf16(env, testStr, testStrLength, &result));
761     ExpectCheckCall(napi_get_value_string_utf16(env, result, buffer, testStrLength + 1, &copied));
762 
763     EXPECT_EQ(testStrLength, copied);
764     for (size_t i = INT_ZERO; i < copied; i++) {
765         EXPECT_EQ(testStr[i], buffer[i]);
766     }
767     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_String_Utf16_0100 end";
768 }
769 
770 /*
771  * @tc.number    : ACE_Napi_Get_Value_String_Utf16_0200
772  * @tc.name      : Test napi_get_value_string_UTf16 truncation
773  * @tc.desc      : 1.The environment engine is created
774  *                 2.Set test variables
775  *                 3.The function of napi_create_string_utf16 is called
776  *                 4.Return value of function is napi_ok
777  *                 5.The function of napi_get_value_string_utf16 is called
778  *                 6.Check whether the obtained parameters meet requirements
779  */
780 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Value_String_Utf16_0200, testing::ext::TestSize.Level1)
781 {
782     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_String_Utf16_0200 start";
783     napi_env env = (napi_env)engine_;
784 
785     char16_t testStr[] = u"system.test.content.abnormal";
786     size_t testStrLength = static_cast<size_t>(std::char_traits<char16_t>::length(testStr));
787     char16_t buffer[testStrLength];
788     size_t copied;
789     napi_value result = nullptr;
790 
791     ExpectCheckCall(napi_create_string_utf16(env, testStr, testStrLength, &result));
792     ExpectCheckCall(napi_get_value_string_utf16(env, result, buffer, INT_FIVE + 1, &copied));
793 
794     for (int i = INT_ZERO; i < INT_FIVE; i++) {
795         EXPECT_EQ(testStr[i], buffer[i]);
796     }
797     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_String_Utf16_0200 end";
798 }
799 
800 /*
801  * @tc.number    : ACE_Napi_Get_Value_String_Utf16_0300
802  * @tc.name      : Test napi_get_value_string_UTf16 The input buffer size is invalid
803  * @tc.desc      : 1.The environment engine is created
804  *                 2.Set test variables
805  *                 3.The function of napi_create_string_utf16 is called
806  *                 4.Return value of function is napi_ok
807  *                 5.The function of napi_get_value_string_utf16 is called
808  *                 6.Check whether the obtained parameters meet requirements
809  */
810 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Value_String_Utf16_0300, testing::ext::TestSize.Level2)
811 {
812     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_String_Utf16_0300 start";
813     napi_env env = (napi_env)engine_;
814 
815     char16_t testStr[] = u"system.test.content.abnormal.!@#$%^&*123";
816     size_t testStrLength = static_cast<size_t>(std::char_traits<char16_t>::length(testStr));
817     char16_t buffer[] = u"12345";
818     size_t buffer_size = INT_ZERO;
819     size_t copied = INT_ZERO;
820     napi_value result = nullptr;
821 
822     ExpectCheckCall(napi_create_string_utf16(env, testStr, testStrLength, &result));
823     ExpectCheckCall(napi_get_value_string_utf16(env, result, buffer, buffer_size, &copied));
824 
825     EXPECT_EQ(copied, testStrLength);
826     for (size_t i = INT_ZERO; i < INT_TWO; i++) {
827         EXPECT_NE(buffer[i], testStr[i]);
828     }
829     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_String_Utf16_0300 end";
830 }
831 
832 /*
833  * @tc.number    : ACE_Napi_Get_Value_String_Utf16_0400
834  * @tc.name      : Test Napi_get_value_string_utf16 Invalid string passed
835  * @tc.desc      : 1.The environment engine is created
836  *                 2.Set test variables
837  *                 3.The function of napi_create_bigint_int64 is called
838  *                 4.Return value of function is napi_ok
839  *                 5.The function of napi_get_value_string_utf16 is called
840  *                 6.Return value of function is napi_string_expected
841  */
842 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Value_String_Utf16_0400, testing::ext::TestSize.Level2)
843 {
844     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_String_Utf16_0400 start";
845     napi_env env = (napi_env)engine_;
846 
847     char16_t buffer[INT_FIVE];
848     int testStrLength = static_cast<int>(std::char_traits<char16_t>::length(buffer));
849     size_t copied;
850     int64_t testValue = INT64_MAX;
851     napi_value result = nullptr;
852     napi_status ret = napi_ok;
853     ExpectCheckCall(napi_create_bigint_int64(env, testValue, &result));
854     AssertCheckValueType(env, result, napi_bigint);
855 
856     ret = napi_get_value_string_utf16(env, result, buffer, testStrLength, &copied);
857 
858     EXPECT_EQ(ret, napi_string_expected);
859     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_String_Utf16_0400 end";
860 }
861 
862 /*
863  * @tc.number    : ACE_Napi_Get_Value_String_Utf16_0500
864  * @tc.name      : Test for invalid buffer for napi_get_value_string_UTf16 string
865  * @tc.desc      : 1.The environment engine is created
866  *                 2.Set test variables
867  *                 3.The function of napi_create_string_utf16 is called
868  *                 4.Return value of function is napi_ok
869  *                 5.The function of napi_get_value_string_utf16 is called
870  *                 6.Check whether the obtained parameters meet requirements
871  */
872 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Value_String_Utf16_0500, testing::ext::TestSize.Level1)
873 {
874     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_String_Utf16_0500 start";
875     napi_env env = (napi_env)engine_;
876 
877     char16_t testStr[] = u"system.test.content.copied.$#@666";
878     size_t testStrLength = static_cast<size_t>(std::char_traits<char16_t>::length(testStr));
879     size_t copied = INT_ZERO;
880     napi_value result = nullptr;
881 
882     ExpectCheckCall(napi_create_string_utf16(env, testStr, testStrLength, &result));
883     ExpectCheckCall(napi_get_value_string_utf16(env, result, nullptr, testStrLength, &copied));
884 
885     EXPECT_EQ(testStrLength, copied);
886     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_String_Utf16_0500 end";
887 }
888 
889 /*
890  * @tc.number    : ACE_Napi_Get_Value_String_Utf16_0600
891  * @tc.name      : The napi_get_value_string_UTf16 output length is invalid
892  * @tc.desc      : 1.The environment engine is created
893  *                 2.Set test variables
894  *                 3.The function of napi_create_string_utf16 is called
895  *                 4.Return value of function is napi_ok
896  *                 5.The function of napi_get_value_string_utf16 is called
897  *                 6.Return value of function is napi_invalid_arg
898  */
899 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Value_String_Utf16_0600, testing::ext::TestSize.Level2)
900 {
901     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_String_Utf16_0600 start";
902     napi_env env = (napi_env)engine_;
903 
904     char16_t testStr[] = u"system.test.content.abnormal";
905     int testStrLength = static_cast<int>(std::char_traits<char16_t>::length(testStr));
906     char16_t buffer[testStrLength];
907     napi_value result = nullptr;
908     napi_status ret = napi_ok;
909 
910     ExpectCheckCall(napi_create_string_utf16(env, testStr, testStrLength, &result));
911     ret = napi_get_value_string_utf16(env, result, buffer, testStrLength, nullptr);
912 
913     EXPECT_EQ(ret, napi_invalid_arg);
914     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_String_Utf16_0600 end";
915 }
916 
917 /*
918  * @tc.number    : ACE_Napi_Get_Value_String_Utf16_0700
919  * @tc.name      : The napi_get_value_string_UTf16 environment parameter is invalid
920  * @tc.desc      : 1.The environment engine is created
921  *                 2.Set test variables
922  *                 3.The function of napi_create_string_utf16 is called
923  *                 4.Return value of function is napi_ok
924  *                 5.The function of napi_get_value_string_utf16 is called
925  *                 6.Return value of function is napi_invalid_arg
926  */
927 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Value_String_Utf16_0700, testing::ext::TestSize.Level2)
928 {
929     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_String_Utf16_0700 start";
930     napi_env env = (napi_env)engine_;
931 
932     char16_t testStr[] = u"system.test.content.env.abnormal";
933     int testStrLength = static_cast<int>(std::char_traits<char16_t>::length(testStr));
934     char16_t buffer[testStrLength];
935     size_t copied;
936     napi_value result = nullptr;
937     napi_status ret = napi_ok;
938     ExpectCheckCall(napi_create_string_utf16(env, testStr, testStrLength, &result));
939 
940     ret = napi_get_value_string_utf16(nullptr, result, buffer, testStrLength, &copied);
941 
942     EXPECT_EQ(ret, napi_invalid_arg);
943     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_String_Utf16_0700 end";
944 }
945 
946 /*
947  * @tc.number    : ACE_Napi_Get_Value_String_Utf16_0800
948  * @tc.name      : The napi_get_value_string_UTf16 value parameter is invalid
949  * @tc.desc      : 1.The environment engine is created
950  *                 2.Set test variables
951  *                 3.The function of napi_get_value_string_utf16 is called
952  *                 4.Return value of function is napi_invalid_arg
953  */
954 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Value_String_Utf16_0800, testing::ext::TestSize.Level2)
955 {
956     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_String_Utf16_0800 start";
957     napi_env env = (napi_env)engine_;
958 
959     char16_t testStr[] = u"system.test.content.result.abnormal";
960     int testStrLength = static_cast<int>(std::char_traits<char16_t>::length(testStr));
961     char16_t buffer[testStrLength];
962     size_t copied;
963     napi_value result = nullptr;
964     napi_status ret = napi_ok;
965 
966     ret = napi_get_value_string_utf16(env, result, buffer, testStrLength, &copied);
967 
968     EXPECT_EQ(ret, napi_invalid_arg);
969     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_String_Utf16_0800 end";
970 }
971 
972 #if  (defined(FOR_JERRYSCRIPT_TEST)) &&  (JERRY_API_MINOR_VERSION <= 3)
973     // jerryscript 2.3 do nothing
974 #else
975 // jerryscript 2.4 or quickjs or V8
976 /*
977  * @tc.number    : ACE_Napi_Create_Bigint_Int64_0100
978  * @tc.name      : Test the maximum value of napi_create_bigint_int64
979  * @tc.desc      : 1.The environment engine is created
980  *                 2.Set test variables
981  *                 3.The function of napi_create_bigint_int64 is called
982  *                 4.Return value of function is napi_ok
983  *                 5.The function of napi_get_value_bigint_int64 is called
984  *                 6.Check whether the obtained parameters meet requirements
985  */
986 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Bigint_Int64_0100, testing::ext::TestSize.Level1)
987 {
988     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Int64_0100 start";
989     napi_env env = (napi_env)engine_;
990 
991     int64_t testValue = INT64_MAX;
992     napi_value result = nullptr;
993 
994     ExpectCheckCall(napi_create_bigint_int64(env, testValue, &result));
995     AssertCheckValueType(env, result, napi_bigint);
996 
997     bool lossless = true;
998     int64_t resultValue = INT_ZERO;
999     ExpectCheckCall(napi_get_value_bigint_int64(env, result, &resultValue, &lossless));
1000 
1001     EXPECT_EQ(resultValue, INT64_MAX);
1002     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Int64_0100 end";
1003 }
1004 
1005 /*
1006  * @tc.number    : ACE_Napi_Create_Bigint_Int64_0200
1007  * @tc.name      : Test the minimum value of napi_create_bigint_int64
1008  * @tc.desc      : 1.The environment engine is created
1009  *                 2.Set test variables
1010  *                 3.The function of napi_create_bigint_int64 is called
1011  *                 4.Return value of function is napi_ok
1012  *                 5.The function of napi_get_value_bigint_int64 is called
1013  *                 6.Check whether the obtained parameters meet requirements
1014  */
1015 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Bigint_Int64_0200, testing::ext::TestSize.Level1)
1016 {
1017     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Int64_0200 start";
1018     napi_env env = (napi_env)engine_;
1019 
1020     int64_t testValue = INT64_MIN;
1021     napi_value result = nullptr;
1022 
1023     ExpectCheckCall(napi_create_bigint_int64(env, testValue, &result));
1024     AssertCheckValueType(env, result, napi_bigint);
1025 
1026     bool lossless = true;
1027     int64_t resultValue = INT_ZERO;
1028     ExpectCheckCall(napi_get_value_bigint_int64(env, result, &resultValue, &lossless));
1029 
1030     EXPECT_EQ(true, lossless);
1031     EXPECT_EQ(resultValue, INT64_MIN);
1032     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Int64_0200 end";
1033 }
1034 
1035 /*
1036  * @tc.number    : ACE_Napi_Create_Bigint_Int64_0300
1037  * @tc.name      : Test invalid environment for NAPi_CREATE_BIGINT_INT64
1038  * @tc.desc      : 1.Set test variables
1039  *                 2.The function of napi_create_bigint_int64 is called
1040  *                 3.Return value of function is napi_invalid_arg
1041  */
1042 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Bigint_Int64_0300, testing::ext::TestSize.Level0)
1043 {
1044     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Int64_0300 start";
1045     int64_t testValue = INT64_MAX;
1046     napi_value result = nullptr;
1047     napi_status ret = napi_ok;
1048 
1049     ret = napi_create_bigint_int64(nullptr, testValue, &result);
1050 
1051     EXPECT_EQ(ret, napi_invalid_arg);
1052     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Int64_0300 end";
1053 }
1054 
1055 /*
1056  * @tc.number    : ACE_Napi_Create_Bigint_Int64_0400
1057  * @tc.name      : Test the normal value of napi_create_bigint_int64
1058  * @tc.desc      : 1.The environment engine is created
1059  *                 2.Set test variables
1060  *                 3.The function of napi_create_bigint_int64 is called
1061  *                 4.Return value of function is napi_ok
1062  *                 5.The function of napi_get_value_bigint_int64 is called
1063  *                 6.Check whether the obtained parameters meet requirements
1064  */
1065 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Bigint_Int64_0400, testing::ext::TestSize.Level1)
1066 {
1067     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Int64_0400 start";
1068     napi_env env = (napi_env)engine_;
1069 
1070     int64_t testValue = INT64_VALUE;
1071     napi_value result = nullptr;
1072 
1073     ExpectCheckCall(napi_create_bigint_int64(env, testValue, &result));
1074     AssertCheckValueType(env, result, napi_bigint);
1075 
1076     bool lossless = true;
1077     int64_t resultValue = INT_ZERO;
1078     ExpectCheckCall(napi_get_value_bigint_int64(env, result, &resultValue, &lossless));
1079 
1080     EXPECT_EQ(resultValue, testValue);
1081     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Int64_0400 end";
1082 }
1083 
1084 /*
1085  * @tc.number    : ACE_Napi_Create_Bigint_Int64_0500
1086  * @tc.name      : Test the napi_create_bigint_int64 function return value nullptr
1087  * @tc.desc      : 1.The environment engine is created
1088  *                 2.Set test variables
1089  *                 3.The function of napi_create_bigint_int64 is called
1090  *                 4.Return value of function is napi_invalid_arg
1091  */
1092 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Bigint_Int64_0500, testing::ext::TestSize.Level2)
1093 {
1094     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Int64_0500 start";
1095     napi_env env = (napi_env)engine_;
1096 
1097     int64_t testValue = INT64_VALUE;
1098     napi_status ret = napi_ok;
1099 
1100     ret = napi_create_bigint_int64(env, testValue, nullptr);
1101 
1102     EXPECT_EQ(ret, napi_invalid_arg);
1103 
1104     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Int64_0500 end";
1105 }
1106 
1107 /*
1108  * @tc.number    : ACE_Napi_Get_Value_Bigint_Int64_0100
1109  * @tc.name      : Test the maximum value of napi_get_value_bigint_int64
1110  * @tc.desc      : 1.The environment engine is created
1111  *                 2.Set test variables
1112  *                 3.The function of napi_create_bigint_int64 is called
1113  *                 4.Return value of function is napi_ok
1114  *                 5.The function of napi_get_value_bigint_int64 is called
1115  *                 6.Check whether the obtained parameters meet requirements
1116  */
1117 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Value_Bigint_Int64_0100, testing::ext::TestSize.Level1)
1118 {
1119     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Int64_0100 start";
1120     napi_env env = (napi_env)engine_;
1121 
1122     int64_t testValue = INT64_MAX;
1123     napi_value result = nullptr;
1124 
1125     ExpectCheckCall(napi_create_bigint_int64(env, testValue, &result));
1126     AssertCheckValueType(env, result, napi_bigint);
1127 
1128     bool lossless = true;
1129     int64_t resultValue = INT_ZERO;
1130     ExpectCheckCall(napi_get_value_bigint_int64(env, result, &resultValue, &lossless));
1131 
1132     EXPECT_EQ(resultValue, INT64_MAX);
1133     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Int64_0100 end";
1134 }
1135 
1136 /*
1137  * @tc.number    : ACE_Napi_Get_Value_Bigint_Int64_0200
1138  * @tc.name      : Test the minimum value of napi_get_value_bigint_int64
1139  * @tc.desc      : 1.The environment engine is created
1140  *                 2.Set test variables
1141  *                 3.The function of napi_create_bigint_int64 is called
1142  *                 4.Return value of function is napi_ok
1143  *                 5.The function of napi_get_value_bigint_int64 is called
1144  *                 6.Check whether the obtained parameters meet requirements
1145  */
1146 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Value_Bigint_Int64_0200, testing::ext::TestSize.Level1)
1147 {
1148     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Int64_0200 start";
1149     napi_env env = (napi_env)engine_;
1150 
1151     int64_t testValue = INT64_MIN;
1152     napi_value result = nullptr;
1153 
1154     ExpectCheckCall(napi_create_bigint_int64(env, testValue, &result));
1155     AssertCheckValueType(env, result, napi_bigint);
1156 
1157     bool lossless = true;
1158     int64_t resultValue = INT_ZERO;
1159     ExpectCheckCall(napi_get_value_bigint_int64(env, result, &resultValue, &lossless));
1160 
1161     EXPECT_EQ(resultValue, INT64_MIN);
1162     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Int64_0200 end";
1163 }
1164 
1165 /*
1166  * @tc.number    : ACE_Napi_Get_Value_Bigint_Int64_0300
1167  * @tc.name      : Test passing in an object that is not Napi_bigint
1168  * @tc.desc      : 1.The environment engine is created
1169  *                 2.Set test variables
1170  *                 3.The function of napi_create_string_utf16 is called
1171  *                 4.Return value of function is napi_ok
1172  *                 5.The function of napi_get_value_bigint_int64 is called
1173  *                 6.Return value of function is napi_bigint_expected
1174  */
1175 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Value_Bigint_Int64_0300, testing::ext::TestSize.Level2)
1176 {
1177     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Int64_0300 start";
1178     napi_env env = (napi_env)engine_;
1179 
1180     napi_status ret = napi_ok;
1181     char16_t testStr[] = u"system.test.content.bigint.abnormal";
1182     int testStrLength = static_cast<int>(std::char_traits<char16_t>::length(testStr));
1183     napi_value result = nullptr;
1184 
1185     ExpectCheckCall(napi_create_string_utf16(env, testStr, testStrLength, &result));
1186 
1187     bool lossless = true;
1188     int64_t resultValue = INT_ZERO;
1189     ret = napi_get_value_bigint_int64(env, result, &resultValue, &lossless);
1190 
1191     EXPECT_EQ(ret, napi_bigint_expected);
1192     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Int64_0300 end";
1193 }
1194 
1195 /*
1196  * @tc.number    : ACE_Napi_Get_Value_Bigint_Int64_0400
1197  * @tc.name      : Passed an invalid environment variable
1198  * @tc.desc      : 1.Set test variables
1199  *                 2.The function of napi_create_bigint_int64 is called
1200  *                 4.Return value of function is napi_ok
1201  *                 5.The function of napi_get_value_bigint_int64 is called
1202  *                 6.Return value of function is napi_invalid_arg
1203  */
1204 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Value_Bigint_Int64_0400, testing::ext::TestSize.Level2)
1205 {
1206     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Int64_0400 start";
1207     napi_env env = (napi_env)engine_;
1208 
1209     int64_t testValue = INT_ZERO;
1210     napi_value result = nullptr;
1211     napi_status ret = napi_ok;
1212 
1213     ExpectCheckCall(napi_create_bigint_int64(env, testValue, &result));
1214     AssertCheckValueType(env, result, napi_bigint);
1215     bool lossless = true;
1216     int64_t resultValue = INT_ZERO;
1217 
1218     ret = napi_get_value_bigint_int64(nullptr, result, &resultValue, &lossless);
1219 
1220     EXPECT_EQ(ret, napi_invalid_arg);
1221     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Int64_0400 end";
1222 }
1223 
1224 /*
1225  * @tc.number    : ACE_Napi_Get_Value_Bigint_Int64_0500
1226  * @tc.name      : Test the normal value of napi_get_value_bigint_int64
1227  * @tc.desc      : 1.The environment engine is created
1228  *                 2.Set test variables
1229  *                 3.The function of napi_create_bigint_int64 is called
1230  *                 4.Return value of function is napi_ok
1231  *                 5.The function of napi_get_value_bigint_int64 is called
1232  *                 6.Check whether the obtained parameters meet requirements
1233  */
1234 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Value_Bigint_Int64_0500, testing::ext::TestSize.Level1)
1235 {
1236     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Int64_0500 start";
1237     napi_env env = (napi_env)engine_;
1238 
1239     int64_t testValue = INT64_VALUE;
1240     napi_value result = nullptr;
1241 
1242     ExpectCheckCall(napi_create_bigint_int64(env, testValue, &result));
1243     AssertCheckValueType(env, result, napi_bigint);
1244 
1245     bool lossless = true;
1246     int64_t resultValue = INT_ZERO;
1247     ExpectCheckCall(napi_get_value_bigint_int64(env, result, &resultValue, &lossless));
1248 
1249     EXPECT_EQ(resultValue, INT64_VALUE);
1250     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Int64_0500 end";
1251 }
1252 
1253 /*
1254  * @tc.number    : ACE_Napi_Get_Value_Bigint_Int64_0600
1255  * @tc.name      : The result value returned by test napi_get_value_bigint_int64 is invalid
1256  * @tc.desc      : 1.The environment engine is created
1257  *                 2.Set test variables
1258  *                 3.The function of napi_create_bigint_int64 is called
1259  *                 4.Return value of function is napi_ok
1260  *                 5.The function of napi_get_value_bigint_int64 is called
1261  *                 6.Return value of function is napi_invalid_arg
1262  */
1263 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Value_Bigint_Int64_0600, testing::ext::TestSize.Level2)
1264 {
1265     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Int64_0600 start";
1266     napi_env env = (napi_env)engine_;
1267 
1268     int64_t testValue = INT64_VALUE;
1269     napi_value result = nullptr;
1270     napi_status ret = napi_ok;
1271 
1272     ExpectCheckCall(napi_create_bigint_int64(env, testValue, &result));
1273     AssertCheckValueType(env, result, napi_bigint);
1274 
1275     bool lossless = true;
1276     ret = napi_get_value_bigint_int64(env, result, nullptr, &lossless);
1277 
1278     EXPECT_EQ(ret, napi_invalid_arg);
1279     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Int64_0600 end";
1280 }
1281 
1282 /*
1283  * @tc.number    : ACE_Napi_Get_Value_Bigint_Int64_0700
1284  * @tc.name      : Test napi_get_value_bigint_int64 returns JS big integer is invalid
1285  * @tc.desc      : 1.The environment engine is created
1286  *                 2.Set test variables
1287  *                 3.The function of napi_create_bigint_int64 is called
1288  *                 4.Return value of function is napi_ok
1289  *                 5.The function of napi_get_value_bigint_int64 is called
1290  *                 6.Return value of function is napi_invalid_arg
1291  */
1292 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Value_Bigint_Int64_0700, testing::ext::TestSize.Level2)
1293 {
1294     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Int64_0700 start";
1295     napi_env env = (napi_env)engine_;
1296 
1297     int64_t testValue = INT64_VALUE;
1298     napi_value result = nullptr;
1299     napi_status ret = napi_ok;
1300 
1301     ExpectCheckCall(napi_create_bigint_int64(env, testValue, &result));
1302     AssertCheckValueType(env, result, napi_bigint);
1303 
1304     int64_t resultValue = INT_ZERO;
1305     ret = napi_get_value_bigint_int64(env, result, &resultValue, nullptr);
1306 
1307     EXPECT_EQ(ret, napi_invalid_arg);
1308     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Int64_0700 end";
1309 }
1310 
1311 /*
1312  * @tc.number    : ACE_Napi_Create_Bigint_Uint64_0100
1313  * @tc.name      : Test the maximum value of napi_create_bigint_uint64
1314  * @tc.desc      : 1.The environment engine is created
1315  *                 2.Set test variables
1316  *                 3.The function of napi_create_bigint_uint64 is called
1317  *                 4.Return value of function is napi_ok
1318  *                 5.The function of napi_get_value_bigint_uint64 is called
1319  *                 6.Check whether the obtained parameters meet requirements
1320  */
1321 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Bigint_Uint64_0100, testing::ext::TestSize.Level1)
1322 {
1323     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Uint64_0100 start";
1324     napi_env env = (napi_env)engine_;
1325 
1326     uint64_t testValue = UINT64_MAX;
1327     napi_value result = nullptr;
1328 
1329     ExpectCheckCall(napi_create_bigint_uint64(env, testValue, &result));
1330     AssertCheckValueType(env, result, napi_bigint);
1331 
1332     bool lossless = false;
1333     uint64_t resultValue = INT_ZERO;
1334     ExpectCheckCall(napi_get_value_bigint_uint64(env, result, &resultValue, &lossless));
1335 
1336     EXPECT_EQ(true, lossless);
1337     EXPECT_EQ(resultValue, testValue);
1338     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Uint64_0100 end";
1339 }
1340 
1341 /*
1342  * @tc.number    : ACE_Napi_Create_Bigint_Uint64_0200
1343  * @tc.name      : Test the minimum value of napi_create_bigint_uint64
1344  * @tc.desc      : 1.The environment engine is created
1345  *                 2.Set test variables
1346  *                 3.The function of napi_create_bigint_uint64 is called
1347  *                 4.Return value of function is napi_ok
1348  *                 5.The function of napi_get_value_bigint_uint64 is called
1349  *                 6.Check whether the obtained parameters meet requirements
1350  */
1351 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Bigint_Uint64_0200, testing::ext::TestSize.Level1)
1352 {
1353     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Uint64_0200 start";
1354     napi_env env = (napi_env)engine_;
1355 
1356     uint64_t testValue = INT_ZERO;
1357     napi_value result = nullptr;
1358 
1359     ExpectCheckCall(napi_create_bigint_uint64(env, testValue, &result));
1360     AssertCheckValueType(env, result, napi_bigint);
1361 
1362     bool lossless = true;
1363     uint64_t resultValue = INT_ONE;
1364     ExpectCheckCall(napi_get_value_bigint_uint64(env, result, &resultValue, &lossless));
1365 
1366     EXPECT_EQ(resultValue, testValue);
1367     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Uint64_0200 end";
1368 }
1369 
1370 /*
1371  * @tc.number    : ACE_Napi_Create_Bigint_Uint64_0300
1372  * @tc.name      : Passed an invalid environment variable
1373  * @tc.desc      : 1.Set test variables
1374  *                 2.The function of napi_create_bigint_uint64 is called
1375  *                 6.Return value of function is napi_invalid_arg
1376  */
1377 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Bigint_Uint64_0300, testing::ext::TestSize.Level2)
1378 {
1379     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Uint64_0300 start";
1380     uint64_t testValue = INT_ZERO;
1381     napi_value result = nullptr;
1382     napi_status ret = napi_ok;
1383 
1384     ret = napi_create_bigint_uint64(nullptr, testValue, &result);
1385     EXPECT_EQ(ret, napi_invalid_arg);
1386     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Uint64_0300 end";
1387 }
1388 
1389 /*
1390  * @tc.number    : ACE_Napi_Create_Bigint_Uint64_0400
1391  * @tc.name      : Test napi_create_bigint_uint64 Normal value
1392  * @tc.desc      : 1.The environment engine is created
1393  *                 2.Set test variables
1394  *                 3.The function of napi_create_bigint_uint64 is called
1395  *                 4.Return value of function is napi_ok
1396  *                 5.The function of napi_get_value_bigint_uint64 is called
1397  *                 6.Check whether the obtained parameters meet requirements
1398  */
1399 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Bigint_Uint64_0400, testing::ext::TestSize.Level1)
1400 {
1401     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Uint64_0400 start";
1402     napi_env env = (napi_env)engine_;
1403 
1404     uint64_t testValue = UINT64_VALUE;
1405     napi_value result = nullptr;
1406 
1407     ExpectCheckCall(napi_create_bigint_uint64(env, testValue, &result));
1408     AssertCheckValueType(env, result, napi_bigint);
1409 
1410     bool lossless = true;
1411     uint64_t resultValue = INT_ONE;
1412     ExpectCheckCall(napi_get_value_bigint_uint64(env, result, &resultValue, &lossless));
1413 
1414     EXPECT_EQ(resultValue, testValue);
1415     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Uint64_0400 end";
1416 }
1417 
1418 /*
1419  * @tc.number    : ACE_Napi_Create_Bigint_Uint64_0500
1420  * @tc.name      : Test the napi_create_bigint_uint64 function return value nullptr
1421  * @tc.desc      : 1.The environment engine is created
1422  *                 2.Set test variables
1423  *                 3.The function of napi_create_bigint_uint64 is called
1424  *                 4.Return value of function is napi_invalid_arg
1425  */
1426 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Bigint_Uint64_0500, testing::ext::TestSize.Level2)
1427 {
1428     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Uint64_0500 start";
1429     napi_env env = (napi_env)engine_;
1430 
1431     uint64_t testValue = UINT64_VALUE;
1432     napi_status ret = napi_ok;
1433 
1434     ret = napi_create_bigint_uint64(env, testValue, nullptr);
1435 
1436     EXPECT_EQ(ret, napi_invalid_arg);
1437     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Uint64_0500 end";
1438 }
1439 
1440 /*
1441  * @tc.number    : ACE_Napi_Get_Value_Bigint_Uint64_0100
1442  * @tc.name      : Test the maximum value of napi_get_value_bigint_uint64
1443  * @tc.desc      : 1.The environment engine is created
1444  *                 2.Set test variables
1445  *                 3.The function of napi_create_bigint_uint64 is called
1446  *                 4.Return value of function is napi_ok
1447  *                 5.The function of napi_get_value_bigint_uint64 is called
1448  *                 6.Check whether the obtained parameters meet requirements
1449  */
1450 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Value_Bigint_Uint64_0100, testing::ext::TestSize.Level1)
1451 {
1452     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Uint64_0100 start";
1453     napi_env env = (napi_env)engine_;
1454 
1455     uint64_t testValue = UINT64_MAX;
1456     napi_value result = nullptr;
1457 
1458     ExpectCheckCall(napi_create_bigint_uint64(env, testValue, &result));
1459     AssertCheckValueType(env, result, napi_bigint);
1460 
1461     bool lossless = true;
1462     uint64_t resultValue = INT_ZERO;
1463     ExpectCheckCall(napi_get_value_bigint_uint64(env, result, &resultValue, &lossless));
1464 
1465     EXPECT_EQ(resultValue, UINT64_MAX);
1466     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Uint64_0100 end";
1467 }
1468 
1469 /*
1470  * @tc.number    : ACE_Napi_Get_Value_Bigint_Uint64_0200
1471  * @tc.name      : Test the maximum value of napi_get_value_bigint_uint64
1472  * @tc.desc      : 1.The environment engine is created
1473  *                 2.Set test variables
1474  *                 3.The function of napi_create_bigint_uint64 is called
1475  *                 4.Return value of function is napi_ok
1476  *                 5.The function of napi_get_value_bigint_uint64 is called
1477  *                 6.Check whether the obtained parameters meet requirements
1478  */
1479 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Value_Bigint_Uint64_0200, testing::ext::TestSize.Level1)
1480 {
1481     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Uint64_0200 start";
1482     napi_env env = (napi_env)engine_;
1483 
1484     uint64_t testValue = INT_ZERO;
1485     napi_value result = nullptr;
1486 
1487     ExpectCheckCall(napi_create_bigint_uint64(env, testValue, &result));
1488     AssertCheckValueType(env, result, napi_bigint);
1489 
1490     bool lossless = true;
1491     uint64_t resultValue = INT_ZERO;
1492     ExpectCheckCall(napi_get_value_bigint_uint64(env, result, &resultValue, &lossless));
1493 
1494     EXPECT_EQ(resultValue, testValue);
1495     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Uint64_0200 end";
1496 }
1497 
1498 /*
1499  * @tc.number    : ACE_Napi_Get_Value_Bigint_Uint64_0300
1500  * @tc.name      : Pass in an object that is not BigInt
1501  * @tc.desc      : 1.The environment engine is created
1502  *                 2.Set test variables
1503  *                 3.The function of napi_create_string_utf16 is called
1504  *                 4.Return value of function is napi_ok
1505  *                 5.The function of napi_get_value_bigint_uint64 is called
1506  *                 6.Return value of function is napi_bigint_expected
1507  */
1508 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Value_Bigint_Uint64_0300, testing::ext::TestSize.Level2)
1509 {
1510     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Uint64_0300 start";
1511     napi_env env = (napi_env)engine_;
1512 
1513     napi_status ret = napi_ok;
1514     char16_t testStr[] = u"system.test.content.bigint.abnormal";
1515     int testStrLength = static_cast<int>(std::char_traits<char16_t>::length(testStr));
1516     napi_value result = nullptr;
1517 
1518     ExpectCheckCall(napi_create_string_utf16(env, testStr, testStrLength, &result));
1519 
1520     bool lossless = true;
1521     uint64_t resultValue = INT_ZERO;
1522     ret = napi_get_value_bigint_uint64(env, result, &resultValue, &lossless);
1523 
1524     EXPECT_EQ(ret, napi_bigint_expected);
1525     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Uint64_0300 end";
1526 }
1527 
1528 /*
1529  * @tc.number    : ACE_Napi_Get_Value_Bigint_Uint64_0400
1530  * @tc.name      : Passed an invalid environment variable
1531  * @tc.desc      : 1.Set test variables
1532  *                 2.The function of napi_create_bigint_uint64 is called
1533  *                 4.Return value of function is napi_ok
1534  *                 5.The function of napi_get_value_bigint_uint64 is called
1535  *                 6.Return value of function is napi_invalid_arg
1536  */
1537 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Value_Bigint_Uint64_0400, testing::ext::TestSize.Level2)
1538 {
1539     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Uint64_0400 start";
1540     napi_env env = (napi_env)engine_;
1541 
1542     uint64_t testValue = INT_ZERO;
1543     napi_value result = nullptr;
1544     napi_status ret = napi_ok;
1545     ExpectCheckCall(napi_create_bigint_uint64(env, testValue, &result));
1546     AssertCheckValueType(env, result, napi_bigint);
1547 
1548     bool lossless = true;
1549     uint64_t resultValue = INT_ZERO;
1550     ret = napi_get_value_bigint_uint64(nullptr, result, &resultValue, &lossless);
1551 
1552     EXPECT_EQ(ret, napi_invalid_arg);
1553     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Uint64_0400 end";
1554 }
1555 
1556 /*
1557  * @tc.number    : ACE_Napi_Get_Value_Bigint_Uint64_0500
1558  * @tc.name      : Test napi_get_value_bigint_uint64 Normal value
1559  * @tc.desc      : 1.The environment engine is created
1560  *                 2.Set test variables
1561  *                 3.The function of napi_create_bigint_uint64 is called
1562  *                 4.Return value of function is napi_ok
1563  *                 5.The function of napi_get_value_bigint_uint64 is called
1564  *                 6.Check whether the obtained parameters meet requirements
1565  */
1566 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Value_Bigint_Uint64_0500, testing::ext::TestSize.Level1)
1567 {
1568     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Uint64_0500 start";
1569     napi_env env = (napi_env)engine_;
1570 
1571     uint64_t testValue = UINT64_VALUE;
1572     napi_value result = nullptr;
1573 
1574     ExpectCheckCall(napi_create_bigint_uint64(env, testValue, &result));
1575     AssertCheckValueType(env, result, napi_bigint);
1576 
1577     bool lossless = true;
1578     uint64_t resultValue = INT_ONE;
1579     ExpectCheckCall(napi_get_value_bigint_uint64(env, result, &resultValue, &lossless));
1580 
1581     EXPECT_EQ(resultValue, (uint64_t)UINT64_VALUE);
1582     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Uint64_0500 end";
1583 }
1584 
1585 /*
1586  * @tc.number    : ACE_Napi_Get_Value_Bigint_Uint64_0600
1587  * @tc.name      : The result value returned by test napi_get_value_bigint_uint64 is invalid
1588  * @tc.desc      : 1.The environment engine is created
1589  *                 2.Set test variables
1590  *                 3.The function of napi_create_bigint_uint64 is called
1591  *                 4.Return value of function is napi_ok
1592  *                 5.The function of napi_get_value_bigint_uint64 is called
1593  *                 6.Return value of function is napi_invalid_arg
1594  */
1595 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Value_Bigint_Uint64_0600, testing::ext::TestSize.Level2)
1596 {
1597     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Uint64_0600 start";
1598     napi_env env = (napi_env)engine_;
1599 
1600     uint64_t testValue = UINT64_VALUE;
1601     napi_value result = nullptr;
1602     napi_status ret = napi_ok;
1603 
1604     ExpectCheckCall(napi_create_bigint_uint64(env, testValue, &result));
1605     AssertCheckValueType(env, result, napi_bigint);
1606 
1607     bool lossless = true;
1608     ret = napi_get_value_bigint_uint64(env, result, nullptr, &lossless);
1609 
1610     EXPECT_EQ(ret, napi_invalid_arg);
1611     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Uint64_0600 end";
1612 }
1613 
1614 /*
1615  * @tc.number    : ACE_Napi_Get_Value_Bigint_Uint64_0700
1616  * @tc.name      : Test napi_get_value_bigint_uint64 returns JS big integer is invalid
1617  * @tc.desc      : 1.The environment engine is created
1618  *                 2.Set test variables
1619  *                 3.The function of napi_create_bigint_uint64 is called
1620  *                 4.Return value of function is napi_ok
1621  *                 5.The function of napi_get_value_bigint_uint64 is called
1622  *                 6.Return value of function is napi_invalid_arg
1623  */
1624 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Value_Bigint_Uint64_0700, testing::ext::TestSize.Level2)
1625 {
1626     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Uint64_0700 start";
1627     napi_env env = (napi_env)engine_;
1628     napi_status ret = napi_ok;
1629     uint64_t testValue = UINT64_VALUE;
1630     napi_value result = nullptr;
1631 
1632     ExpectCheckCall(napi_create_bigint_uint64(env, testValue, &result));
1633     AssertCheckValueType(env, result, napi_bigint);
1634 
1635     uint64_t resultValue = INT_ONE;
1636     ret = napi_get_value_bigint_uint64(env, result, &resultValue, nullptr);
1637 
1638     EXPECT_EQ(ret, napi_invalid_arg);
1639     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Uint64_0700 end";
1640 }
1641 
1642 /*
1643  * @tc.number    : ACE_Napi_Create_Bigint_Words_0100
1644  * @tc.name      : Test the normal value of NAPi_CREATE_BIGINT_WORDS and the character bit is 0
1645  * @tc.desc      : 1.The environment engine is created
1646  *                 2.Set test variables
1647  *                 3.The function of napi_create_bigint_words is called
1648  *                 4.Return value of function is napi_ok
1649  *                 5.The function of napi_get_value_bigint_words is called
1650  *                 6.Check whether the obtained parameters meet requirements
1651  */
1652 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Bigint_Words_0100, testing::ext::TestSize.Level1)
1653 {
1654     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Words_0100 start";
1655     napi_env env = (napi_env)engine_;
1656 
1657     uint64_t words[] = { (uint64_t)16, (uint64_t)128, (uint64_t)56, (uint64_t)226 };
1658     int sign_bit = INT_ZERO;
1659     size_t word_count = INT_FOUR;
1660     napi_value result = nullptr;
1661 
1662     ExpectCheckCall(napi_create_bigint_words(env, sign_bit, word_count, words, &result));
1663 
1664     int sign = INT_ZERO;
1665     uint64_t wordsOut[word_count];
1666     ExpectCheckCall(napi_get_value_bigint_words(env, result, &sign, &word_count, wordsOut));
1667 
1668     EXPECT_EQ(sign_bit, sign);
1669     EXPECT_EQ(word_count, (size_t)INT_FOUR);
1670     for (size_t i = INT_ZERO; i < word_count; i++) {
1671         EXPECT_EQ(wordsOut[i], words[i]);
1672     }
1673     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Words_0100 end";
1674 }
1675 
1676 /*
1677  * @tc.number    : ACE_Napi_Create_Bigint_Words_0200
1678  * @tc.name      : Test the normal value of NAPi_CREATE_BIGINT_WORDS and the character bit is 1
1679  * @tc.desc      : 1.The environment engine is created
1680  *                 2.Set test variables
1681  *                 3.The function of napi_create_bigint_words is called
1682  *                 4.Return value of function is napi_ok
1683  *                 5.The function of napi_get_value_bigint_words is called
1684  *                 6.Check whether the obtained parameters meet requirements
1685  */
1686 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Bigint_Words_0200, testing::ext::TestSize.Level1)
1687 {
1688     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Words_0200 start";
1689     napi_env env = (napi_env)engine_;
1690 
1691     uint64_t words[] = { (uint64_t)16, (uint64_t)64, (uint64_t)28, (uint64_t)8 };
1692     int sign_bit = INT_ONE;
1693     size_t word_count = INT_FOUR;
1694     napi_value result = nullptr;
1695 
1696     ExpectCheckCall(napi_create_bigint_words(env, sign_bit, word_count, words, &result));
1697 
1698     int sign = INT_ZERO;
1699     uint64_t wordsOut[word_count];
1700     ExpectCheckCall(napi_get_value_bigint_words(env, result, &sign, &word_count, wordsOut));
1701 
1702     EXPECT_EQ(sign_bit, sign);
1703     EXPECT_EQ(word_count, INT_FOUR);
1704     for (size_t i = INT_ZERO; i < word_count; i++) {
1705         EXPECT_EQ(wordsOut[i], words[i]);
1706     }
1707     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Words_0200 end";
1708 }
1709 
1710 /*
1711  * @tc.number    : ACE_Napi_Create_Bigint_Words_0300
1712  * @tc.name      : Tests word_count for an invalid value of 0
1713  * @tc.desc      : 1.The environment engine is created
1714  *                 2.Set test variables
1715  *                 3.The function of napi_create_bigint_words is called
1716  *                 4.Return value of function is napi_invalid_arg
1717  */
1718 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Bigint_Words_0300, testing::ext::TestSize.Level2)
1719 {
1720     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Words_0300 start";
1721     napi_env env = (napi_env)engine_;
1722 
1723     int sign_bit = INT_ZERO;
1724     size_t word_count = INT_ZERO;
1725     napi_value result = nullptr;
1726     napi_status ret = napi_ok;
1727 
1728     ret = napi_create_bigint_words(env, sign_bit, word_count, nullptr, &result);
1729 
1730     EXPECT_EQ(ret, napi_invalid_arg);
1731     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Words_0300 end";
1732 }
1733 
1734 /*
1735  * @tc.number    : ACE_Napi_Create_Bigint_Words_0400
1736  * @tc.name      : Tests word_count for an invalid value of 0
1737  * @tc.desc      : 1.Set test variables
1738  *                 2.The function of napi_create_bigint_words is called
1739  *                 3.Return value of function is napi_invalid_arg
1740  */
1741 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Bigint_Words_0400, testing::ext::TestSize.Level2)
1742 {
1743     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Words_0400 start";
1744     uint64_t words[] = { (uint64_t)128, (uint64_t)64, (uint64_t)66, (uint64_t)111 };
1745     int sign_bit = INT_ONE;
1746     size_t word_count = INT_FOUR;
1747     napi_value result = nullptr;
1748     napi_status ret = napi_ok;
1749 
1750     ret = napi_create_bigint_words(nullptr, sign_bit, word_count, words, &result);
1751 
1752     EXPECT_EQ(ret, napi_invalid_arg);
1753     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Words_0400 end";
1754 }
1755 
1756 /*
1757  * @tc.number    : ACE_Napi_Create_Bigint_Words_0500
1758  * @tc.name      : Test napi_create_bigint_words Enter 0 and the character bit is 1
1759  * @tc.desc      : 1.The environment engine is created
1760  *                 2.Set test variables
1761  *                 3.The function of napi_create_bigint_words is called
1762  *                 4.Return value of function is napi_ok
1763  *                 5.The function of napi_get_value_bigint_words is called
1764  *                 6.Check whether the obtained parameters meet requirements
1765  */
1766 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Bigint_Words_0500, testing::ext::TestSize.Level2)
1767 {
1768     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Words_0500 start";
1769 
1770     napi_env env = (napi_env)engine_;
1771 
1772 #ifdef FOR_JERRYSCRIPT_TEST
1773     uint64_t words[] = { (uint64_t)5, (uint64_t)10, (uint64_t)25, (uint64_t)25 };
1774 #else
1775     uint64_t words[] = { (uint64_t)0, (uint64_t)0, (uint64_t)0, (uint64_t)0 };
1776 #endif
1777     int sign_bit = INT_ZERO;
1778     size_t word_count = INT_FOUR;
1779     napi_value result = nullptr;
1780 
1781     ExpectCheckCall(napi_create_bigint_words(env, sign_bit, word_count, words, &result));
1782 
1783     int sign;
1784     uint64_t wordsOut[word_count];
1785     ExpectCheckCall(napi_get_value_bigint_words(env, result, &sign, &word_count, wordsOut));
1786 
1787     EXPECT_EQ(sign_bit, sign);
1788 
1789 #ifdef FOR_JERRYSCRIPT_TEST
1790     EXPECT_EQ(word_count, INT_FOUR);
1791 #else
1792     EXPECT_EQ(word_count, INT_ONE);
1793 #endif
1794     for (size_t i = INT_ZERO; i < word_count; i++) {
1795         EXPECT_EQ(wordsOut[i], words[i]);
1796     }
1797     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Words_0500 end";
1798 }
1799 
1800 /*
1801  * @tc.number    : ACE_Napi_Create_Bigint_Words_0600
1802  * @tc.name      : Test napi_create_bigint_words Combined data. The value is 1 character
1803  * @tc.desc      : 1.The environment engine is created
1804  *                 2.Set test variables
1805  *                 3.The function of napi_create_bigint_words is called
1806  *                 4.Return value of function is napi_ok
1807  *                 5.The function of napi_get_value_bigint_words is called
1808  *                 6.Check whether the obtained parameters meet requirements
1809  */
1810 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Bigint_Words_0600, testing::ext::TestSize.Level2)
1811 {
1812     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Words_0600 start";
1813     napi_env env = (napi_env)engine_;
1814 
1815     uint64_t words[] = { (uint64_t)1, (uint64_t)0, (uint64_t)0, (uint64_t)0 };
1816     int sign_bit = INT_ONE;
1817     size_t word_count = INT_FOUR;
1818     napi_value result = nullptr;
1819 
1820     ExpectCheckCall(napi_create_bigint_words(env, sign_bit, word_count, words, &result));
1821 
1822     int sign;
1823     uint64_t wordsOut[word_count];
1824     ExpectCheckCall(napi_get_value_bigint_words(env, result, &sign, &word_count, wordsOut));
1825 
1826     EXPECT_EQ(sign_bit, sign);
1827     EXPECT_EQ(word_count, INT_ONE);
1828     for (size_t i = INT_ZERO; i < word_count; i++) {
1829         EXPECT_EQ(wordsOut[i], words[i]);
1830     }
1831     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Words_0600 end";
1832 }
1833 
1834 /*
1835  * @tc.number    : ACE_Napi_Create_Bigint_Words_0700
1836  * @tc.name      : Test napi_create_bigint_words Combined data. The value is 1 character
1837  * @tc.desc      : 1.The environment engine is created
1838  *                 2.Set test variables
1839  *                 3.The function of napi_create_bigint_words is called
1840  *                 4.Return value of function is napi_ok
1841  *                 5.The function of napi_get_value_bigint_words is called
1842  *                 6.Check whether the obtained parameters meet requirements
1843  */
1844 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Bigint_Words_0700, testing::ext::TestSize.Level2)
1845 {
1846     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Words_0700 start";
1847     napi_env env = (napi_env)engine_;
1848 
1849     uint64_t words[] = { (uint64_t)0, (uint64_t)0, (uint64_t)0, (uint64_t)1 };
1850     int sign_bit = INT_ONE;
1851     size_t word_count = INT_FOUR;
1852     napi_value result = nullptr;
1853 
1854     ExpectCheckCall(napi_create_bigint_words(env, sign_bit, word_count, words, &result));
1855 
1856     int sign;
1857     uint64_t wordsOut[word_count];
1858     ExpectCheckCall(napi_get_value_bigint_words(env, result, &sign, &word_count, wordsOut));
1859 
1860     EXPECT_EQ(sign_bit, sign);
1861     EXPECT_EQ(word_count, INT_FOUR);
1862     for (size_t i = INT_ZERO; i < word_count; i++) {
1863         EXPECT_EQ(wordsOut[i], words[i]);
1864     }
1865     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Words_0700 end";
1866 }
1867 
1868 /*
1869  * @tc.number    : ACE_Napi_Create_Bigint_Words_0800
1870  * @tc.name      : Tests the maximum number of words entered in napi_create_BIGINt_words and the sign bit is 1
1871  * @tc.desc      : 1.The environment engine is created
1872  *                 2.Set test variables
1873  *                 3.The function of napi_create_bigint_words is called
1874  *                 4.Return value of function is napi_ok
1875  *                 5.The function of napi_get_value_bigint_words is called
1876  *                 6.Check whether the obtained parameters meet requirements
1877  */
1878 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Bigint_Words_0800, testing::ext::TestSize.Level1)
1879 {
1880     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Words_0800 start";
1881     napi_env env = (napi_env)engine_;
1882 
1883     uint64_t words[] = { 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF };
1884     int sign_bit = INT_ONE;
1885     size_t word_count = INT_FOUR;
1886     napi_value result = nullptr;
1887 
1888     ExpectCheckCall(napi_create_bigint_words(env, sign_bit, word_count, words, &result));
1889 
1890     int sign = INT_ZERO;
1891     uint64_t wordsOut[word_count];
1892     ExpectCheckCall(napi_get_value_bigint_words(env, result, &sign, &word_count, wordsOut));
1893 
1894     EXPECT_EQ(sign_bit, sign);
1895     EXPECT_EQ(word_count, INT_FOUR);
1896     for (size_t i = INT_ZERO; i < word_count; i++) {
1897         EXPECT_EQ(wordsOut[i], words[i]);
1898     }
1899     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Words_0800 end";
1900 }
1901 
1902 /*
1903  * @tc.number    : ACE_Napi_Create_Bigint_Words_0900
1904  * @tc.name      : Test the normal value of NAPi_CREATE_BIGINT_WORDS,
1905  *                  the character bit is 0, and the return value is empty.
1906  * @tc.desc      : 1.The environment engine is created.
1907  *                 2.Set test variables.
1908  *                 3.The function of napi_create_bigint_words is called.
1909  *                 4.Return value of function is napi_invalid_arg.
1910  */
1911 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Bigint_Words_0900, testing::ext::TestSize.Level2)
1912 {
1913     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Words_0900 start";
1914     napi_env env = (napi_env)engine_;
1915 
1916     uint64_t words[] = { (uint64_t)16, (uint64_t)64, (uint64_t)28, (uint64_t)8 };
1917     int sign_bit = INT_ONE;
1918     size_t word_count = INT_FOUR;
1919     napi_status ret = napi_ok;
1920 
1921     ret = napi_create_bigint_words(env, sign_bit, word_count, words, nullptr);
1922 
1923     EXPECT_EQ(ret, napi_invalid_arg);
1924     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Words_0900 end";
1925 }
1926 
1927 /*
1928  * @tc.number    : ACE_Napi_Get_Value_Bigint_Words_0100
1929  * @tc.name      : Test the normal value of napi_get_value_bigint_words and the character bit is 0
1930  * @tc.desc      : 1.The environment engine is created
1931  *                 2.Set test variables
1932  *                 3.The function of napi_create_bigint_words is called
1933  *                 4.Return value of function is napi_ok
1934  *                 5.The function of napi_get_value_bigint_words is called
1935  *                 6.Check whether the obtained parameters meet requirements
1936  */
1937 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Value_Bigint_Words_0100, testing::ext::TestSize.Level1)
1938 {
1939     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Words_0100 start";
1940     napi_env env = (napi_env)engine_;
1941 
1942     uint64_t words[] = { 8, 16, 34, 45, 66 };
1943     int sign_bit = INT_ZERO;
1944     size_t word_count = INT_FIVE;
1945     napi_value result = nullptr;
1946 
1947     ExpectCheckCall(napi_create_bigint_words(env, sign_bit, word_count, words, &result));
1948 
1949     int sign;
1950     uint64_t wordsOut[word_count];
1951     ExpectCheckCall(napi_get_value_bigint_words(env, result, &sign, &word_count, wordsOut));
1952 
1953     EXPECT_EQ(sign_bit, sign);
1954     EXPECT_EQ(word_count, INT_FIVE);
1955     for (size_t i = INT_ZERO; i < word_count; i++) {
1956         EXPECT_EQ(wordsOut[i], words[i]);
1957     }
1958     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Words_0100 end";
1959 }
1960 
1961 /*
1962  * @tc.number    : ACE_Napi_Get_Value_Bigint_Words_0200
1963  * @tc.name      : Test the normal value of napi_get_value_bigint_words and the character bit is 1
1964  * @tc.desc      : 1.The environment engine is created
1965  *                 2.Set test variables
1966  *                 3.The function of napi_create_bigint_words is called
1967  *                 4.Return value of function is napi_ok
1968  *                 5.The function of napi_get_value_bigint_words is called
1969  *                 6.Check whether the obtained parameters meet requirements
1970  */
1971 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Value_Bigint_Words_0200, testing::ext::TestSize.Level1)
1972 {
1973     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Words_0200 start";
1974     napi_env env = (napi_env)engine_;
1975 
1976     uint64_t words[] = { (uint64_t)12, (uint64_t)34, (uint64_t)56, 0x000000FF98765432 };
1977     int sign_bit = INT_ONE;
1978     size_t word_count = INT_FOUR;
1979     napi_value result = nullptr;
1980 
1981     ExpectCheckCall(napi_create_bigint_words(env, sign_bit, word_count, words, &result));
1982 
1983     int sign;
1984     uint64_t wordsOut[word_count];
1985     ExpectCheckCall(napi_get_value_bigint_words(env, result, &sign, &word_count, wordsOut));
1986 
1987     EXPECT_EQ(sign_bit, sign);
1988     EXPECT_EQ(word_count, INT_FOUR);
1989     for (size_t i = INT_ZERO; i < word_count; i++) {
1990         EXPECT_EQ(wordsOut[i], words[i]);
1991     }
1992     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Words_0200 end";
1993 }
1994 
1995 /*
1996  * @tc.number    : ACE_Napi_Get_Value_Bigint_Words_0300
1997  * @tc.name      : Tests word_count for an invalid value of 1
1998  * @tc.desc      : 1.The environment engine is created
1999  *                 2.Set test variables
2000  *                 3.The function of napi_create_bigint_int64 is called
2001  *                 4.Return value of function is napi_ok
2002  *                 5.The function of napi_get_value_bigint_words is called
2003  *                 6.Return value of function is napi_object_expected
2004  */
2005 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Value_Bigint_Words_0300, testing::ext::TestSize.Level2)
2006 {
2007     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Words_0300 start";
2008     napi_env env = (napi_env)engine_;
2009     size_t word_count = INT_FOUR;
2010     napi_value result = nullptr;
2011     napi_status ret = napi_ok;
2012     char16_t testStr[] = u"system.test.content.bigint.abnormal";
2013     int testStrLength = static_cast<int>(std::char_traits<char16_t>::length(testStr));
2014 
2015     ExpectCheckCall(napi_create_string_utf16(env, testStr, testStrLength, &result));
2016     int sign;
2017     uint64_t wordsOut[word_count];
2018 
2019     ret = napi_get_value_bigint_words(env, result, &sign, &word_count, wordsOut);
2020 
2021     EXPECT_EQ(ret, napi_object_expected);
2022     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Words_0300 end";
2023 }
2024 
2025 /*
2026  * @tc.number    : ACE_Napi_Get_Value_Bigint_Words_0400
2027  * @tc.name      : Passed an invalid environment variable
2028  * @tc.desc      : 1.Set test variables
2029  *                 2.The function of napi_create_bigint_words is called
2030  *                 3.Return value of function is napi_ok
2031  *                 4.The function of napi_get_value_bigint_words is called
2032  *                 5.Return value of function is napi_invalid_arg
2033  */
2034 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Value_Bigint_Words_0400, testing::ext::TestSize.Level2)
2035 {
2036     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Words_0400 start";
2037     napi_env env = (napi_env)engine_;
2038 
2039     uint64_t words[] = { (uint64_t)13, (uint64_t)84, 0x00FF98765432, (uint64_t)254 };
2040     int sign_bit = INT_ONE;
2041     size_t word_count = INT_FOUR;
2042     napi_value result = nullptr;
2043     napi_status ret = napi_ok;
2044 
2045     ExpectCheckCall(napi_create_bigint_words(env, sign_bit, word_count, words, &result));
2046 
2047     int sign;
2048     uint64_t wordsOut[word_count];
2049 
2050     ret = napi_get_value_bigint_words(nullptr, result, &sign, &word_count, wordsOut);
2051 
2052     EXPECT_EQ(ret, napi_invalid_arg);
2053     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Words_0400 end";
2054 }
2055 
2056 /*
2057  * @tc.number    : ACE_Napi_Get_Value_Bigint_Words_0500
2058  * @tc.name      : Test napi_get_value_bigint_words Enter 0 and the character bit is 1
2059  * @tc.desc      : 1.The environment engine is created
2060  *                 2.Set test variables
2061  *                 3.The function of napi_create_bigint_words is called
2062  *                 4.Return value of function is napi_ok
2063  *                 5.The function of napi_get_value_bigint_words is called
2064  *                 6.Check whether the obtained parameters meet requirements
2065  */
2066 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Value_Bigint_Words_0500, testing::ext::TestSize.Level2)
2067 {
2068     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Words_0500 start";
2069     napi_env env = (napi_env)engine_;
2070 #ifdef FOR_JERRYSCRIPT_TEST
2071     uint64_t words[] = { (uint64_t)5, (uint64_t)10, (uint64_t)15, (uint64_t)20 };
2072 #else
2073     uint64_t words[] = { (uint64_t)0, (uint64_t)0, (uint64_t)0, (uint64_t)0 };
2074 #endif
2075 
2076     int sign_bit = INT_ZERO;
2077     size_t word_count = INT_FOUR;
2078     napi_value result = nullptr;
2079 
2080     ExpectCheckCall(napi_create_bigint_words(env, sign_bit, word_count, words, &result));
2081 
2082     int sign;
2083     uint64_t wordsOut[word_count];
2084     ExpectCheckCall(napi_get_value_bigint_words(env, result, &sign, &word_count, wordsOut));
2085 
2086     EXPECT_EQ(INT_ZERO, sign);
2087 #ifdef FOR_JERRYSCRIPT_TEST
2088     EXPECT_EQ(word_count, INT_FOUR);
2089 #else
2090     EXPECT_EQ(word_count, INT_ONE);
2091 #endif
2092 
2093     for (size_t i = INT_ZERO; i < word_count; i++) {
2094         EXPECT_EQ(wordsOut[i], words[i]);
2095     }
2096     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Words_0500 end";
2097 }
2098 
2099 /*
2100  * @tc.number    : ACE_Napi_Get_Value_Bigint_Words_0600
2101  * @tc.name      : Test napi_get_value_bigint_words Combined data. The value is 0 character
2102  * @tc.desc      : 1.The environment engine is created
2103  *                 2.Set test variables
2104  *                 3.The function of napi_create_bigint_words is called
2105  *                 4.Return value of function is napi_ok
2106  *                 5.The function of napi_get_value_bigint_words is called
2107  *                 6.Check whether the obtained parameters meet requirements
2108  */
2109 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Value_Bigint_Words_0600, testing::ext::TestSize.Level2)
2110 {
2111     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Words_0600 start";
2112     napi_env env = (napi_env)engine_;
2113 
2114     uint64_t words[] = { (uint64_t)1, (uint64_t)0, (uint64_t)0, (uint64_t)0 };
2115     int sign_bit = INT_ZERO;
2116     size_t word_count = INT_FOUR;
2117     napi_value result = nullptr;
2118 
2119     ExpectCheckCall(napi_create_bigint_words(env, sign_bit, word_count, words, &result));
2120 
2121     int sign;
2122     uint64_t wordsOut[word_count];
2123     ExpectCheckCall(napi_get_value_bigint_words(env, result, &sign, &word_count, wordsOut));
2124 
2125     EXPECT_EQ(sign_bit, sign);
2126     EXPECT_EQ(word_count, INT_ONE);
2127     for (size_t i = INT_ZERO; i < word_count; i++) {
2128         EXPECT_EQ(wordsOut[i], words[i]);
2129     }
2130     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Words_0600 end";
2131 }
2132 
2133 /*
2134  * @tc.number    : ACE_Napi_Get_Value_Bigint_Words_0700
2135  * @tc.name      : Test napi_get_value_bigint_words Combined data. The value is 0 character
2136  * @tc.desc      : 1.The environment engine is created
2137  *                 2.Set test variables
2138  *                 3.The function of napi_create_bigint_words is called
2139  *                 4.Return value of function is napi_ok
2140  *                 5.The function of napi_get_value_bigint_words is called
2141  *                 6.Check whether the obtained parameters meet requirements
2142  */
2143 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Value_Bigint_Words_0700, testing::ext::TestSize.Level2)
2144 {
2145     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Words_0700 start";
2146     napi_env env = (napi_env)engine_;
2147 
2148     uint64_t words[] = { (uint64_t)0, (uint64_t)0, (uint64_t)0, (uint64_t)1 };
2149     int sign_bit = INT_ZERO;
2150     size_t word_count = INT_FOUR;
2151     napi_value result = nullptr;
2152 
2153     ExpectCheckCall(napi_create_bigint_words(env, sign_bit, word_count, words, &result));
2154 
2155     int sign;
2156     uint64_t wordsOut[word_count];
2157     ExpectCheckCall(napi_get_value_bigint_words(env, result, &sign, &word_count, wordsOut));
2158 
2159     EXPECT_EQ(sign_bit, sign);
2160     EXPECT_EQ(word_count, INT_FOUR);
2161     for (size_t i = INT_ZERO; i < word_count; i++) {
2162         EXPECT_EQ(wordsOut[i], words[i]);
2163     }
2164     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Words_0700 end";
2165 }
2166 
2167 /*
2168  * @tc.number    : ACE_Napi_Get_Value_Bigint_Words_0800
2169  * @tc.name      : Tests the maximum number of words entered in napi_create_BIGINt_words and the sign bit is 0
2170  * @tc.desc      : 1.The environment engine is created
2171  *                 2.Set test variables
2172  *                 3.The function of napi_create_bigint_words is called
2173  *                 4.Return value of function is napi_ok
2174  *                 5.The function of napi_get_value_bigint_words is called
2175  *                 6.Check whether the obtained parameters meet requirements
2176  */
2177 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Value_Bigint_Words_0800, testing::ext::TestSize.Level1)
2178 {
2179     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Bigint_Words_0800 start";
2180     napi_env env = (napi_env)engine_;
2181 
2182     uint64_t words[] = { 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF };
2183     int sign_bit = INT_ZERO;
2184     size_t word_count = INT_FOUR;
2185     napi_value result = nullptr;
2186 
2187     ExpectCheckCall(napi_create_bigint_words(env, sign_bit, word_count, words, &result));
2188 
2189     int sign = INT_ONE;
2190     uint64_t wordsOut[word_count];
2191     ExpectCheckCall(napi_get_value_bigint_words(env, result, &sign, &word_count, wordsOut));
2192 
2193     EXPECT_EQ(sign_bit, sign);
2194     EXPECT_EQ(word_count, INT_FOUR);
2195     for (size_t i = INT_ZERO; i < word_count; i++) {
2196         EXPECT_EQ(wordsOut[i], words[i]);
2197     }
2198     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Words_0800 end";
2199 }
2200 
2201 /*
2202  * @tc.number    : ACE_Napi_Get_Value_Bigint_Words_0900
2203  * @tc.name      : Test napi_get_value_bigint_words parameter value input is invalid
2204  * @tc.desc      : 1.The environment engine is created
2205  *                 2.Set test variables
2206  *                 3.The function of napi_create_bigint_words is called
2207  *                 4.Return value of function is napi_ok
2208  *                 5.The function of napi_get_value_bigint_words is called
2209  *                 6.Return value of function is napi_invalid_arg
2210  */
2211 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Value_Bigint_Words_0900, testing::ext::TestSize.Level2)
2212 {
2213     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Words_0900 start";
2214     napi_env env = (napi_env)engine_;
2215 
2216     uint64_t words[] = { (uint64_t)1, (uint64_t)20, (uint64_t)64, (uint64_t)88 };
2217     int sign_bit = INT_ZERO;
2218     size_t word_count = INT_FOUR;
2219     napi_value result = nullptr;
2220 
2221     ExpectCheckCall(napi_create_bigint_words(env, sign_bit, word_count, words, &result));
2222 
2223     int sign;
2224     uint64_t wordsOut[word_count];
2225     napi_status ret = napi_get_value_bigint_words(env, nullptr, &sign, &word_count, wordsOut);
2226 
2227     EXPECT_EQ(ret, napi_invalid_arg);
2228     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Words_0900 end";
2229 }
2230 
2231 /*
2232  * @tc.number    : ACE_Napi_Get_Value_Bigint_Words_1000
2233  * @tc.name      : Test napi_get_value_bigint_words returns the sign parameter sign_bit is invalid
2234  * @tc.desc      : 1.The environment engine is created
2235  *                 2.Set test variables
2236  *                 3.The function of napi_create_bigint_words is called
2237  *                 4.Return value of function is napi_ok
2238  *                 5.The function of napi_get_value_bigint_words is called
2239  *                 6.Return value of function is napi_invalid_arg
2240  */
2241 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Value_Bigint_Words_1000, testing::ext::TestSize.Level2)
2242 {
2243     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Words_1000 start";
2244     napi_env env = (napi_env)engine_;
2245 
2246     uint64_t words[] = { (uint64_t)1, (uint64_t)20, (uint64_t)64, (uint64_t)88 };
2247     int sign_bit = INT_ZERO;
2248     size_t word_count = INT_FOUR;
2249     napi_value result = nullptr;
2250 
2251     ExpectCheckCall(napi_create_bigint_words(env, sign_bit, word_count, words, &result));
2252 
2253     uint64_t wordsOut[word_count];
2254     napi_status ret = napi_get_value_bigint_words(env, result, nullptr, &word_count, wordsOut);
2255 
2256     EXPECT_EQ(ret, napi_invalid_arg);
2257     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Words_1000 end";
2258 }
2259 
2260 /*
2261  * @tc.number    : ACE_Napi_Get_Value_Bigint_Words_1100
2262  * @tc.name      : Test that the sign parameter sign_bit returned by napi_get_value_bigint_words invalid
2263  * @tc.desc      : 1.The environment engine is created
2264  *                 2.Set test variables
2265  *                 3.The function of napi_create_bigint_words is called
2266  *                 4.Return value of function is napi_ok
2267  *                 5.The function of napi_get_value_bigint_words is called
2268  *                 6.Return value of function is napi_invalid_arg
2269  */
2270 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Value_Bigint_Words_1100, testing::ext::TestSize.Level2)
2271 {
2272     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Words_1100 start";
2273     napi_env env = (napi_env)engine_;
2274 
2275     uint64_t words[] = { (uint64_t)1, (uint64_t)20, (uint64_t)64, (uint64_t)88 };
2276     int sign_bit = INT_ZERO;
2277     size_t word_count = INT_FOUR;
2278     napi_value result = nullptr;
2279 
2280     ExpectCheckCall(napi_create_bigint_words(env, sign_bit, word_count, words, &result));
2281 
2282     int sign;
2283     uint64_t wordsOut[word_count];
2284     napi_status ret = napi_get_value_bigint_words(env, result, &sign, nullptr, wordsOut);
2285 
2286     EXPECT_EQ(ret, napi_invalid_arg);
2287     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Words_1100 end";
2288 }
2289 
2290 /*
2291  * @tc.number    : ACE_Napi_Get_Value_Bigint_Words_1200
2292  * @tc.name      : Test that the parameter words of the data returned by napi_get_value_bigint_words invalid
2293  * @tc.desc      : 1.The environment engine is created
2294  *                 2.Set test variables
2295  *                 3.The function of napi_create_bigint_words is called
2296  *                 4.Return value of function is napi_ok
2297  *                 5.The function of napi_get_value_bigint_words is called
2298  *                 6.Return value of function is napi_invalid_arg
2299  */
2300 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Value_Bigint_Words_1200, testing::ext::TestSize.Level2)
2301 {
2302     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Words_1200 start";
2303     napi_env env = (napi_env)engine_;
2304 
2305     uint64_t words[] = { (uint64_t)1, (uint64_t)20, (uint64_t)64, (uint64_t)88 };
2306     int sign_bit = INT_ZERO;
2307     size_t word_count = INT_FOUR;
2308     napi_value result = nullptr;
2309 
2310     ExpectCheckCall(napi_create_bigint_words(env, sign_bit, word_count, words, &result));
2311 
2312     int sign;
2313     napi_status ret = napi_get_value_bigint_words(env, result, &sign, &word_count, nullptr);
2314 
2315     EXPECT_EQ(ret, napi_invalid_arg);
2316     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Value_Bigint_Words_1200 end";
2317 }
2318 #endif // (defined(FOR_JERRYSCRIPT_TEST)) &&  (JERRY_API_MINOR_VERSION <= 3)
2319 /**
2320  * @tc.number    : ACE_Napi_Detach_Arraybuffer_0100
2321  * @tc.name      : The parameter is valid, the parameter is input to the buffer object, and the test is confirmed.
2322  * @tc.desc      : 1. Set up the env environment.
2323  *                 2. create arraybuffer.
2324  *                 3. detach arraybuffer.
2325  *                 4. Verify napi_detach_arraybuffer.
2326  */
2327 HWTEST_F(NativeEngineTest, ACE_Napi_Detach_Arraybuffer_0100, testing::ext::TestSize.Level1)
2328 {
2329     GTEST_LOG_(INFO) << "ACE_Napi_Detach_Arraybuffer_0100 start";
2330 
2331     napi_env env = (napi_env)engine_;
2332 
2333     void* arrayBufferPtr = nullptr;
2334     napi_value arrayBuffer = nullptr;
2335     size_t arrayBufferSize = ARRAYBUFFER_SIZE;
2336     napi_status verification = napi_create_arraybuffer(env, arrayBufferSize, &arrayBufferPtr, &arrayBuffer);
2337 
2338     EXPECT_EQ(verification, napi_ok);
2339     size_t compareSize = ARRAYBUFFER_SIZE_NULL;
2340     napi_status result = napi_get_arraybuffer_info(env, arrayBuffer, &arrayBufferPtr, &compareSize);
2341 
2342     EXPECT_EQ(compareSize, ARRAYBUFFER_SIZE);
2343     EXPECT_EQ(result, napi_ok);
2344     GTEST_LOG_(INFO) << "ACE_Napi_Detach_Arraybuffer_0100 create arraybuffer complete";
2345 
2346     napi_status output = napi_detach_arraybuffer(env, arrayBuffer);
2347 
2348     bool out = false;
2349     napi_is_detached_arraybuffer(env, arrayBuffer, &out);
2350     EXPECT_TRUE(out);
2351     EXPECT_EQ(output, napi_ok);
2352 
2353     GTEST_LOG_(INFO) << "ACE_Napi_Detach_Arraybuffer_0100 end";
2354 }
2355 
2356 /**
2357  * @tc.number    : ACE_Napi_Detach_Arraybuffer_0200
2358  * @tc.name      : The parameter is invalid, the parameter arraybuffer input non-buffer object, test and confirm.
2359  * @tc.desc      : 1. Set up the env environment.
2360  *                 2. create buffer
2361  *                 3. detach buffer
2362  *                 4. Verify napi_detach_arraybuffer.
2363  */
2364 HWTEST_F(NativeEngineTest, ACE_Napi_Detach_Arraybuffer_0200, testing::ext::TestSize.Level2)
2365 {
2366     GTEST_LOG_(INFO) << "ACE_Napi_Detach_Arraybuffer_0200 start";
2367 
2368     napi_env env = (napi_env)engine_;
2369 
2370     napi_value Buffer = nullptr;
2371     void* BufferPtr = nullptr;
2372     size_t BufferSize = ARRAYBUFFER_SIZE;
2373     napi_status verification = napi_create_buffer(env, BufferSize, &BufferPtr, &Buffer);
2374 
2375     EXPECT_EQ(verification, napi_ok);
2376     EXPECT_NE(BufferPtr, nullptr);
2377     EXPECT_EQ(BufferSize, ARRAYBUFFER_SIZE);
2378     GTEST_LOG_(INFO) << "ACE_Napi_Detach_Arraybuffer_0200 create buffer complete";
2379 
2380     napi_status result = napi_detach_arraybuffer(env, Buffer);
2381 
2382     EXPECT_NE(BufferPtr, nullptr);
2383     EXPECT_EQ(result, napi_invalid_arg);
2384 
2385     GTEST_LOG_(INFO) << "ACE_Napi_Detach_Arraybuffer_0200 end";
2386 }
2387 
2388 /**
2389  * @tc.number    : ACE_Napi_Detach_Arraybuffer_0300
2390  * @tc.name      : The parameter is invalid, the parameter arraybuffer input buffer object, test to confirm.
2391  * @tc.desc      : 1. Set up the env environment.
2392  *                 2. create arraybuffer.
2393  *                 3. detach arraybuffer.
2394  *                 4. Verify napi_detach_arraybuffer.
2395  */
2396 HWTEST_F(NativeEngineTest, ACE_Napi_Detach_Arraybuffer_0300, testing::ext::TestSize.Level2)
2397 {
2398     GTEST_LOG_(INFO) << "ACE_Napi_Detach_Arraybuffer_0300 start";
2399 
2400     napi_env env = (napi_env)engine_;
2401 
2402     size_t arrayBufferSize = ARRAYBUFFER_SIZE;
2403     void* arrayBufferPtr = nullptr;
2404     napi_value arrayBuffer = nullptr;
2405     napi_status verification = napi_create_arraybuffer(env, arrayBufferSize, &arrayBufferPtr, &arrayBuffer);
2406 
2407     EXPECT_EQ(verification, napi_ok);
2408     size_t compareSize = ARRAYBUFFER_SIZE_NULL;
2409     napi_status result = napi_get_arraybuffer_info(env, arrayBuffer, &arrayBufferPtr, &compareSize);
2410 
2411     EXPECT_EQ(compareSize, ARRAYBUFFER_SIZE);
2412     EXPECT_EQ(result, napi_ok);
2413     GTEST_LOG_(INFO) << "ACE_Napi_Detach_Arraybuffer_0300 create arraybuffer complete";
2414 
2415     napi_status output = napi_detach_arraybuffer(nullptr, arrayBuffer);
2416 
2417     EXPECT_EQ(arrayBufferSize, ARRAYBUFFER_SIZE);
2418     EXPECT_EQ(output, napi_invalid_arg);
2419 
2420     GTEST_LOG_(INFO) << "ACE_Napi_Detach_Arraybuffer_0300 end";
2421 }
2422 
2423 /**
2424  * @tc.number    : ACE_Napi_Detach_Arraybuffer_0400
2425  * @tc.name      : The parameter is invalid, the parameter arraybuffer input date object, test to confirm.
2426  * @tc.desc      : 1. Set up the env environment.
2427  *                 2. create arraybuffer.
2428  *                 3. detach arraybuffer.
2429  *                 4. Verify napi_detach_arraybuffer.
2430  */
2431 HWTEST_F(NativeEngineTest, ACE_Napi_Detach_Arraybuffer_0400, testing::ext::TestSize.Level1)
2432 {
2433     GTEST_LOG_(INFO) << "ACE_Napi_Detach_Arraybuffer_0400 start";
2434 
2435     napi_env env = (napi_env)engine_;
2436 
2437     double time = CREATE_DATE_TIME;
2438     napi_value result = nullptr;
2439     napi_status verification = napi_create_date(env, time, &result);
2440 
2441     EXPECT_EQ(verification, napi_ok);
2442     EXPECT_NE(result, nullptr);
2443     GTEST_LOG_(INFO) << "ACE_Napi_Detach_Arraybuffer_0400 create date complete";
2444 
2445     napi_status ret = napi_detach_arraybuffer(env, result);
2446 
2447     EXPECT_NE(result, nullptr);
2448     EXPECT_EQ(ret, napi_invalid_arg);
2449 
2450     GTEST_LOG_(INFO) << "ACE_Napi_Detach_Arraybuffer_0400 end";
2451 }
2452 
2453 /**
2454  * @tc.number    : ACE_Napi_Detach_Arraybuffer_0500
2455  * @tc.name      : The parameter is invalid, the parameter arraybuffer input is empty, test to confirm.
2456  * @tc.desc      : 1. Set up the env environment.
2457  *                 2. detach arraybuffer.
2458  *                 3. Verify napi_detach_arraybuffer.
2459  */
2460 HWTEST_F(NativeEngineTest, ACE_Napi_Detach_Arraybuffer_0500, testing::ext::TestSize.Level2)
2461 {
2462     GTEST_LOG_(INFO) << "ACE_Napi_Detach_Arraybuffer_0500 start";
2463 
2464     napi_env env = (napi_env)engine_;
2465     napi_status result = napi_detach_arraybuffer(env, nullptr);
2466 
2467     EXPECT_EQ(result, napi_invalid_arg);
2468 
2469     GTEST_LOG_(INFO) << "ACE_Napi_Detach_Arraybuffer_0500 end";
2470 }
2471 
2472 /**
2473  * @tc.number    : ACE_Napi_Detach_Arraybuffer_0600
2474  * @tc.name      : The parameter is invalid, the parameter arraybuffer input is Detached arraybuffer,
2475  *                 test to confirm.
2476  * @tc.desc      : 1. Set up the env environment.
2477  *                 2. detach arraybuffer.
2478  *                 3. Verify napi_detach_arraybuffer.
2479  */
2480 HWTEST_F(NativeEngineTest, ACE_Napi_Detach_Arraybuffer_0600, testing::ext::TestSize.Level2)
2481 {
2482     GTEST_LOG_(INFO) << "ACE_Napi_Detach_Arraybuffer_0600 start";
2483 
2484     napi_env env = (napi_env)engine_;
2485     void* arrayBufferPtr = nullptr;
2486     napi_value arrayBuffer = nullptr;
2487     size_t arrayBufferSize = ARRAYBUFFER_SIZE;
2488     napi_status verification = napi_create_arraybuffer(env, arrayBufferSize, &arrayBufferPtr, &arrayBuffer);
2489 
2490     EXPECT_EQ(verification, napi_ok);
2491     size_t compareSize = ARRAYBUFFER_SIZE_NULL;
2492     napi_status result = napi_get_arraybuffer_info(env, arrayBuffer, &arrayBufferPtr, &compareSize);
2493 
2494     EXPECT_EQ(compareSize, ARRAYBUFFER_SIZE);
2495     EXPECT_EQ(result, napi_ok);
2496     GTEST_LOG_(INFO) << "ACE_Napi_Detach_Arraybuffer_0100 create arraybuffer complete";
2497 
2498     napi_status output = napi_detach_arraybuffer(env, arrayBuffer);
2499 
2500     bool out = false;
2501     napi_status verificationCp = napi_is_detached_arraybuffer(env, arrayBuffer, &out);
2502 
2503     EXPECT_EQ(verificationCp, napi_ok);
2504     EXPECT_TRUE(out);
2505     EXPECT_EQ(output, napi_ok);
2506 
2507     napi_status outcompare = napi_detach_arraybuffer(env, arrayBuffer);
2508     EXPECT_EQ(outcompare, napi_detachable_arraybuffer_expected);
2509 
2510     GTEST_LOG_(INFO) << "ACE_Napi_Detach_Arraybuffer_0600 start";
2511 }
2512 
2513 /**
2514  * @tc.number    : ACE_Napi_Is_Detached_Arraybuffer_0100
2515  * @tc.name      : The parameter is valid, the parameter arraybuffer input buffer object, test to confirm.
2516  * @tc.desc      : 1. Set up the env environment.
2517  *                 2. create arraybuffer.
2518  *                 3. detach arraybuffer.
2519  *                 4. Verify napi_is_detached_arraybuffer.
2520  */
2521 HWTEST_F(NativeEngineTest, ACE_Napi_Is_Detached_Arraybuffer_0100, testing::ext::TestSize.Level1)
2522 {
2523     GTEST_LOG_(INFO) << "ACE_Napi_Is_Detached_Arraybuffer_0100 start";
2524 
2525     napi_env env = (napi_env)engine_;
2526 
2527     size_t arrayBufferSize = ARRAYBUFFER_SIZE;
2528     void* arrayBufferPtr = nullptr;
2529     napi_value arrayBuffer = nullptr;
2530     napi_status verification = napi_create_arraybuffer(env, arrayBufferSize, &arrayBufferPtr, &arrayBuffer);
2531 
2532     EXPECT_EQ(verification, napi_ok);
2533     EXPECT_NE(arrayBufferPtr, nullptr);
2534     GTEST_LOG_(INFO) << "ACE_Napi_Is_Detached_Arraybuffer_0100 create arraybuffer complete";
2535 
2536     napi_status verificationCp = napi_detach_arraybuffer(env, arrayBuffer);
2537     EXPECT_EQ(verificationCp, napi_ok);
2538     GTEST_LOG_(INFO) << "ACE_Napi_Is_Detached_Arraybuffer_0100 detached arraybuffer complete";
2539 
2540     bool result = false;
2541     napi_status out = napi_is_detached_arraybuffer(env, arrayBuffer, &result);
2542 
2543     EXPECT_EQ(out, napi_ok);
2544     EXPECT_TRUE(result);
2545 
2546     GTEST_LOG_(INFO) << "ACE_Napi_Is_Detached_Arraybuffer_0100 end";
2547 }
2548 
2549 /**
2550  * @tc.number    : ACE_Napi_Is_Detached_Arraybuffer_0200
2551  * @tc.name      : The parameter is valid, the parameter arraybuffer input non-buffer object, test to confirm.
2552  * @tc.desc      : 1. Set up the env environment.
2553  *                 2. create arraybuffer.
2554  *                 3. Verify napi_is_detached_arraybuffer.
2555  */
2556 HWTEST_F(NativeEngineTest, ACE_Napi_Is_Detached_Arraybuffer_0200, testing::ext::TestSize.Level2)
2557 {
2558     GTEST_LOG_(INFO) << "ACE_Napi_Is_Detached_Arraybuffer_0200 start";
2559 
2560     napi_env env = (napi_env)engine_;
2561     double time = CREATE_DATE_TIME;
2562     napi_value date = nullptr;
2563     napi_status verification = napi_create_date(env, time, &date);
2564 
2565     EXPECT_EQ(verification, napi_ok);
2566 
2567     bool result = false;
2568     napi_status ret = napi_is_detached_arraybuffer(env, date, &result);
2569 
2570     EXPECT_EQ(ret, napi_invalid_arg);
2571 
2572     GTEST_LOG_(INFO) << "ACE_Napi_Is_Detached_Arraybuffer_0200 end";
2573 }
2574 
2575 /**
2576  * @tc.number    : ACE_Napi_Is_Detached_Arraybuffer_0300
2577  * @tc.name      : The parameter is invalid, the parameter arraybuffer input buffer object, test to confirm.
2578  * @tc.desc      : 1. Set up the env environment.
2579  *                 2. create arraybuffer.
2580  *                 3. detach arraybuffer.
2581  *                 4. Verify napi_is_detached_arraybuffer.
2582  */
2583 HWTEST_F(NativeEngineTest, ACE_Napi_Is_Detached_Arraybuffer_0300, testing::ext::TestSize.Level2)
2584 {
2585     GTEST_LOG_(INFO) << "ACE_Napi_Is_Detached_Arraybuffer_0300 start";
2586 
2587     napi_env env = (napi_env)engine_;
2588 
2589     size_t arrayBufferSize = ARRAYBUFFER_SIZE;
2590     void* arrayBufferPtr = nullptr;
2591     napi_value arrayBuffer = nullptr;
2592     napi_status verification = napi_create_arraybuffer(env, arrayBufferSize, &arrayBufferPtr, &arrayBuffer);
2593 
2594     EXPECT_EQ(verification, napi_ok);
2595     EXPECT_NE(arrayBufferPtr, nullptr);
2596     GTEST_LOG_(INFO) << "ACE_Napi_Is_Detached_Arraybuffer_0300 create arraybuffer complete";
2597 
2598     napi_status verificationCp = napi_detach_arraybuffer(env, arrayBuffer);
2599 
2600     EXPECT_EQ(verificationCp, napi_ok);
2601 
2602     bool result = true;
2603     napi_status ret = napi_is_detached_arraybuffer(nullptr, arrayBuffer, &result);
2604 
2605     EXPECT_TRUE(result);
2606     EXPECT_EQ(arrayBufferSize, ARRAYBUFFER_SIZE);
2607     EXPECT_NE(arrayBuffer, nullptr);
2608     EXPECT_EQ(ret, napi_invalid_arg);
2609 
2610     GTEST_LOG_(INFO) << "ACE_Napi_Is_Detached_Arraybuffer_0300 end";
2611 }
2612 
2613 /**
2614  * @tc.number    : ACE_Napi_Is_Detached_Arraybuffer_0400
2615  * @tc.name      : The parameter is invalid, the parameter result input is empty, test confirmation.
2616  * @tc.desc      : 1. Set up the env environment.
2617  *                 2. create arraybuffer.
2618  *                 3. detach arraybuffer.
2619  *                 4. Verify napi_is_detached_arraybuffer.
2620  */
2621 HWTEST_F(NativeEngineTest, ACE_Napi_Is_Detached_Arraybuffer_0400, testing::ext::TestSize.Level2)
2622 {
2623     GTEST_LOG_(INFO) << "ACE_Napi_Is_Detached_Arraybuffer_0400 start";
2624 
2625     napi_env env = (napi_env)engine_;
2626 
2627     size_t arrayBufferSize = ARRAYBUFFER_SIZE;
2628     void* arrayBufferPtr = nullptr;
2629     napi_value arrayBuffer = nullptr;
2630     napi_status verification = napi_create_arraybuffer(env, arrayBufferSize, &arrayBufferPtr, &arrayBuffer);
2631 
2632     EXPECT_EQ(verification, napi_ok);
2633     GTEST_LOG_(INFO) << "ACE_Napi_Is_Detached_Arraybuffer_0400 create arraybuffer complete";
2634 
2635     napi_status verificationCp = napi_detach_arraybuffer(env, arrayBuffer);
2636 
2637     EXPECT_EQ(verificationCp, napi_ok);
2638 
2639     napi_status ret = napi_is_detached_arraybuffer(env, arrayBuffer, nullptr);
2640 
2641     EXPECT_EQ(ret, napi_invalid_arg);
2642     EXPECT_EQ(arrayBufferSize, ARRAYBUFFER_SIZE);
2643     EXPECT_NE(arrayBuffer, nullptr);
2644 
2645     GTEST_LOG_(INFO) << "ACE_Napi_Is_Detached_Arraybuffer_0400 end";
2646 }
2647 
2648 /**
2649  * @tc.number    : ACE_Napi_Is_Detached_Arraybuffer_0500
2650  * @tc.name      : The parameter is invalid, the parameter arraybuffer input is empty, test to confirm
2651  * @tc.desc      : 1. Set up the env environment.
2652  *                 2. Verify napi_is_detached_arraybuffer.
2653  */
2654 HWTEST_F(NativeEngineTest, ACE_Napi_Is_Detached_Arraybuffer_0500, testing::ext::TestSize.Level2)
2655 {
2656     GTEST_LOG_(INFO) << "ACE_Napi_Is_Detached_Arraybuffer_0500 start";
2657 
2658     napi_env env = (napi_env)engine_;
2659 
2660     bool result = true;
2661     napi_status ret = napi_is_detached_arraybuffer(env, nullptr, &result);
2662 
2663     EXPECT_TRUE(result);
2664     EXPECT_EQ(ret, napi_invalid_arg);
2665 
2666     GTEST_LOG_(INFO) << "ACE_Napi_Is_Detached_Arraybuffer_0500 end";
2667 }
2668 
2669 /**
2670  * @tc.number    : ACE_Napi_Is_Date_0100
2671  * @tc.name      : The parameter is valid,
2672  *                 and the parameter value is entered in the napi_date object,
2673  *                 and the test is performed to confirm.
2674  * @tc.desc      : 1. Set up the env environment.
2675  *                 2. create date.
2676  *                 3. Verify napi_is_date.
2677  */
2678 HWTEST_F(NativeEngineTest, ACE_Napi_Is_Date_0100, testing::ext::TestSize.Level1)
2679 {
2680     GTEST_LOG_(INFO) << "ACE_Napi_Is_Date_0100 start";
2681 
2682     napi_env env = (napi_env)engine_;
2683 
2684     double time = CREATE_DATE_TIME;
2685     napi_value result = nullptr;
2686     napi_status verification = napi_create_date(env, time, &result);
2687 
2688     EXPECT_EQ(verification, napi_ok);
2689     EXPECT_NE(result, nullptr);
2690 
2691     double jsTime = 0;
2692     napi_status output = napi_get_date_value(env, result, &jsTime);
2693 
2694     EXPECT_EQ(output, napi_ok);
2695     EXPECT_EQ(jsTime, GET_DATE_TIME);
2696     GTEST_LOG_(INFO) << "ACE_Napi_Is_Date_0100 create date complete";
2697 
2698     bool ret = false;
2699     napi_status out = napi_is_date(env, result, &ret);
2700 
2701     EXPECT_TRUE(ret);
2702     EXPECT_EQ(out, napi_ok);
2703 
2704     GTEST_LOG_(INFO) << "ACE_Napi_Is_Date_0100 end";
2705 }
2706 
2707 /**
2708  * @tc.number    : ACE_Napi_Is_Date_0200
2709  * @tc.name      : The parameter is invalid,
2710  *                 the value of the parameter is not a napi_date object,
2711  *                 and the test is confirmed.
2712  * @tc.desc      : 1. Set up the env environment.
2713  *                 2. create arraybuffer.
2714  *                 3. Verify napi_is_date.
2715  */
2716 HWTEST_F(NativeEngineTest, ACE_Napi_Is_Date_0200, testing::ext::TestSize.Level2)
2717 {
2718     GTEST_LOG_(INFO) << "ACE_Napi_Is_Date_0200 start";
2719 
2720     napi_env env = (napi_env)engine_;
2721 
2722     size_t arrayBufferSize = ARRAYBUFFER_SIZE;
2723     void* arrayBufferPtr = nullptr;
2724     napi_value arrayBuffer = nullptr;
2725     napi_status verification = napi_create_arraybuffer(env, arrayBufferSize, &arrayBufferPtr, &arrayBuffer);
2726 
2727     EXPECT_EQ(verification, napi_ok);
2728     EXPECT_NE(arrayBufferPtr, nullptr);
2729     GTEST_LOG_(INFO) << "ACE_Napi_Is_Date_0200 create arraybuffer complete";
2730 
2731     size_t compareSize = ARRAYBUFFER_SIZE_NULL;
2732     napi_status result = napi_get_arraybuffer_info(env, arrayBuffer, &arrayBufferPtr, &compareSize);
2733 
2734     EXPECT_EQ(compareSize, ARRAYBUFFER_SIZE);
2735     EXPECT_EQ(result, napi_ok);
2736     GTEST_LOG_(INFO) << "ACE_Napi_Is_Date_0200 get arraybuffer info complete";
2737 
2738     bool ret = true;
2739     napi_status out = napi_is_date(env, arrayBuffer, &ret);
2740 
2741     EXPECT_FALSE(ret);
2742     EXPECT_EQ(out, napi_ok);
2743 
2744     GTEST_LOG_(INFO) << "ACE_Napi_Is_Date_0200 end";
2745 }
2746 
2747 /**
2748  * @tc.number    : ACE_Napi_Is_Date_0300
2749  * @tc.name      : The parameter is invalid,
2750  *                 the parameter value is entered in the napi_date object,
2751  *                 and the test is confirmed
2752  * @tc.desc      : 1. Set up the env environment.
2753  *                 2. create date.
2754  *                 3. Verify napi_is_date.
2755  */
2756 HWTEST_F(NativeEngineTest, ACE_Napi_Is_Date_0300, testing::ext::TestSize.Level2)
2757 {
2758     GTEST_LOG_(INFO) << "ACE_Napi_Is_Date_0300 start";
2759 
2760     napi_env env = (napi_env)engine_;
2761 
2762     double time = CREATE_DATE_TIME;
2763     napi_value result = nullptr;
2764     napi_status verification = napi_create_date(env, time, &result);
2765 
2766     EXPECT_EQ(verification, napi_ok);
2767     EXPECT_NE(result, nullptr);
2768 
2769     double jsTime = 0;
2770     napi_status out = napi_get_date_value(env, result, &jsTime);
2771 
2772     EXPECT_EQ(out, napi_ok);
2773     EXPECT_EQ(jsTime, GET_DATE_TIME);
2774     GTEST_LOG_(INFO) << "ACE_Napi_Is_Date_0300 create date complete";
2775 
2776     bool ret = false;
2777     napi_status output = napi_is_date(nullptr, result, &ret);
2778 
2779     EXPECT_FALSE(ret);
2780     EXPECT_EQ(output, napi_invalid_arg);
2781 
2782     GTEST_LOG_(INFO) << "ACE_Napi_Is_Date_0300 end";
2783 }
2784 
2785 /**
2786  * @tc.number    : ACE_Napi_Is_Date_0400
2787  * @tc.name      : The parameter is invalid,
2788  *                 and the parameter value is entered as the date object that failed to be created,
2789  *                 and the test is performed to confirm.
2790  * @tc.desc      : 1. Set up the env environment.
2791  *                 2. Verify napi_is_date.
2792  */
2793 HWTEST_F(NativeEngineTest, ACE_Napi_Is_Date_0400, testing::ext::TestSize.Level2)
2794 {
2795     GTEST_LOG_(INFO) << "ACE_Napi_Is_Date_0400 start";
2796 
2797     napi_env env = (napi_env)engine_;
2798 
2799     bool ret = false;
2800     napi_status out = napi_is_date(env, nullptr, &ret);
2801 
2802     EXPECT_FALSE(ret);
2803     EXPECT_EQ(out, napi_invalid_arg);
2804 
2805     GTEST_LOG_(INFO) << "ACE_Napi_Is_Date_0400 end";
2806 }
2807 
2808 /**
2809  * @tc.number    : ACE_Napi_Is_Date_0500
2810  * @tc.name      : The parameter is invalid. Enter 0 for the parameter value to confirm the test.
2811  * @tc.desc      : 1. Set up the env environment.
2812  *                 2. create date.
2813  *                 3. Verify napi_is_date.
2814  */
2815 HWTEST_F(NativeEngineTest, ACE_Napi_Is_Date_0500, testing::ext::TestSize.Level1)
2816 {
2817     GTEST_LOG_(INFO) << "ACE_Napi_Is_Date_0500 start";
2818 
2819     napi_env env = (napi_env)engine_;
2820 
2821     double time = DATE_TIME_VALUE;
2822     napi_value result = nullptr;
2823     napi_status out = napi_create_date(env, time, &result);
2824 
2825     EXPECT_EQ(out, napi_ok);
2826     GTEST_LOG_(INFO) << "ACE_Napi_Is_Date_0500 create date value complete";
2827 
2828     napi_status output = napi_is_date(env, result, nullptr);
2829     EXPECT_EQ(output, napi_invalid_arg);
2830 
2831     GTEST_LOG_(INFO) << "ACE_Napi_Is_Date_0500 end";
2832 }
2833 
2834 /**
2835  * @tc.number    : ACE_Napi_Is_Date_0600
2836  * @tc.name      : The parameter is valid, input the character string ("汉字测试") for
2837  *                 the parameter value, and perform the test to confirm.
2838  * @tc.desc      : 1. Install the app.
2839  *                 2. Start the application.
2840  *                 3. Call napi_create_string_utf8.
2841  *                 4. Call napi_is_date.
2842  */
2843 HWTEST_F(NativeEngineTest, ACE_Napi_Is_Date_0600, testing::ext::TestSize.Level1)
2844 {
2845     GTEST_LOG_(INFO) << "ACE_Napi_Is_Date_0600 start";
2846 
2847     napi_env env = (napi_env)engine_;
2848 
2849     napi_value result = nullptr;
2850     napi_status verification = napi_create_string_utf8(env, "汉字测试", NAPI_AUTO_LENGTH, &result);
2851 
2852     EXPECT_EQ(verification, napi_ok);
2853 
2854     bool ret = true;
2855     napi_status out = napi_is_date(env, result, &ret);
2856 
2857     EXPECT_EQ(out, napi_ok);
2858     EXPECT_FALSE(ret);
2859 
2860     GTEST_LOG_(INFO) << "ACE_Napi_Is_Date_0600 end";
2861 }
2862 
2863 /**
2864  * @tc.number    : ACE_Napi_Create_Date_0100
2865  * @tc.name      : The parameter is valid,
2866  *                 enter the double value for the parameter time, and perform the test to confirm
2867  * @tc.desc      : 1. Set up the env environment.
2868  *                 2. create date.
2869  *                 3.Verify napi_create_date.
2870  */
2871 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Date_0100, testing::ext::TestSize.Level1)
2872 {
2873     GTEST_LOG_(INFO) << "ACE_Napi_Create_Date_0100 start";
2874 
2875     napi_env env = (napi_env)engine_;
2876 
2877     time_t date = time(nullptr);
2878     GTEST_LOG_(INFO) << "ACE_Napi_Is_Date_0100 time = " << date;
2879 
2880     napi_value result = nullptr;
2881     napi_status ret = napi_create_date(env, date, &result);
2882 
2883     double jsTime = 0;
2884     napi_status out = napi_get_date_value(env, result, &jsTime);
2885 
2886     EXPECT_NE(result, nullptr);
2887     EXPECT_EQ(date, jsTime);
2888 
2889     EXPECT_EQ(ret, napi_ok);
2890     EXPECT_EQ(out, napi_ok);
2891 
2892     GTEST_LOG_(INFO) << "ACE_Napi_Create_Date_0100 end";
2893 }
2894 
2895 
2896 /**
2897  * @tc.number    : ACE_Napi_Create_Date_0200
2898  * @tc.name      : The parameter is invalid. Enter a double value for the time parameter to confirm the test.
2899  * @tc.desc      : 1. Set up the env environment.
2900  *                 2. create date.
2901  *                 3.Verify napi_create_date.
2902  */
2903 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Date_0200, testing::ext::TestSize.Level2)
2904 {
2905     GTEST_LOG_(INFO) << "ACE_Napi_Create_Date_0200 start";
2906 
2907     double time = CREATE_DATE_TIME;
2908     napi_value result = nullptr;
2909     napi_status ret = napi_create_date(nullptr, time, &result);
2910 
2911     EXPECT_EQ(result, nullptr);
2912     EXPECT_EQ(ret, napi_invalid_arg);
2913 
2914     GTEST_LOG_(INFO) << "ACE_Napi_Create_Date_0200 end";
2915 }
2916 
2917 /**
2918  * @tc.number    : ACE_Napi_Create_Date_0300
2919  * @tc.name      : The parameter is invalid, the parameter time is 0, test to confirm.
2920  * @tc.desc      : 1. Set up the env environment.
2921  *                 2. create date.
2922  *                 3.Verify napi_create_date.
2923  */
2924 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Date_0300, testing::ext::TestSize.Level1)
2925 {
2926     GTEST_LOG_(INFO) << "ACE_Napi_Create_Date_0300 start";
2927 
2928     napi_env env = (napi_env)engine_;
2929 
2930     double time = DATE_TIME_VALUE;
2931     napi_value result = nullptr;
2932     napi_status ret = napi_create_date(env, time, &result);
2933 
2934     double jsTime = 1;
2935     napi_status out = napi_get_date_value(env, result, &jsTime);
2936 
2937     EXPECT_NE(result, nullptr);
2938     EXPECT_EQ(time, jsTime);
2939 
2940     EXPECT_EQ(ret, napi_ok);
2941     EXPECT_EQ(out, napi_ok);
2942 
2943     GTEST_LOG_(INFO) << "ACE_Napi_Create_Date_0300 end";
2944 }
2945 
2946 /**
2947  * @tc.number    : ACE_Napi_Create_Date_0400
2948  * @tc.name      : The parameter is invalid, the parameter time is char, test to confirm
2949  * @tc.desc      : 1. Set up the env environment.
2950  *                 2. create date.
2951  *                 3.Verify napi_create_date.
2952  */
2953 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Date_0400, testing::ext::TestSize.Level1)
2954 {
2955     GTEST_LOG_(INFO) << "ACE_Napi_Create_Date_0400 start";
2956 
2957     napi_env env = (napi_env)engine_;
2958 
2959     char time = 'a';
2960     napi_value result = nullptr;
2961     napi_status ret = napi_create_date(env, time, &result);
2962 
2963     double jsTime = 0;
2964     napi_status out = napi_get_date_value(env, result, &jsTime);
2965 
2966     EXPECT_NE(result, nullptr);
2967     EXPECT_EQ(time, jsTime);
2968 
2969     EXPECT_EQ(ret, napi_ok);
2970     EXPECT_EQ(out, napi_ok);
2971 
2972     GTEST_LOG_(INFO) << "ACE_Napi_Create_Date_0400 end";
2973 }
2974 
2975 /**
2976  * @tc.number    : ACE_Napi_Create_Date_0500
2977  * @tc.name      : The parameter is invalid, the parameter time is empty, test to confirm.
2978  * @tc.desc      : 1. Set up the env environment.
2979  *                 2. create date.
2980  *                 3.Verify napi_create_date.
2981  */
2982 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Date_0500, testing::ext::TestSize.Level2)
2983 {
2984     GTEST_LOG_(INFO) << "ACE_Napi_Create_Date_0500 start";
2985 
2986     napi_env env = (napi_env)engine_;
2987 
2988     double time = CREATE_DATE_TIME;
2989     napi_status ret = napi_create_date(env, time, nullptr);
2990 
2991     EXPECT_EQ(ret, napi_invalid_arg);
2992 
2993     GTEST_LOG_(INFO) << "ACE_Napi_Create_Date_0500 end";
2994 }
2995 
2996 /**
2997  * @tc.number    : ACE_Napi_Create_Date_0600
2998  * @tc.name      : The parameter is invalid, the parameter time is -1, test to confirm.
2999  * @tc.desc      : 1. Set up the env environment.
3000  *                 2. create date.
3001  *                 3.Verify napi_create_date.
3002  */
3003 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Date_0600, testing::ext::TestSize.Level1)
3004 {
3005     GTEST_LOG_(INFO) << "ACE_Napi_Create_Date_0600 start";
3006 
3007     napi_env env = (napi_env)engine_;
3008 
3009     double time = -1;
3010     napi_value result = nullptr;
3011     napi_status ret = napi_create_date(env, time, &result);
3012 
3013     double jsTime = 0;
3014     napi_status out = napi_get_date_value(env, result, &jsTime);
3015     GTEST_LOG_(INFO) << "ACE_Napi_Create_Date_0600 time = " << jsTime;
3016 
3017     EXPECT_NE(result, nullptr);
3018     EXPECT_EQ(jsTime, -1);
3019 
3020     EXPECT_EQ(ret, napi_ok);
3021     EXPECT_EQ(out, napi_ok);
3022 
3023     GTEST_LOG_(INFO) << "ACE_Napi_Create_Date_0600 end";
3024 }
3025 
3026 /**
3027  * @tc.number    : ACE_Napi_Get_Date_Value_0100
3028  * @tc.name      : The parameter is valid,
3029  *                 and the parameter value is entered in the napi_date object, and the test is performed to confirm.
3030  * @tc.desc      : 1. Set up the env environment.
3031  *                 2. create date.
3032  *                 3. get date value.
3033  *                 4.Verify napi_get_date_value.
3034  */
3035 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Date_Value_0100, testing::ext::TestSize.Level1)
3036 {
3037     GTEST_LOG_(INFO) << "ACE_Napi_Get_Date_Value_0100 start";
3038 
3039     napi_env env = (napi_env)engine_;
3040 
3041     double time = CREATE_DATE_TIME;
3042     napi_value result = nullptr;
3043     napi_status verification = napi_create_date(env, time, &result);
3044 
3045     EXPECT_EQ(verification, napi_ok);
3046     EXPECT_NE(result, nullptr);
3047     GTEST_LOG_(INFO) << "ACE_Napi_Get_Date_Value_0100 create date complete";
3048 
3049     double ret = DATE_TIME_VALUE;
3050     napi_status out = napi_get_date_value(env, result, &ret);
3051 
3052     EXPECT_EQ(ret, GET_DATE_TIME);
3053     EXPECT_EQ(out, napi_ok);
3054 
3055     GTEST_LOG_(INFO) << "ACE_Napi_Get_Date_Value_0100 end";
3056 }
3057 
3058 /**
3059  * @tc.number    : ACE_Napi_Get_Date_Value_0200
3060  * @tc.name      : Valid environment variable env, parameter value input non-napi_date object.
3061  * @tc.desc      : 1. Set up the env environment.
3062  *                 2. create arraybuffer.
3063  *                 3. get date value.
3064  *                 4.Verify napi_get_date_value.
3065  */
3066 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Date_Value_0200, testing::ext::TestSize.Level2)
3067 {
3068     GTEST_LOG_(INFO) << "ACE_Napi_Get_Date_Value_0200 start";
3069 
3070     napi_env env = (napi_env)engine_;
3071 
3072     size_t arrayBufferSize = ARRAYBUFFER_SIZE;
3073     void* arrayBufferPtr = nullptr;
3074     napi_value arrayBuffer = nullptr;
3075     napi_status verification = napi_create_arraybuffer(env, arrayBufferSize, &arrayBufferPtr, &arrayBuffer);
3076 
3077     EXPECT_EQ(verification, napi_ok);
3078     EXPECT_NE(arrayBufferPtr, nullptr);
3079     EXPECT_NE(arrayBuffer, nullptr);
3080     GTEST_LOG_(INFO) << "ACE_Napi_Get_Date_Value_0200 create arraybuffer complete";
3081 
3082     double ret = DATE_TIME_VALUE;
3083     napi_status out = napi_get_date_value(env, arrayBuffer, &ret);
3084 
3085     EXPECT_EQ(ret, DATE_TIME_VALUE);
3086     EXPECT_EQ(out, napi_date_expected);
3087 
3088     GTEST_LOG_(INFO) << "ACE_Napi_Get_Date_Value_0200 end";
3089 }
3090 
3091 /**
3092  * @tc.number    : ACE_Napi_Get_Date_Value_0300
3093  * @tc.name      : Invalid environment variable env, parameter value input napi_date object.
3094  * @tc.desc      : 1. Set up the env environment.
3095  *                 2. create date.
3096  *                 3. get date value.
3097  *                 4.Verify napi_get_date_value.
3098  */
3099 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Date_Value_0300, testing::ext::TestSize.Level2)
3100 {
3101     GTEST_LOG_(INFO) << "ACE_Napi_Get_Date_Value_0300 start";
3102 
3103     napi_env env = (napi_env)engine_;
3104 
3105     double time = CREATE_DATE_TIME;
3106     napi_value result = nullptr;
3107     napi_status verification = napi_create_date(env, time, &result);
3108 
3109     EXPECT_EQ(verification, napi_ok);
3110     EXPECT_NE(result, nullptr);
3111     GTEST_LOG_(INFO) << "ACE_Napi_Get_Date_Value_0300 create date complete";
3112 
3113     double ret = DATE_TIME_VALUE;
3114     napi_status out = napi_get_date_value(nullptr, result, &ret);
3115 
3116     EXPECT_EQ(ret, DATE_TIME_VALUE);
3117     EXPECT_EQ(out, napi_invalid_arg);
3118 
3119     GTEST_LOG_(INFO) << "ACE_Napi_Get_Date_Value_0300 end";
3120 }
3121 
3122 /**
3123  * @tc.number    : ACE_Napi_Get_Date_Value_0400
3124  * @tc.name      : The parameter is invalid, the parameter return is empty, test to confirm.
3125  * @tc.desc      : 1. Set up the env environment.
3126  *                 2. create date.
3127  *                 3. get date value.
3128  *                 4.Verify napi_get_date_value.
3129  */
3130 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Date_Value_0400, testing::ext::TestSize.Level2)
3131 {
3132     GTEST_LOG_(INFO) << "ACE_Napi_Get_Date_Value_0400 start";
3133 
3134     napi_env env = (napi_env)engine_;
3135 
3136     double time = CREATE_DATE_TIME;
3137     napi_value result = nullptr;
3138     napi_status verification = napi_create_date(env, time, &result);
3139 
3140     EXPECT_EQ(verification, napi_ok);
3141     EXPECT_NE(result, nullptr);
3142     GTEST_LOG_(INFO) << "ACE_Napi_Get_Date_Value_0400 create date complete";
3143 
3144     napi_status out = napi_get_date_value(env, result, nullptr);
3145 
3146     EXPECT_NE(result, nullptr);
3147     EXPECT_EQ(out, napi_invalid_arg);
3148 
3149     GTEST_LOG_(INFO) << "ACE_Napi_Get_Date_Value_0400 end";
3150 }
3151 
3152 /**
3153  * @tc.number    : ACE_Napi_Get_Date_Value_0500
3154  * @tc.name      : The parameter is invalid, the parameter value is the date when the creation failed, test to confirm.
3155  * @tc.desc      : 1. Set up the env environment.
3156  *                 2. create date.
3157  *                 3. get date value.
3158  *                 4. Verify napi_get_date_value.
3159  */
3160 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Date_Value_0500, testing::ext::TestSize.Level2)
3161 {
3162     GTEST_LOG_(INFO) << "ACE_Napi_Get_Date_Value_0500 start";
3163 
3164     napi_env env = (napi_env)engine_;
3165 
3166     double ret = DATE_TIME_VALUE;
3167     napi_status out = napi_get_date_value(env, nullptr, &ret);
3168 
3169     EXPECT_EQ(ret, DATE_TIME_VALUE);
3170     EXPECT_EQ(out, napi_invalid_arg);
3171 
3172     GTEST_LOG_(INFO) << "ACE_Napi_Get_Date_Value_0500 end";
3173 }
3174 #if  (defined(FOR_JERRYSCRIPT_TEST)) &&  (JERRY_API_MINOR_VERSION <= 3)
3175     // jerryscript 2.3 do nothing
3176 #else
3177 // jerryscript 2.4 or quickjs or V8
3178 /**
3179  * @tc.number    : ACE_Napi_Type_Tag_Object_0100
3180  * @tc.name      : The parameter is valid,
3181  *                 and the parameter js_object js_object is entered in the js object
3182  *                 that is not associated with type_tag, and the test is confirmed.
3183  * @tc.desc      : 1. Set up the env environment.
3184  *                 2. Create object.
3185  *                 3. Mark object
3186  *                 4. Verify napi_type_tag_object.
3187  */
3188 HWTEST_F(NativeEngineTest, ACE_Napi_Type_Tag_Object_0100, testing::ext::TestSize.Level1)
3189 {
3190     GTEST_LOG_(INFO) << "ACE_Napi_Type_Tag_Object_0100 start";
3191 
3192     napi_env env = (napi_env)engine_;
3193 
3194     napi_value result = nullptr;
3195     napi_status verification = napi_create_object(env, &result);
3196 
3197     EXPECT_EQ(verification, napi_ok);
3198     EXPECT_NE(result, nullptr);
3199     GTEST_LOG_(INFO) << "ACE_Napi_Type_Tag_Object_0100 create obiect complete";
3200 
3201     const napi_type_tag typeTag = { 0xFFFFFFFFFFFFFFFF, 34ULL };
3202     napi_status out = napi_type_tag_object(env, result, &typeTag);
3203 
3204     EXPECT_EQ(out, napi_ok);
3205 
3206     GTEST_LOG_(INFO) << "ACE_Napi_Type_Tag_Object_0100 end";
3207 }
3208 
3209 /**
3210  * @tc.number    : ACE_Napi_Type_Tag_Object_0200
3211  * @tc.name      : The parameter is valid,
3212  *                 the parameter js_object js_object enters the js object
3213  *                 associated with type_tag, and the test is confirmed.
3214  * @tc.desc      : 1. Set up the env environment.
3215  *                 2. Create object.
3216  *                 3. Mark object
3217  *                 3. Mark object
3218  *                 4. Verify napi_type_tag_object.
3219  */
3220 HWTEST_F(NativeEngineTest, ACE_Napi_Type_Tag_Object_0200, testing::ext::TestSize.Level2)
3221 {
3222     GTEST_LOG_(INFO) << "ACE_Napi_Type_Tag_Object_0200 start";
3223 
3224     napi_env env = (napi_env)engine_;
3225 
3226     napi_value result = nullptr;
3227     napi_status verification = napi_create_object(env, &result);
3228 
3229     EXPECT_EQ(verification, napi_ok);
3230     EXPECT_NE(result, nullptr);
3231     GTEST_LOG_(INFO) << "ACE_Napi_Type_Tag_Object_0200 create obiect complete";
3232 
3233     const napi_type_tag typeTag = { 0xFFFFFFFFFFFFFFFF, 34ULL };
3234     napi_status ret = napi_type_tag_object(env, result, &typeTag);
3235 
3236     EXPECT_EQ(ret, napi_ok);
3237     GTEST_LOG_(INFO) << "ACE_Napi_Type_Tag_Object_0200 type tag obiect complete";
3238 
3239     const napi_type_tag typeTagcopy = { 12312, 12 };
3240     napi_status out = napi_type_tag_object(env, result, &typeTagcopy);
3241 
3242     EXPECT_EQ(out, napi_invalid_arg);
3243 
3244     GTEST_LOG_(INFO) << "ACE_Napi_Type_Tag_Object_0200 end";
3245 }
3246 
3247 /**
3248  * @tc.number    : ACE_Napi_Type_Tag_Object_0300
3249  * @tc.name      : The parameter is invalid,
3250  *                 the parameter js_object js_object is entered as a js object
3251  *                 that is not associated with type_tag, and the test is confirmed.
3252  * @tc.desc      : 1. Set up the env environment.
3253  *                 2. Create object.
3254  *                 3. Mark object
3255  *                 4. Verify napi_type_tag_object.
3256  */
3257 HWTEST_F(NativeEngineTest, ACE_Napi_Type_Tag_Object_0300, testing::ext::TestSize.Level2)
3258 {
3259     GTEST_LOG_(INFO) << "ACE_Napi_Type_Tag_Object_0300 start";
3260 
3261     napi_env env = (napi_env)engine_;
3262 
3263     napi_value result = nullptr;
3264     napi_status verification = napi_create_object(env, &result);
3265 
3266     EXPECT_EQ(verification, napi_ok);
3267     EXPECT_NE(result, nullptr);
3268     GTEST_LOG_(INFO) << "ACE_Napi_Type_Tag_Object_0200 create obiect complete";
3269 
3270     const napi_type_tag typeTag = { 0xFFFFFFFFFFFFFFFF, 34ULL };
3271     napi_status out = napi_type_tag_object(nullptr, result, &typeTag);
3272 
3273     EXPECT_EQ(out, napi_invalid_arg);
3274 
3275     GTEST_LOG_(INFO) << "ACE_Napi_Type_Tag_Object_0300 end";
3276 }
3277 
3278 /**
3279  * @tc.number    : ACE_Napi_Type_Tag_Object_0400
3280  * @tc.name      : The parameter is invalid,
3281  *                 the parameter js_object js_object object input is empty, test to confirm.
3282  * @tc.desc      : 1. Set up the env environment.
3283  *                 2. Mark object
3284  *                 3. Verify napi_type_tag_object.
3285  */
3286 HWTEST_F(NativeEngineTest, ACE_Napi_Type_Tag_Object_0400, testing::ext::TestSize.Level2)
3287 {
3288     GTEST_LOG_(INFO) << "ACE_Napi_Type_Tag_Object_0400 start";
3289 
3290     napi_env env = (napi_env)engine_;
3291 
3292     const napi_type_tag typeTag = { 0xFFFFFFFFFFFFFFFF, 34ULL };
3293     napi_status out = napi_type_tag_object(env, nullptr, &typeTag);
3294 
3295     EXPECT_EQ(out, napi_invalid_arg);
3296 
3297     GTEST_LOG_(INFO) << "ACE_Napi_Type_Tag_Object_0400 end";
3298 }
3299 
3300 /**
3301  * @tc.number    : ACE_Napi_Type_Tag_Object_0500
3302  * @tc.name      : The parameter is invalid,
3303  *                 the parameter napi_type_tag* object input is empty, test confirmation.
3304  * @tc.desc      : 1. Set up the env environment.
3305  *                 2. Create object.
3306  *                 3. Mark object
3307  *                 4. Verify napi_type_tag_object.
3308  */
3309 HWTEST_F(NativeEngineTest, ACE_Napi_Type_Tag_Object_0500, testing::ext::TestSize.Level2)
3310 {
3311     GTEST_LOG_(INFO) << "ACE_Napi_Type_Tag_Object_0500 start";
3312 
3313     napi_env env = (napi_env)engine_;
3314 
3315     napi_value result = nullptr;
3316     napi_status verification = napi_create_object(env, &result);
3317 
3318     EXPECT_EQ(verification, napi_ok);
3319     EXPECT_NE(result, nullptr);
3320     GTEST_LOG_(INFO) << "ACE_Napi_Type_Tag_Object_0500 create obiect complete";
3321 
3322     napi_status out = napi_type_tag_object(env, result, nullptr);
3323 
3324     EXPECT_EQ(out, napi_invalid_arg);
3325 
3326     GTEST_LOG_(INFO) << "ACE_Napi_Type_Tag_Object_0500 end";
3327 }
3328 
3329 /**
3330  * @tc.number    : ACE_Napi_Check_Object_Type_Tag_0100
3331  * @tc.name      : The parameter is valid,
3332  *                 the js_object object enters the js object
3333  *                 that is not associated with type_tag, and the parameter type_tag
3334  *                 enters a valid parameter, and the test is confirmed.
3335  * @tc.desc      : 1. Set up the env environment.
3336  *                 2. Create object.
3337  *                 3. Mark object
3338  *                 4. Verify napi_check_object_type_tag.
3339  */
3340 HWTEST_F(NativeEngineTest, ACE_Napi_Check_Object_Type_Tag_0100, testing::ext::TestSize.Level1)
3341 {
3342     GTEST_LOG_(INFO) << "ACE_Napi_Check_Object_Type_Tag_0100 start";
3343 
3344     napi_env env = (napi_env)engine_;
3345 
3346     napi_value result = nullptr;
3347     napi_status verification = napi_create_object(env, &result);
3348 
3349     EXPECT_EQ(verification, napi_ok);
3350     EXPECT_NE(result, nullptr);
3351     GTEST_LOG_(INFO) << "ACE_Napi_Check_Object_Type_Tag_0100 create obiect complete";
3352 
3353     const napi_type_tag typeTag = { 0xFFFFFFFFFFFFFFFF, 34ULL };
3354     napi_status ret = napi_type_tag_object(env, result, &typeTag);
3355 
3356     EXPECT_EQ(ret, napi_ok);
3357     GTEST_LOG_(INFO) << "ACE_Napi_Check_Object_Type_Tag_0100 type tag obiect obiect complete";
3358 
3359     bool out = false;
3360     napi_status verificationCp = napi_check_object_type_tag(env, result, &typeTag, &out);
3361 
3362     EXPECT_EQ(verificationCp, napi_ok);
3363     EXPECT_TRUE(out);
3364 
3365     GTEST_LOG_(INFO) << "ACE_Napi_Check_Object_Type_Tag_0100 end";
3366 }
3367 
3368 /**
3369  * @tc.number    : ACE_Napi_Check_Object_Type_Tag_0200
3370  * @tc.name      : The parameter is valid,
3371  *                 the js_object object enters the js object
3372  *                 that is not associated with type_tag, and the parameter type_tag
3373  *                 enters a valid parameter, and the test is confirmed.
3374  * @tc.desc      : 1. Set up the env environment.
3375  *                 2. Create object.
3376  *                 3. Verify napi_check_object_type_tag.
3377  */
3378 HWTEST_F(NativeEngineTest, ACE_Napi_Check_Object_Type_Tag_0200, testing::ext::TestSize.Level1)
3379 {
3380     GTEST_LOG_(INFO) << "ACE_Napi_Check_Object_Type_Tag_0200 start";
3381 
3382     napi_env env = (napi_env)engine_;
3383 
3384     napi_value result = nullptr;
3385     napi_status verification = napi_create_object(env, &result);
3386 
3387     EXPECT_EQ(verification, napi_ok);
3388     EXPECT_NE(result, nullptr);
3389     GTEST_LOG_(INFO) << "ACE_Napi_Check_Object_Type_Tag_0100 create obiect complete";
3390 
3391     const napi_type_tag typeTag = { 0xFFFFFFFFFFFFFFFF, 34ULL };
3392     bool out = true;
3393     napi_status verificationCp = napi_check_object_type_tag(env, result, &typeTag, &out);
3394 
3395     EXPECT_EQ(verificationCp, napi_ok);
3396     EXPECT_FALSE(out);
3397 
3398     GTEST_LOG_(INFO) << "ACE_Napi_Check_Object_Type_Tag_0200 end";
3399 }
3400 
3401 /**
3402  * @tc.number    : ACE_Napi_Check_Object_Type_Tag_0300
3403  * @tc.name      : The parameter is invalid,
3404  *                 the js_object object enters a js object that is not associated with type_tag,
3405  *                 and the parameter type_tag enters a valid parameter, and the test is confirmed.
3406  * @tc.desc      : 1. Set up the env environment.
3407  *                 2. Create object.
3408  *                 3. Mark object
3409  *                 4. Verify napi_check_object_type_tag.
3410  */
3411 HWTEST_F(NativeEngineTest, ACE_Napi_Check_Object_Type_Tag_0300, testing::ext::TestSize.Level2)
3412 {
3413     GTEST_LOG_(INFO) << "ACE_Napi_Check_Object_Type_Tag_0300 start";
3414 
3415     napi_env env = (napi_env)engine_;
3416 
3417     napi_value result = nullptr;
3418     napi_status verification = napi_create_object(env, &result);
3419 
3420     EXPECT_EQ(verification, napi_ok);
3421     EXPECT_NE(result, nullptr);
3422     GTEST_LOG_(INFO) << "ACE_Napi_Check_Object_Type_Tag_0300 create obiect complete";
3423 
3424     const napi_type_tag typeTag = { 0xFFFFFFFFFFFFFFFF, 34ULL };
3425     napi_status ret = napi_type_tag_object(env, result, &typeTag);
3426 
3427     EXPECT_EQ(ret, napi_ok);
3428     GTEST_LOG_(INFO) << "ACE_Napi_Check_Object_Type_Tag_0300 type tag obiect obiect complete";
3429 
3430     bool out = false;
3431     napi_status output = napi_check_object_type_tag(nullptr, result, &typeTag, &out);
3432 
3433     EXPECT_EQ(output, napi_invalid_arg);
3434 
3435     GTEST_LOG_(INFO) << "ACE_Napi_Check_Object_Type_Tag_0300 end";
3436 }
3437 
3438 /**
3439  * @tc.number    : ACE_Napi_Check_Object_Type_Tag_0400
3440  * @tc.name      : The parameter is invalid,
3441  *                 the js_object object enters the js object associated with type_tag,
3442  *                 and the parameter type_tag enters a valid parameter, and the test is confirmed.
3443  * @tc.desc      : 1. Set up the env environment.
3444  *                 2. Create object.
3445  *                 3. Mark object
3446  *                 4. Create object.
3447  *                 5. Verify napi_check_object_type_tag.
3448  */
3449 HWTEST_F(NativeEngineTest, ACE_Napi_Check_Object_Type_Tag_0400, testing::ext::TestSize.Level1)
3450 {
3451     GTEST_LOG_(INFO) << "ACE_Napi_Check_Object_Type_Tag_0400 start";
3452 
3453     napi_env env = (napi_env)engine_;
3454 
3455     napi_value result = nullptr;
3456     napi_status verification = napi_create_object(env, &result);
3457 
3458     EXPECT_EQ(verification, napi_ok);
3459     EXPECT_NE(result, nullptr);
3460     GTEST_LOG_(INFO) << "ACE_Napi_Check_Object_Type_Tag_0400 create obiect complete";
3461 
3462     const napi_type_tag typeTag = { 0xFFFFFFFFFFFFFFFF, 34ULL };
3463     napi_status ret = napi_type_tag_object(env, result, &typeTag);
3464 
3465     EXPECT_EQ(ret, napi_ok);
3466     GTEST_LOG_(INFO) << "ACE_Napi_Check_Object_Type_Tag_0400 type tag obiect obiect complete";
3467 
3468     napi_value resultcopy = nullptr;
3469     napi_status verifi = napi_create_object(env, &resultcopy);
3470 
3471     EXPECT_EQ(verifi, napi_ok);
3472     EXPECT_NE(resultcopy, nullptr);
3473     GTEST_LOG_(INFO) << "ACE_Napi_Check_Object_Type_Tag_0400 create objectcopy complete";
3474 
3475     bool out = true;
3476     napi_status verificationCp = napi_check_object_type_tag(env, resultcopy, &typeTag, &out);
3477 
3478     EXPECT_EQ(verificationCp, napi_ok);
3479     EXPECT_FALSE(out);
3480 
3481     GTEST_LOG_(INFO) << "ACE_Napi_Check_Object_Type_Tag_0400 end";
3482 }
3483 
3484 /**
3485  * @tc.number    : ACE_Napi_Check_Object_Type_Tag_0500
3486  * @tc.name      : The parameter is invalid,
3487  *                 the input of the napi_type_tag* object is empty, test confirmation.
3488  * @tc.desc      : 1. Set up the env environment.
3489  *                 2. Create object.
3490  *                 3. Mark object
3491  *                 4. Verify napi_check_object_type_tag.
3492  */
3493 HWTEST_F(NativeEngineTest, ACE_Napi_Check_Object_Type_Tag_0500, testing::ext::TestSize.Level2)
3494 {
3495     GTEST_LOG_(INFO) << "ACE_Napi_Check_Object_Type_Tag_0500 start";
3496 
3497     napi_env env = (napi_env)engine_;
3498 
3499     napi_value result = nullptr;
3500     napi_status verification = napi_create_object(env, &result);
3501 
3502     EXPECT_EQ(verification, napi_ok);
3503     EXPECT_NE(result, nullptr);
3504     GTEST_LOG_(INFO) << "ACE_Napi_Check_Object_Type_Tag_0500 create obiect complete";
3505 
3506     const napi_type_tag typeTag = { 0xFFFFFFFFFFFFFFFF, 34ULL };
3507     napi_status ret = napi_type_tag_object(env, result, &typeTag);
3508 
3509     EXPECT_EQ(ret, napi_ok);
3510     GTEST_LOG_(INFO) << "ACE_Napi_Check_Object_Type_Tag_0400 type tag obiect obiect complete";
3511 
3512     bool out = false;
3513     napi_status output = napi_check_object_type_tag(env, result, nullptr, &out);
3514 
3515     EXPECT_FALSE(out);
3516     EXPECT_EQ(output, napi_invalid_arg);
3517 
3518     GTEST_LOG_(INFO) << "ACE_Napi_Check_Object_Type_Tag_0500 end";
3519 }
3520 
3521 /**
3522  * @tc.number    : ACE_Napi_Check_Object_Type_Tag_0600
3523  * @tc.name      : Valid environment env, parameter type_tag object input has been associated with type_tag js object,
3524  *                 parameter type_tag input is valid, the returned comparison result is invalid (nullptr).
3525  * @tc.desc      : 1. Set up the env environment.
3526  *                 2. Create object.
3527  *                 3. Mark object
3528  *                 4. Verify napi_check_object_type_tag.
3529  */
3530 HWTEST_F(NativeEngineTest, ACE_Napi_Check_Object_Type_Tag_0600, testing::ext::TestSize.Level1)
3531 {
3532     GTEST_LOG_(INFO) << "ACE_Napi_Check_Object_Type_Tag_0600 start";
3533 
3534     napi_env env = (napi_env)engine_;
3535 
3536     napi_value result = nullptr;
3537     napi_status verification = napi_create_object(env, &result);
3538 
3539     EXPECT_EQ(verification, napi_ok);
3540     EXPECT_NE(result, nullptr);
3541     GTEST_LOG_(INFO) << "ACE_Napi_Check_Object_Type_Tag_0600 create obiect complete";
3542 
3543     const napi_type_tag typeTag = { 0xFFFFFFFFFFFFFFFF, 34ULL };
3544     napi_status ret = napi_type_tag_object(env, result, &typeTag);
3545 
3546     EXPECT_EQ(ret, napi_ok);
3547     GTEST_LOG_(INFO) << "ACE_Napi_Check_Object_Type_Tag_0600 type tag obiect obiect complete";
3548 
3549     napi_status out = napi_check_object_type_tag(env, result, &typeTag, nullptr);
3550 
3551     EXPECT_EQ(out, napi_invalid_arg);
3552 
3553     GTEST_LOG_(INFO) << "ACE_Napi_Check_Object_Type_Tag_0600 end";
3554 }
3555 #endif // (defined(FOR_JERRYSCRIPT_TEST)) &&  (JERRY_API_MINOR_VERSION <= 3)
3556 /**
3557  * @tc.number    : ACE_Napi_Add_Finalizer_0100
3558  * @tc.name      : The necessary parameters of napi_add_finalizer are valid, and callback functions can be added.
3559  * @tc.desc      : 1. Set up the env environment.
3560  *                 2. Configuration parameter.
3561  *                 3. Verify napi_add_finalizer.
3562  */
3563 HWTEST_F(NativeEngineTest, ACE_Napi_Add_Finalizer_0100, testing::ext::TestSize.Level1)
3564 {
3565     GTEST_LOG_(INFO) << "ACE_Napi_Add_Finalizer_0100 start";
3566 
3567     napi_env env = (napi_env)engine_;
3568 
3569     napi_value jsObj = nullptr;
3570     char16_t nativeObj[] = u"napiaddfinalizer";
3571     int finalizeHine = 0;
3572     static bool testValue = false;
3573 
3574     napi_status verification = napi_create_object(env, &jsObj);
3575 
3576     EXPECT_EQ(verification, napi_ok);
3577 
3578     napi_ref result = nullptr;
__anon5f65a7310102(napi_env env, void* data, void* hint) 3579     napi_status ret = napi_add_finalizer(env, jsObj, &nativeObj, [](napi_env env, void* data, void* hint) {
3580         testValue = true;
3581     }, &finalizeHine, &result);
3582 
3583     EXPECT_EQ(ret, napi_ok);
3584 
3585     napi_status verifi = napi_delete_reference(env, result);
3586 
3587     EXPECT_TRUE(testValue);
3588     EXPECT_EQ(verifi, napi_ok);
3589 
3590     GTEST_LOG_(INFO) << "ACE_Napi_Add_Finalizer_0100 end";
3591 }
3592 
3593 /**
3594  * @tc.number    : ACE_Napi_Add_Finalizer_0200
3595  * @tc.name      : The JS object parameter of napi_add_finalizer that binds local data is invalid,
3596  *                 and the callback function cannot be added.
3597  * @tc.desc      : 1. Set up the env environment.
3598  *                 2. Configuration parameter.
3599  *                 3. Verify napi_add_finalizer.
3600  */
3601 HWTEST_F(NativeEngineTest, ACE_Napi_Add_Finalizer_0200, testing::ext::TestSize.Level2)
3602 {
3603     GTEST_LOG_(INFO) << "ACE_Napi_Add_Finalizer_0200 start";
3604 
3605     napi_env env = (napi_env)engine_;
3606 
3607     char16_t nativeObj[] = u"napiaddfinalizer";
3608     int finalizeHine = 0;
3609     static bool testValue = false;
3610 
3611     napi_ref result = nullptr;
__anon5f65a7310202(napi_env env, void* data, void* hint) 3612     napi_status ret = napi_add_finalizer(env, nullptr, &nativeObj, [](napi_env env, void* data, void* hint) {
3613         testValue = true;
3614     }, &finalizeHine, &result);
3615 
3616     EXPECT_EQ(ret, napi_invalid_arg);
3617     EXPECT_FALSE(testValue);
3618 
3619     napi_status output = napi_delete_reference(env, result);
3620     EXPECT_EQ(output, napi_invalid_arg);
3621 
3622     GTEST_LOG_(INFO) << "ACE_Napi_Add_Finalizer_0200 end";
3623 }
3624 
3625 /**
3626  * @tc.number    : ACE_Napi_Add_Finalizer_0300
3627  * @tc.name      : The callback function parameter of napi_add_finalizer used to release local data is invalid,
3628  *                 and the callback function cannot be added.
3629  * @tc.desc      : 1. Set up the env environment.
3630  *                 2. Configuration parameter.
3631  *                 3. Verify napi_add_finalizer.
3632  */
3633 HWTEST_F(NativeEngineTest, ACE_Napi_Add_Finalizer_0300, testing::ext::TestSize.Level2)
3634 {
3635     GTEST_LOG_(INFO) << "ACE_Napi_Add_Finalizer_0300 start";
3636 
3637     napi_env env = (napi_env)engine_;
3638 
3639     napi_value jsObj = nullptr;
3640     char16_t nativeObj[] = u"napiaddfinalizer";
3641     int finalizeHine = 0;
3642 
3643     napi_status verification = napi_create_object(env, &jsObj);
3644 
3645     EXPECT_EQ(verification, napi_ok);
3646 
3647     napi_ref result = nullptr;
3648     napi_status ret = napi_add_finalizer(env, jsObj, &nativeObj, nullptr, &finalizeHine, &result);
3649 
3650     EXPECT_EQ(ret, napi_invalid_arg);
3651 
3652     napi_status output = napi_delete_reference(env, result);
3653     EXPECT_EQ(output, napi_invalid_arg);
3654 
3655     GTEST_LOG_(INFO) << "ACE_Napi_Add_Finalizer_0300 end";
3656 }
3657 
3658 /**
3659  * @tc.number    : ACE_Napi_Add_Finalizer_0400
3660  * @tc.name      : The environment parameter of napi_add_finalizer is invalid,
3661  *                 the callback function cannot be added.
3662  * @tc.desc      : 1. Set up the env environment.
3663  *                 2. Configuration parameter.
3664  *                 3. Verify napi_add_finalizer.
3665  */
3666 HWTEST_F(NativeEngineTest, ACE_Napi_Add_Finalizer_0400, testing::ext::TestSize.Level2)
3667 {
3668     GTEST_LOG_(INFO) << "ACE_Napi_Add_Finalizer_0400 start";
3669 
3670     napi_env env = (napi_env)engine_;
3671 
3672     napi_value jsObj = nullptr;
3673     char16_t nativeObj[] = u"napiaddfinalizer";
3674     int finalizeHine = 0;
3675     static bool testValue = false;
3676 
3677     napi_status verification = napi_create_object(env, &jsObj);
3678 
3679     EXPECT_EQ(verification, napi_ok);
3680 
3681     napi_ref result = nullptr;
__anon5f65a7310302(napi_env env, void* data, void* hint) 3682     napi_status ret = napi_add_finalizer(nullptr, jsObj, &nativeObj, [](napi_env env, void* data, void* hint) {
3683         testValue = true;
3684     }, &finalizeHine, &result);
3685 
3686     EXPECT_EQ(ret, napi_invalid_arg);
3687     EXPECT_FALSE(testValue);
3688 
3689     napi_status output = napi_delete_reference(env, result);
3690     EXPECT_EQ(output, napi_invalid_arg);
3691 
3692     GTEST_LOG_(INFO) << "ACE_Napi_Add_Finalizer_0400 end";
3693 }
3694 
3695 /**
3696  * @tc.number    : ACE_Napi_Add_Finalizer_0500
3697  * @tc.name      : The necessary parameters of napi_add_finalizer are valid,
3698  *                 the local data bound to the JS object is valid, and callback functions can be added.
3699  * @tc.desc      : 1. Set up the env environment.
3700  *                 2. Configuration parameter.
3701  *                 3. Verify napi_add_finalizer.
3702  */
3703 HWTEST_F(NativeEngineTest, ACE_Napi_Add_Finalizer_0500, testing::ext::TestSize.Level1)
3704 {
3705     GTEST_LOG_(INFO) << "ACE_Napi_Add_Finalizer_0500 start";
3706 
3707     napi_env env = (napi_env)engine_;
3708 
3709     napi_value jsObj = nullptr;
3710     char16_t nativeObj[] = u"napiaddfinalizer";
3711     int finalizeHine = 0;
3712     static bool testValue = false;
3713 
3714     napi_status verification = napi_create_object(env, &jsObj);
3715 
3716     EXPECT_EQ(verification, napi_ok);
3717 
__anon5f65a7310402(napi_env env, void* data, void* hint) 3718     napi_status ret = napi_add_finalizer(env, jsObj, &nativeObj, [](napi_env env, void* data, void* hint) {
3719         testValue = true;
3720     }, &finalizeHine, nullptr);
3721 
3722     EXPECT_EQ(ret, napi_ok);
3723     EXPECT_FALSE(testValue);
3724 
3725     GTEST_LOG_(INFO) << "ACE_Napi_Add_Finalizer_0500 end";
3726 }
3727 
3728 /**
3729  * @tc.number    : ACE_Napi_Add_Finalizer_0600
3730  * @tc.name      : The necessary parameters of napi_add_finalizer are valid,
3731  *                 and the local data bound to the JS object is invalid. Callback functions can be added.
3732  * @tc.desc      : 1. Set up the env environment.
3733  *                 2. Configuration parameter.
3734  *                 3. Verify napi_add_finalizer.
3735  */
3736 HWTEST_F(NativeEngineTest, ACE_Napi_Add_Finalizer_0600, testing::ext::TestSize.Level1)
3737 {
3738     GTEST_LOG_(INFO) << "ACE_Napi_Add_Finalizer_0600 start";
3739 
3740     napi_env env = (napi_env)engine_;
3741 
3742     napi_value jsObj = nullptr;
3743     char16_t nativeObj[] = u"napiaddfinalizer";
3744     static bool testValue = false;
3745 
3746     napi_status verification = napi_create_object(env, &jsObj);
3747 
3748     EXPECT_EQ(verification, napi_ok);
3749 
__anon5f65a7310502(napi_env env, void* data, void* hint) 3750     napi_status ret = napi_add_finalizer(env, jsObj, &nativeObj, [](napi_env env, void* data, void* hint) {
3751         testValue = true;
3752     }, nullptr, nullptr);
3753 
3754     EXPECT_EQ(ret, napi_ok);
3755     EXPECT_FALSE(testValue);
3756 
3757     GTEST_LOG_(INFO) << "ACE_Napi_Add_Finalizer_0600 end";
3758 }
3759 
3760 /**
3761  * @tc.number    : ACE_Napi_Add_Finalizer_0700
3762  * @tc.name      : The necessary parameters of napi_add_finalizer are valid,
3763  *                 the callback function parameter is valid, and the callback function can be added.
3764  * @tc.desc      : 1. Set up the env environment.
3765  *                 2. Configuration parameter.
3766  *                 3. Verify napi_add_finalizer.
3767  */
3768 HWTEST_F(NativeEngineTest, ACE_Napi_Add_Finalizer_0700, testing::ext::TestSize.Level2)
3769 {
3770     GTEST_LOG_(INFO) << "ACE_Napi_Add_Finalizer_0700 start";
3771 
3772     napi_env env = (napi_env)engine_;
3773 
3774     napi_value jsObj = nullptr;
3775     int finalizeHine = 0;
3776 
3777     napi_status verification = napi_create_object(env, &jsObj);
3778 
3779     EXPECT_EQ(verification, napi_ok);
3780 
3781     napi_status ret = napi_add_finalizer(env, jsObj, nullptr, nullptr, &finalizeHine, nullptr);
3782 
3783     EXPECT_EQ(ret, napi_invalid_arg);
3784 
3785     GTEST_LOG_(INFO) << "ACE_Napi_Add_Finalizer_0700 end";
3786 }
3787 
3788 /**
3789  * @tc.number    : ACE_Napi_Add_Finalizer_0800
3790  * @tc.name      : The necessary parameters of napi_add_finalizer are valid,
3791  *                 and the callback function parameter is invalid. Callback function can be added.
3792  * @tc.desc      : 1. Set up the env environment.
3793  *                 2. Configuration parameter.
3794  *                 3. Verify napi_add_finalizer.
3795  */
3796 HWTEST_F(NativeEngineTest, ACE_Napi_Add_Finalizer_0800, testing::ext::TestSize.Level1)
3797 {
3798     GTEST_LOG_(INFO) << "ACE_Napi_Add_Finalizer_0800 start";
3799 
3800     napi_env env = (napi_env)engine_;
3801 
3802     napi_value jsObj = nullptr;
3803     int finalizeHine = 0;
3804     static bool testValue = false;
3805 
3806     napi_status verification = napi_create_object(env, &jsObj);
3807 
3808     EXPECT_EQ(verification, napi_ok);
3809 
3810     napi_ref result = nullptr;
__anon5f65a7310602(napi_env env, void* data, void* hint) 3811     napi_status ret = napi_add_finalizer(env, jsObj, nullptr, [](napi_env env, void* data, void* hint) {
3812         testValue = true;
3813     }, &finalizeHine, &result);
3814 
3815     EXPECT_EQ(ret, napi_ok);
3816 
3817     napi_status output = napi_delete_reference(env, result);
3818     EXPECT_EQ(output, napi_ok);
3819     EXPECT_TRUE(testValue);
3820 
3821     GTEST_LOG_(INFO) << "ACE_Napi_Add_Finalizer_0800 end";
3822 }
3823 
3824 /**
3825  * @tc.number    : ACE_Napi_Add_Finalizer_0900
3826  * @tc.name      : The necessary parameters of napi_add_finalizer are valid,
3827  *                 the reference of the returned JS object is valid, and the callback function can be added.
3828  * @tc.desc      : 1. Set up the env environment.
3829  *                 2. Configuration parameter.
3830  *                 3. Verify napi_add_finalizer.
3831  */
3832 HWTEST_F(NativeEngineTest, ACE_Napi_Add_Finalizer_0900, testing::ext::TestSize.Level2)
3833 {
3834     GTEST_LOG_(INFO) << "ACE_Napi_Add_Finalizer_0900 start";
3835 
3836     napi_env env = (napi_env)engine_;
3837 
3838     napi_value jsObj = nullptr;
3839     int finalizeHine = 0;
3840 
3841     napi_status verification = napi_create_object(env, &jsObj);
3842 
3843     EXPECT_EQ(verification, napi_ok);
3844 
3845     napi_ref result = nullptr;
3846     napi_status ret = napi_add_finalizer(env, jsObj, nullptr, nullptr, &finalizeHine, &result);
3847 
3848     EXPECT_EQ(ret, napi_invalid_arg);
3849 
3850     napi_status output = napi_delete_reference(env, result);
3851     EXPECT_EQ(output, napi_invalid_arg);
3852 
3853     GTEST_LOG_(INFO) << "ACE_Napi_Add_Finalizer_0900 end";
3854 }
3855 
3856 /**
3857  * @tc.number    : ACE_Napi_Adjust_External_Memory_0100
3858  * @tc.name      : The necessary parameters of napi_adjust_external_memory
3859  *                 are valid and the function can be called successfully.
3860  * @tc.desc      : 1. Set up the env environment.
3861  *                 2. Configuration parameter.
3862  *                 3. Verify napi_add_finalizer.
3863  */
3864 HWTEST_F(NativeEngineTest, ACE_Napi_Adjust_External_Memory_0100, testing::ext::TestSize.Level2)
3865 {
3866     GTEST_LOG_(INFO) << "ACE_Napi_Adjust_External_Memory_0100 start";
3867 
3868     napi_env env = (napi_env)engine_;
3869 
3870     int64_t change_in_bytes = CHANGE_IN_BYTES;
3871     int64_t adjusted_value = ADJUSTED_VALUE;
3872 
3873     napi_status ret = napi_adjust_external_memory(env, change_in_bytes, &adjusted_value);
3874 
3875     EXPECT_EQ(ret, napi_ok);
3876 
3877     GTEST_LOG_(INFO) << "ACE_Napi_Adjust_External_Memory_0100 end";
3878 }
3879 
3880 /**
3881  * @tc.number    : ACE_Napi_Adjust_External_Memory_0200
3882  * @tc.name      : The size parameter of napi_adjust_external_memory's return
3883  *                 instance allocated memory is invalid, the function is called.
3884  * @tc.desc      : 1. Set up the env environment.
3885  *                 2. Configuration parameter.
3886  *                 3. Verify napi_add_finalizer.
3887  */
3888 HWTEST_F(NativeEngineTest, ACE_Napi_Adjust_External_Memory_0200, testing::ext::TestSize.Level2)
3889 {
3890     GTEST_LOG_(INFO) << "ACE_Napi_Adjust_External_Memory_0200 start";
3891 
3892     napi_env env = (napi_env)engine_;
3893 
3894     int64_t change_in_bytes = CHANGE_IN_BYTES;
3895 
3896     napi_status ret = napi_adjust_external_memory(env, change_in_bytes, nullptr);
3897 
3898     EXPECT_EQ(ret, napi_invalid_arg);
3899 
3900     GTEST_LOG_(INFO) << "ACE_Napi_Adjust_External_Memory_0200 end";
3901 }
3902 
3903 /**
3904  * @tc.number    : ACE_Napi_Adjust_External_Memory_0300
3905  * @tc.name      : The environment parameter of napi_adjust_external_memory is invalid, the function is called.
3906  * @tc.desc      : 1. Set up the env environment.
3907  *                 2. Configuration parameter.
3908  *                 3. Verify napi_add_finalizer.
3909  */
3910 HWTEST_F(NativeEngineTest, ACE_Napi_Adjust_External_Memory_0300, testing::ext::TestSize.Level2)
3911 {
3912     GTEST_LOG_(INFO) << "ACE_Napi_Adjust_External_Memory_0300 start";
3913 
3914     int64_t change_in_bytes = CHANGE_IN_BYTES;
3915     int64_t adjusted_value = ADJUSTED_VALUE;
3916 
3917     napi_status ret = napi_adjust_external_memory(nullptr, change_in_bytes, &adjusted_value);
3918 
3919     EXPECT_EQ(ret, napi_invalid_arg);
3920 
3921     GTEST_LOG_(INFO) << "ACE_Napi_Adjust_External_Memory_0300 end";
3922 }
3923 #if  (defined(FOR_JERRYSCRIPT_TEST)) &&  (JERRY_API_MINOR_VERSION <= 3)
3924     // jerryscript 2.3 do nothing
3925 #else
3926 // jerryscript 2.4 or quickjs or V8
3927 /**
3928  * @tc.number    : ACE_Napi_Get_All_Property_Names_0100
3929  * @tc.name      : The parameter is valid,
3930  *                 the parameter object enters the js object with the defined properties,
3931  *                 the parameter key_mode enters napi_key_include_prototypes,
3932  *                 the parameter key_filter enters napi_key_all_properties,
3933  *                 the parameter key_conversion enters napi_key_keep_numbers, and the test is confirmed.
3934  * @tc.desc      : 1. Set up the env environment.
3935  *                 2. Configuration parameter.
3936  *                 3. Verify napi_get_array_length.
3937  */
3938 HWTEST_F(NativeEngineTest, ACE_Napi_Get_All_Property_Names_0100, testing::ext::TestSize.Level1)
3939 {
3940     GTEST_LOG_(INFO) << "ACE_Napi_Get_All_Property_Names_0100 start";
3941 
3942     napi_env env = (napi_env)engine_;
3943 
3944     napi_value result = nullptr;
3945     napi_status verification = napi_create_object(env, &result);
3946 
3947     EXPECT_EQ(verification, napi_ok);
3948 
3949     int32_t testNumber = 12345;
3950     napi_value numberAttribute = nullptr;
3951     napi_status verifiint = napi_create_int32(env, testNumber, &numberAttribute);
3952 
3953     EXPECT_EQ(verifiint, napi_ok);
3954 
3955     napi_status verifiname = napi_set_named_property(env, result, "numberAttribute", numberAttribute);
3956 
3957     EXPECT_EQ(verifiname, napi_ok);
3958 
3959     napi_key_collection_mode keyMode = napi_key_own_only;
3960     napi_key_filter keyFilter = napi_key_all_properties;
3961     napi_key_conversion keyConversion = napi_key_keep_numbers;
3962     napi_value propNames = nullptr;
3963     napi_status ret = napi_get_all_property_names(env, result, keyMode, keyFilter, keyConversion, &propNames);
3964 
3965     EXPECT_EQ(ret, napi_ok);
3966 
3967     uint32_t length = 0;
3968     napi_status verifilen = napi_get_array_length(env, propNames, &length);
3969 
3970     EXPECT_EQ(verifilen, napi_ok);
3971     EXPECT_EQ(length, (size_t)1);
3972 
3973     GTEST_LOG_(INFO) << "ACE_Napi_Get_All_Property_Names_0100 end";
3974 }
3975 
3976 /**
3977  * @tc.number    : ACE_Napi_Get_All_Property_Names_0200
3978  * @tc.name      : The parameter is invalid,
3979  *                 the parameter object enters the js object with defined properties,
3980  *                 the parameter key_mode enters napi_key_own_only,
3981  *                 the parameter key_filter enters napi_key_all_properties,
3982  *                 the parameter key_conversion enters napi_key_keep_numbers, and the test is confirmed.
3983  * @tc.desc      : 1. Set up the env environment.
3984  *                 2. Configuration parameter.
3985  *                 3. Verify napi_get_array_length.
3986  */
3987 HWTEST_F(NativeEngineTest, ACE_Napi_Get_All_Property_Names_0200, testing::ext::TestSize.Level2)
3988 {
3989     GTEST_LOG_(INFO) << "ACE_Napi_Get_All_Property_Names_0200 start";
3990 
3991     napi_env env = (napi_env)engine_;
3992 
3993     napi_value result = nullptr;
3994     napi_status verification = napi_create_object(env, &result);
3995 
3996     EXPECT_EQ(verification, napi_ok);
3997 
3998     int32_t testNumber = 12345;
3999     napi_value numberAttribute = nullptr;
4000     napi_status verifiint = napi_create_int32(env, testNumber, &numberAttribute);
4001 
4002     EXPECT_EQ(verifiint, napi_ok);
4003 
4004     napi_status verifiname = napi_set_named_property(env, result, "numberAttribute", numberAttribute);
4005 
4006     EXPECT_EQ(verifiname, napi_ok);
4007 
4008     napi_key_collection_mode keyMode = napi_key_own_only;
4009     napi_key_filter keyFilter = napi_key_all_properties;
4010     napi_key_conversion keyConversion = napi_key_keep_numbers;
4011     napi_value propNames = nullptr;
4012     napi_status ret = napi_get_all_property_names(nullptr, result, keyMode, keyFilter, keyConversion, &propNames);
4013 
4014     EXPECT_EQ(ret, napi_invalid_arg);
4015 
4016     GTEST_LOG_(INFO) << "ACE_Napi_Get_All_Property_Names_0200 end";
4017 }
4018 
4019 /**
4020  * @tc.number    : ACE_Napi_Get_All_Property_Names_0300
4021  * @tc.name      : The parameter is invalid,
4022  *                 the parameter object enters the js object with the defined properties,
4023  *                 the parameter key_mode enters napi_key_own_only,
4024  *                 the parameter key_filter enters napi_key_all_properties,
4025  *                 the parameter key_conversion enters napi_key_keep_numbers,
4026  *                 the parameter result enters empty, and the test is confirmed.
4027  * @tc.desc      : 1. Set up the env environment.
4028  *                 2. Configuration parameter.
4029  *                 3. Verify napi_get_array_length.
4030  */
4031 HWTEST_F(NativeEngineTest, ACE_Napi_Get_All_Property_Names_0300, testing::ext::TestSize.Level2)
4032 {
4033     GTEST_LOG_(INFO) << "ACE_Napi_Get_All_Property_Names_0300 start";
4034 
4035     napi_env env = (napi_env)engine_;
4036 
4037     napi_value result = nullptr;
4038     napi_status verification = napi_create_object(env, &result);
4039 
4040     EXPECT_EQ(verification, napi_ok);
4041 
4042     int32_t testNumber = 12345;
4043     napi_value numberAttribute = nullptr;
4044     napi_status verifiint = napi_create_int32(env, testNumber, &numberAttribute);
4045 
4046     EXPECT_EQ(verifiint, napi_ok);
4047 
4048     napi_status verifiname = napi_set_named_property(env, result, "numberAttribute", numberAttribute);
4049 
4050     EXPECT_EQ(verifiname, napi_ok);
4051 
4052     napi_key_collection_mode keyMode = napi_key_own_only;
4053     napi_key_filter keyFilter = napi_key_all_properties;
4054     napi_key_conversion keyConversion = napi_key_keep_numbers;
4055     napi_status ret = napi_get_all_property_names(env, result, keyMode, keyFilter, keyConversion, nullptr);
4056 
4057     EXPECT_EQ(ret, napi_invalid_arg);
4058 
4059     GTEST_LOG_(INFO) << "ACE_Napi_Get_All_Property_Names_0300 end";
4060 }
4061 
4062 /**
4063  * @tc.number    : ACE_Napi_Get_All_Property_Names_0400
4064  * @tc.name      : The parameter is invalid,
4065  *                 the parameter object is empty,
4066  *                 the parameter key_mode is entered napi_key_own_only,
4067  *                 the parameter key_filter is entered napi_key_all_properties,
4068  *                 the parameter key_conversion is entered napi_key_keep_numbers,
4069  *                 and the test is confirmed.
4070  * @tc.desc      : 1. Set up the env environment.
4071  *                 2. Configuration parameter.
4072  *                 3. Verify napi_get_array_length.
4073  */
4074 HWTEST_F(NativeEngineTest, ACE_Napi_Get_All_Property_Names_0400, testing::ext::TestSize.Level2)
4075 {
4076     GTEST_LOG_(INFO) << "ACE_Napi_Get_All_Property_Names_0400 start";
4077 
4078     napi_env env = (napi_env)engine_;
4079 
4080     napi_key_collection_mode keyMode = napi_key_own_only;
4081     napi_key_filter keyFilter = napi_key_all_properties;
4082     napi_key_conversion keyConversion = napi_key_keep_numbers;
4083     napi_value propNames = nullptr;
4084     napi_status ret = napi_get_all_property_names(env, nullptr, keyMode, keyFilter, keyConversion, &propNames);
4085 
4086     EXPECT_EQ(ret, napi_invalid_arg);
4087 
4088     GTEST_LOG_(INFO) << "ACE_Napi_Get_All_Property_Names_0400 end";
4089 }
4090 
4091 /**
4092  * @tc.number    : ACE_Napi_Get_All_Property_Names_0500
4093  * @tc.name      : The parameter is invalid,
4094  *                 the parameter object enters the js object with the defined properties,
4095  *                 the parameter key_mode enters napi_key_include_prototypes,
4096  *                 the parameter key_filter enters napi_key_numbers_to_strings,
4097  *                 the parameter key_conversion enters napi_key_keep_numbers.
4098  * @tc.desc      : 1. Set up the env environment.
4099  *                 2. Configuration parameter.
4100  *                 3. Verify napi_get_array_length.
4101  */
4102 HWTEST_F(NativeEngineTest, ACE_Napi_Get_All_Property_Names_0500, testing::ext::TestSize.Level1)
4103 {
4104     GTEST_LOG_(INFO) << "ACE_Napi_Get_All_Property_Names_0500 start";
4105 
4106     napi_env env = (napi_env)engine_;
4107 
4108     napi_value result = nullptr;
4109     napi_status verification = napi_create_object(env, &result);
4110 
4111     EXPECT_EQ(verification, napi_ok);
4112 
4113     int32_t testNumber = 12345;
4114     napi_value numberAttribute = nullptr;
4115     napi_status verifiint = napi_create_int32(env, testNumber, &numberAttribute);
4116 
4117     EXPECT_EQ(verifiint, napi_ok);
4118 
4119     napi_status verifiname = napi_set_named_property(env, result, "numberAttribute", numberAttribute);
4120 
4121     EXPECT_EQ(verifiname, napi_ok);
4122 
4123     napi_key_collection_mode keyMode = napi_key_include_prototypes;
4124     napi_key_filter keyFilter = napi_key_all_properties;
4125     napi_key_conversion keyConversion = napi_key_numbers_to_strings;
4126     napi_value propNames = nullptr;
4127     napi_status ret = napi_get_all_property_names(env, result, keyMode, keyFilter, keyConversion, &propNames);
4128 
4129     EXPECT_EQ(ret, napi_ok);
4130 
4131     uint32_t length = 0;
4132     napi_status verifilen = napi_get_array_length(env, propNames, &length);
4133 
4134     EXPECT_EQ(verifilen, napi_ok);
4135     EXPECT_EQ(length, (size_t)1);
4136 
4137     GTEST_LOG_(INFO) << "ACE_Napi_Get_All_Property_Names_0500 end";
4138 }
4139 
4140 /**
4141  * @tc.number    : ACE_Napi_Get_All_Property_Names_0600
4142  * @tc.name      : The parameter is valid,
4143  *                 the parameter object enters the js object with the defined properties,
4144  *                 the parameter key_mode enters napi_key_include_prototypes,
4145  *                 the parameter key_filter enters napi_key_writable,
4146  *                 the parameter key_conversion enters napi_key_keep_numbers, and the test is confirmed.
4147  * @tc.desc      : 1. Set up the env environment.
4148  *                 2. Configuration parameter.
4149  *                 3. Verify napi_get_array_length.
4150  */
4151 HWTEST_F(NativeEngineTest, ACE_Napi_Get_All_Property_Names_0600, testing::ext::TestSize.Level1)
4152 {
4153     GTEST_LOG_(INFO) << "ACE_Napi_Get_All_Property_Names_0600 start";
4154 
4155     napi_env env = (napi_env)engine_;
4156 
4157     napi_value result = nullptr;
4158     napi_status verification = napi_create_object(env, &result);
4159 
4160     EXPECT_EQ(verification, napi_ok);
4161 
4162     int32_t testNumber = 12345;
4163     napi_value numberAttribute = nullptr;
4164     napi_status verifiint = napi_create_int32(env, testNumber, &numberAttribute);
4165 
4166     EXPECT_EQ(verifiint, napi_ok);
4167 
4168     napi_status verifiname = napi_set_named_property(env, result, "numberAttribute", numberAttribute);
4169 
4170     EXPECT_EQ(verifiname, napi_ok);
4171 
4172     napi_key_collection_mode keyMode = napi_key_own_only;
4173     napi_key_filter keyFilter = napi_key_writable;
4174     napi_key_conversion keyConversion = napi_key_keep_numbers;
4175     napi_value propNames = nullptr;
4176     napi_status ret = napi_get_all_property_names(env, result, keyMode, keyFilter, keyConversion, &propNames);
4177 
4178     EXPECT_EQ(ret, napi_ok);
4179 
4180     uint32_t length = 0;
4181     napi_status verifilen = napi_get_array_length(env, propNames, &length);
4182 
4183     EXPECT_EQ(verifilen, napi_ok);
4184     EXPECT_EQ(length, (size_t)1);
4185 
4186     GTEST_LOG_(INFO) << "ACE_Napi_Get_All_Property_Names_0600 end";
4187 }
4188 
4189 /**
4190  * @tc.number    : ACE_Napi_Get_All_Property_Names_0700
4191  * @tc.name      : The parameter is valid,
4192  *                 the parameter object enters the js object with the defined properties,
4193  *                 the parameter key_mode enters napi_key_include_prototypes,
4194  *                 the parameter key_filter enters napi_key_enumerable,
4195  *                 the parameter key_conversion enters napi_key_keep_numbers, and the test is confirmed.
4196  * @tc.desc      : 1. Set up the env environment.
4197  *                 2. Configuration parameter.
4198  *                 3. Verify napi_get_array_length.
4199  */
4200 HWTEST_F(NativeEngineTest, ACE_Napi_Get_All_Property_Names_0700, testing::ext::TestSize.Level1)
4201 {
4202     GTEST_LOG_(INFO) << "ACE_Napi_Get_All_Property_Names_0700 start";
4203 
4204     napi_env env = (napi_env)engine_;
4205 
4206     napi_value result = nullptr;
4207     napi_status verification = napi_create_object(env, &result);
4208 
4209     EXPECT_EQ(verification, napi_ok);
4210 
4211     int32_t testNumber = 12345;
4212     napi_value numberAttribute = nullptr;
4213     napi_status verifiint = napi_create_int32(env, testNumber, &numberAttribute);
4214 
4215     EXPECT_EQ(verifiint, napi_ok);
4216 
4217     napi_status verifiname = napi_set_named_property(env, result, "numberAttribute", numberAttribute);
4218 
4219     EXPECT_EQ(verifiname, napi_ok);
4220 
4221     napi_key_collection_mode keyMode = napi_key_own_only;
4222     napi_key_filter keyFilter = napi_key_enumerable;
4223     napi_key_conversion keyConversion = napi_key_keep_numbers;
4224     napi_value propNames = nullptr;
4225     napi_status ret = napi_get_all_property_names(env, result, keyMode, keyFilter, keyConversion, &propNames);
4226 
4227     EXPECT_EQ(ret, napi_ok);
4228 
4229     uint32_t length = 0;
4230     napi_status verifilen = napi_get_array_length(env, propNames, &length);
4231 
4232     EXPECT_EQ(verifilen, napi_ok);
4233     EXPECT_EQ(length, (size_t)1);
4234 
4235     GTEST_LOG_(INFO) << "ACE_Napi_Get_All_Property_Names_0700 end";
4236 }
4237 
4238 /**
4239  * @tc.number    : ACE_Napi_Get_All_Property_Names_0800
4240  * @tc.name      : Invalid parameter, invalid parameter object input (non-object object, for example: string),
4241  *                 parameter key_mode input napi_key_include_prototypes,
4242  *                 parameter key_filter input napi_key_all_properties,
4243  *                 parameter key_conversion input napi_key_keep_numbers, test confirmation.
4244  * @tc.desc      : 1. Install the app.
4245  *                 2. Start the application.
4246  *                 3. Call napi_create_string_utf8 to create a string.
4247  *                 4. Call napi_get_all_property_names.
4248  */
4249 HWTEST_F(NativeEngineTest, ACE_Napi_Get_All_Property_Names_0800, testing::ext::TestSize.Level2)
4250 {
4251     GTEST_LOG_(INFO) << "ACE_Napi_Get_All_Property_Names_0800 start";
4252 
4253     napi_env env = (napi_env)engine_;
4254     napi_value result = nullptr;
4255     napi_status verification = napi_create_string_utf8(env, "napi_get_all_property_namesTest",
4256         NAPI_AUTO_LENGTH, &result);
4257 
4258     EXPECT_EQ(verification, napi_ok);
4259 
4260     napi_key_collection_mode keyMode = napi_key_include_prototypes;
4261     napi_key_filter keyFilter = napi_key_all_properties;
4262     napi_key_conversion keyConversion = napi_key_keep_numbers;
4263     napi_value propNames = nullptr;
4264     napi_status ret = napi_get_all_property_names(env, result, keyMode, keyFilter, keyConversion, &propNames);
4265 
4266     EXPECT_EQ(ret, napi_object_expected);
4267     GTEST_LOG_(INFO) << "ACE_Napi_Get_All_Property_Names_0800 end";
4268 }
4269 #endif // (defined(FOR_JERRYSCRIPT_TEST)) &&  (JERRY_API_MINOR_VERSION <= 3)
4270 /*
4271  * @tc.number    : ACE_Napi_Create_Buffer_0100
4272  * @tc.name      : The parameters of napi_create_buffer are valid,
4273  *                 The parameter of buffer size is the minimum value (1),
4274  *                 A node::Buffer object can be created
4275  * @tc.desc      : 1.The environment engine is created
4276  *                 2.Set test variables
4277  *                 3.The function of napi_create_buffer is called
4278  *                 4.Return value of function is napi_ok
4279  */
4280 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Buffer_0100, testing::ext::TestSize.Level1)
4281 {
4282     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Buffer_0100 start";
4283 
4284     napi_env env = (napi_env)engine_;
4285     napi_value Buffer = nullptr;
4286     void* BufferPtr = nullptr;
4287     size_t BufferSize = 1;
4288 
4289     napi_status creatresult = napi_create_buffer(env, BufferSize, &BufferPtr, &Buffer);
4290     EXPECT_EQ(creatresult, napi_status::napi_ok);
4291     EXPECT_NE(BufferPtr, nullptr);
4292 
4293     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Buffer_0100 end";
4294 }
4295 
4296 /*
4297  * @tc.number    : ACE_Napi_Create_Buffer_0200
4298  * @tc.name      : The parameter of buffer size is the over maxnum value (2G),
4299  *                 A node::Buffer object can  not be created
4300  * @tc.desc      : 1.The environment engine is created
4301  *                 2.Set test variables
4302  *                 3.The function of napi_create_buffer is called
4303  *                 4.Return value of function is napi_invalid_arg
4304  */
4305 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Buffer_0200, testing::ext::TestSize.Level1)
4306 {
4307     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Buffer_0200 start";
4308 
4309     napi_env env = (napi_env)engine_;
4310     napi_value Buffer = nullptr;
4311     void* BufferPtr = nullptr;
4312     size_t BufferSize = BUFFER_OVERMAX_SIZE;
4313 
4314     napi_status creatresult = napi_create_buffer(env, BufferSize, &BufferPtr, &Buffer);
4315     EXPECT_EQ(creatresult, napi_status::napi_invalid_arg);
4316     EXPECT_EQ(BufferPtr, nullptr);
4317 
4318     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Buffer_0200 end";
4319 }
4320 
4321 /*
4322  * @tc.number    : ACE_Napi_Create_Buffer_0300
4323  * @tc.name      : The parameter of buffer size is invalid(-1),
4324  *                 A node::Buffer object can  not be created
4325  * @tc.desc      : 1.The environment engine is created
4326  *                 2.Set test variables
4327  *                 3.The function of napi_create_buffer is called
4328  *                 4.Return value of function is napi_invalid_arg
4329  */
4330 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Buffer_0300, testing::ext::TestSize.Level2)
4331 {
4332     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Buffer_0300 start";
4333 
4334     napi_env env = (napi_env)engine_;
4335     napi_value Buffer = nullptr;
4336     void* BufferPtr = nullptr;
4337     size_t BufferSize = -1;
4338 
4339     GTEST_LOG_(INFO) << "BufferSize is" << BufferSize;
4340     napi_status creatresult = napi_create_buffer(env, BufferSize, &BufferPtr, &Buffer);
4341     EXPECT_EQ(creatresult, napi_status::napi_invalid_arg);
4342     EXPECT_EQ(BufferPtr, nullptr);
4343 
4344     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Buffer_0300 end";
4345 }
4346 
4347 /*
4348  * @tc.number    : ACE_Napi_Create_Buffer_0400
4349  * @tc.name      : The parameter of buffer size is invalid(0),
4350  *                 A node::Buffer object can  not be created
4351  * @tc.desc      : 1.The environment engine is created
4352  *                 2.Set test variables
4353  *                 3.The function of napi_create_buffer is called
4354  *                 4.Return value of function is napi_invalid_arg
4355  */
4356 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Buffer_0400, testing::ext::TestSize.Level2)
4357 {
4358     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Buffer_0400 start";
4359 
4360     napi_env env = (napi_env)engine_;
4361     napi_value Buffer = nullptr;
4362     void* BufferPtr = nullptr;
4363     size_t BufferSize = 0;
4364 
4365     napi_status creatresult = napi_create_buffer(env, BufferSize, &BufferPtr, &Buffer);
4366     EXPECT_EQ(creatresult, napi_status::napi_invalid_arg);
4367     EXPECT_EQ(BufferPtr, nullptr);
4368 
4369     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Buffer_0400 end";
4370 }
4371 
4372 /*
4373  * @tc.number    : ACE_Napi_Create_Buffer_0500
4374  * @tc.name      : Raw pointer to the underlying buffer is invalid(nullptr),
4375  *                 A node::Buffer object can  not be created
4376  * @tc.desc      : 1.The environment engine is created
4377  *                 2.Set test variables
4378  *                 3.The function of napi_create_buffer is called
4379  *                 4.Return value of function is napi_invalid_arg
4380  */
4381 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Buffer_0500, testing::ext::TestSize.Level2)
4382 {
4383     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Buffer_0500 start";
4384 
4385     napi_env env = (napi_env)engine_;
4386     napi_value Buffer = nullptr;
4387     size_t BufferSize = 1024;
4388 
4389     napi_status creatresult = napi_create_buffer(env, BufferSize, nullptr, &Buffer);
4390     EXPECT_EQ(creatresult, napi_status::napi_invalid_arg);
4391 
4392     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Buffer_0500 end";
4393 }
4394 
4395 /*
4396  * @tc.number    : ACE_Napi_Create_Buffer_0600
4397  * @tc.name      : The parameter of result is invalid(nullptr),
4398  *                 A node::Buffer object can  not be created
4399  * @tc.desc      : 1.The environment engine is created
4400  *                 2.Set test variables
4401  *                 3.The function of napi_create_buffer is called
4402  *                 4.Return value of function is napi_invalid_arg
4403  */
4404 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Buffer_0600, testing::ext::TestSize.Level2)
4405 {
4406     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Buffer_0600 start";
4407 
4408     napi_env env = (napi_env)engine_;
4409     void* BufferPtr = nullptr;
4410     size_t BufferSize = 1024;
4411 
4412     napi_status creatresult = napi_create_buffer(env, BufferSize, &BufferPtr, nullptr);
4413     EXPECT_EQ(creatresult, napi_status::napi_invalid_arg);
4414 
4415     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Buffer_0600 end";
4416 }
4417 
4418 /*
4419  * @tc.number    : ACE_Napi_Create_Buffer_0700
4420  * @tc.name      : The parameter of environment  is invalid(nullptr),
4421  *                 A node::Buffer object can  not be created
4422  * @tc.desc      : 1.The environment engine is created
4423  *                 2.Set test variables
4424  *                 3.The function of napi_create_buffer is called
4425  *                 4.Return value of function is napi_invalid_arg
4426  */
4427 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Buffer_0700, testing::ext::TestSize.Level2)
4428 {
4429     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Buffer_0700 start";
4430 
4431     napi_env env = nullptr;
4432     napi_value Buffer = nullptr;
4433     void* BufferPtr = nullptr;
4434     size_t BufferSize = 1024;
4435 
4436     napi_status creatresult = napi_create_buffer(env, BufferSize, &BufferPtr, &Buffer);
4437     EXPECT_EQ(creatresult, napi_status::napi_invalid_arg);
4438 
4439     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Buffer_0700 end";
4440 }
4441 
4442 /*
4443  * @tc.number    : ACE_Napi_Is_Buffer_0100
4444  * @tc.name      : The parameters of napi_is_buffer are valid,
4445  *                 The buffer is created by napi_create_buffer function,
4446  *                 Checks if the Object passed in is a buffer.
4447  * @tc.desc      : 1.The environment engine is created
4448  *                 2.Set test variables
4449  *                 3.The function of napi_create_buffer is used to create a new buffer
4450  *                 4.The function of napi_is_buffer is called
4451  *                 5.Return value of function is napi_ok
4452  */
4453 HWTEST_F(NativeEngineTest, ACE_Napi_Is_Buffer_0100, testing::ext::TestSize.Level1)
4454 {
4455     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Is_Buffer_0100 start";
4456 
4457     napi_env env = (napi_env)engine_;
4458     napi_value Buffer = nullptr;
4459     void* BufferPtr = nullptr;
4460     size_t BufferSize = 1024;
4461 
4462     napi_status creatresult = napi_create_buffer(env, BufferSize, &BufferPtr, &Buffer);
4463     EXPECT_EQ(creatresult, napi_status::napi_ok);
4464     bool isBuffer = false;
4465     napi_status isresult = napi_is_buffer(env, Buffer, &isBuffer);
4466     EXPECT_EQ(isresult, napi_status::napi_ok);
4467     EXPECT_TRUE(isBuffer);
4468 
4469     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Is_Buffer_0100 end";
4470 }
4471 
4472 /*
4473  * @tc.number    : ACE_Napi_Is_Buffer_0200
4474  * @tc.name      : The parameters of napi_is_buffer are valid,
4475  *                 The buffer is created by napi_create_buffer_copy function,
4476  *                 Checks if the Object passed in is a buffer.
4477  * @tc.desc      : 1.The environment engine is created
4478  *                 2.Set test variables
4479  *                 3.The function of napi_create_buffer_copy is used to create a new buffer
4480  *                 4.The function of napi_is_buffer is called
4481  *                 5.Return value of function is napi_ok
4482  */
4483 HWTEST_F(NativeEngineTest, ACE_Napi_Is_Buffer_0200, testing::ext::TestSize.Level1)
4484 {
4485     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Is_Buffer_0200 start";
4486 
4487     napi_env env = (napi_env)engine_;
4488     napi_value Buffer = nullptr;
4489     void* result_data = nullptr;
4490     size_t BufferSize = sizeof(Text);
4491 
4492     napi_status creatresult = napi_create_buffer_copy(env, BufferSize, Text, &result_data, &Buffer);
4493     EXPECT_EQ(creatresult, napi_status::napi_ok);
4494     bool isBuffer = false;
4495     napi_status isresult = napi_is_buffer(env, Buffer, &isBuffer);
4496     EXPECT_EQ(isresult, napi_status::napi_ok);
4497     EXPECT_TRUE(isBuffer);
4498 
4499     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Is_Buffer_0200 end";
4500 }
4501 
4502 /*
4503  * @tc.number    : ACE_Napi_Is_Buffer_0300
4504  * @tc.name      : The parameters of napi_is_buffer are valid,
4505  *                 The buffer is created by napi_create_external_buffer function,
4506  *                 Checks if the Object passed in is a buffer.
4507  * @tc.desc      : 1.The environment engine is created
4508  *                 2.Set test variables
4509  *                 3.The function of napi_create_external_buffer is used to create a new buffer
4510  *                 4.The function of napi_is_buffer is called
4511  *                 5.Return value of function is napi_ok
4512  */
4513 HWTEST_F(NativeEngineTest, ACE_Napi_Is_Buffer_0300, testing::ext::TestSize.Level1)
4514 {
4515     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Is_Buffer_0300 start";
4516 
4517     napi_env env = (napi_env)engine_;
4518     napi_value Buffer = nullptr;
4519     size_t BufferSize = sizeof(Text);
4520 
4521     napi_status creatresult = napi_create_external_buffer(env, BufferSize, Text, BufferFinalizer, nullptr, &Buffer);
4522     EXPECT_EQ(creatresult, napi_status::napi_ok);
4523     bool isBuffer = false;
4524     napi_status isresult = napi_is_buffer(env, Buffer, &isBuffer);
4525     EXPECT_EQ(isresult, napi_status::napi_ok);
4526     EXPECT_TRUE(isBuffer);
4527 
4528     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Is_Buffer_0300 end";
4529 }
4530 
4531 /*
4532  * @tc.number    : ACE_Napi_Is_Buffer_0400
4533  * @tc.name      : The JavaScript value to check is invalid
4534  * @tc.desc      : 1.The environment engine is created
4535  *                 2.Set test variables
4536  *                 3.The function of napi_create_buffer is used to create a invalid buffer
4537  *                 4.The function of napi_is_buffer is called
4538  *                 5.Return value of function is napi_invalid_arg
4539  */
4540 HWTEST_F(NativeEngineTest, ACE_Napi_Is_Buffer_0400, testing::ext::TestSize.Level2)
4541 {
4542     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Is_Buffer_0400 start";
4543 
4544     napi_env env = (napi_env)engine_;
4545     napi_value Buffer = nullptr;
4546     void* BufferPtr = nullptr;
4547     size_t BufferSize = -1;
4548 
4549     napi_status creatresult = napi_create_buffer(env, BufferSize, &BufferPtr, &Buffer);
4550     EXPECT_EQ(creatresult, napi_status::napi_invalid_arg);
4551     EXPECT_EQ(BufferPtr, nullptr);
4552     bool isBuffer = false;
4553     napi_status isresult = napi_is_buffer(env, Buffer, &isBuffer);
4554     EXPECT_EQ(isresult, napi_status::napi_invalid_arg);
4555     EXPECT_FALSE(isBuffer);
4556 
4557     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Is_Buffer_0400 end";
4558 }
4559 
4560 /*
4561  * @tc.number    : ACE_Napi_Is_Buffer_0500
4562  * @tc.name      : The out parameter of result is invalid(nullptr)
4563  * @tc.desc      : 1.The environment engine is created
4564  *                 2.Set test variables
4565  *                 3.The function of napi_create_buffer is used to create a valid buffer
4566  *                 4.The function of napi_is_buffer is called
4567  *                 5.Return value of function is napi_invalid_arg
4568  */
4569 HWTEST_F(NativeEngineTest, ACE_Napi_Is_Buffer_0500, testing::ext::TestSize.Level2)
4570 {
4571     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Is_Buffer_0500 start";
4572 
4573     napi_env env = (napi_env)engine_;
4574     napi_value Buffer = nullptr;
4575     void* BufferPtr = nullptr;
4576     size_t BufferSize = 1024;
4577 
4578     napi_status creatresult = napi_create_buffer(env, BufferSize, &BufferPtr, &Buffer);
4579     EXPECT_EQ(creatresult, napi_status::napi_ok);
4580     napi_status isresult = napi_is_buffer(env, Buffer, nullptr);
4581     EXPECT_EQ(isresult, napi_status::napi_invalid_arg);
4582 
4583     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Is_Buffer_0500 end";
4584 }
4585 
4586 /*
4587  * @tc.number    : ACE_Napi_Is_Buffer_0600
4588  * @tc.name      : The parameter of environment is invalid(nullptr)
4589  * @tc.desc      : 1.The environment engine is created
4590  *                 2.Set test variables
4591  *                 3.The function of napi_create_buffer is used to create a valid buffer
4592  *                 4.The function of napi_is_buffer is called
4593  *                 5.Return value of function is napi_invalid_arg
4594  */
4595 HWTEST_F(NativeEngineTest, ACE_Napi_Is_Buffer_0600, testing::ext::TestSize.Level2)
4596 {
4597     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Is_Buffer_0600 start";
4598 
4599     napi_env envone = (napi_env)engine_;
4600     napi_env envtwo = nullptr;
4601     napi_value Buffer = nullptr;
4602     void* BufferPtr = nullptr;
4603     size_t BufferSize = 1024;
4604 
4605     napi_status creatresult = napi_create_buffer(envone, BufferSize, &BufferPtr, &Buffer);
4606     EXPECT_EQ(creatresult, napi_status::napi_ok);
4607     bool isBuffer = false;
4608     napi_status isresult = napi_is_buffer(envtwo, Buffer, &isBuffer);
4609     EXPECT_EQ(isresult, napi_status::napi_invalid_arg);
4610     EXPECT_FALSE(isBuffer);
4611 
4612     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Is_Buffer_0600 end";
4613 }
4614 
4615 /*
4616  * @tc.number    : ACE_Napi_Get_Buffer_Info_0100
4617  * @tc.name      : The parameters of napi_is_buffer are valid,
4618  *                 The buffer is created by napi_create_buffer function,
4619  *                 Checks if the Object passed in is a buffer.
4620  * @tc.desc      : 1.The environment engine is created
4621  *                 2.Set test variables
4622  *                 3.The function of napi_create_buffer is used to create a new buffer
4623  *                 4.The function of napi_get_buffer_info is called
4624  *                 5.Return value of function is napi_ok
4625  */
4626 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Buffer_Info_0100, testing::ext::TestSize.Level1)
4627 {
4628     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Buffer_Info_0100 start";
4629 
4630     napi_env env = (napi_env)engine_;
4631     napi_value Buffer = nullptr;
4632     void* BufferPtr = nullptr;
4633     size_t BufferSize = 1024;
4634 
4635     napi_status creatresult = napi_create_buffer(env, BufferSize, &BufferPtr, &Buffer);
4636     EXPECT_EQ(creatresult, napi_status::napi_ok);
4637     void* tmpBufferPtr = nullptr;
4638     size_t BufferLength = 0;
4639     napi_status getinforesult = napi_get_buffer_info(env, Buffer, &tmpBufferPtr, &BufferLength);
4640     EXPECT_EQ(getinforesult, napi_status::napi_ok);
4641     EXPECT_EQ(BufferPtr, tmpBufferPtr);
4642     GTEST_LOG_(INFO) << "*tmpBufferPtr"<<(char*)tmpBufferPtr;
4643     EXPECT_EQ(strcmp((char*)tmpBufferPtr, ""), 0);
4644     EXPECT_EQ(BufferSize, BufferLength);
4645 
4646     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Buffer_Info_0100 end";
4647 }
4648 
4649 /*
4650  * @tc.number    : ACE_Napi_Get_Buffer_Info_0200
4651  * @tc.name      : The parameter of value is invalid
4652  * @tc.desc      : 1.The environment engine is created
4653  *                 2.Set test variables
4654  *                 3.The function of napi_create_buffer_copy is used to create a invalid buffer
4655  *                 4.The function of napi_get_buffer_info is called
4656  *                 5.Return value of function is napi_ok
4657  */
4658 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Buffer_Info_0200, testing::ext::TestSize.Level1)
4659 {
4660     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Buffer_Info_0200 start";
4661 
4662     napi_env env = (napi_env)engine_;
4663     napi_value Buffer = nullptr;
4664     void* result_data = nullptr;
4665     size_t BufferSize = sizeof(Text);
4666 
4667     napi_status creatresult = napi_create_buffer_copy(env, BufferSize, Text, &result_data, &Buffer);
4668     EXPECT_EQ(creatresult, napi_status::napi_ok);
4669     void* tmpBufferPtr = nullptr;
4670     size_t BufferLength = 0;
4671     napi_status getinforesult = napi_get_buffer_info(env, Buffer, &tmpBufferPtr, &BufferLength);
4672     EXPECT_EQ(getinforesult, napi_status::napi_ok);
4673     GTEST_LOG_(INFO) << "*tmpBufferPtr"<<(char*)tmpBufferPtr;
4674     EXPECT_EQ(strcmp((char*)tmpBufferPtr, "hello world"), 0);
4675     EXPECT_EQ(result_data, tmpBufferPtr);
4676     EXPECT_EQ(BufferSize, BufferLength);
4677 
4678     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Buffer_Info_0200 end";
4679 }
4680 
4681 /*
4682  * @tc.number    : ACE_Napi_Get_Buffer_Info_0300
4683  * @tc.name      : The parameter of value is invalid(nullptr)
4684  * @tc.desc      : 1.The environment engine is created
4685  *                 2.Set test variables
4686  *                 3.The function of napi_get_buffer_info is called
4687  *                 4.Return value of function is napi_invalid_arg
4688  */
4689 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Buffer_Info_0300, testing::ext::TestSize.Level2)
4690 {
4691     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Buffer_Info_0300 start";
4692 
4693     napi_env env = (napi_env)engine_;
4694     napi_value Buffer = nullptr;
4695     void* tmpBufferPtr = nullptr;
4696     size_t BufferLength = 0;
4697 
4698     napi_status getinforesult = napi_get_buffer_info(env, Buffer, &tmpBufferPtr, &BufferLength);
4699     EXPECT_EQ(getinforesult, napi_status::napi_invalid_arg);
4700     EXPECT_EQ(nullptr, tmpBufferPtr);
4701 
4702     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Buffer_Info_0300 end";
4703 }
4704 
4705 /*
4706  * @tc.number    : ACE_Napi_Get_Buffer_Info_0400
4707  * @tc.name      : The parameters of data buffer and length are invalid
4708  * @tc.desc      : 1.The environment engine is created
4709  *                 2.Set test variables
4710  *                 3.The function of napi_get_buffer_info is called
4711  *                 4.Return value of function is napi_ok
4712  */
4713 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Buffer_Info_0400, testing::ext::TestSize.Level1)
4714 {
4715     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Buffer_Info_0400 start";
4716 
4717     napi_env env = (napi_env)engine_;
4718     napi_value Buffer = nullptr;
4719     void* BufferPtr = nullptr;
4720     size_t BufferSize = 1024;
4721 
4722     napi_status creatresult = napi_create_buffer(env, BufferSize, &BufferPtr, &Buffer);
4723     EXPECT_EQ(creatresult, napi_status::napi_ok);
4724     size_t BufferLength = 0;
4725     napi_status getinforesult = napi_get_buffer_info(env, Buffer, nullptr, &BufferLength);
4726     GTEST_LOG_(INFO) << "BufferLength" << BufferLength;
4727     EXPECT_EQ(getinforesult, napi_status::napi_ok);
4728     EXPECT_EQ(BufferLength, BufferSize);
4729 
4730     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Buffer_Info_0400 end";
4731 }
4732 
4733 /*
4734  * @tc.number    : ACE_Napi_Get_Buffer_Info_0500
4735  * @tc.name      : The parameters of length is invalid
4736  * @tc.desc      : 1.The environment engine is created
4737  *                 2.Set test variables
4738  *                 3.The function of napi_get_buffer_info is called
4739  *                 4.Return value of function is napi_ok
4740  */
4741 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Buffer_Info_0500, testing::ext::TestSize.Level1)
4742 {
4743     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Buffer_Info_0500 start";
4744 
4745     napi_env env = (napi_env)engine_;
4746     napi_value Buffer = nullptr;
4747     void* BufferPtr = nullptr;
4748     size_t BufferSize = 1024;
4749 
4750     napi_status creatresult = napi_create_buffer(env, BufferSize, &BufferPtr, &Buffer);
4751     EXPECT_EQ(creatresult, napi_status::napi_ok);
4752     void* tmpBufferPtr = nullptr;
4753     napi_status getinforesult = napi_get_buffer_info(env, Buffer, &tmpBufferPtr, nullptr);
4754     GTEST_LOG_(INFO) << "*tmpBufferPtr"<<(char*)tmpBufferPtr;
4755     EXPECT_EQ(strcmp((char*)tmpBufferPtr, ""), 0);
4756     EXPECT_EQ(getinforesult, napi_status::napi_ok);
4757     EXPECT_EQ(tmpBufferPtr, BufferPtr);
4758 
4759     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Buffer_Info_0500 end";
4760 }
4761 
4762 /*
4763  * @tc.number    : ACE_Napi_Get_Buffer_Info_0600
4764  * @tc.name      : The parameters of environment is invalid
4765  * @tc.desc      : 1.The environment engine is created
4766  *                 2.Set test variables
4767  *                 3.The function of napi_get_buffer_info is called
4768  *                 4.Return value of function is napi_invalid_arg
4769  */
4770 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Buffer_Info_0600, testing::ext::TestSize.Level2)
4771 {
4772     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Buffer_Info_0600 start";
4773 
4774     napi_env envone = (napi_env)engine_;
4775     napi_env envtwo = nullptr;
4776     napi_value Buffer = nullptr;
4777     void* BufferPtr = nullptr;
4778     size_t BufferSize = 1024;
4779 
4780     napi_status creatresult = napi_create_buffer(envone, BufferSize, &BufferPtr, &Buffer);
4781     EXPECT_EQ(creatresult, napi_status::napi_ok);
4782     void* tmpBufferPtr = nullptr;
4783     size_t BufferLength = 0;
4784     napi_status getinforesult = napi_get_buffer_info(envtwo, Buffer, &tmpBufferPtr, &BufferLength);
4785     EXPECT_EQ(getinforesult, napi_status::napi_invalid_arg);
4786 
4787     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Buffer_Info_0600 end";
4788 }
4789 
4790 /*
4791  * @tc.number    : ACE_Napi_Create_Buffer_Copy_0100
4792  * @tc.name      : The data of raw pointer to the underlying buffer to copy from is invalid.
4793  * @tc.desc      : 1.The environment engine is created
4794  *                 2.Set test variables
4795  *                 3.The function of napi_create_buffer_copy is called
4796  *                 4.Return value of function is napi_invalid_arg
4797  */
4798 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Buffer_Copy_0100, testing::ext::TestSize.Level2)
4799 {
4800     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Buffer_Copy_0100 start";
4801 
4802     napi_env env = (napi_env)engine_;
4803     napi_value Buffer = nullptr;
4804     void* result_data = nullptr;
4805     size_t BufferSize = 1;
4806 
4807     napi_status creatresult = napi_create_buffer_copy(env, BufferSize, nullptr, &result_data, &Buffer);
4808     EXPECT_EQ(creatresult, napi_status::napi_invalid_arg);
4809     void* tmpBufferPtr = nullptr;
4810     size_t BufferLength = 0;
4811     napi_status getinforesult = napi_get_buffer_info(env, Buffer, &tmpBufferPtr, &BufferLength);
4812     EXPECT_EQ(getinforesult, napi_status::napi_invalid_arg);
4813     EXPECT_EQ(tmpBufferPtr, nullptr);
4814     EXPECT_EQ(BufferLength, (size_t)0);
4815 
4816     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Buffer_Copy_0100 end";
4817 }
4818 
4819 /*
4820  * @tc.number    : ACE_Napi_Create_Buffer_Copy_0200
4821  * @tc.name      : The size of buffer is over maxnum.
4822  * @tc.desc      : 1.The environment engine is created
4823  *                 2.Set test variables
4824  *                 3.The function of napi_create_buffer_copy is called
4825  *                 4.Return value of function is napi_invalid_arg
4826  */
4827 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Buffer_Copy_0200, testing::ext::TestSize.Level2)
4828 {
4829     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Buffer_Copy_0200 start";
4830 
4831     napi_env env = (napi_env)engine_;
4832     napi_value Buffer = nullptr;
4833     void* result_data = nullptr;
4834 
4835     size_t BufferSize = BUFFER_OVERMAX_SIZE;
4836 
4837     napi_status creatresult = napi_create_buffer_copy(env, BufferSize, Text, &result_data, &Buffer);
4838 
4839     EXPECT_EQ(creatresult, napi_status::napi_invalid_arg);
4840     void* tmpBufferPtr = nullptr;
4841     size_t BufferLength = 0;
4842     napi_status getinforesult = napi_get_buffer_info(env, Buffer, &tmpBufferPtr, &BufferLength);
4843     EXPECT_EQ(getinforesult, napi_status::napi_invalid_arg);
4844     EXPECT_EQ(tmpBufferPtr, nullptr);
4845     EXPECT_EQ(BufferLength, size_t(0));
4846 
4847     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Buffer_Copy_0200 end";
4848 }
4849 
4850 /*
4851  * @tc.number    : ACE_Napi_Create_Buffer_Copy_0300
4852  * @tc.name      : The parameters of size(BUFFER_OVERMAX_SIZE) and data are invalid
4853  * @tc.desc      : 1.The environment engine is created
4854  *                 2.Set test variables
4855  *                 3.The function of napi_create_buffer_copy is called
4856  *                 4.Return value of function is napi_invalid_arg
4857  */
4858 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Buffer_Copy_0300, testing::ext::TestSize.Level2)
4859 {
4860     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Buffer_Copy_0300 start";
4861 
4862     napi_env env = (napi_env)engine_;
4863     napi_value Buffer = nullptr;
4864     void* result_data = nullptr;
4865     size_t BufferSize = BUFFER_OVERMAX_SIZE;
4866 
4867     napi_status creatresult = napi_create_buffer_copy(env, BufferSize, nullptr, &result_data, &Buffer);
4868     EXPECT_EQ(creatresult, napi_status::napi_invalid_arg);
4869     void* tmpBufferPtr = nullptr;
4870     size_t BufferLength = 0;
4871     napi_status getinforesult = napi_get_buffer_info(env, Buffer, &tmpBufferPtr, &BufferLength);
4872     EXPECT_EQ(getinforesult, napi_status::napi_invalid_arg);
4873     EXPECT_EQ(tmpBufferPtr, nullptr);
4874     EXPECT_EQ(BufferLength, (size_t)0);
4875 
4876     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Buffer_Copy_0300 end";
4877 }
4878 
4879 /*
4880  * @tc.number    : ACE_Napi_Create_Buffer_Copy_0400
4881  * @tc.name      : The parameters of size(-1) and data are invalid
4882  * @tc.desc      : 1.The environment engine is created
4883  *                 2.Set test variables
4884  *                 3.The function of napi_create_buffer_copy is called
4885  *                 4.Return value of function is napi_invalid_arg
4886  */
4887 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Buffer_Copy_0400, testing::ext::TestSize.Level2)
4888 {
4889     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Buffer_Copy_0400 start";
4890 
4891     napi_env env = (napi_env)engine_;
4892     napi_value Buffer = nullptr;
4893     void* result_data = nullptr;
4894     size_t BufferSize = -1;
4895 
4896     napi_status creatresult = napi_create_buffer_copy(env, BufferSize, Text, &result_data, &Buffer);
4897     EXPECT_EQ(creatresult, napi_status::napi_invalid_arg);
4898     void* tmpBufferPtr = nullptr;
4899     size_t BufferLength = 0;
4900     napi_status getinforesult = napi_get_buffer_info(env, Buffer, &tmpBufferPtr, &BufferLength);
4901     EXPECT_EQ(getinforesult, napi_status::napi_invalid_arg);
4902     EXPECT_EQ(tmpBufferPtr, nullptr);
4903 
4904     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Buffer_Copy_0400 end";
4905 }
4906 
4907 /*
4908  * @tc.number    : ACE_Napi_Create_Buffer_Copy_0500
4909  * @tc.name      : The parameter of size(0) is invalid
4910  * @tc.desc      : 1.The environment engine is created
4911  *                 2.Set test variables
4912  *                 3.The function of napi_create_buffer_copy is called
4913  *                 4.Return value of function is napi_invalid_arg
4914  */
4915 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Buffer_Copy_0500, testing::ext::TestSize.Level2)
4916 {
4917     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Buffer_Copy_0500 start";
4918 
4919     napi_env env = (napi_env)engine_;
4920     napi_value Buffer = nullptr;
4921     void* result_data = nullptr;
4922     size_t BufferSize = 0;
4923 
4924     napi_status creatresult = napi_create_buffer_copy(env, BufferSize, Text, &result_data, &Buffer);
4925     EXPECT_EQ(creatresult, napi_status::napi_invalid_arg);
4926     void* tmpBufferPtr = nullptr;
4927     size_t BufferLength = 0;
4928     napi_status getinforesult = napi_get_buffer_info(env, Buffer, &tmpBufferPtr, &BufferLength);
4929     EXPECT_EQ(getinforesult, napi_status::napi_invalid_arg);
4930     EXPECT_EQ(tmpBufferPtr, nullptr);
4931 
4932     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Buffer_Copy_0500 end";
4933 }
4934 
4935 /*
4936  * @tc.number    : ACE_Napi_Create_Buffer_Copy_0600
4937  * @tc.name      : The parameters of napi_create_buffer_copy are valid,
4938  *                 The buffer is created by napi_create_buffer_copy function.
4939  * @tc.desc      : 1.The environment engine is created
4940  *                 2.Set test variables
4941  *                 3.The function of napi_create_buffer_copy is used to create a new buffer
4942  *                 4.Return value of function is napi_ok
4943  *                 5.The function of napi_get_buffer_info is called
4944  *                 6.Return value of function is napi_ok
4945  */
4946 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Buffer_Copy_0600, testing::ext::TestSize.Level1)
4947 {
4948     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Buffer_Copy_0600 start";
4949 
4950     napi_env env = (napi_env)engine_;
4951     napi_value Buffer = nullptr;
4952     void* Bufferptr = nullptr;
4953     size_t BufferSize = sizeof(Text) - 2;
4954 
4955     napi_status creatresult = napi_create_buffer_copy(env, BufferSize, Text, &Bufferptr, &Buffer);
4956     GTEST_LOG_(INFO) << "*Bufferptr"<<(char*)Bufferptr;
4957     EXPECT_EQ(creatresult, napi_status::napi_ok);
4958     void* tmpBufferPtr = nullptr;
4959     size_t BufferLength = 0;
4960     napi_status getinforesult = napi_get_buffer_info(env, Buffer, &tmpBufferPtr, &BufferLength);
4961     EXPECT_EQ(getinforesult, napi_status::napi_ok);
4962     GTEST_LOG_(INFO) << "*tmpBufferPtr"<<(char*)tmpBufferPtr;
4963     EXPECT_EQ(memcmp((char*)tmpBufferPtr, "hello worl", 10), 0);
4964     EXPECT_EQ(tmpBufferPtr, Bufferptr);
4965     EXPECT_EQ(BufferLength, sizeof(Text) - 2);
4966 
4967     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Buffer_Copy_0600 end";
4968 }
4969 
4970 /*
4971  * @tc.number    : ACE_Napi_Create_Buffer_Copy_0700
4972  * @tc.name      : The parameter of pointer to the new Buffer's underlying data buffer is invalid,
4973  *                 The buffer is created by napi_create_buffer_copy function.
4974  * @tc.desc      : 1.The environment engine is created
4975  *                 2.Set test variables
4976  *                 3.The function of napi_create_buffer_copy is used to create a new buffer
4977  *                 4.Return value of function is napi_ok
4978  *                 5.The function of napi_get_buffer_info is called
4979  *                 6.Return value of function is napi_ok
4980  */
4981 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Buffer_Copy_0700, testing::ext::TestSize.Level1)
4982 {
4983     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Buffer_Copy_0700 start";
4984 
4985     napi_env env = (napi_env)engine_;
4986     napi_value Buffer = nullptr;
4987     void* result_data = nullptr;
4988     size_t BufferSize = sizeof(Text);
4989 
4990     napi_status creatresult = napi_create_buffer_copy(env, BufferSize, Text, &result_data, &Buffer);
4991     EXPECT_EQ(creatresult, napi_status::napi_ok);
4992     void* tmpBufferPtr = nullptr;
4993     size_t BufferLength = 0;
4994     napi_status getinforesult = napi_get_buffer_info(env, Buffer, &tmpBufferPtr, &BufferLength);
4995     EXPECT_EQ(getinforesult, napi_status::napi_ok);
4996     GTEST_LOG_(INFO) << "*tmpBufferPtr"<<(char*)tmpBufferPtr;
4997     EXPECT_EQ(strcmp((char*)tmpBufferPtr, "hello world"), 0);
4998     EXPECT_NE(tmpBufferPtr, nullptr);
4999     EXPECT_EQ(BufferLength, BufferSize);
5000 
5001     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Buffer_Copy_0700 end";
5002 }
5003 
5004 /*
5005  * @tc.number    : ACE_Napi_Create_Buffer_Copy_0800
5006  * @tc.name      : The parameter of result is invalid,
5007  *                 The buffer can not be created by napi_create_buffer_copy function.
5008  * @tc.desc      : 1.The environment engine is created
5009  *                 2.Set test variables
5010  *                 3.The function of napi_create_buffer_copy is used to create a new buffer
5011  *                 4.Return value of function is napi_invalid_arg
5012  *                 5.The function of napi_get_buffer_info is called
5013  *                 6.Return value of function is napi_invalid_arg
5014  */
5015 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Buffer_Copy_0800, testing::ext::TestSize.Level2)
5016 {
5017     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Buffer_Copy_0800 start";
5018 
5019     napi_env env = (napi_env)engine_;
5020     napi_value Buffer = nullptr;
5021     void* result_data = nullptr;
5022     size_t BufferSize = sizeof(Text);
5023 
5024     napi_status creatresult = napi_create_buffer_copy(env, BufferSize, Text, &result_data, nullptr);
5025     EXPECT_EQ(creatresult, napi_status::napi_invalid_arg);
5026     void* tmpBufferPtr = nullptr;
5027     size_t BufferLength = 0;
5028     napi_status getinforesult = napi_get_buffer_info(env, Buffer, &tmpBufferPtr, &BufferLength);
5029     EXPECT_EQ(getinforesult, napi_status::napi_invalid_arg);
5030     EXPECT_EQ(tmpBufferPtr, nullptr);
5031 
5032     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Buffer_Copy_0800 end";
5033 }
5034 
5035 /*
5036  * @tc.number    : ACE_Napi_Create_Buffer_Copy_0900
5037  * @tc.name      : The parameter of environment is invalid,
5038  *                 The buffer can not be created by napi_create_buffer_copy function.
5039  * @tc.desc      : 1.The environment engine is created
5040  *                 2.Set test variables
5041  *                 3.The function of napi_create_buffer_copy is used to create a new buffer
5042  *                 4.Return value of function is napi_invalid_arg
5043  *                 5.The function of napi_get_buffer_info is called
5044  *                 6.Return value of function is napi_invalid_arg
5045  */
5046 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Buffer_Copy_0900, testing::ext::TestSize.Level2)
5047 {
5048     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Buffer_Copy_0900 start";
5049 
5050     napi_env envinfo = (napi_env)engine_;
5051     napi_env envcopy = nullptr;
5052     napi_value Buffer = nullptr;
5053     void* result_data = nullptr;
5054     size_t BufferSize = sizeof(Text);
5055 
5056     napi_status creatresult = napi_create_buffer_copy(envcopy, BufferSize, Text, &result_data, &Buffer);
5057     EXPECT_EQ(creatresult, napi_status::napi_invalid_arg);
5058     void* tmpBufferPtr = nullptr;
5059     size_t BufferLength = 0;
5060     napi_status getinforesult = napi_get_buffer_info(envinfo, Buffer, &tmpBufferPtr, &BufferLength);
5061     EXPECT_EQ(getinforesult, napi_status::napi_invalid_arg);
5062     EXPECT_EQ(tmpBufferPtr, nullptr);
5063 
5064     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Buffer_Copy_0900 end";
5065 }
5066 
5067 /*
5068  * @tc.number    : ACE_Napi_Create_Buffer_Copy_1000
5069  * @tc.name      : The parameter of environment is invalid,
5070  *                 The buffer can not be created by napi_create_buffer_copy function.
5071  * @tc.desc      : 1.The environment engine is created.
5072  *                 2.Set test variables.
5073  *                 3.The function of napi_create_buffer_copy is used to create
5074  *                   a new buffer when the BufferSize is larger then buffer.
5075  *                 4.Return value of function is napi_ok.
5076  *                 5.The function of napi_get_buffer_info is called.
5077  *                 6.Return value of function is napi_ok.
5078  */
5079 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Buffer_Copy_1000, testing::ext::TestSize.Level1)
5080 {
5081     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Buffer_Copy_1000 start";
5082 
5083     napi_env env = (napi_env)engine_;
5084     napi_value Buffer = nullptr;
5085     void* result_data = nullptr;
5086     size_t BufferSize = 1024;
5087 
5088     napi_status creatresult = napi_create_buffer_copy(env, BufferSize, Text, &result_data, &Buffer);
5089     EXPECT_EQ(creatresult, napi_status::napi_ok);
5090     void* tmpBufferPtr = nullptr;
5091     size_t BufferLength = 0;
5092     napi_status getinforesult = napi_get_buffer_info(env, Buffer, &tmpBufferPtr, &BufferLength);
5093     EXPECT_EQ(getinforesult, napi_status::napi_ok);
5094     GTEST_LOG_(INFO) << "*tmpBufferPtr"<<(char*)tmpBufferPtr;
5095     EXPECT_EQ(strcmp((char*)tmpBufferPtr, "hello world"), 0);
5096     EXPECT_NE(tmpBufferPtr, nullptr);
5097     EXPECT_EQ(BufferLength, (size_t)1024);
5098 
5099     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Buffer_Copy_1000 end";
5100 }
5101 
5102 /*
5103  * @tc.number    : ACE_Napi_Create_External_Buffer_0100
5104  * @tc.name      : The parameters of napi_create_external_buffer are valid,
5105  *                 The buffer is created by napi_create_external_buffer function.
5106  * @tc.desc      : 1.The environment engine is created
5107  *                 2.Set test variables
5108  *                 3.The function of napi_create_external_buffer is used to create a new buffer
5109  *                 4.Return value of function is napi_ok
5110  *                 5.The function of napi_get_buffer_info is called
5111  *                 6.Return value of function is napi_ok
5112  */
5113 HWTEST_F(NativeEngineTest, ACE_Napi_Create_External_Buffer_0100, testing::ext::TestSize.Level1)
5114 {
5115     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_External_Buffer_0100 start";
5116 
5117     napi_env env = (napi_env)engine_;
5118     napi_value Buffer = nullptr;
5119     size_t BufferSize = 1;
5120 
5121     napi_status creatresult = napi_create_external_buffer(env, BufferSize, Text, BufferFinalizer, nullptr, &Buffer);
5122     EXPECT_EQ(creatresult, napi_status::napi_ok);
5123     void* tmpBufferPtr = nullptr;
5124     size_t BufferLength = 0;
5125     napi_status getinforesult = napi_get_buffer_info(env, Buffer, &tmpBufferPtr, &BufferLength);
5126     EXPECT_EQ(getinforesult, napi_status::napi_ok);
5127     GTEST_LOG_(INFO) << "*tmpBufferPtr"<<(char*)tmpBufferPtr;
5128     EXPECT_EQ(strcmp((char*)tmpBufferPtr, "hello world"), 0);
5129     EXPECT_NE(tmpBufferPtr, nullptr);
5130     EXPECT_EQ(BufferLength, BufferSize);
5131 
5132     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_External_Buffer_0100 end";
5133 }
5134 
5135 /*
5136  * @tc.number    : ACE_Napi_Create_External_Buffer_0200
5137  * @tc.name      : The parameter of buffer size is over maxnum,
5138  *                 The buffer can not be created by napi_create_external_buffer function.
5139  * @tc.desc      : 1.The environment engine is created
5140  *                 2.Set test variables
5141  *                 3.The function of napi_create_external_buffer is used to create a new buffer
5142  *                 4.Return value of function is napi_invalid_arg
5143  */
5144 HWTEST_F(NativeEngineTest, ACE_Napi_Create_External_Buffer_0200, testing::ext::TestSize.Level2)
5145 {
5146     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_External_Buffer_0200 start";
5147 
5148     napi_env env = (napi_env)engine_;
5149     napi_value Buffer = nullptr;
5150     size_t BufferSize = BUFFER_OVERMAX_SIZE;
5151 
5152     napi_status creatresult = napi_create_external_buffer(env, BufferSize, Text, BufferFinalizer, nullptr, &Buffer);
5153     EXPECT_EQ(creatresult, napi_status::napi_invalid_arg);
5154 
5155     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_External_Buffer_0200 end";
5156 }
5157 
5158 /*
5159  * @tc.number    : ACE_Napi_Create_External_Buffer_0300
5160  * @tc.name      : The parameter of result is invalid,
5161  *                 The buffer can not be created by napi_create_external_buffer function.
5162  * @tc.desc      : 1.The environment engine is created
5163  *                 2.Set test variables
5164  *                 3.The function of napi_create_external_buffer is used to create a new buffer
5165  *                 4.Return value of function is napi_invalid_arg
5166  */
5167 HWTEST_F(NativeEngineTest, ACE_Napi_Create_External_Buffer_0300, testing::ext::TestSize.Level2)
5168 {
5169     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_External_Buffer_0300 start";
5170 
5171     napi_env env = (napi_env)engine_;
5172     napi_value Buffer = nullptr;
5173     size_t BufferSize = 0;
5174 
5175     napi_status creatresult = napi_create_external_buffer(env, BufferSize, Text, BufferFinalizer, nullptr, &Buffer);
5176     EXPECT_EQ(creatresult, napi_status::napi_invalid_arg);
5177 
5178     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_External_Buffer_0300 end";
5179 }
5180 
5181 /*
5182  * @tc.number    : ACE_Napi_Create_External_Buffer_0400
5183  * @tc.name      : The parameters of finalize_cb and finalize_hint are invalid,
5184  *                 The buffer is created by napi_create_external_buffer function.
5185  * @tc.desc      : 1.The environment engine is created
5186  *                 2.Set test variables
5187  *                 3.The function of napi_create_external_buffer is used to create a new buffer
5188  *                 4.Return value of function is napi_ok
5189  *                 5.The function of napi_get_buffer_info is called
5190  *                 6.Return value of function is napi_ok
5191  */
5192 HWTEST_F(NativeEngineTest, ACE_Napi_Create_External_Buffer_0400, testing::ext::TestSize.Level1)
5193 {
5194     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_External_Buffer_0400 start";
5195 
5196     napi_env env = (napi_env)engine_;
5197     napi_value Buffer = nullptr;
5198     size_t BufferSize = sizeof(Text);
5199 
5200     napi_status creatresult = napi_create_external_buffer(env, BufferSize, Text, nullptr, nullptr, &Buffer);
5201     EXPECT_EQ(creatresult, napi_status::napi_ok);
5202     void* tmpBufferPtr = nullptr;
5203     size_t BufferLength = 0;
5204     napi_status getinforesult = napi_get_buffer_info(env, Buffer, &tmpBufferPtr, &BufferLength);
5205     EXPECT_EQ(getinforesult, napi_status::napi_ok);
5206     GTEST_LOG_(INFO) << "*tmpBufferPtr"<<(char*)tmpBufferPtr;
5207     EXPECT_EQ(strcmp((char*)tmpBufferPtr, "hello world"), 0);
5208     EXPECT_NE(tmpBufferPtr, nullptr);
5209     EXPECT_EQ(BufferLength, size_t(12));
5210 
5211     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_External_Buffer_0400 end";
5212 }
5213 
5214 /*
5215  * @tc.number    : ACE_Napi_Create_External_Buffer_0500
5216  * @tc.name      : The parameter of buffer size is invalid,
5217  *                 The buffer can not be created by napi_create_external_buffer function.
5218  * @tc.desc      : 1.The environment engine is created
5219  *                 2.Set test variables
5220  *                 3.The function of napi_create_external_buffer is used to create a new buffer
5221  *                 4.Return value of function is napi_invalid_arg
5222  */
5223 HWTEST_F(NativeEngineTest, ACE_Napi_Create_External_Buffer_0500, testing::ext::TestSize.Level2)
5224 {
5225     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_External_Buffer_0500 start";
5226 
5227     napi_env env = (napi_env)engine_;
5228     napi_value Buffer = nullptr;
5229     size_t BufferSize = -1;
5230 
5231     napi_status creatresult = napi_create_external_buffer(env, BufferSize, Text, BufferFinalizer, nullptr, &Buffer);
5232     EXPECT_EQ(creatresult, napi_status::napi_invalid_arg);
5233 
5234     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_External_Buffer_0500 end";
5235 }
5236 
5237 /*
5238  * @tc.number    : ACE_Napi_Create_External_Buffer_0600
5239  * @tc.name      : The parameter of environment is invalid,
5240  *                 The buffer can not be created by napi_create_external_buffer function.
5241  * @tc.desc      : 1.The environment engine is created
5242  *                 2.Set test variables
5243  *                 3.The function of napi_create_external_buffer is used to create a new buffer
5244  *                 4.Return value of function is napi_invalid_arg
5245  */
5246 HWTEST_F(NativeEngineTest, ACE_Napi_Create_External_Buffer_0600, testing::ext::TestSize.Level2)
5247 {
5248     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_External_Buffer_0600 start";
5249 
5250     napi_env env = nullptr;
5251     napi_value Buffer = nullptr;
5252     size_t BufferSize = sizeof(Text);
5253 
5254     napi_status creatresult = napi_create_external_buffer(env, BufferSize, Text, BufferFinalizer, nullptr, &Buffer);
5255     EXPECT_EQ(creatresult, napi_status::napi_invalid_arg);
5256 
5257     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_External_Buffer_0600 end";
5258 }
5259 
5260 #if  (defined(FOR_JERRYSCRIPT_TEST)) &&  (JERRY_API_MINOR_VERSION <= 3)
5261     // jerryscript 2.3 do nothing
5262 #else
5263 // jerryscript 2.4 or quickjs or V8
5264 /*
5265  * @tc.number    : ACE_Napi_Object_Freeze_0100
5266  * @tc.name      : The parameters of napi_object_freeze are valid,
5267  *                 The object is freeze by napi_object_freeze function.
5268  * @tc.desc      : 1.The environment engine is created
5269  *                 2.Set test variables
5270  *                 3.The function of napi_object_freeze is used to freeze a object
5271  *                 4.Return value of function is napi_ok
5272  *                 5.The function of napi_set_element is called
5273  *                 6.The element can not be added
5274  */
5275 HWTEST_F(NativeEngineTest, ACE_Napi_Object_Freeze_0100, testing::ext::TestSize.Level1)
5276 {
5277     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Object_Freeze_0100 start";
5278     napi_env env = (napi_env)engine_;
5279     napi_value object = nullptr;
5280     napi_value int32result;
5281     napi_value newuint32result;
5282     napi_value freezeresult;
5283     napi_value newfreezeresult;
5284     int32_t numresultone;
5285     int32_t numresulttwo;
5286     auto numone = static_cast<int32_t>(10);
5287     auto numtwo = static_cast<int32_t>(20);
5288 
5289     napi_create_object(env, &object);
5290     napi_status status = napi_create_int32(env, numone, &int32result);
5291     EXPECT_EQ(status, napi_status::napi_ok);
5292     status = napi_create_int32(env, numtwo, &freezeresult);
5293     EXPECT_EQ(status, napi_status::napi_ok);
5294     status = napi_set_named_property(env, object, "int32result", int32result);
5295     EXPECT_EQ(status, napi_status::napi_ok);
5296     status = napi_get_named_property(env, object, "int32result", &newuint32result);
5297     EXPECT_EQ(status, napi_status::napi_ok);
5298     status = napi_get_value_int32(env, newuint32result, &numresultone);
5299     EXPECT_EQ(status, napi_status::napi_ok);
5300     GTEST_LOG_(INFO) << "newuint32result is" << numresultone;
5301     napi_status creatresult = napi_object_freeze(env, object);
5302     EXPECT_EQ(creatresult, napi_status::napi_ok);
5303     status = napi_set_named_property(env, object, "freezeresult", freezeresult);
5304     EXPECT_EQ(status, napi_status::napi_ok);
5305     status = napi_get_named_property(env, object, "freezeresult", &newfreezeresult);
5306     EXPECT_EQ(status, napi_status::napi_ok);
5307     status = napi_get_value_int32(env, newfreezeresult, &numresulttwo);
5308     EXPECT_EQ(status, napi_status::napi_number_expected);
5309     GTEST_LOG_(INFO) << "newfreezeresult is" << numresulttwo;
5310 
5311     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Object_Freeze_0100 end";
5312 }
5313 
5314 /*
5315  * @tc.number    : ACE_Napi_Object_Freeze_0200
5316  * @tc.name      : The parameters of napi_object_freeze are valid,
5317  *                 The object is freeze by napi_object_freeze function.
5318  * @tc.desc      : 1.The environment engine is created
5319  *                 2.Set test variables
5320  *                 3.The function of napi_object_freeze is used to freeze a object
5321  *                 4.Return value of function is napi_ok
5322  *                 5.The function of napi_delete_element is called
5323  *                 6.The element can not be deleted
5324  */
5325 HWTEST_F(NativeEngineTest, ACE_Napi_Object_Freeze_0200, testing::ext::TestSize.Level1)
5326 {
5327     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Object_Freeze_0200 start";
5328 
5329     napi_env env = (napi_env)engine_;
5330     napi_value object = nullptr;
5331     napi_value int32result;
5332     napi_value newuint32result;
5333     napi_value freezeresult;
5334     napi_value newfreezeresult;
5335     napi_value afterfreezeresult;
5336     napi_value namestr;
5337     int32_t numresultone;
5338     int32_t numresulttwo;
5339     int32_t afternumresulttwo;
5340     bool deleteresult = false;
5341     auto numone = static_cast<int32_t>(10);
5342     auto numtwo = static_cast<int32_t>(20);
5343 
5344     napi_create_object(env, &object);
5345     napi_status status = napi_create_int32(env, numone, &int32result);
5346     EXPECT_EQ(status, napi_status::napi_ok);
5347     status = napi_create_int32(env, numtwo, &freezeresult);
5348     EXPECT_EQ(status, napi_status::napi_ok);
5349     status = napi_set_named_property(env, object, "int32result", int32result);
5350     EXPECT_EQ(status, napi_status::napi_ok);
5351     status = napi_get_named_property(env, object, "int32result", &newuint32result);
5352     EXPECT_EQ(status, napi_status::napi_ok);
5353     status = napi_get_value_int32(env, newuint32result, &numresultone);
5354     EXPECT_EQ(status, napi_status::napi_ok);
5355     GTEST_LOG_(INFO) << "newuint32result is" << numresultone;
5356     status = napi_set_named_property(env, object, "freezeresult", freezeresult);
5357     EXPECT_EQ(status, napi_status::napi_ok);
5358     status = napi_get_named_property(env, object, "freezeresult", &newfreezeresult);
5359     EXPECT_EQ(status, napi_status::napi_ok);
5360     status = napi_get_value_int32(env, newfreezeresult, &numresulttwo);
5361     EXPECT_EQ(status, napi_status::napi_ok);
5362     GTEST_LOG_(INFO) << "newfreezeresult is" << numresulttwo;
5363     napi_status creatresult = napi_object_freeze(env, object);
5364     EXPECT_EQ(creatresult, napi_status::napi_ok);
5365     status = napi_create_string_utf8(env, "freezeresult", strlen("freezeresult"), &namestr);
5366     EXPECT_EQ(status, napi_status::napi_ok);
5367     status = napi_delete_property(env, object, namestr, &deleteresult);
5368     EXPECT_EQ(status, napi_status::napi_ok);
5369     status = napi_get_named_property(env, object, "freezeresult", &afterfreezeresult);
5370     EXPECT_EQ(status, napi_status::napi_ok);
5371     status = napi_get_value_int32(env, afterfreezeresult, &afternumresulttwo);
5372     EXPECT_EQ(status, napi_status::napi_ok);
5373     GTEST_LOG_(INFO) << "afterfreezeresult is" << afternumresulttwo;
5374     EXPECT_EQ(numresulttwo, 20);
5375 
5376     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Object_Freeze_0200 end";
5377 }
5378 
5379 /*
5380  * @tc.number    : ACE_Napi_Object_Freeze_0300
5381  * @tc.name      : The parameters of napi_object_freeze are valid,
5382  *                 The object is freeze by napi_object_freeze function.
5383  * @tc.desc      : 1.The environment engine is created
5384  *                 2.Set test variables
5385  *                 3.The function of napi_object_freeze is used to freeze a object
5386  *                 4.Return value of function is napi_ok
5387  *                 5.The function of napi_set_element is called
5388  *                 6.The element can not be changed
5389  */
5390 HWTEST_F(NativeEngineTest, ACE_Napi_Object_Freeze_0300, testing::ext::TestSize.Level1)
5391 {
5392     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Object_Freeze_0300 start";
5393 
5394     napi_env env = (napi_env)engine_;
5395     napi_value object = nullptr;
5396     napi_value int32result;
5397     napi_value newuint32result;
5398     napi_value freezeresult;
5399     napi_value newfreezeresult;
5400     int32_t numresultone;
5401     int32_t numresulttwo;
5402     auto numone = static_cast<int32_t>(10);
5403     auto numtwo = static_cast<int32_t>(20);
5404 
5405     napi_create_object(env, &object);
5406     napi_status status = napi_create_int32(env, numone, &int32result);
5407     EXPECT_EQ(status, napi_status::napi_ok);
5408     status = napi_create_int32(env, numtwo, &freezeresult);
5409     EXPECT_EQ(status, napi_status::napi_ok);
5410     status = napi_set_named_property(env, object, "int32result", int32result);
5411     EXPECT_EQ(status, napi_status::napi_ok);
5412     status = napi_get_named_property(env, object, "int32result", &newuint32result);
5413     EXPECT_EQ(status, napi_status::napi_ok);
5414     status = napi_get_value_int32(env, newuint32result, &numresultone);
5415     EXPECT_EQ(status, napi_status::napi_ok);
5416     GTEST_LOG_(INFO) << "newuint32result is" << numresultone;
5417     napi_status creatresult = napi_object_freeze(env, object);
5418     EXPECT_EQ(creatresult, napi_status::napi_ok);
5419     status = napi_set_named_property(env, object, "int32result", freezeresult);
5420     EXPECT_EQ(status, napi_status::napi_ok);
5421     status = napi_get_named_property(env, object, "int32result", &newfreezeresult);
5422     EXPECT_EQ(status, napi_status::napi_ok);
5423     status = napi_get_value_int32(env, newfreezeresult, &numresulttwo);
5424     EXPECT_EQ(status, napi_status::napi_ok);
5425     GTEST_LOG_(INFO) << "newfreezeresult is" << numresulttwo;
5426     EXPECT_EQ(numresulttwo, 10);
5427 
5428     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Object_Freeze_0300 end";
5429 }
5430 
5431 /*
5432  * @tc.number    : ACE_Napi_Object_Freeze_0400
5433  * @tc.name      : The parameter of the object to freeze is invalid,
5434  *                 The object can not be freezed by napi_object_freeze function.
5435  * @tc.desc      : 1.The environment engine is created
5436  *                 2.Set test variables
5437  *                 3.The function of napi_object_freeze is used to freeze a object
5438  *                 4.Return value of function is napi_invalid_arg
5439  *                 5.The function of napi_set_element is called
5440  *                 6.The element can be added
5441  */
5442 HWTEST_F(NativeEngineTest, ACE_Napi_Object_Freeze_0400, testing::ext::TestSize.Level2)
5443 {
5444     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Object_Freeze_0400 start";
5445 
5446     napi_env env = (napi_env)engine_;
5447     napi_value object = nullptr;
5448     napi_value int32result;
5449     napi_value newuint32result;
5450     napi_value freezeresult;
5451     napi_value newfreezeresult;
5452     int32_t numresultone;
5453     int32_t numresulttwo;
5454     auto numone = static_cast<int32_t>(10);
5455     auto numtwo = static_cast<int32_t>(20);
5456 
5457     napi_create_object(env, &object);
5458     napi_status status = napi_create_int32(env, numone, &int32result);
5459     EXPECT_EQ(status, napi_status::napi_ok);
5460     status = napi_create_int32(env, numtwo, &freezeresult);
5461     EXPECT_EQ(status, napi_status::napi_ok);
5462     status = napi_set_named_property(env, object, "int32result", int32result);
5463     EXPECT_EQ(status, napi_status::napi_ok);
5464     status = napi_get_named_property(env, object, "int32result", &newuint32result);
5465     EXPECT_EQ(status, napi_status::napi_ok);
5466     status = napi_get_value_int32(env, newuint32result, &numresultone);
5467     EXPECT_EQ(status, napi_status::napi_ok);
5468     GTEST_LOG_(INFO) << "newuint32result is" << numresultone;
5469     napi_status creatresult = napi_object_freeze(env, nullptr);
5470     EXPECT_EQ(creatresult, napi_status::napi_invalid_arg);
5471     status = napi_set_named_property(env, object, "freezeresult", freezeresult);
5472     EXPECT_EQ(status, napi_status::napi_ok);
5473     status = napi_get_named_property(env, object, "freezeresult", &newfreezeresult);
5474     EXPECT_EQ(status, napi_status::napi_ok);
5475     status = napi_get_value_int32(env, newfreezeresult, &numresulttwo);
5476     EXPECT_EQ(status, napi_status::napi_ok);
5477     GTEST_LOG_(INFO) << "newfreezeresult is" << numresulttwo;
5478     EXPECT_EQ(numresulttwo, 20);
5479 
5480     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Object_Freeze_0400 end";
5481 }
5482 
5483 /*
5484  * @tc.number    : ACE_Napi_Object_Freeze_0500
5485  * @tc.name      : The parameter of environment is invalid,
5486  *                 The object can not be freezed by napi_object_freeze function.
5487  * @tc.desc      : 1.The environment engine is created
5488  *                 2.Set test variables
5489  *                 3.The function of napi_object_freeze is used to freeze a object
5490  *                 4.Return value of function is napi_invalid_arg
5491  *                 5.The function of napi_set_element is called
5492  *                 6.The element can be added
5493  */
5494 HWTEST_F(NativeEngineTest, ACE_Napi_Object_Freeze_0500, testing::ext::TestSize.Level2)
5495 {
5496     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Object_Freeze_0500 start";
5497 
5498     napi_env env = (napi_env)engine_;
5499     napi_value object = nullptr;
5500     napi_value int32result;
5501     napi_value newuint32result;
5502     napi_value freezeresult;
5503     napi_value newfreezeresult;
5504     int32_t numresultone;
5505     int32_t numresulttwo;
5506     auto numone = static_cast<int32_t>(10);
5507     auto numtwo = static_cast<int32_t>(20);
5508 
5509     napi_create_object(env, &object);
5510     napi_status status = napi_create_int32(env, numone, &int32result);
5511     EXPECT_EQ(status, napi_status::napi_ok);
5512     status = napi_create_int32(env, numtwo, &freezeresult);
5513     EXPECT_EQ(status, napi_status::napi_ok);
5514     status = napi_set_named_property(env, object, "int32result", int32result);
5515     EXPECT_EQ(status, napi_status::napi_ok);
5516     status = napi_get_named_property(env, object, "int32result", &newuint32result);
5517     EXPECT_EQ(status, napi_status::napi_ok);
5518     status = napi_get_value_int32(env, newuint32result, &numresultone);
5519     EXPECT_EQ(status, napi_status::napi_ok);
5520     GTEST_LOG_(INFO) << "newuint32result is" << numresultone;
5521     napi_status creatresult = napi_object_freeze(nullptr, object);
5522     EXPECT_EQ(creatresult, napi_status::napi_invalid_arg);
5523     status = napi_set_named_property(env, object, "freezeresult", freezeresult);
5524     EXPECT_EQ(status, napi_status::napi_ok);
5525     status = napi_get_named_property(env, object, "freezeresult", &newfreezeresult);
5526     EXPECT_EQ(status, napi_status::napi_ok);
5527     status = napi_get_value_int32(env, newfreezeresult, &numresulttwo);
5528     EXPECT_EQ(status, napi_status::napi_ok);
5529     GTEST_LOG_(INFO) << "newfreezeresult is" << numresulttwo;
5530     EXPECT_EQ(numresulttwo, 20);
5531 
5532     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Object_Freeze_0500 end";
5533 }
5534 
5535 /*
5536  * @tc.number    : ACE_Napi_Object_Freeze_0600
5537  * @tc.name      : The parameter of environment is invalid,
5538  *                 The object can not be freezed by napi_object_freeze function.
5539  * @tc.desc      : 1.The environment engine is created
5540  *                 2.Set test variables
5541  *                 3.The function of napi_object_freeze is used to freeze a object
5542  *                 4.Return value of function is napi_invalid_arg
5543  *                 5.The function of napi_set_element is called
5544  *                 6.The element can be deleted
5545  */
5546 HWTEST_F(NativeEngineTest, ACE_Napi_Object_Freeze_0600, testing::ext::TestSize.Level2)
5547 {
5548     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Object_Freeze_0600 start";
5549 
5550     napi_env env = (napi_env)engine_;
5551     napi_value object = nullptr;
5552     napi_value int32result;
5553     napi_value newuint32result;
5554     napi_value freezeresult;
5555     napi_value newfreezeresult;
5556     napi_value afterfreezeresult;
5557     napi_value namestr;
5558     int32_t numresultone;
5559     int32_t numresulttwo;
5560     int32_t afternumresulttwo;
5561     bool deleteresult = false;
5562     auto numone = static_cast<int32_t>(10);
5563     auto numtwo = static_cast<int32_t>(20);
5564 
5565     napi_create_object(env, &object);
5566     napi_status status = napi_create_int32(env, numone, &int32result);
5567     EXPECT_EQ(status, napi_status::napi_ok);
5568     status = napi_create_int32(env, numtwo, &freezeresult);
5569     EXPECT_EQ(status, napi_status::napi_ok);
5570     status = napi_set_named_property(env, object, "int32result", int32result);
5571     EXPECT_EQ(status, napi_status::napi_ok);
5572     status = napi_get_named_property(env, object, "int32result", &newuint32result);
5573     EXPECT_EQ(status, napi_status::napi_ok);
5574     status = napi_get_value_int32(env, newuint32result, &numresultone);
5575     EXPECT_EQ(status, napi_status::napi_ok);
5576     GTEST_LOG_(INFO) << "newuint32result is" << numresultone;
5577     status = napi_set_named_property(env, object, "freezeresult", freezeresult);
5578     EXPECT_EQ(status, napi_status::napi_ok);
5579     status = napi_get_named_property(env, object, "freezeresult", &newfreezeresult);
5580     EXPECT_EQ(status, napi_status::napi_ok);
5581     status = napi_get_value_int32(env, newfreezeresult, &numresulttwo);
5582     EXPECT_EQ(status, napi_status::napi_ok);
5583     GTEST_LOG_(INFO) << "newfreezeresult is" << numresulttwo;
5584     napi_status creatresult = napi_object_freeze(nullptr, object);
5585     EXPECT_EQ(creatresult, napi_status::napi_invalid_arg);
5586     status = napi_create_string_utf8(env, "freezeresult", strlen("freezeresult"), &namestr);
5587     EXPECT_EQ(status, napi_status::napi_ok);
5588     status = napi_delete_property(env, object, namestr, &deleteresult);
5589     EXPECT_EQ(status, napi_status::napi_ok);
5590     EXPECT_EQ(deleteresult, true);
5591     status = napi_get_named_property(env, object, "freezeresult", &afterfreezeresult);
5592     EXPECT_EQ(status, napi_status::napi_ok);
5593     status = napi_get_value_int32(env, afterfreezeresult, &afternumresulttwo);
5594     EXPECT_EQ(status, napi_status::napi_number_expected);
5595     GTEST_LOG_(INFO) << "afterfreezeresult is" << afternumresulttwo;
5596 
5597     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Object_Freeze_0600 end";
5598 }
5599 
5600 /*
5601  * @tc.number    : ACE_Napi_Object_Freeze_0700
5602  * @tc.name      : The parameter of environment is invalid,
5603  *                 The object can not be freezed by napi_object_freeze function.
5604  * @tc.desc      : 1.The environment engine is created
5605  *                 2.Set test variables
5606  *                 3.The function of napi_object_freeze is used to freeze a object
5607  *                 4.Return value of function is napi_invalid_arg
5608  *                 5.The function of napi_set_element is called
5609  *                 6.The element can be changed
5610  */
5611 HWTEST_F(NativeEngineTest, ACE_Napi_Object_Freeze_0700, testing::ext::TestSize.Level2)
5612 {
5613     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Object_Freeze_0700 start";
5614 
5615     napi_env env = (napi_env)engine_;
5616     napi_value object = nullptr;
5617     napi_value int32result;
5618     napi_value newuint32result;
5619     napi_value freezeresult;
5620     napi_value newfreezeresult;
5621     int32_t numresultone;
5622     int32_t numresulttwo;
5623     auto numone = static_cast<int32_t>(10);
5624     auto numtwo = static_cast<int32_t>(20);
5625 
5626     napi_create_object(env, &object);
5627     napi_status status = napi_create_int32(env, numone, &int32result);
5628     EXPECT_EQ(status, napi_status::napi_ok);
5629     status = napi_create_int32(env, numtwo, &freezeresult);
5630     EXPECT_EQ(status, napi_status::napi_ok);
5631     status = napi_set_named_property(env, object, "int32result", int32result);
5632     EXPECT_EQ(status, napi_status::napi_ok);
5633     status = napi_get_named_property(env, object, "int32result", &newuint32result);
5634     EXPECT_EQ(status, napi_status::napi_ok);
5635     status = napi_get_value_int32(env, newuint32result, &numresultone);
5636     EXPECT_EQ(status, napi_status::napi_ok);
5637     GTEST_LOG_(INFO) << "newuint32result is" << numresultone;
5638     napi_status creatresult = napi_object_freeze(nullptr, object);
5639     EXPECT_EQ(creatresult, napi_status::napi_invalid_arg);
5640     status = napi_set_named_property(env, object, "int32result", freezeresult);
5641     EXPECT_EQ(status, napi_status::napi_ok);
5642     status = napi_get_named_property(env, object, "int32result", &newfreezeresult);
5643     EXPECT_EQ(status, napi_status::napi_ok);
5644     status = napi_get_value_int32(env, newfreezeresult, &numresulttwo);
5645     EXPECT_EQ(status, napi_status::napi_ok);
5646     GTEST_LOG_(INFO) << "newfreezeresult is" << numresulttwo;
5647     EXPECT_EQ(numresulttwo, 20);
5648 
5649     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Object_Freeze_0700 end";
5650 }
5651 
5652 /*
5653  * @tc.number    : ACE_Napi_Object_Freeze_0800
5654  * @tc.name      : The parameter of environment is invalid,
5655  *                 The object can not be freezed by napi_object_freeze function.
5656  * @tc.desc      : 1.The environment engine is created
5657  *                 2.Set test variables
5658  *                 3.The function of napi_object_freeze is used to freeze a number
5659  *                 4.Return value of function is napi_object_expected
5660  */
5661 HWTEST_F(NativeEngineTest, ACE_Napi_Object_Freeze_0800, testing::ext::TestSize.Level2)
5662 {
5663     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Object_Freeze_0800 start";
5664 
5665     napi_env env = (napi_env)engine_;
5666     napi_value int32result;
5667     auto numone = static_cast<int32_t>(10);
5668 
5669     napi_status status = napi_create_int32(env, numone, &int32result);
5670     EXPECT_EQ(status, napi_status::napi_ok);
5671     napi_status creatresult = napi_object_freeze(env, int32result);
5672     EXPECT_EQ(creatresult, napi_status::napi_object_expected);
5673 
5674     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Object_Freeze_0800 end";
5675 }
5676 
5677 /*
5678  * @tc.number    : ACE_Napi_Object_Seal_0100
5679  * @tc.name      : The parameters of napi_object_seal are valid,
5680  *                 The object is sealed by napi_object_seal function.
5681  * @tc.desc      : 1.The environment engine is created
5682  *                 2.Set test variables
5683  *                 3.The function of napi_object_seal is used to seal a object
5684  *                 4.Return value of function is napi_ok
5685  *                 5.The function of napi_set_element is called
5686  *                 6.The element can not be added
5687  */
5688 HWTEST_F(NativeEngineTest, ACE_Napi_Object_Seal_0100, testing::ext::TestSize.Level1)
5689 {
5690     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Object_Seal_0100 start";
5691 
5692     napi_env env = (napi_env)engine_;
5693     napi_value object = nullptr;
5694     napi_value int32result;
5695     napi_value newuint32result;
5696     napi_value freezeresult;
5697     napi_value newfreezeresult;
5698     int32_t numresultone;
5699     int32_t numresulttwo;
5700     auto numone = static_cast<int32_t>(10);
5701     auto numtwo = static_cast<int32_t>(20);
5702 
5703     napi_create_object(env, &object);
5704     napi_status status = napi_create_int32(env, numone, &int32result);
5705     EXPECT_EQ(status, napi_status::napi_ok);
5706     status = napi_create_int32(env, numtwo, &freezeresult);
5707     EXPECT_EQ(status, napi_status::napi_ok);
5708     status = napi_set_named_property(env, object, "int32result", int32result);
5709     EXPECT_EQ(status, napi_status::napi_ok);
5710     status = napi_get_named_property(env, object, "int32result", &newuint32result);
5711     EXPECT_EQ(status, napi_status::napi_ok);
5712     status = napi_get_value_int32(env, newuint32result, &numresultone);
5713     EXPECT_EQ(status, napi_status::napi_ok);
5714     GTEST_LOG_(INFO) << "newuint32result is" << numresultone;
5715     napi_status creatresult = napi_object_seal(env, object);
5716     EXPECT_EQ(creatresult, napi_status::napi_ok);
5717     status = napi_set_named_property(env, object, "freezeresult", freezeresult);
5718     EXPECT_EQ(status, napi_status::napi_ok);
5719     status = napi_get_named_property(env, object, "freezeresult", &newfreezeresult);
5720     EXPECT_EQ(status, napi_status::napi_ok);
5721     status = napi_get_value_int32(env, newfreezeresult, &numresulttwo);
5722     EXPECT_EQ(status, napi_status::napi_number_expected);
5723     GTEST_LOG_(INFO) << "newfreezeresult is" << numresulttwo;
5724 
5725     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Object_Seal_0100 end";
5726 }
5727 
5728 /*
5729  * @tc.number    : ACE_Napi_Object_Seal_0200
5730  * @tc.name      : The parameters of napi_object_seal are valid,
5731  *                 The object is sealed by napi_object_seal function.
5732  * @tc.desc      : 1.The environment engine is created
5733  *                 2.Set test variables
5734  *                 3.The function of napi_object_seal is used to seal a object
5735  *                 4.Return value of function is napi_ok
5736  *                 5.The function of napi_delete_element is called
5737  *                 6.The element can be deleted
5738  */
5739 HWTEST_F(NativeEngineTest, ACE_Napi_Object_Seal_0200, testing::ext::TestSize.Level1)
5740 {
5741     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Object_Seal_0200 start";
5742 
5743     napi_env env = (napi_env)engine_;
5744     napi_value object = nullptr;
5745     napi_value int32result;
5746     napi_value newuint32result;
5747     napi_value freezeresult;
5748     napi_value newfreezeresult;
5749     napi_value afterfreezeresult;
5750     napi_value namestr;
5751     int32_t numresultone;
5752     int32_t numresulttwo;
5753     int32_t afternumresulttwo;
5754     bool deleteresult = false;
5755     auto numone = static_cast<int32_t>(10);
5756     auto numtwo = static_cast<int32_t>(20);
5757 
5758     napi_create_object(env, &object);
5759     napi_status status = napi_create_int32(env, numone, &int32result);
5760     EXPECT_EQ(status, napi_status::napi_ok);
5761     status = napi_create_int32(env, numtwo, &freezeresult);
5762     EXPECT_EQ(status, napi_status::napi_ok);
5763     status = napi_set_named_property(env, object, "int32result", int32result);
5764     EXPECT_EQ(status, napi_status::napi_ok);
5765     status = napi_get_named_property(env, object, "int32result", &newuint32result);
5766     EXPECT_EQ(status, napi_status::napi_ok);
5767     status = napi_get_value_int32(env, newuint32result, &numresultone);
5768     EXPECT_EQ(status, napi_status::napi_ok);
5769     GTEST_LOG_(INFO) << "newuint32result is" << numresultone;
5770     status = napi_set_named_property(env, object, "freezeresult", freezeresult);
5771     EXPECT_EQ(status, napi_status::napi_ok);
5772     status = napi_get_named_property(env, object, "freezeresult", &newfreezeresult);
5773     EXPECT_EQ(status, napi_status::napi_ok);
5774     status = napi_get_value_int32(env, newfreezeresult, &numresulttwo);
5775     EXPECT_EQ(status, napi_status::napi_ok);
5776     GTEST_LOG_(INFO) << "newfreezeresult is" << numresulttwo;
5777     napi_status creatresult = napi_object_seal(env, object);
5778     EXPECT_EQ(creatresult, napi_status::napi_ok);
5779     status = napi_create_string_utf8(env, "freezeresult", strlen("freezeresult"), &namestr);
5780     EXPECT_EQ(status, napi_status::napi_ok);
5781     status = napi_delete_property(env, object, namestr, &deleteresult);
5782     EXPECT_EQ(status, napi_status::napi_ok);
5783     status = napi_get_named_property(env, object, "freezeresult", &afterfreezeresult);
5784     EXPECT_EQ(status, napi_status::napi_ok);
5785     status = napi_get_value_int32(env, afterfreezeresult, &afternumresulttwo);
5786     EXPECT_EQ(status, napi_status::napi_ok);
5787     GTEST_LOG_(INFO) << "afterfreezeresult is" << afternumresulttwo;
5788     EXPECT_EQ(afternumresulttwo, 20);
5789 
5790     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Object_Seal_0200 end";
5791 }
5792 
5793 /*
5794  * @tc.number    : ACE_Napi_Object_Seal_0300
5795  * @tc.name      : The parameters of napi_object_seal are valid,
5796  *                 The object is sealed by napi_object_seal function.
5797  * @tc.desc      : 1.The environment engine is created
5798  *                 2.Set test variables
5799  *                 3.The function of napi_object_seal is used to seal a object
5800  *                 4.Return value of function is napi_ok
5801  *                 5.The function of napi_set_element is called
5802  *                 6.The element can be changed
5803  */
5804 HWTEST_F(NativeEngineTest, ACE_Napi_Object_Seal_0300, testing::ext::TestSize.Level1)
5805 {
5806     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Object_Seal_0300 start";
5807 
5808     napi_env env = (napi_env)engine_;
5809     napi_value object = nullptr;
5810     napi_value int32result;
5811     napi_value newuint32result;
5812     napi_value freezeresult;
5813     napi_value newfreezeresult;
5814     int32_t numresultone;
5815     int32_t numresulttwo;
5816     auto numone = static_cast<int32_t>(10);
5817     auto numtwo = static_cast<int32_t>(20);
5818 
5819     napi_create_object(env, &object);
5820     napi_status status = napi_create_int32(env, numone, &int32result);
5821     EXPECT_EQ(status, napi_status::napi_ok);
5822     status = napi_create_int32(env, numtwo, &freezeresult);
5823     EXPECT_EQ(status, napi_status::napi_ok);
5824     status = napi_set_named_property(env, object, "int32result", int32result);
5825     EXPECT_EQ(status, napi_status::napi_ok);
5826     status = napi_get_named_property(env, object, "int32result", &newuint32result);
5827     EXPECT_EQ(status, napi_status::napi_ok);
5828     status = napi_get_value_int32(env, newuint32result, &numresultone);
5829     EXPECT_EQ(status, napi_status::napi_ok);
5830     GTEST_LOG_(INFO) << "newuint32result is" << numresultone;
5831     napi_status creatresult = napi_object_seal(env, object);
5832     EXPECT_EQ(creatresult, napi_status::napi_ok);
5833     status = napi_set_named_property(env, object, "int32result", freezeresult);
5834     EXPECT_EQ(status, napi_status::napi_ok);
5835     status = napi_get_named_property(env, object, "int32result", &newfreezeresult);
5836     EXPECT_EQ(status, napi_status::napi_ok);
5837     status = napi_get_value_int32(env, newfreezeresult, &numresulttwo);
5838     EXPECT_EQ(status, napi_status::napi_ok);
5839     GTEST_LOG_(INFO) << "newfreezeresult is" << numresulttwo;
5840     EXPECT_EQ(numresulttwo, 20);
5841 
5842     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Object_Seal_0300 end";
5843 }
5844 
5845 /*
5846  * @tc.number    : ACE_Napi_Object_Seal_0400
5847  * @tc.name      : The parameter of the object to seal is invalid,
5848  *                 The object can not be sealed by napi_object_seal function.
5849  * @tc.desc      : 1.The environment engine is created
5850  *                 2.Set test variables
5851  *                 3.The function of napi_object_seal is used to seal a object
5852  *                 4.Return value of function is napi_invalid_arg
5853  *                 5.The function of napi_set_element is called
5854  *                 6.The element can be added
5855  */
5856 HWTEST_F(NativeEngineTest, ACE_Napi_Object_Seal_0400, testing::ext::TestSize.Level2)
5857 {
5858     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Object_Seal_0400 start";
5859 
5860     napi_env env = (napi_env)engine_;
5861     napi_value object = nullptr;
5862     napi_value int32result;
5863     napi_value newuint32result;
5864     napi_value freezeresult;
5865     napi_value newfreezeresult;
5866     int32_t numresultone;
5867     int32_t numresulttwo;
5868     auto numone = static_cast<int32_t>(10);
5869     auto numtwo = static_cast<int32_t>(20);
5870 
5871     napi_create_object(env, &object);
5872     napi_status status = napi_create_int32(env, numone, &int32result);
5873     EXPECT_EQ(status, napi_status::napi_ok);
5874     status = napi_create_int32(env, numtwo, &freezeresult);
5875     EXPECT_EQ(status, napi_status::napi_ok);
5876     status = napi_set_named_property(env, object, "int32result", int32result);
5877     EXPECT_EQ(status, napi_status::napi_ok);
5878     status = napi_get_named_property(env, object, "int32result", &newuint32result);
5879     EXPECT_EQ(status, napi_status::napi_ok);
5880     status = napi_get_value_int32(env, newuint32result, &numresultone);
5881     EXPECT_EQ(status, napi_status::napi_ok);
5882     GTEST_LOG_(INFO) << "newuint32result is" << numresultone;
5883     napi_status creatresult = napi_object_seal(env, nullptr);
5884     EXPECT_EQ(creatresult, napi_status::napi_invalid_arg);
5885     status = napi_set_named_property(env, object, "freezeresult", freezeresult);
5886     EXPECT_EQ(status, napi_status::napi_ok);
5887     status = napi_get_named_property(env, object, "freezeresult", &newfreezeresult);
5888     EXPECT_EQ(status, napi_status::napi_ok);
5889     status = napi_get_value_int32(env, newfreezeresult, &numresulttwo);
5890     EXPECT_EQ(status, napi_status::napi_ok);
5891     GTEST_LOG_(INFO) << "newfreezeresult is" << numresulttwo;
5892     EXPECT_EQ(numresulttwo, 20);
5893 
5894     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Object_Seal_0400 end";
5895 }
5896 
5897 /*
5898  * @tc.number    : ACE_Napi_Object_Seal_0500
5899  * @tc.name      : The parameter of environment is invalid,
5900  *                 The object can not be sealed by napi_object_seal function.
5901  * @tc.desc      : 1.The environment engine is created
5902  *                 2.Set test variables
5903  *                 3.The function of napi_object_seal is used to seal a object
5904  *                 4.Return value of function is napi_invalid_arg
5905  *                 5.The function of napi_set_element is called
5906  *                 6.The element can be added
5907  */
5908 HWTEST_F(NativeEngineTest, ACE_Napi_Object_Seal_0500, testing::ext::TestSize.Level2)
5909 {
5910     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Object_Seal_0500 start";
5911 
5912     napi_env env = (napi_env)engine_;
5913     napi_value object = nullptr;
5914     napi_value int32result;
5915     napi_value newuint32result;
5916     napi_value freezeresult;
5917     napi_value newfreezeresult;
5918     int32_t numresultone;
5919     int32_t numresulttwo;
5920     auto numone = static_cast<int32_t>(10);
5921     auto numtwo = static_cast<int32_t>(20);
5922 
5923     napi_create_object(env, &object);
5924     napi_status status = napi_create_int32(env, numone, &int32result);
5925     EXPECT_EQ(status, napi_status::napi_ok);
5926     status = napi_create_int32(env, numtwo, &freezeresult);
5927     EXPECT_EQ(status, napi_status::napi_ok);
5928     status = napi_set_named_property(env, object, "int32result", int32result);
5929     EXPECT_EQ(status, napi_status::napi_ok);
5930     status = napi_get_named_property(env, object, "int32result", &newuint32result);
5931     EXPECT_EQ(status, napi_status::napi_ok);
5932     status = napi_get_value_int32(env, newuint32result, &numresultone);
5933     EXPECT_EQ(status, napi_status::napi_ok);
5934     GTEST_LOG_(INFO) << "newuint32result is" << numresultone;
5935     napi_status creatresult = napi_object_seal(nullptr, object);
5936     EXPECT_EQ(creatresult, napi_status::napi_invalid_arg);
5937     status = napi_set_named_property(env, object, "freezeresult", freezeresult);
5938     EXPECT_EQ(status, napi_status::napi_ok);
5939     status = napi_get_named_property(env, object, "freezeresult", &newfreezeresult);
5940     EXPECT_EQ(status, napi_status::napi_ok);
5941     status = napi_get_value_int32(env, newfreezeresult, &numresulttwo);
5942     EXPECT_EQ(status, napi_status::napi_ok);
5943     GTEST_LOG_(INFO) << "newfreezeresult is" << numresulttwo;
5944     EXPECT_EQ(numresulttwo, 20);
5945 
5946     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Object_Seal_0500 end";
5947 }
5948 
5949 /*
5950  * @tc.number    : ACE_Napi_Object_Seal_0600
5951  * @tc.name      : The parameter of environment is invalid,
5952  *                 The object can not be sealed by napi_object_seal function.
5953  * @tc.desc      : 1.The environment engine is created
5954  *                 2.Set test variables
5955  *                 3.The function of napi_object_seal is used to seal a object
5956  *                 4.Return value of function is napi_invalid_arg
5957  *                 5.The function of napi_set_element is called
5958  *                 6.The element can be deleted
5959  */
5960 HWTEST_F(NativeEngineTest, ACE_Napi_Object_Seal_0600, testing::ext::TestSize.Level2)
5961 {
5962     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Object_Seal_0600 start";
5963 
5964     napi_env env = (napi_env)engine_;
5965     napi_value object = nullptr;
5966     napi_value int32result;
5967     napi_value newuint32result;
5968     napi_value freezeresult;
5969     napi_value newfreezeresult;
5970     napi_value afterfreezeresult;
5971     napi_value namestr;
5972     int32_t numresultone;
5973     int32_t numresulttwo;
5974     int32_t afternumresulttwo;
5975     bool deleteresult = false;
5976     auto numone = static_cast<int32_t>(10);
5977     auto numtwo = static_cast<int32_t>(20);
5978 
5979     napi_create_object(env, &object);
5980     napi_status status = napi_create_int32(env, numone, &int32result);
5981     EXPECT_EQ(status, napi_status::napi_ok);
5982     status = napi_create_int32(env, numtwo, &freezeresult);
5983     EXPECT_EQ(status, napi_status::napi_ok);
5984     status = napi_set_named_property(env, object, "int32result", int32result);
5985     EXPECT_EQ(status, napi_status::napi_ok);
5986     status = napi_get_named_property(env, object, "int32result", &newuint32result);
5987     EXPECT_EQ(status, napi_status::napi_ok);
5988     status = napi_get_value_int32(env, newuint32result, &numresultone);
5989     EXPECT_EQ(status, napi_status::napi_ok);
5990     GTEST_LOG_(INFO) << "newuint32result is" << numresultone;
5991     status = napi_set_named_property(env, object, "freezeresult", freezeresult);
5992     EXPECT_EQ(status, napi_status::napi_ok);
5993     status = napi_get_named_property(env, object, "freezeresult", &newfreezeresult);
5994     EXPECT_EQ(status, napi_status::napi_ok);
5995     status = napi_get_value_int32(env, newfreezeresult, &numresulttwo);
5996     EXPECT_EQ(status, napi_status::napi_ok);
5997     GTEST_LOG_(INFO) << "newfreezeresult is" << numresulttwo;
5998     napi_status creatresult = napi_object_seal(nullptr, object);
5999     EXPECT_EQ(creatresult, napi_status::napi_invalid_arg);
6000     status = napi_create_string_utf8(env, "freezeresult", strlen("freezeresult"), &namestr);
6001     EXPECT_EQ(status, napi_status::napi_ok);
6002     status = napi_delete_property(env, object, namestr, &deleteresult);
6003     EXPECT_EQ(status, napi_status::napi_ok);
6004     EXPECT_EQ(deleteresult, true);
6005     status = napi_get_named_property(env, object, "freezeresult", &afterfreezeresult);
6006     EXPECT_EQ(status, napi_status::napi_ok);
6007     status = napi_get_value_int32(env, afterfreezeresult, &afternumresulttwo);
6008     EXPECT_EQ(status, napi_status::napi_number_expected);
6009     GTEST_LOG_(INFO) << "afterfreezeresult is" << afternumresulttwo;
6010 
6011     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Object_Seal_0600 end";
6012 }
6013 
6014 /*
6015  * @tc.number    : ACE_Napi_Object_Seal_0700
6016  * @tc.name      : The parameter of environment is invalid,
6017  *                 The object can not be sealed by napi_object_seal function.
6018  * @tc.desc      : 1.The environment engine is created
6019  *                 2.Set test variables
6020  *                 3.The function of napi_object_seal is used to seal a object
6021  *                 4.Return value of function is napi_invalid_arg
6022  *                 5.The function of napi_set_element is called
6023  *                 6.The element can be changed
6024  */
6025 HWTEST_F(NativeEngineTest, ACE_Napi_Object_Seal_0700, testing::ext::TestSize.Level2)
6026 {
6027     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Object_Seal_0700 start";
6028 
6029     napi_env env = (napi_env)engine_;
6030     napi_value object = nullptr;
6031     napi_value int32result;
6032     napi_value newuint32result;
6033     napi_value freezeresult;
6034     napi_value newfreezeresult;
6035     int32_t numresultone;
6036     int32_t numresulttwo;
6037     auto numone = static_cast<int32_t>(10);
6038     auto numtwo = static_cast<int32_t>(20);
6039 
6040     napi_create_object(env, &object);
6041     napi_status status = napi_create_int32(env, numone, &int32result);
6042     EXPECT_EQ(status, napi_status::napi_ok);
6043     status = napi_create_int32(env, numtwo, &freezeresult);
6044     EXPECT_EQ(status, napi_status::napi_ok);
6045     status = napi_set_named_property(env, object, "int32result", int32result);
6046     EXPECT_EQ(status, napi_status::napi_ok);
6047     status = napi_get_named_property(env, object, "int32result", &newuint32result);
6048     EXPECT_EQ(status, napi_status::napi_ok);
6049     status = napi_get_value_int32(env, newuint32result, &numresultone);
6050     EXPECT_EQ(status, napi_status::napi_ok);
6051     GTEST_LOG_(INFO) << "newuint32result is" << numresultone;
6052     napi_status creatresult = napi_object_seal(nullptr, object);
6053     EXPECT_EQ(creatresult, napi_status::napi_invalid_arg);
6054     status = napi_set_named_property(env, object, "int32result", freezeresult);
6055     EXPECT_EQ(status, napi_status::napi_ok);
6056     status = napi_get_named_property(env, object, "int32result", &newfreezeresult);
6057     EXPECT_EQ(status, napi_status::napi_ok);
6058     status = napi_get_value_int32(env, newfreezeresult, &numresulttwo);
6059     EXPECT_EQ(status, napi_status::napi_ok);
6060     GTEST_LOG_(INFO) << "newfreezeresult is" << numresulttwo;
6061     EXPECT_EQ(numresulttwo, 20);
6062 
6063     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Object_Seal_0700 end";
6064 }
6065 
6066 /*
6067  * @tc.number    : ACE_Napi_Object_Seal_0800
6068  * @tc.name      : The parameters of napi_object_seal are valid,
6069  *                 The object is sealed by napi_object_seal function.
6070  * @tc.desc      : 1.The environment engine is created
6071  *                 2.Set test variables
6072  *                 3.The function of napi_object_seal is used to seal a number
6073  *                 4.Return value of function is napi_object_expected
6074  */
6075 HWTEST_F(NativeEngineTest, ACE_Napi_Object_Seal_0800, testing::ext::TestSize.Level2)
6076 {
6077     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Object_Seal_0800 start";
6078 
6079     napi_env env = (napi_env)engine_;
6080     napi_value int32result;
6081     auto numone = static_cast<int32_t>(10);
6082 
6083     napi_status status = napi_create_int32(env, numone, &int32result);
6084     EXPECT_EQ(status, napi_status::napi_ok);
6085     napi_status creatresult = napi_object_seal(env, int32result);
6086     EXPECT_EQ(creatresult, napi_status::napi_object_expected);
6087 
6088     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Object_Seal_0800 end";
6089 }
6090 #endif // (defined(FOR_JERRYSCRIPT_TEST)) &&  (JERRY_API_MINOR_VERSION <= 3)
6091 /*
6092  * @tc.number    : ACE_Napi_Call_Threadsafe_Function_0100
6093  * @tc.name      : napi_create_threadsafe_function creates a queue and
6094  *                  calls napi_call_threadsafe_function is called in blocking mode.
6095  * @tc.desc      : 1.The environment engine is created.
6096  *                 2.napi_create_threadsafe_function creates a queue.
6097  *                 3.calls the napi_call_threadsafe_function function in the test thread and child threads.
6098  */
6099 HWTEST_F(NativeEngineTest, ACE_Napi_Call_Threadsafe_Function_0100, testing::ext::TestSize.Level1)
6100 {
6101     GTEST_LOG_(INFO) << "ACE_Napi_Call_Threadsafe_Function_0100 called start";
6102     napi_env env = (napi_env)engine_;
6103     napi_threadsafe_function tsFunc = nullptr;
6104     napi_value resourceName = 0;
6105 
6106     auto status = napi_create_string_latin1(env, __func__, NAPI_AUTO_LENGTH, &resourceName);
6107     EXPECT_EQ(status, napi_ok);
6108 
6109     g_jsData.id = CALL_JS_CB_DATA_TEST_ID;
6110     g_finalData.id = FINAL_CB_DATA_TEST_ID;
6111     g_callJSCallBackCount = 0;
6112     g_callFinalizeEnd = false;
6113 
6114     status = napi_create_threadsafe_function(env, nullptr, nullptr, resourceName, 0, 1, &g_finalData,
6115         FinalizeThreadCallBack, &g_jsData, CallJSCallBack, &tsFunc);
6116     EXPECT_EQ(status, napi_ok);
6117 
6118     uv_thread_t newChildTid;
6119     ThreadData_t threadData = { .tsfn = tsFunc, .isMode = napi_tsfn_blocking };
6120     if (uv_thread_create(&newChildTid, NewChildThreadMuti, (void*)&threadData) != 0) {
6121         GTEST_LOG_(INFO) << "NewChildThreadMuti Failed to create uv thread!";
6122     }
6123     if (uv_thread_join(&newChildTid) != 0) {
6124         GTEST_LOG_(INFO) << "uv_thread_join Failed!";
6125     }
6126     int testCount = 20;
6127     for (int i = 0; i < testCount; i++) {
6128         status = napi_call_threadsafe_function(tsFunc, (void*)&g_threadDataContent, napi_tsfn_blocking);
6129         EXPECT_EQ(status, napi_ok);
6130     }
6131 
6132     status = napi_release_threadsafe_function(tsFunc, napi_tsfn_release);
6133     EXPECT_EQ(status, napi_ok);
6134 
6135     GetFinalizeStatus();
6136     GTEST_LOG_(INFO) << "ACE_Napi_Call_Threadsafe_Function_0100 called end";
6137 }
6138 
6139 /*
6140  * @tc.number    : ACE_Napi_Call_Threadsafe_Function_0200
6141  * @tc.name      : napi_create_threadsafe_function creates a queue and
6142  *                  calls napi_call_threadsafe_function is called in nonblocking mode.
6143  * @tc.desc      : 1.The environment engine is created.
6144  *                 2.napi_create_threadsafe_function creates a queue.
6145  *                 3.calls the napi_call_threadsafe_function function in the test thread and child threads.
6146  */
6147 HWTEST_F(NativeEngineTest, ACE_Napi_Call_Threadsafe_Function_0200, testing::ext::TestSize.Level1)
6148 {
6149     GTEST_LOG_(INFO) << "ACE_Napi_Call_Threadsafe_Function_0200 called start";
6150     napi_env env = (napi_env)engine_;
6151     napi_threadsafe_function tsFunc = nullptr;
6152     napi_value resourceName = 0;
6153 
6154     auto status = napi_create_string_latin1(env, __func__, NAPI_AUTO_LENGTH, &resourceName);
6155     EXPECT_EQ(status, napi_ok);
6156 
6157     g_jsData.id = CALL_JS_CB_DATA_TEST_ID;
6158     g_finalData.id = FINAL_CB_DATA_TEST_ID;
6159     g_callJSCallBackCount = 0;
6160     g_callFinalizeEnd = false;
6161 
6162     status = napi_create_threadsafe_function(env, nullptr, nullptr, resourceName, 0, 1, &g_finalData,
6163         NonBlockFinalizeThreadCallBack, &g_jsData, CallJSCallBack, &tsFunc);
6164     EXPECT_EQ(status, napi_ok);
6165 
6166     uv_thread_t newChildTid;
6167     ThreadData_t threadData = { .tsfn = tsFunc, .isMode = napi_tsfn_nonblocking };
6168     if (uv_thread_create(&newChildTid, NewChildThreadMuti, (void*)&threadData) != 0) {
6169         GTEST_LOG_(INFO) << "NewChildThreadMuti Failed to create uv thread!";
6170     }
6171     if (uv_thread_join(&newChildTid) != 0) {
6172         GTEST_LOG_(INFO) << "uv_thread_join Failed!";
6173     }
6174     int testCount = 20;
6175     for (int i = 0; i < testCount; i++) {
6176         status = napi_call_threadsafe_function(tsFunc, &g_threadDataContent, napi_tsfn_nonblocking);
6177         EXPECT_EQ(status, napi_ok);
6178     }
6179 
6180     status = napi_release_threadsafe_function(tsFunc, napi_tsfn_release);
6181     EXPECT_EQ(status, napi_ok);
6182     GetFinalizeStatus();
6183 
6184     GTEST_LOG_(INFO) << "ACE_Napi_Call_Threadsafe_Function_0200 called end";
6185 }
6186 /*
6187  * @tc.number    : ACE_Napi_Call_Threadsafe_Function_0300
6188  * @tc.name      : napi_create_threadsafe_function creates a queue and
6189  *                  calls napi_call_threadsafe_function.
6190  * @tc.desc      : 1.The environment engine is created.
6191  *                 2.napi_create_threadsafe_function creates a queue.
6192  *                 3.In the test thread, calls the napi_call_threadsafe_function function in blocking mode.
6193  *                 4.calls the napi_call_threadsafe_function function in non-blocking mode in the created child thread.
6194  */
6195 HWTEST_F(NativeEngineTest, ACE_Napi_Call_Threadsafe_Function_0300, testing::ext::TestSize.Level1)
6196 {
6197     GTEST_LOG_(INFO) << "ACE_Napi_Call_Threadsafe_Function_0300 called start";
6198     napi_env env = (napi_env)engine_;
6199     napi_threadsafe_function tsFunc = nullptr;
6200     napi_value resourceName = 0;
6201 
6202     auto status = napi_create_string_latin1(env, __func__, NAPI_AUTO_LENGTH, &resourceName);
6203     EXPECT_EQ(status, napi_ok);
6204 
6205     g_jsData.id = CALL_JS_CB_DATA_TEST_ID;
6206     g_finalData.id = FINAL_CB_DATA_TEST_ID;
6207     g_callJSCallBackCount = 0;
6208     g_callFinalizeEnd = false;
6209 
6210     status = napi_create_threadsafe_function(env, nullptr, nullptr, resourceName, 50, 1, &g_finalData,
6211         FinalizeThreadCallBack, &g_jsData, CallJSCallBack, &tsFunc);
6212     EXPECT_EQ(status, napi_ok);
6213 
6214     uv_thread_t newChildTid;
6215     ThreadData_t threadData = { .tsfn = tsFunc, .isMode = napi_tsfn_blocking };
6216     if (uv_thread_create(&newChildTid, NewChildThreadMuti, (void*)&threadData) != 0) {
6217         GTEST_LOG_(INFO) << "NewChildThreadMuti Failed to create uv thread!";
6218     }
6219     if (uv_thread_join(&newChildTid) != 0) {
6220         GTEST_LOG_(INFO) << "uv_thread_join Failed!";
6221     }
6222 
6223     int testCount = 20;
6224     for (int i = 0; i < testCount; i++) {
6225         status = napi_call_threadsafe_function(tsFunc, &g_threadDataContent, napi_tsfn_nonblocking);
6226         EXPECT_EQ(status, napi_ok);
6227     }
6228 
6229     status = napi_release_threadsafe_function(tsFunc, napi_tsfn_release);
6230     EXPECT_EQ(status, napi_ok);
6231     GetFinalizeStatus();
6232     GTEST_LOG_(INFO) << "ACE_Napi_Call_Threadsafe_Function_0300 called end";
6233 }
6234 
6235 /*
6236  * @tc.number    : ACE_Napi_Call_Threadsafe_Function_0400
6237  * @tc.name      : napi_create_threadsafe_function creates a queue and
6238  *                  calls napi_call_threadsafe_function.
6239  * @tc.desc      : 1.The environment engine is created.
6240  *                 2.napi_create_threadsafe_function creates a queue.
6241  *                 3.In the test thread, calls the napi_call_threadsafe_function function in non-blocking mode.
6242  *                 4.calls the napi_call_threadsafe_function function in blocking mode in the created child thread.
6243  */
6244 HWTEST_F(NativeEngineTest, ACE_Napi_Call_Threadsafe_Function_0400, testing::ext::TestSize.Level1)
6245 {
6246     GTEST_LOG_(INFO) << "ACE_Napi_Call_Threadsafe_Function_0400 called start";
6247     napi_env env = (napi_env)engine_;
6248     napi_threadsafe_function tsFunc = nullptr;
6249     napi_value resourceName = 0;
6250 
6251     auto status = napi_create_string_latin1(env, __func__, NAPI_AUTO_LENGTH, &resourceName);
6252     EXPECT_EQ(status, napi_ok);
6253 
6254     g_jsData.id = CALL_JS_CB_DATA_TEST_ID;
6255     g_finalData.id = FINAL_CB_DATA_TEST_ID;
6256     g_callJSCallBackCount = 0;
6257     g_callFinalizeEnd = false;
6258 
6259     status = napi_create_threadsafe_function(env, nullptr, nullptr, resourceName, 50, 1, &g_finalData,
6260         FinalizeThreadCallBack, &g_jsData, CallJSCallBack, &tsFunc);
6261     EXPECT_EQ(status, napi_ok);
6262 
6263     uv_thread_t newChildTid;
6264     ThreadData_t threadData = { .tsfn = tsFunc, .isMode = napi_tsfn_nonblocking };
6265     if (uv_thread_create(&newChildTid, NewChildThreadMuti, (void*)&threadData) != 0) {
6266         GTEST_LOG_(INFO) << "NewChildThreadMuti Failed to create uv thread!";
6267     }
6268     if (uv_thread_join(&newChildTid) != 0) {
6269         GTEST_LOG_(INFO) << "uv_thread_join Failed!";
6270     }
6271 
6272     int testCount = 20;
6273     for (int i = 0; i < testCount; i++) {
6274         status = napi_call_threadsafe_function(tsFunc, &g_threadDataContent, napi_tsfn_blocking);
6275         EXPECT_EQ(status, napi_ok);
6276     }
6277 
6278     status = napi_release_threadsafe_function(tsFunc, napi_tsfn_release);
6279     EXPECT_EQ(status, napi_ok);
6280     GetFinalizeStatus();
6281     GTEST_LOG_(INFO) << "ACE_Napi_Call_Threadsafe_Function_0400 called end";
6282 }
6283 
6284 /*
6285  * @tc.number    : ACE_Napi_Call_Threadsafe_Function_0500
6286  * @tc.name      : napi_create_threadsafe_function creates a queue and
6287  *                  calls napi_call_threadsafe_function.
6288  * @tc.desc      : 1.The environment engine is created.
6289  *                 2.napi_create_threadsafe_function creates a queue.
6290  *                 3.In the test thread, calls the napi_call_threadsafe_function function in blocking and non-blocking
6291  *                  modes.
6292  *                 4.calls the napi_call_threadsafe_function function in blocking and non-blocking modes in the created
6293  *                  child thread.
6294  */
6295 HWTEST_F(NativeEngineTest, ACE_Napi_Call_Threadsafe_Function_0500, testing::ext::TestSize.Level1)
6296 {
6297     GTEST_LOG_(INFO) << "ACE_Napi_Call_Threadsafe_Function_0500 called start";
6298     napi_env env = (napi_env)engine_;
6299     napi_threadsafe_function tsFunc = nullptr;
6300     napi_value resourceName = 0;
6301 
6302     napi_create_string_latin1(env, __func__, NAPI_AUTO_LENGTH, &resourceName);
6303     g_jsData.id = CALL_JS_CB_DATA_TEST_ID;
6304     g_finalData.id = FINAL_CB_DATA_TEST_ID;
6305     g_callJSCallBackCount = 0;
6306     g_callFinalizeEnd = false;
6307 
6308     auto status = napi_create_threadsafe_function(env, nullptr, nullptr, resourceName, 50, 1, &g_finalData,
6309         AllFinalizeThreadCallBack, &g_jsData, CallJSCallBack, &tsFunc);
6310     EXPECT_EQ(status, napi_ok);
6311 
6312     uv_thread_t newChildTid;
6313     ThreadData_t threadData = { .tsfn = tsFunc };
6314     if (uv_thread_create(&newChildTid, NonBlockAndBlockNewChildThreadMuti, (void*)&threadData) != 0) {
6315         GTEST_LOG_(INFO) << "NewChildThreadMuti Failed to create uv thread!";
6316     }
6317     if (uv_thread_join(&newChildTid) != 0) {
6318         GTEST_LOG_(INFO) << "uv_thread_join Failed!";
6319     }
6320 
6321     int testCount = 10;
6322     for (int i = 0; i < testCount; i++) {
6323         status = napi_call_threadsafe_function(tsFunc, &g_threadDataContent3, napi_tsfn_blocking);
6324         EXPECT_EQ(status, napi_ok);
6325     }
6326 
6327     for (int i = 0; i < testCount; i++) {
6328         status = napi_call_threadsafe_function(tsFunc, &g_threadDataContent3, napi_tsfn_nonblocking);
6329         EXPECT_EQ(status, napi_ok);
6330     }
6331     status = napi_release_threadsafe_function(tsFunc, napi_tsfn_release);
6332     EXPECT_EQ(status, napi_ok);
6333     GetFinalizeStatus();
6334     GTEST_LOG_(INFO) << "ACE_Napi_Call_Threadsafe_Function_0500 called end";
6335 }
6336 
6337 /*
6338  * @tc.number    : ACE_Napi_Call_Threadsafe_Function_0600
6339  * @tc.name      : napi_create_threadsafe_function creates a queue and
6340  *                  calls napi_call_threadsafe_function.
6341  * @tc.desc      : 1.The environment engine is created.
6342  *                 2.napi_create_threadsafe_function creates a queue.
6343  *                 3.In the test thread, calls the napi_call_threadsafe_function function in blocking and non-blocking
6344  *                   modes.
6345  *                 4.calls the napi_call_threadsafe_function function in blocking and non-blocking modes in the created
6346  *                  child thread.
6347  */
6348 HWTEST_F(NativeEngineTest, ACE_Napi_Call_Threadsafe_Function_0600, testing::ext::TestSize.Level1)
6349 {
6350     GTEST_LOG_(INFO) << "ACE_Napi_Call_Threadsafe_Function_0600 called start";
6351     napi_env env = (napi_env)engine_;
6352     napi_threadsafe_function tsFunc = nullptr;
6353     napi_value resourceName = 0;
6354 
6355     auto status = napi_create_string_latin1(env, __func__, NAPI_AUTO_LENGTH, &resourceName);
6356     EXPECT_EQ(status, napi_ok);
6357 
6358     g_jsData.id = CALL_JS_CB_DATA_TEST_ID;
6359     g_finalData.id = FINAL_CB_DATA_TEST_ID;
6360     g_callJSCallBackCount = 0;
6361     g_callFinalizeEnd = false;
6362 
6363     status = napi_create_threadsafe_function(env, nullptr, nullptr, resourceName, 50, 1, &g_finalData,
6364         OtherFinalizeThreadCallBack, &g_jsData, CallJSCallBack, &tsFunc);
6365     EXPECT_EQ(status, napi_ok);
6366 
6367     uv_thread_t newChildTid;
6368     uv_thread_t newChildTid2;
6369     ThreadData_t threadData = { .tsfn = tsFunc, .isMode = napi_tsfn_nonblocking };
6370     if (uv_thread_create(&newChildTid, NonBlockAndBlockNewChildThreadMuti, (void*)&threadData) != 0) {
6371         GTEST_LOG_(INFO) << "NewChildThreadMuti Failed to create uv thread!";
6372     }
6373     if (uv_thread_join(&newChildTid) != 0) {
6374         GTEST_LOG_(INFO) << "uv_thread_join(&newChildTid) Failed!";
6375     }
6376 
6377     if (uv_thread_create(&newChildTid2, NonBlockAndBlockNewChildThreadMuti, (void*)&threadData) != 0) {
6378         GTEST_LOG_(INFO) << "NewChildThreadMuti Failed to create uv thread!";
6379     }
6380     if (uv_thread_join(&newChildTid2) != 0) {
6381         GTEST_LOG_(INFO) << "uv_thread_join(&newChildTid2) Failed!";
6382     }
6383     int testCount = 3;
6384     for (int i = 0; i < testCount; i++) {
6385         status = napi_call_threadsafe_function(tsFunc, &g_threadDataContent3, napi_tsfn_blocking);
6386         EXPECT_EQ(status, napi_ok);
6387     }
6388     testCount = 3;
6389     for (int i = 0; i < testCount; i++) {
6390         status = napi_call_threadsafe_function(tsFunc, &g_threadDataContent3, napi_tsfn_nonblocking);
6391         EXPECT_EQ(status, napi_ok);
6392     }
6393     status = napi_release_threadsafe_function(tsFunc, napi_tsfn_release);
6394     EXPECT_EQ(status, napi_ok);
6395 
6396     GetFinalizeStatus();
6397     GTEST_LOG_(INFO) << "ACE_Napi_Call_Threadsafe_Function_0600 called end";
6398 }
6399 
6400 /*
6401  * @tc.number    : ACE_Napi_Call_Threadsafe_Function_0700
6402  * @tc.name      : napi_create_threadsafe_function creates a queue and
6403  *                  calls napi_call_threadsafe_function.
6404  * @tc.desc      : 1.The environment engine is created.
6405  *                 2.napi_create_threadsafe_function creates a queue.
6406  *                 3.In the test thread, calls the napi_call_threadsafe_function function [nonblock call 10 times,
6407  *                   block call 10 times, nonblock call 10 times].
6408  *                 4.In the three child threads created, calls the napi_call_threadsafe_function
6409  *                   function[nonblock call 10 times, block call 10 times, onblock call 10 times].
6410  */
6411 HWTEST_F(NativeEngineTest, ACE_Napi_Call_Threadsafe_Function_0700, testing::ext::TestSize.Level1)
6412 {
6413     GTEST_LOG_(INFO) << "ACE_Napi_Call_Threadsafe_Function_0700 called start";
6414     napi_env env = (napi_env)engine_;
6415     napi_threadsafe_function tsFunc = nullptr;
6416     napi_value resourceName = 0;
6417 
6418     auto status = napi_create_string_latin1(env, __func__, NAPI_AUTO_LENGTH, &resourceName);
6419     EXPECT_EQ(status, napi_ok);
6420 
6421     g_jsData.id = CALL_JS_CB_DATA_TEST_ID;
6422     g_finalData.id = FINAL_CB_DATA_TEST_ID;
6423     g_callJSCallBackCount = 0;
6424     g_callFinalizeEnd = false;
6425 
6426     status = napi_create_threadsafe_function(env, nullptr, nullptr, resourceName, 200, 1, &g_finalData,
6427         MutiModeFinalizeThreadCallBack, &g_jsData, CallJSCallBack, &tsFunc);
6428     EXPECT_EQ(status, napi_ok);
6429 
6430     uv_thread_t newChildTid, newChildTid2, newChildTid3;
6431     OneModeCallData_t threadData = { .tsfn = tsFunc, .mode = napi_tsfn_nonblocking, .callCount = 10 };
6432     if (uv_thread_create(&newChildTid, MutiModeCallOne, (void*)&threadData) != 0) {
6433         GTEST_LOG_(INFO) << "uv_thread_create(&newChildTid) Failed to create uv thread!";
6434     }
6435     if (uv_thread_join(&newChildTid) != 0) {
6436         GTEST_LOG_(INFO) << "uv_thread_join(&newChildTid) Failed!";
6437     }
6438     if (uv_thread_create(&newChildTid2, MutiModeCallOne, (void*)&threadData) != 0) {
6439         GTEST_LOG_(INFO) << "uv_thread_create(&newChildTid2) Failed to create uv thread!";
6440     }
6441     if (uv_thread_join(&newChildTid2) != 0) {
6442         GTEST_LOG_(INFO) << "uv_thread_join(&newChildTid2) Failed!";
6443     }
6444     if (uv_thread_create(&newChildTid3, MutiModeCallOne, (void*)&threadData) != 0) {
6445         GTEST_LOG_(INFO) << "uv_thread_create(&newChildTid3) Failed to create uv thread!";
6446     }
6447     if (uv_thread_join(&newChildTid3) != 0) {
6448         GTEST_LOG_(INFO) << "uv_thread_join(&newChildTid3) Failed!";
6449     }
6450 
6451     threadData.mode = napi_tsfn_nonblocking;
6452     threadData.callCount = 10;
6453     OneModeCall(&threadData);
6454 
6455     threadData.mode = napi_tsfn_blocking;
6456     OneModeCall(&threadData);
6457 
6458     threadData.mode = napi_tsfn_nonblocking;
6459     OneModeCall(&threadData);
6460 
6461     status = napi_release_threadsafe_function(tsFunc, napi_tsfn_release);
6462     EXPECT_EQ(status, napi_ok);
6463     GetFinalizeStatus();
6464     GTEST_LOG_(INFO) << "ACE_Napi_Call_Threadsafe_Function_0700 called end";
6465 }
6466 /*
6467  * @tc.number    : ACE_Napi_Call_Threadsafe_Function_0800
6468  * @tc.name      : napi_create_threadsafe_function creates a queue and
6469  *                  calls napi_call_threadsafe_function.
6470  * @tc.desc      : 1.The environment engine is created.
6471  *                 2.napi_create_threadsafe_function creates a queue.
6472  *                 3.In the test thread, calls the napi_call_threadsafe_function function [block call 10 times,
6473  *                   nonblock call 10 times, block call 10 times].
6474  *                 4.In the three child threads created, calls the napi_call_threadsafe_function
6475  *                   function[block call 10 times, nonblock call 10 times, block call 10 times].
6476  */
6477 HWTEST_F(NativeEngineTest, ACE_Napi_Call_Threadsafe_Function_0800, testing::ext::TestSize.Level1)
6478 {
6479     GTEST_LOG_(INFO) << "ACE_Napi_Call_Threadsafe_Function_0800 called start";
6480     napi_env env = (napi_env)engine_;
6481     napi_threadsafe_function tsFunc = nullptr;
6482     napi_value resourceName = 0;
6483 
6484     auto status = napi_create_string_latin1(env, __func__, NAPI_AUTO_LENGTH, &resourceName);
6485     EXPECT_EQ(status, napi_ok);
6486 
6487     g_jsData.id = CALL_JS_CB_DATA_TEST_ID;
6488     g_finalData.id = FINAL_CB_DATA_TEST_ID;
6489     g_callJSCallBackCount = 0;
6490     g_callFinalizeEnd = false;
6491 
6492     status = napi_create_threadsafe_function(env, nullptr, nullptr, resourceName, 200, 1, &g_finalData,
6493         MutiModeFinalizeThreadCallBack, &g_jsData, CallJSCallBack, &tsFunc);
6494     EXPECT_EQ(status, napi_ok);
6495 
6496     uv_thread_t newChildTid, newChildTid2, newChildTid3;
6497     OneModeCallData_t threadData = { .tsfn = tsFunc, .mode = napi_tsfn_nonblocking, .callCount = 10 };
6498     if (uv_thread_create(&newChildTid, MutiModeCallTwo, (void*)&threadData) != 0) {
6499         GTEST_LOG_(INFO) << "NewChildThreadMuti Failed to create uv thread!";
6500     }
6501     if (uv_thread_join(&newChildTid) != 0) {
6502         GTEST_LOG_(INFO) << "uv_thread_join(&newChildTid) Failed!";
6503     }
6504     if (uv_thread_create(&newChildTid2, MutiModeCallTwo, (void*)&threadData) != 0) {
6505         GTEST_LOG_(INFO) << "NewChildThreadMuti Failed to create uv thread!";
6506     }
6507     if (uv_thread_join(&newChildTid2) != 0) {
6508         GTEST_LOG_(INFO) << "uv_thread_join(&newChildTid2) Failed!";
6509     }
6510     if (uv_thread_create(&newChildTid3, MutiModeCallTwo, (void*)&threadData) != 0) {
6511         GTEST_LOG_(INFO) << "NewChildThreadMuti Failed to create uv thread!";
6512     }
6513     if (uv_thread_join(&newChildTid3) != 0) {
6514         GTEST_LOG_(INFO) << "uv_thread_join(&newChildTid3) Failed!";
6515     }
6516 
6517     threadData.mode = napi_tsfn_blocking;
6518     threadData.callCount = 10;
6519     OneModeCall(&threadData);
6520 
6521     threadData.mode = napi_tsfn_nonblocking;
6522     OneModeCall(&threadData);
6523 
6524     threadData.mode = napi_tsfn_blocking;
6525     OneModeCall(&threadData);
6526 
6527     status = napi_release_threadsafe_function(tsFunc, napi_tsfn_release);
6528     EXPECT_EQ(status, napi_ok);
6529     GetFinalizeStatus();
6530     GTEST_LOG_(INFO) << "ACE_Napi_Call_Threadsafe_Function_0800 called end";
6531 }
6532 
6533 /*
6534  * @tc.number    : ACE_Napi_Call_Threadsafe_Function_0900
6535  * @tc.name      : napi_create_threadsafe_function creates a queue and
6536  *                  calls napi_call_threadsafe_function.
6537  * @tc.desc      : 1.The environment engine is created.
6538  *                 2.napi_create_threadsafe_function creates a queue.
6539  *                 3.In the test thread, calls the napi_call_threadsafe_function function [block call 10 times,
6540  *                   nonblock call 10 times, block call 10 times].
6541  *                 4.In the first child thread created, calls the napi_call_threadsafe_function
6542  *                   function[nonblock call 10 times, block call 10 times, nonblock call 10 times].
6543  *                 5.In the second child thread created, calls the napi_call_threadsafe_function
6544  *                   function[block call 10 times, nonblock call 10 times, block call 10 times].
6545  *                 6.In the third child thread created, calls the napi_call_threadsafe_function
6546  *                   function[nonblock call 10 times, block call 10 times, nonblock call 10 times].
6547  */
6548 HWTEST_F(NativeEngineTest, ACE_Napi_Call_Threadsafe_Function_0900, testing::ext::TestSize.Level1)
6549 {
6550     GTEST_LOG_(INFO) << "ACE_Napi_Call_Threadsafe_Function_0900 called start";
6551     napi_env env = (napi_env)engine_;
6552     napi_threadsafe_function tsFunc = nullptr;
6553     napi_value resourceName = 0;
6554 
6555     auto status = napi_create_string_latin1(env, __func__, NAPI_AUTO_LENGTH, &resourceName);
6556     EXPECT_EQ(status, napi_ok);
6557 
6558     g_jsData.id = CALL_JS_CB_DATA_TEST_ID;
6559     g_finalData.id = FINAL_CB_DATA_TEST_ID;
6560     g_callJSCallBackCount = 0;
6561     g_callFinalizeEnd = false;
6562 
6563     status = napi_create_threadsafe_function(env, nullptr, nullptr, resourceName, 200, 1, &g_finalData,
6564         MutiModeFinalizeThreadCallBack, &g_jsData, CallJSCallBack, &tsFunc);
6565     EXPECT_EQ(status, napi_ok);
6566 
6567     uv_thread_t newChildTid, newChildTid2, newChildTid3;
6568     OneModeCallData_t threadData = { .tsfn = tsFunc, .mode = napi_tsfn_nonblocking, .callCount = 10 };
6569     if (uv_thread_create(&newChildTid, MutiModeCallOne, (void*)&threadData) != 0) {
6570         GTEST_LOG_(INFO) << "NewChildThreadMuti Failed to create uv thread!";
6571     }
6572     if (uv_thread_join(&newChildTid) != 0) {
6573         GTEST_LOG_(INFO) << "uv_thread_join(&newChildTid) Failed!";
6574     }
6575     if (uv_thread_create(&newChildTid2, MutiModeCallTwo, (void*)&threadData) != 0) {
6576         GTEST_LOG_(INFO) << "NewChildThreadMuti Failed to create uv thread!";
6577     }
6578     if (uv_thread_join(&newChildTid2) != 0) {
6579         GTEST_LOG_(INFO) << "uv_thread_join(&newChildTid2) Failed!";
6580     }
6581     if (uv_thread_create(&newChildTid3, MutiModeCallOne, (void*)&threadData) != 0) {
6582         GTEST_LOG_(INFO) << "NewChildThreadMuti Failed to create uv thread!";
6583     }
6584     if (uv_thread_join(&newChildTid3) != 0) {
6585         GTEST_LOG_(INFO) << "uv_thread_join(&newChildTid3) Failed!";
6586     }
6587 
6588     threadData.mode = napi_tsfn_blocking;
6589     threadData.callCount = 10;
6590     OneModeCall(&threadData);
6591 
6592     threadData.mode = napi_tsfn_nonblocking;
6593     OneModeCall(&threadData);
6594 
6595     threadData.mode = napi_tsfn_blocking;
6596     OneModeCall(&threadData);
6597 
6598     status = napi_release_threadsafe_function(tsFunc, napi_tsfn_release);
6599     EXPECT_EQ(status, napi_ok);
6600 
6601     GetFinalizeStatus();
6602     GTEST_LOG_(INFO) << "ACE_Napi_Call_Threadsafe_Function_0900 called end";
6603 }
6604 /*
6605  * @tc.number    : ACE_Napi_Call_Threadsafe_Function_1000
6606  * @tc.name      : napi_create_threadsafe_function creates a queue and
6607  *                  calls napi_call_threadsafe_function.
6608  * @tc.desc      : 1.The environment engine is created.
6609  *                 2.napi_create_threadsafe_function creates a queue.
6610  *                 3.In the test thread, calls the napi_call_threadsafe_function function [nonblock call 30 times].
6611  *                 4.In the one child thread created, calls the napi_call_threadsafe_function
6612  *                   function[nonblock call 30 times].
6613  */
6614 HWTEST_F(NativeEngineTest, ACE_Napi_Call_Threadsafe_Function_1000, testing::ext::TestSize.Level1)
6615 {
6616     GTEST_LOG_(INFO) << "ACE_Napi_Call_Threadsafe_Function_1000 called start";
6617     napi_env env = (napi_env)engine_;
6618     napi_threadsafe_function tsFunc = nullptr;
6619     napi_value resourceName = 0;
6620 
6621     auto status = napi_create_string_latin1(env, __func__, NAPI_AUTO_LENGTH, &resourceName);
6622     g_jsData.id = CALL_JS_CB_DATA_TEST_ID;
6623     g_finalData.id = FINAL_CB_DATA_TEST_ID;
6624     g_callJSCallBackCount = 0;
6625     g_callFinalizeEnd = false;
6626 
6627     status = napi_create_threadsafe_function(env, nullptr, nullptr, resourceName, 200, 1, &g_finalData,
6628         MutiModeFinalizeThreadCallBack, &g_jsData, CallJSCallBack, &tsFunc);
6629     EXPECT_EQ(status, napi_ok);
6630 
6631     uv_thread_t newChildTid, newChildTid2, newChildTid3;
6632     OneModeCallData_t threadData = { .tsfn = tsFunc, .mode = napi_tsfn_nonblocking, .callCount = 10 };
6633     if (uv_thread_create(&newChildTid, MutiModeCallThree, (void*)&threadData) != 0) {
6634         GTEST_LOG_(INFO) << "NewChildThreadMuti Failed to create uv thread!";
6635     }
6636     if (uv_thread_join(&newChildTid) != 0) {
6637         GTEST_LOG_(INFO) << "uv_thread_join(&newChildTid) Failed!";
6638     }
6639     if (uv_thread_create(&newChildTid2, MutiModeCallThree, (void*)&threadData) != 0) {
6640         GTEST_LOG_(INFO) << "NewChildThreadMuti Failed to create uv thread!";
6641     }
6642     if (uv_thread_join(&newChildTid2) != 0) {
6643         GTEST_LOG_(INFO) << "uv_thread_join(&newChildTid2) Failed!";
6644     }
6645     if (uv_thread_create(&newChildTid3, MutiModeCallThree, (void*)&threadData) != 0) {
6646         GTEST_LOG_(INFO) << "NewChildThreadMuti Failed to create uv thread!";
6647     }
6648     if (uv_thread_join(&newChildTid3) != 0) {
6649         GTEST_LOG_(INFO) << "uv_thread_join(&newChildTid3) Failed!";
6650     }
6651 
6652     threadData.mode = napi_tsfn_nonblocking;
6653     threadData.callCount = 30;
6654     OneModeCall(&threadData);
6655 
6656     status = napi_release_threadsafe_function(tsFunc, napi_tsfn_release);
6657     EXPECT_EQ(status, napi_ok);
6658     GetFinalizeStatus();
6659     GTEST_LOG_(INFO) << "ACE_Napi_Call_Threadsafe_Function_1000 called end";
6660 }
6661 /*
6662  * @tc.number    : ACE_Napi_Call_Threadsafe_Function_1100
6663  * @tc.name      : napi_create_threadsafe_function creates a queue and
6664  *                  calls napi_call_threadsafe_function.
6665  * @tc.desc      : 1.The environment engine is created.
6666  *                 2.napi_create_threadsafe_function creates a queue.
6667  *                 3.In the test thread, calls the napi_call_threadsafe_function function [block call 30 times].
6668  *                 4.In the three child threads created, calls the napi_call_threadsafe_function
6669  *                   function[block call 30 times].
6670  */
6671 HWTEST_F(NativeEngineTest, ACE_Napi_Call_Threadsafe_Function_1100, testing::ext::TestSize.Level1)
6672 {
6673     GTEST_LOG_(INFO) << "ACE_Napi_Call_Threadsafe_Function_1100 called start";
6674     napi_env env = (napi_env)engine_;
6675     napi_threadsafe_function tsFunc = nullptr;
6676     napi_value resourceName = 0;
6677 
6678     auto status = napi_create_string_latin1(env, __func__, NAPI_AUTO_LENGTH, &resourceName);
6679 
6680     g_jsData.id = CALL_JS_CB_DATA_TEST_ID;
6681     g_finalData.id = FINAL_CB_DATA_TEST_ID;
6682     g_callJSCallBackCount = 0;
6683     g_callFinalizeEnd = false;
6684 
6685     status = napi_create_threadsafe_function(env, nullptr, nullptr, resourceName, 200, 1, &g_finalData,
6686         MutiModeFinalizeThreadCallBack, &g_jsData, CallJSCallBack, &tsFunc);
6687     EXPECT_EQ(status, napi_ok);
6688 
6689     uv_thread_t newChildTid, newChildTid2, newChildTid3;
6690     OneModeCallData_t threadData = { .tsfn = tsFunc, .mode = napi_tsfn_nonblocking, .callCount = 10 };
6691     if (uv_thread_create(&newChildTid, MutiModeCallFour, (void*)&threadData) != 0) {
6692         GTEST_LOG_(INFO) << "NewChildThreadMuti Failed to create uv thread!";
6693     }
6694     if (uv_thread_join(&newChildTid)!= 0) {
6695         GTEST_LOG_(INFO) << "uv_thread_join(&newChildTid) Failed!";
6696     }
6697     if (uv_thread_create(&newChildTid2, MutiModeCallFour, (void*)&threadData) != 0) {
6698         GTEST_LOG_(INFO) << "NewChildThreadMuti Failed to create uv thread!";
6699     }
6700     if (uv_thread_join(&newChildTid2) != 0) {
6701         GTEST_LOG_(INFO) << "uv_thread_join(&newChildTid2) Failed!";
6702     }
6703     if (uv_thread_create(&newChildTid3, MutiModeCallFour, (void*)&threadData) != 0) {
6704         GTEST_LOG_(INFO) << "NewChildThreadMuti Failed to create uv thread!";
6705     }
6706     if (uv_thread_join(&newChildTid3) != 0) {
6707         GTEST_LOG_(INFO) << "uv_thread_join(&newChildTid3) Failed!";
6708     }
6709 
6710     threadData.mode = napi_tsfn_blocking;
6711     threadData.callCount = 30;
6712     OneModeCall(&threadData);
6713 
6714     status = napi_release_threadsafe_function(tsFunc, napi_tsfn_release);
6715     EXPECT_EQ(status, napi_ok);
6716     GetFinalizeStatus();
6717     GTEST_LOG_(INFO) << "ACE_Napi_Call_Threadsafe_Function_1100 called end";
6718 }
6719 /*
6720  * @tc.number    : ACE_Napi_Call_Threadsafe_Function_1200
6721  * @tc.name      : napi_create_threadsafe_function creates a queue and
6722  *                 test napi_call_threadsafe_function none blocking mode with the queue full .
6723  * @tc.desc      :1.The environment engine is created.
6724  *                2.napi_create_threadsafe_function creates a queue with size 10.
6725  *                3.In the child thread, calls the napi_call_threadsafe_function function in non-blocking modes for 30
6726  *                  times.
6727  *                4.Normally for each CallJSSlowCallBack takes at least 1 second,
6728  *                  the created queue would be full quickly.
6729  *                5.Check if napi_call_threadsafe_function failure happens.
6730  */
6731 HWTEST_F(NativeEngineTest, ACE_Napi_Call_Threadsafe_Function_1200, testing::ext::TestSize.Level1)
6732 {
6733     GTEST_LOG_(INFO) << "ACE_Napi_Call_Threadsafe_Function_1200 called start";
6734     napi_env env = (napi_env)engine_;
6735     napi_threadsafe_function tsFunc = nullptr;
6736     napi_value resourceName = 0;
6737     g_callJSCallBackCount = 0;
6738     g_callCount = 0;
6739     g_bFailFlag = false;
6740     g_bIsFinish = false;
6741 
6742     auto status = napi_create_string_latin1(env, __func__, NAPI_AUTO_LENGTH, &resourceName);
6743     EXPECT_EQ(status, napi_ok);
6744 
6745     g_jsData.id = CALL_JS_CB_DATA_TEST_ID;
6746     g_finalData.id = FINAL_CB_DATA_TEST_ID;
6747 
6748     status = napi_create_threadsafe_function(env, nullptr, nullptr, resourceName, 10, 1, &g_finalData,
6749         FinalCallBack, &g_jsData, CallJSSlowCallBack, &tsFunc);
6750     EXPECT_EQ(status, napi_ok);
6751 
6752     uv_thread_t newChildTid;
6753     if (uv_thread_create(&newChildTid, NewChildThreadMutiCallNoneBlocking, tsFunc) != 0) {
6754         GTEST_LOG_(INFO) << "NewChildThreadMuti Failed to create uv thread!";
6755     }
6756     if (uv_thread_join(&newChildTid) != 0) {
6757         GTEST_LOG_(INFO) << "uv_thread_join(&newChildTid) Failed!";
6758     }
6759     status = napi_release_threadsafe_function(tsFunc, napi_tsfn_release);
6760     EXPECT_EQ(status, napi_ok);
6761 
6762     WaitForFinish();
6763     EXPECT_EQ(g_bFailFlag, true);
6764     GTEST_LOG_(INFO) << "CallBack Count= " << g_callJSCallBackCount;
6765     GTEST_LOG_(INFO) << "ACE_Napi_Call_Threadsafe_Function_1200 called end";
6766 }
6767 
6768 /*
6769  * @tc.number    : ACE_Napi_Call_Threadsafe_Function_1300
6770  * @tc.name      : napi_create_threadsafe_function creates a queue and
6771  *                 test napi_call_threadsafe_function blocking mode with the queue full.
6772  * @tc.desc      :1.The environment engine is created.
6773  *                2.napi_create_threadsafe_function creates a queue with size 10.
6774  *                3.In the child thread, calls the napi_call_threadsafe_function
6775  *                  function in blocking mode for 20 times.
6776  *                4.Normally for each CallJSSlowCallBack takes at least 1 second, the created queue would be full
6777  *                  quickly. 5.Check if napi_call_threadsafe_function failure happens.
6778  */
6779 HWTEST_F(NativeEngineTest, ACE_Napi_Call_Threadsafe_Function_1300, testing::ext::TestSize.Level1)
6780 {
6781     GTEST_LOG_(INFO) << "ACE_Napi_Call_Threadsafe_Function_1300 called start";
6782     napi_env env = (napi_env)engine_;
6783     napi_threadsafe_function tsFunc = nullptr;
6784     napi_value resourceName = 0;
6785     g_callJSCallBackCount = 0;
6786     g_callCount = 0;
6787     g_bIsFinish = false;
6788 
6789     auto status = napi_create_string_latin1(env, __func__, NAPI_AUTO_LENGTH, &resourceName);
6790     EXPECT_EQ(status, napi_ok);
6791 
6792     g_jsData.id = CALL_JS_CB_DATA_TEST_ID;
6793     g_finalData.id = FINAL_CB_DATA_TEST_ID;
6794 
6795     status = napi_create_threadsafe_function(env, nullptr, nullptr, resourceName, 10, 1, &g_finalData,
6796         FinalCallBack, &g_jsData, CallJSSlowCallBack, &tsFunc);
6797     EXPECT_EQ(status, napi_ok);
6798 
6799     uv_thread_t newChildTid;
6800     if (uv_thread_create(&newChildTid, NewChildThreadMutiCallBlocking, tsFunc) != 0) {
6801         GTEST_LOG_(INFO) << "NewChildThreadMuti Failed to create uv thread!";
6802     }
6803     if (uv_thread_join(&newChildTid) != 0) {
6804         GTEST_LOG_(INFO) << "uv_thread_join(&newChildTid) Failed!";
6805     }
6806 
6807     status = napi_release_threadsafe_function(tsFunc, napi_tsfn_release);
6808     EXPECT_EQ(status, napi_ok);
6809     WaitForFinish();
6810     EXPECT_EQ(g_callCount, g_callJSCallBackCount);
6811     GTEST_LOG_(INFO) << "ACE_Napi_Call_Threadsafe_Function_1300 called end";
6812 }
6813 
6814 /*
6815  * @tc.number  : ACE_Napi_Create_Threadsafe_Function_0100
6816  * @tc.name    : If all parameters are normal, call napi_create_threadsafe_function to create a safe thread
6817  * @tc.desc    : 1.Declare each parameter correctly
6818  *               2.Call napi_create_threadsafe_function
6819  *               3.Call uv_thread_create to create the thread
6820  *               4.Jscallback is triggered by napi_call_threadsafe_function
6821  *               5.Call napi_release_threadsafe_function to free the thread
6822  *               6.Trigger Threadfinalcb
6823  */
6824 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Threadsafe_Function_0100, testing::ext::TestSize.Level1)
6825 {
6826     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Threadsafe_Function_0100 start";
6827 
6828     napi_env env = (napi_env)engine_;
6829     g_callFinalizeEnd = false;
6830     size_t strsize = 13;
6831     napi_value resource_name;
6832     napi_threadsafe_function result = nullptr;
6833     jsData.id = CALL_JSCB_DATA;
6834     finalData.id = FINAL_CB_DATA;
6835     napi_create_string_utf8(env, "JSstringTest", strsize, &resource_name);
6836     napi_status threadresult = napi_create_threadsafe_function(
6837         env, nullptr, nullptr, resource_name, 0, 1, &finalData, Threadfinalcb, &jsData, ThreadSafeCallJs, &result);
6838     GTEST_LOG_(INFO) << "threadresult is " << threadresult;
6839     EXPECT_EQ(threadresult, napi_status::napi_ok);
6840     EXPECT_NE(result, nullptr);
6841     g_callFinalizeEnd = true;
6842     GetFinalizeStatus();
6843     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Threadsafe_Function_0100 end";
6844 }
6845 
6846 /*
6847  * @tc.number  : ACE_Napi_Create_Threadsafe_Function_0200
6848  * @tc.name    : Call napi_create_threadsafe_function when the number of initial threads is the maximum
6849  * @tc.desc    : 1.Declare each parameter correctly
6850  *               2.Call napi_create_threadsafe_function when the number of initial threads is the
6851  *                  maximum
6852  *               3.Call uv_thread_create to create the thread
6853  *               4.Jscallback is triggered by napi_call_threadsafe_function
6854  *               5.Call napi_release_threadsafe_function to free the thread
6855  *               6.Trigger Threadfinalcb
6856  */
6857 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Threadsafe_Function_0200, testing::ext::TestSize.Level1)
6858 {
6859     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Threadsafe_Function_0200 start";
6860 
6861     napi_env env = (napi_env)engine_;
6862     g_callFinalizeEnd = false;
6863     size_t strsize = 13;
6864     napi_value resource_name;
6865     napi_threadsafe_function result = nullptr;
6866     jsData.id = CALL_JSCB_DATA;
6867     finalData.id = FINAL_CB_DATA;
6868     napi_create_string_utf8(env, "JSstringTest", strsize, &resource_name);
6869     napi_status threadresult = napi_create_threadsafe_function(env, nullptr, nullptr, resource_name,
6870         0, MAX_COUNT, &finalData, Threadfinalcb, &jsData, ThreadSafeCallJs, &result);
6871     GTEST_LOG_(INFO) << "threadresult is " << threadresult;
6872     EXPECT_EQ(threadresult, napi_status::napi_ok);
6873     EXPECT_NE(result, nullptr);
6874     if (uv_thread_create(&g_uvThread, TsFuncDataSourceThread0200, result) != 0) {
6875         GTEST_LOG_(INFO) << "Failed to create uv thread!";
6876     }
6877     GetFinalizeStatus();
6878 
6879     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Threadsafe_Function_0200 end";
6880 }
6881 
6882 /*
6883  * @tc.number  : ACE_Napi_Create_Threadsafe_Function_0300
6884  * @tc.name    : Call napi_create_threadsafe_function when the number of initialization threads exceeds the maximum
6885  * @tc.desc    : 1.Declare each parameter correctly
6886  *               2.Call napi_create_threadsafe_function when the number of initialization threads
6887  *                  exceeds the maximum
6888  *               3.return napi_invalid_arg
6889  */
6890 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Threadsafe_Function_0300, testing::ext::TestSize.Level2)
6891 {
6892     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Threadsafe_Function_0300 start";
6893 
6894     napi_env env = (napi_env)engine_;
6895     size_t strsize = 13;
6896     napi_value resource_name;
6897     napi_threadsafe_function result = nullptr;
6898     jsData.id = CALL_JSCB_DATA;
6899     finalData.id = FINAL_CB_DATA;
6900     napi_create_string_utf8(env, "JSstringTest", strsize, &resource_name);
6901     napi_status threadresult = napi_create_threadsafe_function(env, nullptr, nullptr, resource_name, 0, OVER_MAX_COUNT,
6902         &finalData, Threadfinalcb, &jsData, ThreadSafeCallJs, &result);
6903     GTEST_LOG_(INFO) << "threadresult is " << threadresult;
6904     EXPECT_EQ(threadresult, napi_status::napi_invalid_arg);
6905     EXPECT_EQ(result, nullptr);
6906 
6907     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Threadsafe_Function_0300 end";
6908 }
6909 
6910 /*
6911  * @tc.number  : ACE_Napi_Create_Threadsafe_Function_0400
6912  * @tc.name    : Call napi_create_threadsafe_function when JSCallback is nullptr
6913  * @tc.desc    : 1.Declare each parameter correctly
6914  *               2.Call napi_create_threadsafe_function when JSCallback is nullptr
6915  *               3.return napi_invalid_arg
6916  */
6917 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Threadsafe_Function_0400, testing::ext::TestSize.Level1)
6918 {
6919     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Threadsafe_Function_0400 start";
6920 
6921     napi_env env = (napi_env)engine_;
6922     size_t strsize = 13;
6923     napi_value resource_name;
6924     napi_threadsafe_function result = nullptr;
6925     jsData.id = CALL_JSCB_DATA;
6926     finalData.id = FINAL_CB_DATA;
6927     napi_create_string_utf8(env, "JSstringTest", strsize, &resource_name);
6928     napi_status threadresult = napi_create_threadsafe_function(
6929         env, nullptr, nullptr, resource_name, 0, 1, &finalData, Threadfinalcb, &jsData, nullptr, &result);
6930     GTEST_LOG_(INFO) << "threadresult is " << threadresult;
6931     EXPECT_EQ(threadresult, napi_status::napi_invalid_arg);
6932     EXPECT_EQ(result, nullptr);
6933 
6934     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Threadsafe_Function_0400 end";
6935 }
6936 
6937 /*
6938  * @tc.number  : ACE_Napi_Create_Threadsafe_Function_0500
6939  * @tc.name    : Call napi_create_threadsafe_function when finalcallback is nullptr
6940  * @tc.desc    : 1.Declare each parameter correctly
6941  *               2.Call napi_create_threadsafe_function when finalcallback is nullptr
6942  *               3.Call uv_thread_create to create the thread
6943  *               4.Jscallback is triggered by napi_call_threadsafe_function
6944  *               5.Call napi_release_threadsafe_function to free the thread
6945  *               6.Trigger Threadfinalcb
6946  */
6947 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Threadsafe_Function_0500, testing::ext::TestSize.Level1)
6948 {
6949     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Threadsafe_Function_0500 start";
6950 
6951     napi_env env = (napi_env)engine_;
6952     size_t strsize = 13;
6953     napi_value resource_name;
6954     napi_threadsafe_function result = nullptr;
6955     jsData.id = CALL_JSCB_DATA;
6956     finalData.id = FINAL_CB_DATA;
6957     napi_create_string_utf8(env, "JSstringTest", strsize, &resource_name);
6958     napi_status threadresult = napi_create_threadsafe_function(
6959         env, nullptr, nullptr, resource_name, 0, 1, &finalData, nullptr, &jsData, ThreadSafeCallJs, &result);
6960     GTEST_LOG_(INFO) << "threadresult is " << threadresult;
6961     EXPECT_EQ(threadresult, napi_status::napi_ok);
6962     EXPECT_NE(result, nullptr);
6963     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Threadsafe_Function_0500 end";
6964 }
6965 
6966 /*
6967  * @tc.number  : ACE_Napi_Create_Threadsafe_Function_0600
6968  * @tc.name    : Call napi_create_threadsafe_function when JSCallback and finalcallback is nullptr
6969  * @tc.desc    : 1.Declare each parameter correctly
6970  *               2.Call napi_create_threadsafe_function when JSCallback and finalcallback is nullptr
6971  *               3.return napi_invalid_arg
6972  */
6973 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Threadsafe_Function_0600, testing::ext::TestSize.Level1)
6974 {
6975     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Threadsafe_Function_0600 start";
6976 
6977     napi_env env = (napi_env)engine_;
6978     size_t strsize = 13;
6979     napi_value resource_name;
6980     napi_threadsafe_function result = nullptr;
6981     jsData.id = CALL_JSCB_DATA;
6982     finalData.id = FINAL_CB_DATA;
6983     napi_create_string_utf8(env, "JSstringTest", strsize, &resource_name);
6984     napi_status threadresult = napi_create_threadsafe_function(
6985         env, nullptr, nullptr, resource_name, 0, 1, &finalData, nullptr, &jsData, nullptr, &result);
6986     GTEST_LOG_(INFO) << "threadresult is " << threadresult;
6987     EXPECT_EQ(threadresult, napi_status::napi_invalid_arg);
6988     EXPECT_EQ(result, nullptr);
6989 
6990     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Threadsafe_Function_0600 end";
6991 }
6992 
6993 /*
6994  * @tc.number  : ACE_Napi_Create_Threadsafe_Function_0700
6995  * @tc.name    : Call napi_create_threadsafe_function when the number of initialization threads is 0
6996  * @tc.desc    : 1.Declare each parameter correctly
6997  *               2.Call napi_create_threadsafe_function when the number of initialization threads is 0
6998  *               3.return napi_invalid_arg
6999  */
7000 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Threadsafe_Function_0700, testing::ext::TestSize.Level2)
7001 {
7002     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Threadsafe_Function_0700 start";
7003 
7004     napi_env env = (napi_env)engine_;
7005     size_t strsize = 13;
7006     napi_value resource_name;
7007     napi_threadsafe_function result = nullptr;
7008     jsData.id = CALL_JSCB_DATA;
7009     finalData.id = FINAL_CB_DATA;
7010     napi_create_string_utf8(env, "JSstringTest", strsize, &resource_name);
7011     napi_status threadresult = napi_create_threadsafe_function(
7012         env, nullptr, nullptr, resource_name, 0, 0, &finalData, Threadfinalcb, &jsData, ThreadSafeCallJs, &result);
7013     GTEST_LOG_(INFO) << "threadresult is " << threadresult;
7014     EXPECT_EQ(threadresult, napi_status::napi_invalid_arg);
7015     EXPECT_EQ(result, nullptr);
7016 
7017     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Threadsafe_Function_0700 end";
7018 }
7019 
7020 /*
7021  * @tc.number  : ACE_Napi_Create_Threadsafe_Function_0800
7022  * @tc.name    : Call napi_create_threadsafe_function when the number of initialization threads is -1
7023  * @tc.desc    : 1.Declare each parameter correctly
7024  *               2.Call napi_create_threadsafe_function when the number of initialization threads is -1
7025  *               3.return napi_invalid_arg
7026  */
7027 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Threadsafe_Function_0800, testing::ext::TestSize.Level2)
7028 {
7029     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Threadsafe_Function_0800 start";
7030 
7031     napi_env env = (napi_env)engine_;
7032     size_t strsize = 13;
7033     napi_value resource_name;
7034     napi_threadsafe_function result = nullptr;
7035     jsData.id = CALL_JSCB_DATA;
7036     finalData.id = FINAL_CB_DATA;
7037     napi_create_string_utf8(env, "JSstringTest", strsize, &resource_name);
7038     napi_status threadresult = napi_create_threadsafe_function(
7039         env, nullptr, nullptr, resource_name, 0, -1, &finalData, Threadfinalcb, &jsData, ThreadSafeCallJs, &result);
7040     EXPECT_EQ(threadresult, napi_status::napi_invalid_arg);
7041     EXPECT_EQ(result, nullptr);
7042 
7043     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Threadsafe_Function_0800 end";
7044 }
7045 
7046 /*
7047  * @tc.number  : ACE_Napi_Create_Threadsafe_Function_0900
7048  * @tc.name    : Call napi_create_threadsafe_function when the JS identifier name is empty
7049  * @tc.desc    : 1.Declare each parameter correctly
7050  *               2.Call napi_create_threadsafe_function when the JS identifier name is empty
7051  *               3.return napi_invalid_arg
7052  */
7053 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Threadsafe_Function_0900, testing::ext::TestSize.Level2)
7054 {
7055     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Threadsafe_Function_0900 start";
7056 
7057     napi_env env = (napi_env)engine_;
7058     napi_threadsafe_function result = nullptr;
7059     jsData.id = CALL_JSCB_DATA;
7060     finalData.id = FINAL_CB_DATA;
7061     napi_status threadresult = napi_create_threadsafe_function(
7062         env, nullptr, nullptr, nullptr, 0, 1, &finalData, Threadfinalcb, &jsData, ThreadSafeCallJs, &result);
7063     GTEST_LOG_(INFO) << "threadresult is " << threadresult;
7064     EXPECT_EQ(threadresult, napi_status::napi_invalid_arg);
7065     EXPECT_EQ(result, nullptr);
7066 
7067     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Threadsafe_Function_0900 end";
7068 }
7069 
7070 /*
7071  * @tc.number  : ACE_Napi_Create_Threadsafe_Function_1000
7072  * @tc.name    : Call napi_create_threadsafe_function when the output parameter result is empty
7073  * @tc.desc    : 1.Declare each parameter correctly
7074  *               2.Call napi_create_threadsafe_function when the output parameter result is empty
7075  *               3.return napi_invalid_arg
7076  */
7077 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Threadsafe_Function_1000, testing::ext::TestSize.Level2)
7078 {
7079     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Threadsafe_Function_1000 start";
7080 
7081     napi_env env = (napi_env)engine_;
7082     size_t strsize = 13;
7083     napi_value resource_name;
7084     jsData.id = CALL_JSCB_DATA;
7085     finalData.id = FINAL_CB_DATA;
7086     napi_create_string_utf8(env, "JSstringTest", strsize, &resource_name);
7087     napi_status threadresult = napi_create_threadsafe_function(
7088         env, nullptr, nullptr, resource_name, 0, 1, &finalData, Threadfinalcb, &jsData, ThreadSafeCallJs, nullptr);
7089     GTEST_LOG_(INFO) << "threadresult is " << threadresult;
7090     EXPECT_EQ(threadresult, napi_status::napi_invalid_arg);
7091 
7092     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Threadsafe_Function_1000 end";
7093 }
7094 
7095 /*
7096  * @tc.number  : ACE_Napi_Create_Threadsafe_Function_1100
7097  * @tc.name    : Call napi_create_threadsafe_function when the env environment variable is empty
7098  * @tc.desc    : 1.Declare each parameter correctly
7099  *               2.Call napi_create_threadsafe_function when the env environment variable is empty
7100  *               3.return napi_invalid_arg
7101  */
7102 HWTEST_F(NativeEngineTest, ACE_Napi_Create_Threadsafe_Function_1100, testing::ext::TestSize.Level2)
7103 {
7104     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Threadsafe_Function_1100 start";
7105 
7106     napi_env env = nullptr;
7107     size_t strsize = 13;
7108     napi_value resource_name;
7109     napi_threadsafe_function result = nullptr;
7110     jsData.id = CALL_JSCB_DATA;
7111     finalData.id = FINAL_CB_DATA;
7112     napi_create_string_utf8(env, "JSstringTest", strsize, &resource_name);
7113     napi_status threadresult = napi_create_threadsafe_function(
7114         env, nullptr, nullptr, resource_name, 0, 1, &finalData, Threadfinalcb, &jsData, ThreadSafeCallJs, &result);
7115     GTEST_LOG_(INFO) << "threadresult is " << threadresult;
7116     EXPECT_EQ(threadresult, napi_status::napi_invalid_arg);
7117     EXPECT_EQ(result, nullptr);
7118 
7119     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Create_Threadsafe_Function_1100 end";
7120 }
7121 
7122 /*
7123  * @tc.number  : ACE_Napi_Get_Threadsafe_Function_Context_0100
7124  * @tc.name    : Call napi_get_threadsafe_function_context to get the context value passed by creat
7125  * @tc.desc    : 1.Declare each parameter correctly
7126  *               2.Call napi_create_threadsafe_function and the value passed in context is number
7127  *               3.Call napi_get_threadsafe_function_context to get context
7128  *               4.Call napi_release_threadsafe_function to free the thread
7129  */
7130 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Threadsafe_Function_Context_0100, testing::ext::TestSize.Level1)
7131 {
7132     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Threadsafe_Function_Context_0100 start";
7133 
7134     napi_env env = (napi_env)engine_;
7135     size_t strsize = 13;
7136     napi_value resource_name;
7137     napi_threadsafe_function result = nullptr;
7138     void* contextresult = nullptr;
7139     jsData.id = CALL_JSCB_DATA;
7140     napi_create_string_utf8(env, "JSstringTest", strsize, &resource_name);
7141     napi_status threadresult = napi_create_threadsafe_function(
7142         env, nullptr, nullptr, resource_name, 0, 1, nullptr, nullptr, &jsData, ThreadSafeCallJs, &result);
7143     EXPECT_EQ(threadresult, napi_status::napi_ok);
7144     napi_status getcontextresult = napi_get_threadsafe_function_context(result, &contextresult);
7145     EXPECT_EQ(getcontextresult, napi_status::napi_ok);
7146     CallJsCbData* cbdata = nullptr;
7147     cbdata = (CallJsCbData*)contextresult;
7148     EXPECT_EQ(cbdata->id, CALL_JSCB_DATA);
7149     napi_status releaseresult = napi_release_threadsafe_function(result, napi_tsfn_release);
7150     GTEST_LOG_(INFO) << "napi_release_threadsafe_function finish!";
7151     EXPECT_EQ(releaseresult, napi_status::napi_ok);
7152     sleep(1);
7153 
7154     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Threadsafe_Function_Context_0100 end";
7155 }
7156 
7157 /*
7158  * @tc.number  : ACE_Napi_Get_Threadsafe_Function_Context_0200
7159  * @tc.name    : Call napi_get_threadsafe_function_context to get the context value passed by creat
7160  * @tc.desc    : 1.Declare each parameter correctly
7161  *               2.Call napi_create_threadsafe_function
7162  *               3.Call napi_get_threadsafe_function_context to get context when the contextresult is
7163  *                  nullptr
7164  *               4.return napi_invalid_arg 5.Call napi_release_threadsafe_function to free the thread
7165  */
7166 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Threadsafe_Function_Context_0200, testing::ext::TestSize.Level2)
7167 {
7168     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Threadsafe_Function_Context_0200 start";
7169 
7170     napi_env env = (napi_env)engine_;
7171     size_t strsize = 13;
7172     napi_value resource_name;
7173     napi_threadsafe_function result = nullptr;
7174     jsData.id = CALL_JSCB_DATA;
7175     napi_create_string_utf8(env, "JSstringTest", strsize, &resource_name);
7176     napi_status threadresult = napi_create_threadsafe_function(
7177         env, nullptr, nullptr, resource_name, 0, 1, nullptr, nullptr, &jsData, ThreadSafeCallJs, &result);
7178     EXPECT_EQ(threadresult, napi_status::napi_ok);
7179     napi_status getcontextresult = napi_get_threadsafe_function_context(result, nullptr);
7180     EXPECT_EQ(getcontextresult, napi_status::napi_invalid_arg);
7181     napi_status releaseresult = napi_release_threadsafe_function(result, napi_tsfn_release);
7182     GTEST_LOG_(INFO) << "napi_release_threadsafe_function finish!";
7183     EXPECT_EQ(releaseresult, napi_status::napi_ok);
7184     sleep(1);
7185 
7186     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Threadsafe_Function_Context_0200 end";
7187 }
7188 
7189 /*
7190  * @tc.number  : ACE_Napi_Get_Threadsafe_Function_Context_0300
7191  * @tc.name    : Call napi_get_threadsafe_function_context to get the context value passed by creat
7192  * @tc.desc    : 1.Declare each parameter correctly
7193  *               2.Call napi_create_threadsafe_function
7194  *               3.Call napi_get_threadsafe_function_context to get context when the result is nullptr
7195  *               4.return napi_invalid_arg
7196  *               5.Call napi_release_threadsafe_function to free the thread
7197  */
7198 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Threadsafe_Function_Context_0300, testing::ext::TestSize.Level2)
7199 {
7200     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Threadsafe_Function_Context_0300 start";
7201 
7202     napi_env env = (napi_env)engine_;
7203     size_t strsize = 13;
7204     napi_value resource_name;
7205     napi_threadsafe_function result = nullptr;
7206     void* contextresult = nullptr;
7207     jsData.id = CALL_JSCB_DATA;
7208     napi_create_string_utf8(env, "JSstringTest", strsize, &resource_name);
7209     napi_status threadresult = napi_create_threadsafe_function(
7210         env, nullptr, nullptr, resource_name, 0, 1, nullptr, nullptr, &jsData, ThreadSafeCallJs, &result);
7211     EXPECT_EQ(threadresult, napi_status::napi_ok);
7212     napi_status getcontextresult = napi_get_threadsafe_function_context(nullptr, &contextresult);
7213     EXPECT_EQ(getcontextresult, napi_status::napi_invalid_arg);
7214     napi_status releaseresult = napi_release_threadsafe_function(result, napi_tsfn_release);
7215     GTEST_LOG_(INFO) << "napi_release_threadsafe_function finish!";
7216     EXPECT_EQ(releaseresult, napi_status::napi_ok);
7217     sleep(1);
7218 
7219     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Threadsafe_Function_Context_0300 end";
7220 }
7221 
7222 /*
7223  * @tc.number  : ACE_Napi_Get_Threadsafe_Function_Context_0400
7224  * @tc.name    : Call napi_get_threadsafe_function_context to get the context value passed by creat
7225  * @tc.desc    : 1.Declare each parameter correctly
7226  *               2.Call napi_create_threadsafe_function and the value passed in context is a string
7227  *               3.Call napi_get_threadsafe_function_context to get context
7228  *               4.Call napi_release_threadsafe_function to free the thread
7229  */
7230 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Threadsafe_Function_Context_0400, testing::ext::TestSize.Level2)
7231 {
7232     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Threadsafe_Function_Context_0400 start";
7233 
7234     napi_env env = (napi_env)engine_;
7235     size_t strsize = 13;
7236     napi_value resource_name;
7237     napi_threadsafe_function result = nullptr;
7238     void* contextresult = nullptr;
7239     jsData_str.id = CALL_JSCB_DATA;
7240     if (strcpy_s(jsData_str.strdata, strlen("contextdata") + 1, "contextdata") != 0) {
7241         return;
7242     }
7243     napi_create_string_utf8(env, "JSstringTest", strsize, &resource_name);
7244     napi_status threadresult = napi_create_threadsafe_function(
7245         env, nullptr, nullptr, resource_name, 0, 1, nullptr, nullptr, &jsData_str, ThreadSafeCallJs, &result);
7246     EXPECT_EQ(threadresult, napi_status::napi_ok);
7247     napi_status getcontextresult = napi_get_threadsafe_function_context(result, &contextresult);
7248     EXPECT_EQ(getcontextresult, napi_status::napi_ok);
7249     CallJsCbData_str* cbdata = nullptr;
7250     cbdata = (CallJsCbData_str*)contextresult;
7251     GTEST_LOG_(INFO) << "cbdata->id is " << cbdata->id;
7252     EXPECT_EQ(cbdata->id, CALL_JSCB_DATA);
7253     GTEST_LOG_(INFO) << "cbdata->strdata is " << cbdata->strdata;
7254     EXPECT_EQ(strcmp(cbdata->strdata, "contextdata"), 0);
7255     napi_status releaseresult = napi_release_threadsafe_function(result, napi_tsfn_release);
7256     GTEST_LOG_(INFO) << "napi_release_threadsafe_function finish!";
7257     EXPECT_EQ(releaseresult, napi_status::napi_ok);
7258     sleep(1);
7259 
7260     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Threadsafe_Function_Context_0400 end";
7261 }
7262 
7263 /*
7264  * @tc.number  : ACE_Napi_Get_Threadsafe_Function_Context_0500
7265  * @tc.name    : Call napi_get_threadsafe_function_context to get the context value passed by creat
7266  * @tc.desc    : 1.Declare each parameter correctly
7267  *               2.Call napi_create_threadsafe_function and the value passed in context is a special
7268  *                  string
7269  *               3.Call napi_get_threadsafe_function_context to get context 4.Call napi_release_threadsafe_function to
7270  *                  free the thread
7271  */
7272 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Threadsafe_Function_Context_0500, testing::ext::TestSize.Level1)
7273 {
7274     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Threadsafe_Function_Context_0500 start";
7275 
7276     napi_env env = (napi_env)engine_;
7277     size_t strsize = 13;
7278     napi_value resource_name;
7279     napi_threadsafe_function result = nullptr;
7280     void* contextresult = nullptr;
7281     jsData_str.id = CALL_JSCB_DATA;
7282     if (strcpy_s(jsData_str.strdata, strlen("~!@#$%^&*( ") + 1, "~!@#$%^&*( ") != 0) {
7283         return;
7284     }
7285     napi_create_string_utf8(env, "JSstringTest", strsize, &resource_name);
7286     napi_status threadresult = napi_create_threadsafe_function(
7287         env, nullptr, nullptr, resource_name, 0, 1, nullptr, nullptr, &jsData_str, ThreadSafeCallJs, &result);
7288     EXPECT_EQ(threadresult, napi_status::napi_ok);
7289     napi_status getcontextresult = napi_get_threadsafe_function_context(result, &contextresult);
7290     EXPECT_EQ(getcontextresult, napi_status::napi_ok);
7291     CallJsCbData_str* cbdata = nullptr;
7292     cbdata = (CallJsCbData_str*)contextresult;
7293     GTEST_LOG_(INFO) << "cbdata->id is " << cbdata->id;
7294     EXPECT_EQ(cbdata->id, CALL_JSCB_DATA);
7295     GTEST_LOG_(INFO) << "cbdata->strdata is " << cbdata->strdata;
7296     EXPECT_EQ(strcmp(cbdata->strdata, "~!@#$%^&*( "), 0);
7297     napi_status releaseresult = napi_release_threadsafe_function(result, napi_tsfn_release);
7298     GTEST_LOG_(INFO) << "napi_release_threadsafe_function finish!";
7299     EXPECT_EQ(releaseresult, napi_status::napi_ok);
7300     sleep(1);
7301 
7302     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Threadsafe_Function_Context_0500 end";
7303 }
7304 
7305 /*
7306  * @tc.number  : ACE_Napi_Get_Threadsafe_Function_Context_0600
7307  * @tc.name    : Call napi_get_threadsafe_function_context to get the context value passed by creat
7308  * @tc.desc    : 1.Declare each parameter correctly
7309  *               2.Call napi_create_threadsafe_function and the value of the incoming context is a
7310  *                  Chinese character
7311  *               3.Call napi_get_threadsafe_function_context to get context 4.Call napi_release_threadsafe_function
7312  *                  to free the thread
7313  */
7314 HWTEST_F(NativeEngineTest, ACE_Napi_Get_Threadsafe_Function_Context_0600, testing::ext::TestSize.Level1)
7315 {
7316     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Threadsafe_Function_Context_0600 start";
7317 
7318     napi_env env = (napi_env)engine_;
7319     size_t strsize = 13;
7320     napi_value resource_name;
7321     napi_threadsafe_function result = nullptr;
7322     void* contextresult = nullptr;
7323     jsData_str.id = CALL_JSCB_DATA;
7324     if (strcpy_s(jsData_str.strdata, strlen("大家好!!") + 1, "大家好!!") != 0) {
7325         return;
7326     }
7327     napi_create_string_utf8(env, "JSstringTest", strsize, &resource_name);
7328     napi_status threadresult = napi_create_threadsafe_function(
7329         env, nullptr, nullptr, resource_name, 0, 1, nullptr, nullptr, &jsData_str, ThreadSafeCallJs, &result);
7330     EXPECT_EQ(threadresult, napi_status::napi_ok);
7331     napi_status getcontextresult = napi_get_threadsafe_function_context(result, &contextresult);
7332     EXPECT_EQ(getcontextresult, napi_status::napi_ok);
7333     CallJsCbData_str* cbdata = nullptr;
7334     cbdata = (CallJsCbData_str*)contextresult;
7335     GTEST_LOG_(INFO) << "cbdata->id is " << cbdata->id;
7336     EXPECT_EQ(cbdata->id, CALL_JSCB_DATA);
7337     GTEST_LOG_(INFO) << "cbdata->strdata is " << cbdata->strdata;
7338     EXPECT_EQ(strcmp(cbdata->strdata, "大家好!!"), 0);
7339     napi_status releaseresult = napi_release_threadsafe_function(result, napi_tsfn_release);
7340     GTEST_LOG_(INFO) << "napi_release_threadsafe_function finish!";
7341     EXPECT_EQ(releaseresult, napi_status::napi_ok);
7342     sleep(1);
7343 
7344     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Get_Threadsafe_Function_Context_0600 end";
7345 }
7346 
7347 /*
7348  * @tc.number  : ACE_Napi_Acquire_Threadsafe_Function_0100
7349  * @tc.name    : Call napi_acquire_threadsafe_function after passing the parameters correctly
7350  * @tc.desc    : 1.Declare each parameter correctly
7351  *               2.Call napi_create_threadsafe_function
7352  *               3.Call napi_acquire_threadsafe_function
7353  *               4.Call twice  napi_release_threadsafe_function to free the thread
7354  */
7355 HWTEST_F(NativeEngineTest, ACE_Napi_Acquire_Threadsafe_Function_0100, testing::ext::TestSize.Level1)
7356 {
7357     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Acquire_Threadsafe_Function_0100 start";
7358 
7359     napi_env env = (napi_env)engine_;
7360     size_t strsize = 13;
7361     napi_value resource_name;
7362     napi_threadsafe_function result = nullptr;
7363     napi_create_string_utf8(env, "JSstringTest", strsize, &resource_name);
7364     napi_status threadresult = napi_create_threadsafe_function(
7365         env, nullptr, nullptr, resource_name, 0, 1, nullptr, nullptr, nullptr, ThreadSafeCallJs, &result);
7366     EXPECT_EQ(threadresult, napi_status::napi_ok);
7367     napi_status acquireresult = napi_acquire_threadsafe_function(result);
7368     GTEST_LOG_(INFO) << "acquireresult is " << acquireresult;
7369     EXPECT_EQ(acquireresult, napi_status::napi_ok);
7370     napi_status releaseresultone = napi_release_threadsafe_function(result, napi_tsfn_release);
7371     GTEST_LOG_(INFO) << "releaseresultone is " << releaseresultone;
7372     EXPECT_EQ(releaseresultone, napi_status::napi_ok);
7373     napi_status releaseresulttwo = napi_release_threadsafe_function(result, napi_tsfn_release);
7374     GTEST_LOG_(INFO) << "releaseresulttwo is " << releaseresulttwo;
7375     EXPECT_EQ(releaseresulttwo, napi_status::napi_ok);
7376     GTEST_LOG_(INFO) << "napi_release_threadsafe_function finish!";
7377 
7378     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Acquire_Threadsafe_Function_0100 end";
7379 }
7380 
7381 /*
7382  * @tc.number  : ACE_Napi_Acquire_Threadsafe_Function_0200
7383  * @tc.name    : Call napi_acquire_threadsafe_function after passing parameter error
7384  * @tc.desc    : 1.Declare each parameter correctly
7385  *               2.Call napi_create_threadsafe_function
7386  *               3.Call napi_acquire_threadsafe_function after the result value is nullptr
7387  *               4.Call napi_release_threadsafe_function to free the thread
7388  */
7389 HWTEST_F(NativeEngineTest, ACE_Napi_Acquire_Threadsafe_Function_0200, testing::ext::TestSize.Level2)
7390 {
7391     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Acquire_Threadsafe_Function_0200 start";
7392 
7393     napi_env env = (napi_env)engine_;
7394     size_t strsize = 13;
7395     napi_value resource_name;
7396     napi_threadsafe_function result = nullptr;
7397     napi_create_string_utf8(env, "JSstringTest", strsize, &resource_name);
7398     napi_status threadresult = napi_create_threadsafe_function(
7399         env, nullptr, nullptr, resource_name, 0, 1, nullptr, nullptr, nullptr, ThreadSafeCallJs, &result);
7400     EXPECT_EQ(threadresult, napi_status::napi_ok);
7401     napi_status acquireresult = napi_acquire_threadsafe_function(nullptr);
7402     GTEST_LOG_(INFO) << "acquireresult is " << acquireresult;
7403     EXPECT_EQ(acquireresult, napi_status::napi_invalid_arg);
7404     napi_status releaseresultone = napi_release_threadsafe_function(result, napi_tsfn_release);
7405     GTEST_LOG_(INFO) << "releaseresult is " << releaseresultone;
7406     EXPECT_EQ(releaseresultone, napi_status::napi_ok);
7407     napi_status releaseresulttwo = napi_release_threadsafe_function(result, napi_tsfn_release);
7408     GTEST_LOG_(INFO) << "releaseresult is " << releaseresulttwo;
7409     EXPECT_EQ(releaseresulttwo, napi_status::napi_generic_failure);
7410     GTEST_LOG_(INFO) << "napi_release_threadsafe_function finish!";
7411 
7412     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Acquire_Threadsafe_Function_0200 end";
7413 }
7414 
7415 /*
7416  * @tc.number  : ACE_Napi_Acquire_Threadsafe_Function_0300
7417  * @tc.name    : Call napi_acquire_threadsafe_function after passing the parameters correctly
7418  * @tc.desc    : 1.Declare each parameter correctly
7419  *               2.Call napi_create_threadsafe_function
7420  *               3.Call twice napi_acquire_threadsafe_function
7421  *               4.Call thrice napi_release_threadsafe_function to free the thread
7422  */
7423 HWTEST_F(NativeEngineTest, ACE_Napi_Acquire_Threadsafe_Function_0300, testing::ext::TestSize.Level1)
7424 {
7425     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Acquire_Threadsafe_Function_0300 start";
7426 
7427     napi_env env = (napi_env)engine_;
7428     size_t strsize = 13;
7429     napi_value resource_name;
7430     napi_threadsafe_function result = nullptr;
7431     napi_create_string_utf8(env, "JSstringTest", strsize, &resource_name);
7432     napi_status threadresult = napi_create_threadsafe_function(
7433         env, nullptr, nullptr, resource_name, 0, 1, nullptr, nullptr, nullptr, ThreadSafeCallJs, &result);
7434     EXPECT_EQ(threadresult, napi_status::napi_ok);
7435     napi_status acquireresultone = napi_acquire_threadsafe_function(result);
7436     GTEST_LOG_(INFO) << "acquireresult is " << acquireresultone;
7437     EXPECT_EQ(acquireresultone, napi_status::napi_ok);
7438     napi_status acquireresulttwo = napi_acquire_threadsafe_function(result);
7439     GTEST_LOG_(INFO) << "acquireresult is " << acquireresulttwo;
7440     EXPECT_EQ(acquireresulttwo, napi_status::napi_ok);
7441     napi_status releaseresultone = napi_release_threadsafe_function(result, napi_tsfn_release);
7442     GTEST_LOG_(INFO) << "releaseresultone is " << releaseresultone;
7443     EXPECT_EQ(releaseresultone, napi_status::napi_ok);
7444     napi_status releaseresulttwo = napi_release_threadsafe_function(result, napi_tsfn_release);
7445     GTEST_LOG_(INFO) << "releaseresulttwo is " << releaseresulttwo;
7446     EXPECT_EQ(releaseresulttwo, napi_status::napi_ok);
7447     napi_status releaseresultthree = napi_release_threadsafe_function(result, napi_tsfn_release);
7448     GTEST_LOG_(INFO) << "releaseresultthree is " << releaseresultthree;
7449     EXPECT_EQ(releaseresultthree, napi_status::napi_ok);
7450     GTEST_LOG_(INFO) << "napi_release_threadsafe_function finish!";
7451 
7452     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Acquire_Threadsafe_Function_0300 end";
7453 }
7454 
7455 /*
7456  * @tc.number  : ACE_Napi_Release_Threadsafe_Function_0100
7457  * @tc.name    : Call napi_release_threadsafe_function after passing the parameters correctly
7458  * @tc.desc    : 1.Declare each parameter correctly
7459  *               2.Call napi_create_threadsafe_function when the number of initial threads is one
7460  *               3.Call uv_thread_create to create thread
7461  *               4.Call napi_release_threadsafe_function
7462  */
7463 HWTEST_F(NativeEngineTest, ACE_Napi_Release_Threadsafe_Function_0100, testing::ext::TestSize.Level1)
7464 {
7465     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Release_Threadsafe_Function_0100 start";
7466 
7467     napi_env env = (napi_env)engine_;
7468     size_t strsize = 13;
7469     napi_value resource_name;
7470     napi_threadsafe_function result = nullptr;
7471     napi_create_string_utf8(env, "JSstringTest", strsize, &resource_name);
7472     napi_status threadresult = napi_create_threadsafe_function(
7473         env, nullptr, nullptr, resource_name, 0, 1, nullptr, nullptr, nullptr, ThreadSafeCallJs, &result);
7474     GTEST_LOG_(INFO) << "threadresult is " << threadresult;
7475     EXPECT_EQ(threadresult, napi_status::napi_ok);
7476     EXPECT_NE(result, nullptr);
7477     if (uv_thread_create(&g_uvThread, TsFuncreleaseThread, result) != 0) {
7478         GTEST_LOG_(INFO) << "Failed to create uv thread!";
7479     }
7480     sleep(1);
7481 
7482     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Release_Threadsafe_Function_0100 end";
7483 }
7484 
7485 /*
7486  * @tc.number  : ACE_Napi_Release_Threadsafe_Function_0200
7487  * @tc.name    : Call napi_release_threadsafe_function after passing parameter error
7488  * @tc.desc    : 1.Declare each parameter correctly
7489  *               2.Call napi_create_threadsafe_function when the number of initial threads is one
7490  *               3.Call uv_thread_create to create thread
7491  *               4.Call napi_release_threadsafe_function when the incoming result is nullptr
7492  *               5.return napi_invalid_arg
7493  */
7494 HWTEST_F(NativeEngineTest, ACE_Napi_Release_Threadsafe_Function_0200, testing::ext::TestSize.Level2)
7495 {
7496     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Release_Threadsafe_Function_0200 start";
7497 
7498     napi_env env = (napi_env)engine_;
7499     size_t strsize = 13;
7500     napi_value resource_name;
7501     napi_threadsafe_function result = nullptr;
7502     napi_create_string_utf8(env, "JSstringTest", strsize, &resource_name);
7503     napi_status threadresult = napi_create_threadsafe_function(
7504         env, nullptr, nullptr, resource_name, 0, 1, nullptr, nullptr, nullptr, ThreadSafeCallJs, &result);
7505     GTEST_LOG_(INFO) << "threadresult is " << threadresult;
7506     EXPECT_EQ(threadresult, napi_status::napi_ok);
7507     EXPECT_NE(result, nullptr);
7508     if (uv_thread_create(&g_uvThread, TsFuncErrReleaseThread, result) != 0) {
7509         GTEST_LOG_(INFO) << "Failed to create uv thread!";
7510     }
7511     sleep(1);
7512     napi_status releaselastresult = napi_release_threadsafe_function(result, napi_tsfn_release);
7513     GTEST_LOG_(INFO) << "releaseresultthree is " << releaselastresult;
7514     EXPECT_EQ(releaselastresult, napi_status::napi_ok);
7515 
7516     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Release_Threadsafe_Function_0200 end";
7517 }
7518 
7519 /*
7520  * @tc.number  : ACE_Napi_Release_Threadsafe_Function_0300
7521  * @tc.name    : Call napi_release_threadsafe_function after passing the parameters correctly
7522  * @tc.desc    : 1.Declare each parameter correctly
7523  *               2.Call napi_create_threadsafe_function when the number of initial threads is five
7524  *               3.Call uv_thread_create to create thread
7525  *               4.Call Five times napi_release_threadsafe_function
7526  */
7527 HWTEST_F(NativeEngineTest, ACE_Napi_Release_Threadsafe_Function_0300, testing::ext::TestSize.Level1)
7528 {
7529     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Release_Threadsafe_Function_0300 start";
7530 
7531     napi_env env = (napi_env)engine_;
7532     size_t strsize = 13;
7533     napi_value resource_name;
7534     napi_threadsafe_function result = nullptr;
7535     napi_create_string_utf8(env, "JSstringTest", strsize, &resource_name);
7536     napi_status threadresult = napi_create_threadsafe_function(
7537         env, nullptr, nullptr, resource_name, 0, 5, nullptr, nullptr, nullptr, ThreadSafeCallJs, &result);
7538     GTEST_LOG_(INFO) << "threadresult is " << threadresult;
7539     EXPECT_EQ(threadresult, napi_status::napi_ok);
7540     EXPECT_NE(result, nullptr);
7541     if (uv_thread_create(&g_uvThread, TsFuncreleasefiveThread, result) != 0) {
7542         GTEST_LOG_(INFO) << "Failed to create uv thread!";
7543     }
7544     sleep(1);
7545 
7546     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Release_Threadsafe_Function_0300 end";
7547 }
7548 
7549 /*
7550  * @tc.number  : ACE_Napi_Release_Threadsafe_Function_0400
7551  * @tc.name    : Call napi_release_threadsafe_function after passing the parameters correctly
7552  * @tc.desc    : 1.Declare each parameter correctly
7553  *               2.Call napi_create_threadsafe_function when the number of initial threads is two
7554  *               3.Call uv_thread_create to create thread
7555  *               4.Call napi_release_threadsafe_function when the incoming mode is napi_tsfn_abort
7556  *               5.Call uv_thread_create to create thread return napi_closing
7557  */
7558 HWTEST_F(NativeEngineTest, ACE_Napi_Release_Threadsafe_Function_0400, testing::ext::TestSize.Level1)
7559 {
7560     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Release_Threadsafe_Function_0400 start";
7561 
7562     napi_env env = (napi_env)engine_;
7563     g_callFinalizeEnd = false;
7564     size_t strsize = 13;
7565     napi_value resource_name;
7566     napi_threadsafe_function result = nullptr;
7567     jsData.id = CALL_JSCB_DATA;
7568     finalData.id = FINAL_CB_DATA;
7569     napi_create_string_utf8(env, "JSstringTest", strsize, &resource_name);
7570     napi_status threadresult = napi_create_threadsafe_function(
7571         env, nullptr, nullptr, resource_name, 0, 2, &finalData, Threadfinalcb, &jsData, ThreadSafeCallJs, &result);
7572     GTEST_LOG_(INFO) << "threadresult is " << threadresult;
7573     EXPECT_EQ(threadresult, napi_status::napi_ok);
7574     EXPECT_NE(result, nullptr);
7575     if (uv_thread_create(&g_uvThread, TsFuncabortThread, result) != 0) {
7576         GTEST_LOG_(INFO) << "Failed to create uv thread!";
7577     }
7578     GetFinalizeStatus();
7579 
7580     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Release_Threadsafe_Function_0400 end";
7581 }
7582 
Cleanup(void * arg)7583 static void Cleanup(void* arg)
7584 {
7585     GTEST_LOG_(INFO) << "Cleanup(void* arg) start";
7586 
7587     HOOK_TAG += INT_ONE;
7588     if (arg != nullptr) {
7589         GTEST_LOG_(INFO) << "cleanup(" << *(int*)(arg) << ")";
7590     }
7591     GTEST_LOG_(INFO) << "Cleanup(void* arg) end";
7592 }
7593 
CleanupCopy(void * arg)7594 static void CleanupCopy(void* arg)
7595 {
7596     GTEST_LOG_(INFO) << "CleanupCopy(void* arg) start";
7597 
7598     HOOK_TAGCP += INT_ONE;
7599     if (arg != nullptr) {
7600         GTEST_LOG_(INFO) << "CleanupCopy(" << *(int*)(arg) << ")";
7601     }
7602     GTEST_LOG_(INFO) << "CleanupCopy(void* arg) end";
7603 }
7604 
7605 /*
7606  * @tc.number    : ACE_Napi_Add_Env_Cleanup_Hook_0100
7607  * @tc.name      : Tests whether napi_add_env_cleanup_hook is called properly when the environment exits
7608  * @tc.desc      : 1.The environment engine is created
7609  *                 2.Set test variables
7610  *                 3.The function of napi_add_env_cleanup_hook is called
7611  *                 4.Return value of function is napi_ok
7612  *                 5.Call RunCleanup to trigger napi_add_env_cleanup_hook
7613  */
7614 HWTEST_F(NativeEngineTest, ACE_Napi_Add_Env_Cleanup_Hook_0100, testing::ext::TestSize.Level1)
7615 {
7616     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Add_Env_Cleanup_Hook_0100 start";
7617     napi_env env = (napi_env)engine_;
7618     HOOK_TAG = INT_ZERO;
7619     ExpectCheckCall(napi_add_env_cleanup_hook(env, Cleanup, &HOOK_ARG_ONE));
7620     engine_->RunCleanup();
7621     EXPECT_EQ(HOOK_TAG, INT_ONE);
7622     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Add_Env_Cleanup_Hook_0100 end";
7623 }
7624 
7625 /*
7626  * @tc.number    : ACE_Napi_Add_Env_Cleanup_Hook_0200
7627  * @tc.name      : Test napi_add_env_cleanup_hook if the arg parameter is null
7628  * @tc.desc      : 1.The environment engine is created
7629  *                 2.Set test variables
7630  *                 3.The function of napi_add_env_cleanup_hook is called
7631  *                 4.Return value of function is napi_ok
7632  *                 5.Call RunCleanup to trigger napi_add_env_cleanup_hook
7633  */
7634 HWTEST_F(NativeEngineTest, ACE_Napi_Add_Env_Cleanup_Hook_0200, testing::ext::TestSize.Level2)
7635 {
7636     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Add_Env_Cleanup_Hook_0200 start";
7637     napi_env env = (napi_env)engine_;
7638     napi_status ret = napi_invalid_arg;
7639     ret = napi_add_env_cleanup_hook(env, Cleanup, nullptr);
7640     engine_->RunCleanup();
7641     EXPECT_EQ(ret, napi_ok);
7642     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Add_Env_Cleanup_Hook_0200 end";
7643 }
7644 
7645 /*
7646  * @tc.number    : ACE_Napi_Add_Env_Cleanup_Hook_0300
7647  * @tc.name      : Invalid registered function for napi_add_env_cleanup_hook test
7648  * @tc.desc      : 1.The environment engine is created
7649  *                 2.Set test variables
7650  *                 3.The function of napi_add_env_cleanup_hook is called
7651  *                 4.Return value of function is napi_invalid_arg
7652  */
7653 HWTEST_F(NativeEngineTest, ACE_Napi_Add_Env_Cleanup_Hook_0300, testing::ext::TestSize.Level2)
7654 {
7655     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Add_Env_Cleanup_Hook_0300 start";
7656     napi_env env = (napi_env)engine_;
7657     napi_status ret = napi_ok;
7658     ret = napi_add_env_cleanup_hook(env, nullptr, &HOOK_ARG_ONE);
7659 
7660     EXPECT_EQ(ret, napi_invalid_arg);
7661     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Add_Env_Cleanup_Hook_0300 end";
7662 }
7663 
7664 /*
7665  * @tc.number    : ACE_Napi_Add_Env_Cleanup_Hook_0400
7666  * @tc.name      : Test napi_add_env_cleanup_hook passing an invalid env
7667  * @tc.desc      : 1.The environment engine is created
7668  *                 2.Set test variables
7669  *                 3.The function of napi_add_env_cleanup_hook is called
7670  *                 4.Return value of function is napi_invalid_arg
7671  */
7672 HWTEST_F(NativeEngineTest, ACE_Napi_Add_Env_Cleanup_Hook_0400, testing::ext::TestSize.Level2)
7673 {
7674     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Add_Env_Cleanup_Hook_0400 start";
7675     napi_status ret = napi_ok;
7676     ret = napi_add_env_cleanup_hook(nullptr, Cleanup, &HOOK_ARG_ONE);
7677     engine_->RunCleanup();
7678     EXPECT_EQ(ret, napi_invalid_arg);
7679     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Add_Env_Cleanup_Hook_0400 end";
7680 }
7681 
7682 /*
7683  * @tc.number    : ACE_Napi_Add_Env_Cleanup_Hook_0500
7684  * @tc.name      : Release after testing napi_add_env_cleanup_hook call, call again
7685  * @tc.desc      : 1.The environment engine is created
7686  *                 2.Set test variables
7687  *                 3.The function of napi_add_env_cleanup_hook is called
7688  *                 4.Return value of function is napi_ok
7689  *                 5.The function of napi_remove_env_cleanup_hook is called
7690  *                 6.Release napi_add_env_cleanup_hook
7691  *                 7.The function of napi_add_env_cleanup_hook is called
7692  *                 8.Return value of function is napi_ok
7693  */
7694 HWTEST_F(NativeEngineTest, ACE_Napi_Add_Env_Cleanup_Hook_0500, testing::ext::TestSize.Level1)
7695 {
7696     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Add_Env_Cleanup_Hook_0500 start";
7697     napi_env env = (napi_env)engine_;
7698     HOOK_TAG = INT_ZERO;
7699     ExpectCheckCall(napi_add_env_cleanup_hook(env, Cleanup, &HOOK_ARG_ONE));
7700     ExpectCheckCall(napi_remove_env_cleanup_hook(env, Cleanup, &HOOK_ARG_ONE));
7701     ExpectCheckCall(napi_add_env_cleanup_hook(env, Cleanup, &HOOK_ARG_ONE));
7702     engine_->RunCleanup();
7703     EXPECT_EQ(HOOK_TAG, INT_ONE);
7704     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Add_Env_Cleanup_Hook_0500 end";
7705 }
7706 
7707 /*
7708  * @tc.number    : ACE_Napi_Add_Env_Cleanup_Hook_0600
7709  * @tc.name      : Test the normal operation of napi_add_env_cleanup_hook
7710  * @tc.desc      : 1.The environment engine is created
7711  *                 2.Set test variables
7712  *                 3.The function of napi_add_env_cleanup_hook is called
7713  *                 4.Return value of function is napi_ok
7714  *                 5.Then call the function of napi_add_env_cleanup_hook again
7715  */
7716 HWTEST_F(NativeEngineTest, ACE_Napi_Add_Env_Cleanup_Hook_0600, testing::ext::TestSize.Level1)
7717 {
7718     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Add_Env_Cleanup_Hook_0600 start";
7719     HOOK_TAG = INT_ZERO;
7720     napi_env env = (napi_env)engine_;
7721     ExpectCheckCall(napi_add_env_cleanup_hook(env, Cleanup, &HOOK_ARG_ONE));
7722     ExpectCheckCall(napi_add_env_cleanup_hook(env, Cleanup, &HOOK_ARG_TWO));
7723     engine_->RunCleanup();
7724     EXPECT_EQ(HOOK_TAG, INT_TWO);
7725     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Add_Env_Cleanup_Hook_0600 end";
7726 }
7727 
7728 /*
7729  * @tc.number    : ACE_Napi_Add_Env_Cleanup_Hook_0700
7730  * @tc.name      : Test whether an exception is returned when the parameters of
7731  *                 napi_add_env_cleanup_hook are the same
7732  * @tc.desc      : 1.The environment engine is created
7733  *                 2.Set test variables
7734  *                 3.The function of napi_add_env_cleanup_hook is called
7735  *                 4.Return value of function is napi_ok
7736  */
7737 HWTEST_F(NativeEngineTest, ACE_Napi_Add_Env_Cleanup_Hook_0700, testing::ext::TestSize.Level2)
7738 {
7739     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Add_Env_Cleanup_Hook_0700 start";
7740     napi_env env = (napi_env)engine_;
7741     HOOK_TAG = INT_ZERO;
7742     ExpectCheckCall(napi_add_env_cleanup_hook(env, Cleanup, &HOOK_ARG_ONE));
7743     ExpectCheckCall(napi_add_env_cleanup_hook(env, Cleanup, &HOOK_ARG_ONE));
7744     engine_->RunCleanup();
7745     EXPECT_EQ(HOOK_TAG, INT_ONE);
7746     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Add_Env_Cleanup_Hook_0700 end";
7747 }
7748 
7749 /*
7750  * @tc.number    : ACE_Napi_Add_Env_Cleanup_Hook_0800
7751  * @tc.name      : Test the normal operation of napi_add_env_cleanup_hook
7752  * @tc.desc      : 1.The environment engine is created
7753  *                 2.Set test variables
7754  *                 3.The function of napi_add_env_cleanup_hook is called
7755  *                 4.Return value of function is napi_ok
7756  */
7757 HWTEST_F(NativeEngineTest, ACE_Napi_Add_Env_Cleanup_Hook_0800, testing::ext::TestSize.Level1)
7758 {
7759     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Add_Env_Cleanup_Hook_0800 start";
7760     napi_env env = (napi_env)engine_;
7761     HOOK_TAG = INT_ZERO;
7762     ExpectCheckCall(napi_add_env_cleanup_hook(env, Cleanup, &HOOK_ARG_ONE));
7763     ExpectCheckCall(napi_add_env_cleanup_hook(env, Cleanup, &HOOK_ARG_TWO));
7764     ExpectCheckCall(napi_add_env_cleanup_hook(env, Cleanup, &HOOK_ARG_THREE));
7765     engine_->RunCleanup();
7766     EXPECT_EQ(HOOK_TAG, INT_THREE);
7767     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Add_Env_Cleanup_Hook_0800 end";
7768 }
7769 
7770 /*
7771  * @tc.number    : ACE_Napi_Remove_Env_Cleanup_Hook_0100
7772  * @tc.name      : Test napi_remove_env_cleanup_hook Delete napi_add_env_cleanup_hook
7773  * @tc.desc      : 1.The environment engine is created
7774  *                 2.Set test variables
7775  *                 3.The function of napi_add_env_cleanup_hook is called
7776  *                 4.Return value of function is napi_ok
7777  *                 5.Call RunCleanup to trigger napi_add_env_cleanup_hook
7778  */
7779 HWTEST_F(NativeEngineTest, ACE_Napi_Remove_Env_Cleanup_Hook_0100, testing::ext::TestSize.Level1)
7780 {
7781     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Remove_Env_Cleanup_Hook_0100 start";
7782     napi_env env = (napi_env)engine_;
7783     HOOK_TAG = INT_ZERO;
7784     ExpectCheckCall(napi_add_env_cleanup_hook(env, Cleanup, &HOOK_ARG_ONE));
7785     ExpectCheckCall(napi_add_env_cleanup_hook(env, Cleanup, &HOOK_ARG_TWO));
7786     ExpectCheckCall(napi_remove_env_cleanup_hook(env, Cleanup, &HOOK_ARG_TWO));
7787     engine_->RunCleanup();
7788     EXPECT_EQ(HOOK_TAG, INT_ONE);
7789     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Remove_Env_Cleanup_Hook_0100 end";
7790 }
7791 
7792 /*
7793  * @tc.number    : ACE_Napi_Remove_Env_Cleanup_Hook_0200
7794  * @tc.name      : Test napi_remove_env_cleanup_hook  the arg parameter is null
7795  * @tc.desc      : 1.The environment engine is created
7796  *                 2.Set test variables
7797  *                 3.The function of napi_remove_env_cleanup_hook is called
7798  *                 4.Return value of function is napi_invalid_arg
7799  */
7800 HWTEST_F(NativeEngineTest, ACE_Napi_Remove_Env_Cleanup_Hook_0200, testing::ext::TestSize.Level2)
7801 {
7802     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Remove_Env_Cleanup_Hook_0200 start";
7803     napi_env env = (napi_env)engine_;
7804     HOOK_TAG = INT_ZERO;
7805     napi_status ret = napi_invalid_arg;
7806     ExpectCheckCall(napi_add_env_cleanup_hook(env, Cleanup, &HOOK_ARG_ONE));
7807     ExpectCheckCall(napi_add_env_cleanup_hook(env, Cleanup, &HOOK_ARG_TWO));
7808     ret = napi_remove_env_cleanup_hook(env, Cleanup, nullptr);
7809     engine_->RunCleanup();
7810     EXPECT_EQ(HOOK_TAG, INT_TWO);
7811     EXPECT_EQ(ret, napi_ok);
7812     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Remove_Env_Cleanup_Hook_0200 end";
7813 }
7814 
7815 /*
7816  * @tc.number    : ACE_Napi_Remove_Env_Cleanup_Hook_0300
7817  * @tc.name      : Test Invalid registered function for napi_remove_env_cleanup_hook
7818  * @tc.desc      : 1.The environment engine is created
7819  *                 2.Set test variables
7820  *                 3.The function of napi_remove_env_cleanup_hook is called
7821  *                 4.Return value of function is napi_invalid_arg
7822  */
7823 HWTEST_F(NativeEngineTest, ACE_Napi_Remove_Env_Cleanup_Hook_0300, testing::ext::TestSize.Level2)
7824 {
7825     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Remove_Env_Cleanup_Hook_0300 start";
7826     napi_env env = (napi_env)engine_;
7827     HOOK_TAG = INT_ZERO;
7828     napi_status ret = napi_ok;
7829     ExpectCheckCall(napi_add_env_cleanup_hook(env, Cleanup, &HOOK_ARG_ONE));
7830     ExpectCheckCall(napi_add_env_cleanup_hook(env, Cleanup, &HOOK_ARG_TWO));
7831     ret = napi_remove_env_cleanup_hook(env, nullptr, &HOOK_ARG_TWO);
7832     engine_->RunCleanup();
7833     EXPECT_EQ(HOOK_TAG, INT_TWO);
7834     EXPECT_EQ(ret, napi_invalid_arg);
7835     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Remove_Env_Cleanup_Hook_0300 end";
7836 }
7837 
7838 /*
7839  * @tc.number    : ACE_Napi_Remove_Env_Cleanup_Hook_0400
7840  * @tc.name      : Test napi_remove_env_cleanup_hook passing an invalid env
7841  * @tc.desc      : 1.The environment engine is created
7842  *                 2.Set test variables
7843  *                 3.The function of napi_remove_env_cleanup_hook is called
7844  *                 4.Return value of function is napi_invalid_arg
7845  */
7846 HWTEST_F(NativeEngineTest, ACE_Napi_Remove_Env_Cleanup_Hook_0400, testing::ext::TestSize.Level2)
7847 {
7848     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Remove_Env_Cleanup_Hook_0400 start";
7849     napi_env env = (napi_env)engine_;
7850     HOOK_TAG = INT_ZERO;
7851     napi_status ret = napi_ok;
7852     ExpectCheckCall(napi_add_env_cleanup_hook(env, Cleanup, &HOOK_ARG_ONE));
7853     ExpectCheckCall(napi_add_env_cleanup_hook(env, Cleanup, &HOOK_ARG_TWO));
7854     ret = napi_remove_env_cleanup_hook(nullptr, Cleanup, &HOOK_ARG_TWO);
7855     engine_->RunCleanup();
7856     EXPECT_EQ(HOOK_TAG, INT_TWO);
7857     EXPECT_EQ(ret, napi_invalid_arg);
7858     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Remove_Env_Cleanup_Hook_0400 end";
7859 }
7860 
7861 /*
7862  * @tc.number    : ACE_Napi_Remove_Env_Cleanup_Hook_0500
7863  * @tc.name      : Test napi_remove_env_cleanup_hook Delete
7864  *                 napi_add_env_cleanup_hook abnormal parameter transmission
7865  * @tc.desc      : 1.The environment engine is created
7866  *                 2.Set test variables
7867  *                 3.The function of napi_add_env_cleanup_hook is called
7868  *                 4.Return value of function is napi_ok
7869  *                 5.Call RunCleanup to trigger napi_add_env_cleanup_hook
7870  */
7871 HWTEST_F(NativeEngineTest, ACE_Napi_Remove_Env_Cleanup_Hook_0500, testing::ext::TestSize.Level2)
7872 {
7873     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Remove_Env_Cleanup_Hook_0500 start";
7874     napi_env env = (napi_env)engine_;
7875     HOOK_TAG = INT_ZERO;
7876     HOOK_TAGCP = INT_ZERO;
7877     ExpectCheckCall(napi_add_env_cleanup_hook(env, Cleanup, &HOOK_ARG_ONE));
7878     ExpectCheckCall(napi_add_env_cleanup_hook(env, CleanupCopy, &HOOK_ARG_TWO));
7879     ExpectCheckCall(napi_remove_env_cleanup_hook(env, Cleanup, &HOOK_ARG_TWO));
7880     ExpectCheckCall(napi_remove_env_cleanup_hook(env, CleanupCopy, &HOOK_ARG_ONE));
7881     engine_->RunCleanup();
7882     EXPECT_EQ(HOOK_TAG, INT_ONE);
7883     EXPECT_EQ(HOOK_TAGCP, INT_ONE);
7884     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Remove_Env_Cleanup_Hook_0500 end";
7885 }
7886 
7887 /*
7888  * @tc.number    : ACE_Napi_Remove_Env_Cleanup_Hook_0600
7889  * @tc.name      : Test napi_remove_env_cleanup_hook Delete napi_add_env_cleanup_hook
7890  * @tc.desc      : 1.The environment engine is created
7891  *                 2.Set test variables
7892  *                 3.The function of napi_add_env_cleanup_hook is called
7893  *                 4.Return value of function is napi_ok
7894  *                 5.Call RunCleanup to trigger napi_add_env_cleanup_hook
7895  */
7896 HWTEST_F(NativeEngineTest, ACE_Napi_Remove_Env_Cleanup_Hook_0600, testing::ext::TestSize.Level1)
7897 {
7898     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Remove_Env_Cleanup_Hook_0600 start";
7899     napi_env env = (napi_env)engine_;
7900     HOOK_TAG = INT_ZERO;
7901     HOOK_TAGCP = INT_ZERO;
7902     ExpectCheckCall(napi_add_env_cleanup_hook(env, Cleanup, &HOOK_ARG_ONE));
7903     ExpectCheckCall(napi_add_env_cleanup_hook(env, CleanupCopy, &HOOK_ARG_TWO));
7904     ExpectCheckCall(napi_remove_env_cleanup_hook(env, Cleanup, &HOOK_ARG_ONE));
7905     ExpectCheckCall(napi_remove_env_cleanup_hook(env, CleanupCopy, &HOOK_ARG_TWO));
7906     engine_->RunCleanup();
7907     EXPECT_EQ(HOOK_TAG, INT_ZERO);
7908     EXPECT_EQ(HOOK_TAGCP, INT_ZERO);
7909     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Remove_Env_Cleanup_Hook_0600 end";
7910 }
7911 
MustNotCall(napi_async_cleanup_hook_handle hook,void * arg)7912 static void MustNotCall(napi_async_cleanup_hook_handle hook, void* arg)
7913 {
7914     EXPECT_EQ(1, 0);
7915 }
7916 
7917 struct AsyncData {
7918     uv_async_t async;
7919     napi_env env;
7920     napi_async_cleanup_hook_handle handle;
7921 };
7922 
CreateAsyncData()7923 static struct AsyncData* CreateAsyncData()
7924 {
7925     GTEST_LOG_(INFO) << "CreateAsyncData";
7926     struct AsyncData* data = (struct AsyncData*)malloc(sizeof(struct AsyncData));
7927     if (data == nullptr) {
7928         return nullptr;
7929     }
7930     data->handle = nullptr;
7931     return data;
7932 }
7933 
AfterCleanupHookTwo(uv_handle_t * handle)7934 static void AfterCleanupHookTwo(uv_handle_t* handle)
7935 {
7936     GTEST_LOG_(INFO) << "AfterCleanupHookTwo start";
7937     struct AsyncData* data = (struct AsyncData*)handle->data;
7938     ExpectCheckCall(napi_remove_async_cleanup_hook(data->handle));
7939     HOOK_TAG += INT_ONE;
7940     free(data);
7941     GTEST_LOG_(INFO) << "AfterCleanupHookTwo end";
7942 }
7943 
AfterCleanupHookOne(uv_async_t * async)7944 static void AfterCleanupHookOne(uv_async_t* async)
7945 {
7946     GTEST_LOG_(INFO) << "AfterCleanupHookOne start";
7947     uv_close((uv_handle_t*)async, AfterCleanupHookTwo);
7948     GTEST_LOG_(INFO) << "AfterCleanupHookOne end";
7949 }
7950 
AsyncCleanupHook(napi_async_cleanup_hook_handle handle,void * arg)7951 static void AsyncCleanupHook(napi_async_cleanup_hook_handle handle, void* arg)
7952 {
7953     GTEST_LOG_(INFO) << "AsyncCleanupHook start";
7954     struct AsyncData* data = (struct AsyncData*)arg;
7955     uv_loop_t* loop;
7956     ExpectCheckCall(napi_get_uv_event_loop(data->env, &loop));
7957     int err = uv_async_init(loop, &data->async, AfterCleanupHookOne);
7958     EXPECT_EQ(err, 0);
7959 
7960     data->async.data = data;
7961     data->handle = handle;
7962     uv_async_send(&data->async);
7963     GTEST_LOG_(INFO) << "AsyncCleanupHook end";
7964     sleep(1);
7965 }
7966 
7967 /*
7968  * @tc.number    : ACE_Napi_Add_Async_Cleanup_Hook_0100
7969  * @tc.name      : Test napi_add_async_cleanup_hook to pass the normal environment
7970  * @tc.desc      : 1.The environment engine is created
7971  *                 2.Set test variables
7972  *                 3.The function of napi_add_async_cleanup_hook is called
7973  *                 4.Return value of function is napi_ok
7974  *                 5.Call the incoming function normally after the environment exits
7975  */
7976 HWTEST_F(NativeEngineTest, ACE_Napi_Add_Async_Cleanup_Hook_0100, testing::ext::TestSize.Level1)
7977 {
7978     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Add_Async_Cleanup_Hook_0100 start";
7979 
7980     napi_env env = (napi_env)engine_;
7981     struct AsyncData* data = CreateAsyncData();
7982     if (data == nullptr) {
7983         return;
7984     }
7985     HOOK_TAG = INT_ZERO;
7986     data->env = env;
7987     napi_status ret = napi_add_async_cleanup_hook(env, AsyncCleanupHook, data, &data->handle);
7988     engine_->RunCleanup();
7989     EXPECT_EQ(ret, napi_ok);
7990     EXPECT_EQ(HOOK_TAG, INT_ONE);
7991     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Add_Async_Cleanup_Hook_0100 end";
7992     sleep(1);
7993 }
7994 
7995 /*
7996  * @tc.number    : ACE_Napi_Add_Async_Cleanup_Hook_0200
7997  * @tc.name      : Test napi_remove_env_cleanup_hook passing an invalid remove_handle
7998  * @tc.desc      : 1.The environment engine is created
7999  *                 2.Set test variables
8000  *                 3.The function of napi_add_async_cleanup_hook is called
8001  *                 4.Return value of function is napi_ok
8002  *                 5.Call the incoming function normally after the environment exits
8003  */
8004 HWTEST_F(NativeEngineTest, ACE_Napi_Add_Async_Cleanup_Hook_0200, testing::ext::TestSize.Level1)
8005 {
8006     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Add_Async_Cleanup_Hook_0200 start";
8007 
8008     napi_env env = (napi_env)engine_;
8009     struct AsyncData* data = CreateAsyncData();
8010     if (data == nullptr) {
8011         return;
8012     }
8013     HOOK_TAG = INT_ZERO;
8014     data->env = env;
8015     napi_status ret = napi_add_async_cleanup_hook(env, AsyncCleanupHook, data, nullptr);
8016     engine_->RunCleanup();
8017     EXPECT_EQ(HOOK_TAG, INT_ONE);
8018     EXPECT_EQ(ret, napi_ok);
8019     sleep(1);
8020     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Add_Async_Cleanup_Hook_0200 end";
8021 }
8022 
8023 /*
8024  * @tc.number    : ACE_Napi_Add_Async_Cleanup_Hook_0300
8025  * @tc.name      : Test napi_add_async_cleanup_hook passing an invalid arg
8026  * @tc.desc      : 1.The environment engine is created
8027  *                 2.Set test variables
8028  *                 3.The function of napi_add_async_cleanup_hook is called
8029  *                 4.Return value of function is napi_ok
8030  *                 5.Call the incoming function normally after the environment exits
8031  *                 6.The function of napi_remove_async_cleanup_hook is called
8032  *                 7.Return value of function is napi_ok
8033  */
8034 HWTEST_F(NativeEngineTest, ACE_Napi_Add_Async_Cleanup_Hook_0300, testing::ext::TestSize.Level2)
8035 {
8036     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Add_Async_Cleanup_Hook_0300 start";
8037 
8038     napi_env env = (napi_env)engine_;
8039     napi_async_cleanup_hook_handle must_not_call_handle;
8040     HOOK_TAG = INT_ZERO;
8041     ExpectCheckCall(napi_add_async_cleanup_hook(env, MustNotCall, nullptr, &must_not_call_handle));
8042     ExpectCheckCall(napi_remove_async_cleanup_hook(must_not_call_handle));
8043     engine_->RunCleanup();
8044     EXPECT_EQ(HOOK_TAG, INT_ZERO);
8045     sleep(1);
8046     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Add_Async_Cleanup_Hook_0300 start";
8047 }
8048 
8049 /*
8050  * @tc.number    : ACE_Napi_Add_Async_Cleanup_Hook_0400
8051  * @tc.name      : Test napi_add_async_cleanup_hook passing an invalid env
8052  * @tc.desc      : 1.The environment engine is created
8053  *                 2.Set test variables
8054  *                 3.The function of napi_add_async_cleanup_hook is called
8055  *                 4.Return value of function is napi_invalid_arg
8056  */
8057 HWTEST_F(NativeEngineTest, ACE_Napi_Add_Async_Cleanup_Hook_0400, testing::ext::TestSize.Level2)
8058 {
8059     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Add_Async_Cleanup_Hook_0400 start";
8060 
8061     napi_status ret = napi_ok;
8062     napi_async_cleanup_hook_handle must_not_call_handle;
8063     HOOK_TAG = INT_ZERO;
8064     ret = napi_add_async_cleanup_hook(nullptr, MustNotCall, nullptr, &must_not_call_handle);
8065     engine_->RunCleanup();
8066     EXPECT_EQ(ret, napi_invalid_arg);
8067     sleep(1);
8068     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Add_Async_Cleanup_Hook_0400 start";
8069 }
8070 
8071 /*
8072  * @tc.number    : ACE_Napi_Add_Async_Cleanup_Hook_0500
8073  * @tc.name      : Test napi_add_async_cleanup_hook passing an invalid hook
8074  * @tc.desc      : 1.The environment engine is created
8075  *                 2.Set test variables
8076  *                 3.The function of napi_add_async_cleanup_hook is called
8077  *                 4.Return value of function is napi_invalid_arg
8078  */
8079 HWTEST_F(NativeEngineTest, ACE_Napi_Add_Async_Cleanup_Hook_0500, testing::ext::TestSize.Level2)
8080 {
8081     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Add_Async_Cleanup_Hook_0500 start";
8082 
8083     napi_env env = (napi_env)engine_;
8084     napi_status ret = napi_ok;
8085     napi_async_cleanup_hook_handle must_not_call_handle;
8086     ret = napi_add_async_cleanup_hook(env, nullptr, nullptr, &must_not_call_handle);
8087     engine_->RunCleanup();
8088     EXPECT_EQ(ret, napi_invalid_arg);
8089     sleep(1);
8090     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Add_Async_Cleanup_Hook_0500 start";
8091 }
8092 
8093 /*
8094  * @tc.number    : ACE_Napi_Add_Async_Cleanup_Hook_0600
8095  * @tc.name      : Test napi_add_async_cleanup_hook, after registering the function,
8096  *                 call remove to delete the registered function, and then re-register the function.
8097  * @tc.desc      : 1.The environment engine is created
8098  *                 2.Set test variables
8099  *                 3.The function of napi_add_async_cleanup_hook is called
8100  *                 4.Return value of function is napi_ok
8101  *                 5.Call the incoming function normally after the environment exits
8102  */
8103 HWTEST_F(NativeEngineTest, ACE_Napi_Add_Async_Cleanup_Hook_0600, testing::ext::TestSize.Level1)
8104 {
8105     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Add_Async_Cleanup_Hook_0600 start";
8106 
8107     napi_env env = (napi_env)engine_;
8108     struct AsyncData* data = CreateAsyncData();
8109     if (data == nullptr) {
8110         return;
8111     }
8112     data->env = env;
8113     HOOK_TAG = INT_ZERO;
8114     napi_status ret = napi_invalid_arg;
8115     ret = napi_add_async_cleanup_hook(env, AsyncCleanupHook, data, &data->handle);
8116     ASSERT_EQ(ret, napi_ok);
8117     ret = napi_remove_async_cleanup_hook(data->handle);
8118     ASSERT_EQ(ret, napi_ok);
8119     ret = napi_add_async_cleanup_hook(env, AsyncCleanupHook, data, &data->handle);
8120     ASSERT_EQ(ret, napi_ok);
8121     engine_->RunCleanup();
8122     EXPECT_EQ(HOOK_TAG, INT_ONE);
8123     EXPECT_EQ(ret, napi_ok);
8124     sleep(1);
8125     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Add_Async_Cleanup_Hook_0600 end";
8126 }
8127 
8128 /*
8129  * @tc.number    : ACE_Napi_Add_Async_Cleanup_Hook_0700
8130  * @tc.name      : Test napi_add_async_cleanup_hook to pass the normal environment
8131  * @tc.desc      : 1.The environment engine is created
8132  *                 2.Set test variables
8133  *                 3.The function of napi_add_async_cleanup_hook is called
8134  *                 4.Return value of function is napi_ok
8135  *                 5.Call the incoming function normally after the environment exits
8136  */
8137 HWTEST_F(NativeEngineTest, ACE_Napi_Add_Async_Cleanup_Hook_0700, testing::ext::TestSize.Level1)
8138 {
8139     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Add_Async_Cleanup_Hook_0700 start";
8140 
8141     napi_env env = (napi_env)engine_;
8142     napi_env envtwo = (napi_env)engine_;
8143     HOOK_TAG = INT_ZERO;
8144     struct AsyncData* data = CreateAsyncData();
8145     if (data == nullptr) {
8146         return;
8147     }
8148     data->env = env;
8149     napi_status ret = napi_invalid_arg;
8150     ret = napi_add_async_cleanup_hook(env, AsyncCleanupHook, data, &data->handle);
8151     EXPECT_EQ(ret, napi_ok);
8152     struct AsyncData* datatwo = CreateAsyncData();
8153     if (datatwo == nullptr) {
8154         return;
8155     }
8156     datatwo->env = envtwo;
8157     ret = napi_add_async_cleanup_hook(env, AsyncCleanupHook, datatwo, &datatwo->handle);
8158     EXPECT_EQ(ret, napi_ok);
8159     engine_->RunCleanup();
8160     EXPECT_EQ(HOOK_TAG, INT_TWO);
8161     sleep(1);
8162     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Add_Async_Cleanup_Hook_0700 end";
8163 }
8164 
8165 /*
8166  * @tc.number    : ACE_Napi_Add_Async_Cleanup_Hook_0800
8167  * @tc.name      : Test napi_add_async_cleanup_hook to pass the normal environment
8168  * @tc.desc      : 1.The environment engine is created
8169  *                 2.Set test variables
8170  *                 3.The function of napi_add_async_cleanup_hook is called
8171  *                 4.Return value of function is napi_ok
8172  *                 5.Call the incoming function normally after the environment exits
8173  */
8174 HWTEST_F(NativeEngineTest, ACE_Napi_Add_Async_Cleanup_Hook_0800, testing::ext::TestSize.Level1)
8175 {
8176     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Add_Async_Cleanup_Hook_0800 start";
8177 
8178     napi_env env = (napi_env)engine_;
8179     napi_env envtwo = (napi_env)engine_;
8180     napi_env envthree = (napi_env)engine_;
8181     struct AsyncData* data = CreateAsyncData();
8182     if (data == nullptr) {
8183         return;
8184     }
8185     HOOK_TAG = INT_ZERO;
8186     data->env = env;
8187     napi_status ret = napi_invalid_arg;
8188     ret = napi_add_async_cleanup_hook(env, AsyncCleanupHook, data, &data->handle);
8189     EXPECT_EQ(ret, napi_ok);
8190 
8191     struct AsyncData* datatwo = CreateAsyncData();
8192     if (datatwo == nullptr) {
8193         return;
8194     }
8195     datatwo->env = envtwo;
8196     ret = napi_add_async_cleanup_hook(env, AsyncCleanupHook, datatwo, &datatwo->handle);
8197     EXPECT_EQ(ret, napi_ok);
8198 
8199     struct AsyncData* datathree = CreateAsyncData();
8200     if (datathree == nullptr) {
8201         return;
8202     }
8203     datathree->env = envthree;
8204     ret = napi_add_async_cleanup_hook(env, AsyncCleanupHook, datathree, &datathree->handle);
8205     EXPECT_EQ(ret, napi_ok);
8206     engine_->RunCleanup();
8207     EXPECT_EQ(HOOK_TAG, INT_THREE);
8208     sleep(2);
8209     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Add_Async_Cleanup_Hook_0800 end";
8210 }
8211 
8212 /*
8213  * @tc.number    : ACE_Napi_Remove_Async_Cleanup_Hook_0100
8214  * @tc.name      : Test the normal call of napi_remove_async_cleanup_hook
8215  * @tc.desc      : 1.The environment engine is created
8216  *                 2.Set test variables
8217  *                 3.The function of napi_add_async_cleanup_hook is called
8218  *                 4.Return value of function is napi_ok
8219  *                 5.The function of napi_remove_async_cleanup_hook is called
8220  *                 6.Return value of function is napi_ok
8221  */
8222 HWTEST_F(NativeEngineTest, ACE_Napi_Remove_Async_Cleanup_Hook_0100, testing::ext::TestSize.Level1)
8223 {
8224     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Remove_Async_Cleanup_Hook_0100 start";
8225 
8226     napi_env env = (napi_env)engine_;
8227     struct AsyncData* data = CreateAsyncData();
8228     if (data == nullptr) {
8229         return;
8230     }
8231     napi_status ret = napi_invalid_arg;
8232     HOOK_TAG = INT_ZERO;
8233     data->env = env;
8234     ret = napi_add_async_cleanup_hook(env, AsyncCleanupHook, data, &data->handle);
8235     EXPECT_EQ(ret, napi_ok);
8236     ret = napi_remove_async_cleanup_hook(data->handle);
8237     EXPECT_EQ(ret, napi_ok);
8238     engine_->RunCleanup();
8239     EXPECT_EQ(HOOK_TAG, INT_ZERO);
8240     sleep(1);
8241     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Remove_Async_Cleanup_Hook_0100 end";
8242 }
8243 
8244 /*
8245  * @tc.number    : ACE_Napi_Remove_Async_Cleanup_Hook_0200
8246  * @tc.name      : Test napi_remove_async_cleanup_hook passing an invalid remove_handle
8247  * @tc.desc      : 1.The environment engine is created
8248  *                 2.Set test variables
8249  *                 3.The function of napi_remove_async_cleanup_hook is called
8250  *                 4.Return value of function is napi_invalid_arg
8251  */
8252 HWTEST_F(NativeEngineTest, ACE_Napi_Remove_Async_Cleanup_Hook_0200, testing::ext::TestSize.Level2)
8253 {
8254     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Remove_Async_Cleanup_Hook_0200 start";
8255 
8256     napi_status ret = napi_ok;
8257     ret = napi_remove_async_cleanup_hook(nullptr);
8258     EXPECT_EQ(ret, napi_invalid_arg);
8259 
8260     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Remove_Async_Cleanup_Hook_0200 end";
8261 }
8262 
8263 /*
8264  * @tc.number    : ACE_Napi_Remove_Async_Cleanup_Hook_0300
8265  * @tc.name      : Test that napi_add_async_cleanup_hook is registered twice,
8266  *                 release one of them, and the other is triggered normally
8267  * @tc.desc      : 1.The environment engine is created
8268  *                 2.Set test variables
8269  *                 3.The function of napi_add_async_cleanup_hook is called
8270  *                 4.Return value of function is napi_ok
8271  *                 5.The function of napi_remove_async_cleanup_hook is called
8272  *                 6.Return value of function is napi_ok
8273  */
8274 HWTEST_F(NativeEngineTest, ACE_Napi_Remove_Async_Cleanup_Hook_0300, testing::ext::TestSize.Level2)
8275 {
8276     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Remove_Async_Cleanup_Hook_0300 start";
8277 
8278     napi_env env = (napi_env)engine_;
8279     napi_env envtwo = (napi_env)engine_;
8280     struct AsyncData* data = CreateAsyncData();
8281     if (data == nullptr) {
8282         return;
8283     }
8284     napi_status ret = napi_invalid_arg;
8285     data->env = env;
8286     ret = napi_add_async_cleanup_hook(env, AsyncCleanupHook, data, nullptr);
8287     EXPECT_EQ(ret, napi_ok);
8288     struct AsyncData* datatwo = CreateAsyncData();
8289     if (datatwo == nullptr) {
8290         return;
8291     }
8292     datatwo->env = envtwo;
8293     ret = napi_add_async_cleanup_hook(env, AsyncCleanupHook, datatwo, &datatwo->handle);
8294     EXPECT_EQ(ret, napi_ok);
8295     ret = napi_remove_async_cleanup_hook(datatwo->handle);
8296     EXPECT_EQ(ret, napi_ok);
8297     engine_->RunCleanup();
8298     sleep(1);
8299     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Remove_Async_Cleanup_Hook_0300 end";
8300 }
8301 
8302 /*
8303  * @tc.number    : ACE_Napi_Async_Init_0100
8304  * @tc.name      : The parameter is valid, the parameter async_resource input the defined date,
8305  *                 the parameter async_resource_name input string, the parameter result input result.
8306  * @tc.desc      : 1.Valid environment variable env
8307  *                 2.parameter async_resource input defined date
8308  *                 3.parameter async_resource_name input string
8309  *                 4.parameter result input result
8310  */
8311 HWTEST_F(NativeEngineTest, ACE_Napi_Async_Init_0100, testing::ext::TestSize.Level1)
8312 {
8313     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Async_Init_0100 start";
8314 
8315     napi_env env = (napi_env)engine_;
8316     napi_value asyncResource = nullptr;
8317     double time = 2731123.12;
8318     napi_value asyncResourceName = nullptr;
8319     napi_async_context result = nullptr;
8320 
8321     napi_status status = napi_create_date(env, time, &asyncResource);
8322     EXPECT_EQ(status, napi_ok);
8323 
8324     status = napi_create_string_utf8(env, "ACE_Napi_Async_Init_0100", NAPI_AUTO_LENGTH, &asyncResourceName);
8325     EXPECT_EQ(status, napi_ok);
8326 
8327     napi_status ret = napi_async_init(env, asyncResource, asyncResourceName, &result);
8328 
8329     EXPECT_EQ(ret, napi_ok);
8330     EXPECT_NE(result, nullptr);
8331 
8332     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Async_Init_0100 end";
8333 }
8334 
8335 /*
8336  * @tc.number    : ACE_Napi_Async_Init_0200
8337  * @tc.name      : The parameter is valid, the parameter async_resource is empty,
8338  *                 the parameter async_resource_name is string,
8339  *                 and the parameter result is result.
8340  * @tc.desc      : 1.Valid environment variable env.
8341  *                 2.the parameter async_resource is empty.
8342  *                 3.the parameter async_resource_name is string.
8343  *                 4.the parameter result is result.
8344  */
8345 HWTEST_F(NativeEngineTest, ACE_Napi_Async_Init_0200, testing::ext::TestSize.Level1)
8346 {
8347     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Async_Init_0200 start";
8348 
8349     napi_env env = (napi_env)engine_;
8350     napi_value asyncResource = nullptr;
8351     napi_value asyncResourceName = nullptr;
8352     napi_async_context result = nullptr;
8353 
8354     napi_status status = napi_create_string_utf8(env, "ACE_Napi_Async_Init_0200", NAPI_AUTO_LENGTH, &asyncResourceName);
8355     EXPECT_EQ(status, napi_ok);
8356 
8357     napi_status ret = napi_async_init(env, asyncResource, asyncResourceName, &result);
8358     EXPECT_EQ(ret, napi_ok);
8359 
8360     EXPECT_NE(result, nullptr);
8361 
8362     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Async_Init_0200 end";
8363 }
8364 
8365 /*
8366  * @tc.number    : ACE_Napi_Async_Init_0300
8367  * @tc.name      : The parameter is invalid, env is empty, the parameter async_resource enters the defined date,
8368  *                 the parameter async_resource_name enters string, and the parameter result enters result.
8369  * @tc.desc      : 1.Invalid environment variable env.
8370  *                 2.parameter async_resource input defined date.
8371  *                 3.parameter async_resource_name input string.
8372  *                 4.parameter result input result.
8373  */
8374 HWTEST_F(NativeEngineTest, ACE_Napi_Async_Init_0300, testing::ext::TestSize.Level2)
8375 {
8376     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Async_Init_0300 start";
8377 
8378     napi_env env = (napi_env)engine_;
8379     napi_value asyncResource = nullptr;
8380     double time = 2731123.12;
8381     napi_value asyncResourceName = nullptr;
8382     napi_async_context result = nullptr;
8383 
8384     napi_status status = napi_create_date(env, time, &asyncResource);
8385     EXPECT_EQ(status, napi_ok);
8386 
8387     status = napi_create_string_utf8(env, "ACE_Napi_Async_Init_0300", NAPI_AUTO_LENGTH, &asyncResourceName);
8388     EXPECT_EQ(status, napi_ok);
8389 
8390     napi_status ret = napi_async_init(nullptr, asyncResource, asyncResourceName, &result);
8391     EXPECT_EQ(ret, napi_invalid_arg);
8392 
8393     EXPECT_EQ(result, nullptr);
8394 
8395     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Async_Init_0300 end";
8396 }
8397 
8398 /*
8399  * @tc.number    : ACE_Napi_Async_Init_0400
8400  * @tc.name      : The parameter is invalid, the parameter async_resource enters the defined date,
8401  *                 the parameter async_resource_name enters empty,
8402  *                 the parameter result enters result.
8403  * @tc.desc      : 1.Valid environment variable env.
8404  *                 2.the parameter async_resource enters the defined date.
8405  *                 3.the parameter async_resource_name enters empty.
8406  *                 4.the parameter result enters result.
8407  */
8408 HWTEST_F(NativeEngineTest, ACE_Napi_Async_Init_0400, testing::ext::TestSize.Level2)
8409 {
8410     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Async_Init_0400 start";
8411 
8412     napi_env env = (napi_env)engine_;
8413     napi_value asyncResource = nullptr;
8414     double time = 2731123.12;
8415     napi_async_context result = nullptr;
8416 
8417     napi_status status = napi_create_date(env, time, &asyncResource);
8418     EXPECT_EQ(status, napi_ok);
8419 
8420     napi_status ret = napi_async_init(env, asyncResource, nullptr, &result);
8421     EXPECT_EQ(ret, napi_invalid_arg);
8422     EXPECT_EQ(result, nullptr);
8423 
8424     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Async_Init_0400 end";
8425 }
8426 
8427 /*
8428  * @tc.number    : ACE_Napi_Async_Init_0500
8429  * @tc.name      : The parameter is invalid, the parameter async_resource input the defined date,
8430  *                 the parameter async_resource_name input string,the parameter result input is empty.
8431  * @tc.desc      : 1.Valid environment variable env.
8432  *                 2.the parameter async_resource enters the defined date.
8433  *                 3.the parameter async_resource_name input string.
8434  *                 4.the parameter result input is empty.
8435  */
8436 HWTEST_F(NativeEngineTest, ACE_Napi_Async_Init_0500, testing::ext::TestSize.Level2)
8437 {
8438     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Async_Init_0500 start";
8439 
8440     napi_env env = (napi_env)engine_;
8441     napi_value asyncResource = nullptr;
8442     double time = 2731123.12;
8443     napi_value asyncResourceName = nullptr;
8444 
8445     napi_status status = napi_create_date(env, time, &asyncResource);
8446     EXPECT_EQ(status, napi_ok);
8447 
8448     status = napi_create_string_utf8(env, "ACE_Napi_Async_Init_0500", NAPI_AUTO_LENGTH, &asyncResourceName);
8449     EXPECT_EQ(status, napi_ok);
8450 
8451     napi_status ret = napi_async_init(env, asyncResource, asyncResourceName, nullptr);
8452     EXPECT_EQ(ret, napi_invalid_arg);
8453 
8454     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Async_Init_0500 end";
8455 }
8456 
8457 /*
8458  * @tc.number    : ACE_Napi_Async_Destroy_0100
8459  * @tc.name      : The parameter is valid, and the parameter async_context enters the initialized object.
8460  * @tc.desc      : 1.Valid environment variable env.
8461  *                 2.parameter async_context input initialized object.
8462  */
8463 HWTEST_F(NativeEngineTest, ACE_Napi_Async_Destroy_0100, testing::ext::TestSize.Level1)
8464 {
8465     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Async_Destroy_0100 start";
8466 
8467     napi_env env = (napi_env)engine_;
8468     void* arrayBufferPtr = nullptr;
8469     napi_value arrayBuffer = nullptr;
8470     size_t arrayBufferSize = ARRAYBUFFER_SIZE;
8471     napi_value asyncResourceName = nullptr;
8472     napi_async_context result = nullptr;
8473 
8474     napi_status status = napi_create_string_utf8(env, "ACE_Napi_Async_Destroy_0100",
8475         NAPI_AUTO_LENGTH, &asyncResourceName);
8476     EXPECT_EQ(status, napi_ok);
8477 
8478     napi_status verification = napi_create_arraybuffer(env, arrayBufferSize, &arrayBufferPtr, &arrayBuffer);
8479 
8480     EXPECT_EQ(verification, napi_ok);
8481 
8482     napi_status ret = napi_async_init(env, arrayBuffer, asyncResourceName, &result);
8483 
8484     EXPECT_EQ(ret, napi_ok);
8485     EXPECT_NE(result, nullptr);
8486 
8487     napi_status out = napi_async_destroy(env, result);
8488     EXPECT_EQ(out, napi_ok);
8489 
8490     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Async_Destroy_0100 end";
8491 }
8492 
8493 /*
8494  * @tc.number    : ACE_Napi_Async_Destroy_0200
8495  * @tc.name      : The parameter is invalid, the parameter async_context input is empty.
8496  * @tc.desc      : 1.Valid environment variable env.
8497  *                 2.parameter async_context input is empty.
8498  */
8499 HWTEST_F(NativeEngineTest, ACE_Napi_Async_Destroy_0200, testing::ext::TestSize.Level2)
8500 {
8501     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Async_Destroy_0200 start";
8502 
8503     napi_env env = (napi_env)engine_;
8504     napi_async_context result = nullptr;
8505 
8506     napi_status out = napi_async_destroy(env, result);
8507     EXPECT_EQ(out, napi_invalid_arg);
8508 
8509     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Async_Destroy_0200 end";
8510 }
8511 
8512 /*
8513  * @tc.number    : ACE_Napi_Async_Destroy_0300
8514  * @tc.name      : The parameter is invalid, the parameter async_context input is empty.
8515  * @tc.desc      : 1.Invalid environment variable env.
8516  *                 2.parameter async_context input initialized object.
8517  */
8518 HWTEST_F(NativeEngineTest, ACE_Napi_Async_Destroy_0300, testing::ext::TestSize.Level2)
8519 {
8520     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Async_Destroy_0300 start";
8521 
8522     napi_env env = (napi_env)engine_;
8523     void* arrayBufferPtr = nullptr;
8524     napi_value arrayBuffer = nullptr;
8525     size_t arrayBufferSize = ARRAYBUFFER_SIZE;
8526     napi_value asyncResourceName = nullptr;
8527     napi_async_context result = nullptr;
8528 
8529     napi_status status = napi_create_string_utf8(env, "ACE_Napi_Async_Destroy_0300",
8530         NAPI_AUTO_LENGTH, &asyncResourceName);
8531     EXPECT_EQ(status, napi_ok);
8532 
8533     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Async_Destroy_0300 napi_create_string_utf8 successful";
8534 
8535     napi_status verification = napi_create_arraybuffer(env, arrayBufferSize, &arrayBufferPtr, &arrayBuffer);
8536 
8537     EXPECT_EQ(verification, napi_ok);
8538     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Async_Destroy_0300 napi_create_arraybuffer successful";
8539 
8540     napi_status ret = napi_async_init(env, arrayBuffer, asyncResourceName, &result);
8541     EXPECT_EQ(ret, napi_ok);
8542     EXPECT_NE(result, nullptr);
8543     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Async_Destroy_0300 napi_async_init successful";
8544 
8545     napi_status out = napi_async_destroy(nullptr, result);
8546 
8547     EXPECT_EQ(out, napi_invalid_arg);
8548     EXPECT_NE(result, nullptr);
8549 
8550     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Async_Destroy_0300 end";
8551 }
8552 
8553 /*
8554  * @tc.number    : ACE_Napi_Async_Destroy_0400
8555  * @tc.name      : The parameter is valid, env is empty, and the parameter async_context input is empty
8556  * @tc.desc      : 1.Invalid environment variable env
8557  *                 2.parameter async_context input is empty
8558  */
8559 HWTEST_F(NativeEngineTest, ACE_Napi_Async_Destroy_0400, testing::ext::TestSize.Level2)
8560 {
8561     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Async_Destroy_0400 start";
8562 
8563     napi_async_context result = nullptr;
8564 
8565     napi_status out = napi_async_destroy(nullptr, result);
8566     EXPECT_EQ(out, napi_invalid_arg);
8567 
8568     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Async_Destroy_0400 end";
8569 }
8570 
8571 /*
8572  * @tc.number    : ACE_Napi_Open_callback_Scope_0100
8573  * @tc.name      : The parameter is valid, the resource_object object enters a valid arrayBuffer object,
8574  *                 the parameter context enters a valid parameter connext,
8575  *                 the parameter result enters a valid parameter, and the test is confirmed
8576  * @tc.desc      : 1.Valid environment variable env.
8577  *                 2.resource_object object input valid arrayBuffer object.
8578  *                 3.parameter context input valid parameter connext.
8579  *                 4.parameter result input valid parameter.
8580  */
8581 HWTEST_F(NativeEngineTest, ACE_Napi_Open_callback_Scope_0100, testing::ext::TestSize.Level1)
8582 {
8583     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Open_callback_Scope_0100 start";
8584 
8585     napi_env env = (napi_env)engine_;
8586     void* arrayBufferPtr = nullptr;
8587     napi_value arrayBuffer = nullptr;
8588     size_t arrayBufferSize = ARRAYBUFFER_SIZE;
8589     napi_async_context connext = nullptr;
8590     napi_value asyncResourceName = nullptr;
8591     napi_callback_scope result = nullptr;
8592 
8593     napi_status status = napi_create_arraybuffer(env, arrayBufferSize, &arrayBufferPtr, &arrayBuffer);
8594     EXPECT_EQ(status, napi_ok);
8595 
8596     status = napi_create_string_utf8(env, "ACE_Napi_Open_callback_Scope_0100", NAPI_AUTO_LENGTH, &asyncResourceName);
8597     EXPECT_EQ(status, napi_ok);
8598 
8599     napi_status ret = napi_async_init(env, arrayBuffer, asyncResourceName, &connext);
8600     EXPECT_EQ(ret, napi_ok);
8601 
8602     napi_status out = napi_open_callback_scope(env, arrayBuffer, connext, &result);
8603     EXPECT_EQ(out, napi_ok);
8604     EXPECT_NE(result, nullptr);
8605 
8606     status = napi_async_destroy(env, connext);
8607     EXPECT_EQ(status, napi_ok);
8608 
8609     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Open_callback_Scope_0100 end";
8610 }
8611 
8612 /*
8613  * @tc.number    : ACE_Napi_Open_callback_Scope_0200
8614  * @tc.name      : The parameter is invalid, the resource_object object is input a valid arrayBuffer object,
8615  *                 the parameter context is input the valid parameter connext,
8616  *                 the parameter result is empty, and the test is confirmed.
8617  * @tc.desc      : 1.Valid environment variable env.
8618  *                 2.the resource_object object is input a valid arrayBuffer object.
8619  *                 3.parameter context input valid parameter connext.
8620  *                 4.parameter result input valid parameter.
8621  */
8622 HWTEST_F(NativeEngineTest, ACE_Napi_Open_callback_Scope_0200, testing::ext::TestSize.Level2)
8623 {
8624     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Open_callback_Scope_0200 start";
8625 
8626     napi_env env = (napi_env)engine_;
8627     void* arrayBufferPtr = nullptr;
8628     napi_value arrayBuffer = nullptr;
8629     size_t arrayBufferSize = ARRAYBUFFER_SIZE;
8630     napi_async_context connext = nullptr;
8631     napi_value asyncResourceName = nullptr;
8632 
8633     napi_status status = napi_create_arraybuffer(env, arrayBufferSize, &arrayBufferPtr, &arrayBuffer);
8634     EXPECT_EQ(status, napi_ok);
8635 
8636     status = napi_create_string_utf8(env, "ACE_Napi_Open_callback_Scope_0200", NAPI_AUTO_LENGTH, &asyncResourceName);
8637     EXPECT_EQ(status, napi_ok);
8638 
8639     napi_status ret = napi_async_init(env, arrayBuffer, asyncResourceName, &connext);
8640     EXPECT_EQ(ret, napi_ok);
8641 
8642     napi_status out = napi_open_callback_scope(env, arrayBuffer, connext, nullptr);
8643     EXPECT_EQ(out, napi_invalid_arg);
8644 
8645     status = napi_async_destroy(env, connext);
8646     EXPECT_EQ(status, napi_ok);
8647 
8648     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Open_callback_Scope_0200 end";
8649 }
8650 
8651 /*
8652  * @tc.number    : ACE_Napi_Open_callback_Scope_0300
8653  * @tc.name      : The parameter is invalid,  the resource_object object enters a valid arrayBuffer object,
8654  *                 the parameter context enters a valid parameter connext,
8655  *                 the parameter result enters a valid parameter, and the test is confirmed.
8656  * @tc.desc      : 1.Invalid environment variable env.
8657  *                 2.resource_object object input valid arrayBuffer object.
8658  *                 3.parameter context input valid parameter connext.
8659  *                 4.parameter result input valid parameter.
8660  */
8661 HWTEST_F(NativeEngineTest, ACE_Napi_Open_callback_Scope_0300, testing::ext::TestSize.Level2)
8662 {
8663     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Open_callback_Scope_0300 start";
8664 
8665     napi_env env = (napi_env)engine_;
8666     void* arrayBufferPtr = nullptr;
8667     napi_value arrayBuffer = nullptr;
8668     size_t arrayBufferSize = ARRAYBUFFER_SIZE;
8669     napi_async_context connext = nullptr;
8670     napi_value asyncResourceName = nullptr;
8671     napi_callback_scope result = nullptr;
8672 
8673     napi_status status = napi_create_arraybuffer(env, arrayBufferSize, &arrayBufferPtr, &arrayBuffer);
8674     EXPECT_EQ(status, napi_ok);
8675 
8676     status = napi_create_string_utf8(env, "ACE_Napi_Open_callback_Scope_0300", NAPI_AUTO_LENGTH, &asyncResourceName);
8677     EXPECT_EQ(status, napi_ok);
8678 
8679     napi_status ret = napi_async_init(env, arrayBuffer, asyncResourceName, &connext);
8680 
8681     EXPECT_EQ(ret, napi_ok);
8682 
8683     napi_status out = napi_open_callback_scope(nullptr, arrayBuffer, connext, &result);
8684     EXPECT_EQ(out, napi_invalid_arg);
8685     EXPECT_EQ(result, nullptr);
8686 
8687     status = napi_async_destroy(env, connext);
8688     EXPECT_EQ(status, napi_ok);
8689 
8690     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Open_callback_Scope_0300 end";
8691 }
8692 
8693 /*
8694  * @tc.number    : ACE_Napi_Open_callback_Scope_0400
8695  * @tc.name      : The parameter is invalid, the resource_object object input is empty,
8696  *                 the parameter context input valid parameter connext,
8697  *                 the parameter result input valid parameter, and the test is confirmed.
8698  * @tc.desc      : 1.Valid environment variable env.
8699  *                 2.the resource_object object input is empty.
8700  *                 3.parameter context input valid parameter connext.
8701  *                 4.parameter result input valid parameter.
8702  */
8703 HWTEST_F(NativeEngineTest, ACE_Napi_Open_callback_Scope_0400, testing::ext::TestSize.Level1)
8704 {
8705     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Open_callback_Scope_0400 start";
8706 
8707     napi_env env = (napi_env)engine_;
8708     void* arrayBufferPtr = nullptr;
8709     napi_value arrayBuffer = nullptr;
8710     size_t arrayBufferSize = ARRAYBUFFER_SIZE;
8711     napi_async_context connext = nullptr;
8712     napi_value asyncResourceName = nullptr;
8713     napi_callback_scope result = nullptr;
8714 
8715     napi_status status = napi_create_arraybuffer(env, arrayBufferSize, &arrayBufferPtr, &arrayBuffer);
8716     EXPECT_EQ(status, napi_ok);
8717 
8718     status = napi_create_string_utf8(env, "ACE_Napi_Open_callback_Scope_0400", NAPI_AUTO_LENGTH, &asyncResourceName);
8719     EXPECT_EQ(status, napi_ok);
8720 
8721     napi_status ret = napi_async_init(env, arrayBuffer, asyncResourceName, &connext);
8722     EXPECT_EQ(ret, napi_ok);
8723 
8724     napi_status out = napi_open_callback_scope(env, nullptr, connext, &result);
8725     EXPECT_EQ(out, napi_ok);
8726     EXPECT_NE(result, nullptr);
8727 
8728     status = napi_async_destroy(env, connext);
8729     EXPECT_EQ(status, napi_ok);
8730 
8731     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Open_callback_Scope_0400 end";
8732 }
8733 
8734 /*
8735  * @tc.number    : ACE_Napi_Open_callback_Scope_0500
8736  * @tc.name      : The parameter is invalid, the resource_object object is input a valid arrayBuffer object,
8737  *                 the parameter context is empty, and the parameter result is a valid parameter,
8738  *                 and the test is confirmed.
8739  * @tc.desc      : 1.Valid environment variable env.
8740  *                 2.resource_object object input valid arrayBuffer object.
8741  *                 3.the parameter result is a valid parameter.
8742  *                 4.parameter result input valid parameter.
8743  */
8744 HWTEST_F(NativeEngineTest, ACE_Napi_Open_callback_Scope_0500, testing::ext::TestSize.Level1)
8745 {
8746     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Open_callback_Scope_0500 start";
8747 
8748     napi_env env = (napi_env)engine_;
8749     void* arrayBufferPtr = nullptr;
8750     napi_value arrayBuffer = nullptr;
8751     size_t arrayBufferSize = ARRAYBUFFER_SIZE;
8752     napi_async_context connext = nullptr;
8753     napi_value asyncResourceName = nullptr;
8754     napi_callback_scope result = nullptr;
8755 
8756     napi_status status = napi_create_arraybuffer(env, arrayBufferSize, &arrayBufferPtr, &arrayBuffer);
8757     EXPECT_EQ(status, napi_ok);
8758 
8759     status = napi_create_string_utf8(env, "ACE_Napi_Open_callback_Scope_0500", NAPI_AUTO_LENGTH, &asyncResourceName);
8760     EXPECT_EQ(status, napi_ok);
8761 
8762     napi_status ret = napi_async_init(env, arrayBuffer, asyncResourceName, &connext);
8763     EXPECT_EQ(ret, napi_ok);
8764 
8765     napi_status out = napi_open_callback_scope(env, arrayBuffer, nullptr, &result);
8766     EXPECT_EQ(out, napi_ok);
8767     EXPECT_NE(result, nullptr);
8768 
8769     status = napi_async_destroy(env, connext);
8770     EXPECT_EQ(status, napi_ok);
8771 
8772     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Open_callback_Scope_0500 end";
8773 }
8774 
8775 /*
8776  * @tc.number    : ACE_Napi_Close_callback_Scope_0100
8777  * @tc.name      : The parameter is valid, and the scope object enters the newly created associated scope.
8778  * @tc.desc      : 1.Valid environment variable env.
8779  *                 2.scope object enters the newly created associated scope.
8780  */
8781 HWTEST_F(NativeEngineTest, ACE_Napi_Close_callback_Scope_0100, testing::ext::TestSize.Level1)
8782 {
8783     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Close_callback_Scope_0100 start";
8784 
8785     napi_env env = (napi_env)engine_;
8786     void* arrayBufferPtr = nullptr;
8787     napi_value arrayBuffer = nullptr;
8788     size_t arrayBufferSize = ARRAYBUFFER_SIZE;
8789     napi_async_context connext = nullptr;
8790     napi_value asyncResourceName = nullptr;
8791     napi_callback_scope result = nullptr;
8792 
8793     napi_status status = napi_create_arraybuffer(env, arrayBufferSize, &arrayBufferPtr, &arrayBuffer);
8794     EXPECT_EQ(status, napi_ok);
8795 
8796     status = napi_create_string_utf8(env, "ACE_Napi_Close_callback_Scope_0100", NAPI_AUTO_LENGTH, &asyncResourceName);
8797     EXPECT_EQ(status, napi_ok);
8798 
8799     napi_status ret = napi_async_init(env, arrayBuffer, asyncResourceName, &connext);
8800     EXPECT_EQ(ret, napi_ok);
8801 
8802     napi_status out = napi_open_callback_scope(env, arrayBuffer, connext, &result);
8803     EXPECT_EQ(out, napi_ok);
8804     EXPECT_NE(result, nullptr);
8805 
8806     napi_status output = napi_close_callback_scope(env, result);
8807     EXPECT_EQ(output, napi_ok);
8808 
8809     status = napi_async_destroy(env, connext);
8810     EXPECT_EQ(status, napi_ok);
8811 
8812     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Close_callback_Scope_0100 end";
8813 }
8814 
8815 /*
8816  * @tc.number    : ACE_Napi_Close_callback_Scope_0200
8817  * @tc.name      : The parameter is invalid, the scope object input is empty.
8818  * @tc.desc      : 1.Valid environment variable env.
8819  *                 2.scope object input is empty.
8820  */
8821 HWTEST_F(NativeEngineTest, ACE_Napi_Close_callback_Scope_0200, testing::ext::TestSize.Level2)
8822 {
8823     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Close_callback_Scope_0200 start";
8824 
8825     napi_env env = (napi_env)engine_;
8826 
8827     napi_callback_scope result = nullptr;
8828 
8829     napi_status output = napi_close_callback_scope(env, result);
8830     EXPECT_EQ(output, napi_invalid_arg);
8831 
8832     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Close_callback_Scope_0200 end";
8833 }
8834 
8835 /*
8836  * @tc.number    : ACE_Napi_Close_callback_Scope_0300
8837  * @tc.name      : The parameter is invalid, env is empty, and the scope object enters the newly created associated
8838  *                  scope.
8839  * @tc.desc      : 1.Invalid environment variable env.
8840  *                 2.scope object enters the newly created associated scope.
8841  */
8842 HWTEST_F(NativeEngineTest, ACE_Napi_Close_callback_Scope_0300, testing::ext::TestSize.Level2)
8843 {
8844     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Close_callback_Scope_0300 start";
8845 
8846     napi_env env = (napi_env)engine_;
8847     void* arrayBufferPtr = nullptr;
8848     napi_value arrayBuffer = nullptr;
8849     size_t arrayBufferSize = ARRAYBUFFER_SIZE;
8850     napi_async_context connext = nullptr;
8851     napi_value asyncResourceName = nullptr;
8852     napi_callback_scope result = nullptr;
8853 
8854     napi_status status = napi_create_arraybuffer(env, arrayBufferSize, &arrayBufferPtr, &arrayBuffer);
8855     EXPECT_EQ(status, napi_ok);
8856 
8857     status = napi_create_string_utf8(env, "ACE_Napi_Close_callback_Scope_0300", NAPI_AUTO_LENGTH, &asyncResourceName);
8858     EXPECT_EQ(status, napi_ok);
8859 
8860     napi_status ret = napi_async_init(env, arrayBuffer, asyncResourceName, &connext);
8861 
8862     EXPECT_EQ(ret, napi_ok);
8863 
8864     napi_status out = napi_open_callback_scope(env, arrayBuffer, connext, &result);
8865     EXPECT_EQ(out, napi_ok);
8866     EXPECT_NE(result, nullptr);
8867 
8868     napi_status output = napi_close_callback_scope(nullptr, result);
8869     EXPECT_EQ(output, napi_invalid_arg);
8870 
8871     status = napi_async_destroy(env, connext);
8872     EXPECT_EQ(status, napi_ok);
8873 
8874     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Close_callback_Scope_0300 end";
8875 }
8876 
8877 /*
8878  * @tc.number    : ACE_Napi_Close_callback_Scope_0400
8879  * @tc.name      : The parameter is invalid, env is empty, scope object input is empty.
8880  * @tc.desc      : 1.Invalid environment variable env
8881  *                 2.scope object input is empty
8882  */
8883 HWTEST_F(NativeEngineTest, ACE_Napi_Close_callback_Scope_0400, testing::ext::TestSize.Level2)
8884 {
8885     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Close_callback_Scope_0400 start";
8886 
8887     napi_status output = napi_close_callback_scope(nullptr, nullptr);
8888     EXPECT_EQ(output, napi_invalid_arg);
8889 
8890     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Close_callback_Scope_0400 end";
8891 }
8892 
8893 /*
8894  * @tc.number    : ACE_Napi_Fatal_Exception_0700
8895  * @tc.name      : napi_fatal_exception is passed to the JS uncaughtException error message is invalid nullptr,
8896  *                 triggering uncaughtException exception failure.
8897  * @tc.desc      : 1.The environment engine is created.
8898  *                 2.Set test variables.
8899  *                 3.The function of napi_fatal_exception is called.
8900  *                 4.Return value of function is napi_invalid_arg.
8901  */
8902 HWTEST_F(NativeEngineTest, ACE_Napi_Fatal_Exception_0700, testing::ext::TestSize.Level2)
8903 {
8904     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Fatal_Exception_0700 start";
8905 
8906     napi_env env = (napi_env)engine_;
8907 
8908     napi_status output = napi_fatal_exception(env, nullptr);
8909 
8910     EXPECT_EQ(output, napi_invalid_arg);
8911 
8912     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Fatal_Exception_0700 end";
8913 }
8914 
8915 /*
8916  * @tc.number    : ACE_Napi_Fatal_Exception_0800
8917  * @tc.name      : The environment parameter of napi_fatal_exception nullptr,
8918  *                 triggering uncaughtException failed.
8919  * @tc.desc      : 1.The environment engine is created
8920  *                 2.Set test variables.
8921  *                 3.The function of napi_fatal_exception is called.
8922  *                 4.Return value of function is napi_invalid_arg.
8923  */
8924 HWTEST_F(NativeEngineTest, ACE_Napi_Fatal_Exception_0800, testing::ext::TestSize.Level2)
8925 {
8926     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Fatal_Exception_0800 start";
8927 
8928     napi_env env = (napi_env)engine_;
8929 
8930     napi_value err = nullptr;
8931     size_t sizeLen = sizeof("uncaughtException");
8932     napi_status verification = napi_create_string_utf8(env, "uncaughtException", sizeLen, &err);
8933 
8934     EXPECT_EQ(verification, napi_ok);
8935     napi_status output = napi_fatal_exception(nullptr, err);
8936 
8937     EXPECT_EQ(output, napi_invalid_arg);
8938 
8939     GTEST_LOG_(INFO) << "NativeEngineTest ACE_Napi_Fatal_Exception_0800 end";
8940 }
8941 
8942 /*
8943  * @tc.number    : ACE_Napi_Ref_Threadsafe_Function_0100
8944  * @tc.name      : napi_create_threadsafe_function creates a queue and
8945  *                 test napi_call_threadsafe_function none blocking mode with the queue full.
8946  * @tc.desc      :1.The environment engine is created.
8947  *                2.napi_create_threadsafe_function creates a queue
8948  *                3.Call napi_ref_threadsafe_function to set ref flag
8949  *                4.Call uv_has_ref to check if ref flag hasbeen set.
8950  */
8951 HWTEST_F(NativeEngineTest, ACE_Napi_Ref_Threadsafe_Function_0100, testing::ext::TestSize.Level1)
8952 {
8953     GTEST_LOG_(INFO) << "ACE_Napi_Ref_Threadsafe_Function_0100 called start";
8954     napi_env env = (napi_env)engine_;
8955     napi_threadsafe_function tsFunc = nullptr;
8956     napi_value resourceName = 0;
8957 
8958     napi_create_string_latin1(env, __func__, NAPI_AUTO_LENGTH, &resourceName);
8959     g_jsData.id = CALL_JS_CB_DATA_TEST_ID;
8960     g_finalData.id = FINAL_CB_DATA_TEST_ID;
8961     g_bIsFinish = false;
8962 
8963     auto status = napi_create_threadsafe_function(env, nullptr, nullptr, resourceName,
8964         0, 1, &g_finalData, FinalCallBack, &g_jsData, CallJSSlowCallBack, &tsFunc);
8965     EXPECT_EQ(status, napi_ok);
8966 
8967     status = napi_ref_threadsafe_function(env, tsFunc);
8968     EXPECT_EQ(status, napi_ok);
8969 
8970     auto safeAsyncWork = reinterpret_cast<NativeSafeAsyncWork*>(tsFunc);
8971 
8972     auto ret = uv_has_ref(reinterpret_cast<uv_handle_t*>(&(safeAsyncWork->asyncHandler_)));
8973     EXPECT_EQ(ret, 1);
8974 
8975     status = napi_release_threadsafe_function(tsFunc, napi_tsfn_release);
8976     EXPECT_EQ(status, napi_ok);
8977     WaitForFinish();
8978 
8979     GTEST_LOG_(INFO) << "ACE_Napi_Ref_Threadsafe_Function_0100 called end";
8980 }
8981 
8982 /*
8983  * @tc.number    : ACE_Napi_Ref_Threadsafe_Function_0200
8984  * @tc.name      : napi_create_threadsafe_function creates a queue and
8985  *                 test napi_call_threadsafe_function none blocking mode with the queue full.
8986  * @tc.desc      :1.The environment engine is created.
8987  *                2.napi_create_threadsafe_function creates a queue
8988  *                3.Call napi_ref_threadsafe_function with invalid param
8989  *                4.Check if napi_ref_threadsafe_function fails
8990  */
8991 HWTEST_F(NativeEngineTest, ACE_Napi_Ref_Threadsafe_Function_0200, testing::ext::TestSize.Level2)
8992 {
8993     GTEST_LOG_(INFO) << "ACE_Napi_Ref_Threadsafe_Function_0200 called start";
8994     napi_env env = (napi_env)engine_;
8995     napi_threadsafe_function tsFunc = nullptr;
8996     napi_value resourceName = 0;
8997 
8998     napi_create_string_latin1(env, __func__, NAPI_AUTO_LENGTH, &resourceName);
8999     g_jsData.id = CALL_JS_CB_DATA_TEST_ID;
9000     g_finalData.id = FINAL_CB_DATA_TEST_ID;
9001     g_bIsFinish = false;
9002 
9003     auto status = napi_create_threadsafe_function(env, nullptr, nullptr,
9004         resourceName, 0, 1, &g_finalData, FinalCallBack, &g_jsData, CallJSSlowCallBack, &tsFunc);
9005     EXPECT_EQ(status, napi_ok);
9006 
9007     status = napi_ref_threadsafe_function(env, nullptr);
9008     EXPECT_NE(status, napi_ok);
9009 
9010     status = napi_release_threadsafe_function(tsFunc, napi_tsfn_release);
9011     EXPECT_EQ(status, napi_ok);
9012     WaitForFinish();
9013 
9014     GTEST_LOG_(INFO) << "ACE_Napi_Ref_Threadsafe_Function_0200 called end";
9015 }
9016 
9017 /*
9018  * @tc.number    : ACE_Napi_Ref_Threadsafe_Function_0300
9019  * @tc.name      : napi_create_threadsafe_function creates a queue and
9020  *                 test napi_call_threadsafe_function none blocking mode with the queue full.
9021  * @tc.desc      :1.The environment engine is created.
9022  *                2.napi_create_threadsafe_function creates a queue
9023  *                3.Create child thread napi_ref_threadsafe_function to set ref flag
9024  *                4.Check if ref flag has been set.
9025  */
9026 HWTEST_F(NativeEngineTest, ACE_Napi_Ref_Threadsafe_Function_0300, testing::ext::TestSize.Level2)
9027 {
9028     GTEST_LOG_(INFO) << "ACE_Napi_Ref_Threadsafe_Function_0300 called start";
9029     napi_env env = (napi_env)engine_;
9030     napi_threadsafe_function tsFunc = nullptr;
9031     napi_value resourceName = 0;
9032 
9033     napi_create_string_latin1(env, __func__, NAPI_AUTO_LENGTH, &resourceName);
9034     g_jsData.id = CALL_JS_CB_DATA_TEST_ID;
9035     g_finalData.id = FINAL_CB_DATA_TEST_ID;
9036     g_bIsFinish = false;
9037 
9038     auto status = napi_create_threadsafe_function(env, nullptr, nullptr,
9039         resourceName, 0, 1, &g_finalData, FinalCallBack, &g_jsData, CallJSSlowCallBack, &tsFunc);
9040     EXPECT_EQ(status, napi_ok);
9041 
9042     status = napi_unref_threadsafe_function(env, tsFunc);
9043     EXPECT_EQ(status, napi_ok);
9044 
9045     uv_thread_t newChildTid;
9046     g_stEnv = env;
9047     if (uv_thread_create(&newChildTid, NewChildRef, tsFunc) != 0) {
9048         GTEST_LOG_(INFO) << "NewChildThreadMuti Failed to create uv thread!";
9049     }
9050     if (uv_thread_join(&newChildTid) != 0) {
9051         GTEST_LOG_(INFO) << "uv_thread_join Failed!";
9052     }
9053 
9054     auto safeAsyncWork = reinterpret_cast<NativeSafeAsyncWork*>(tsFunc);
9055 
9056     auto ret = uv_has_ref(reinterpret_cast<uv_handle_t*>(&(safeAsyncWork->asyncHandler_)));
9057     EXPECT_EQ(ret, 0);
9058 
9059     status = napi_release_threadsafe_function(tsFunc, napi_tsfn_release);
9060     EXPECT_EQ(status, napi_ok);
9061     WaitForFinish();
9062 
9063     GTEST_LOG_(INFO) << "ACE_Napi_Ref_Threadsafe_Function_0300 called end";
9064 }
9065 
9066 /*
9067  * @tc.number    : ACE_Napi_Ref_Threadsafe_Function_0400
9068  * @tc.name      : napi_create_threadsafe_function creates a queue and
9069  *                 test napi_call_threadsafe_function none blocking mode with the queue full.
9070  * @tc.desc      :1.The environment engine is created.
9071  *                2.napi_create_threadsafe_function creates a queue
9072  *                3.Call uv_has_ref to check if ref flag hasbeen set.
9073  */
9074 HWTEST_F(NativeEngineTest, ACE_Napi_Ref_Threadsafe_Function_0400, testing::ext::TestSize.Level1)
9075 {
9076     GTEST_LOG_(INFO) << "ACE_Napi_Ref_Threadsafe_Function_0400 called start";
9077     napi_env env = (napi_env)engine_;
9078     napi_threadsafe_function tsFunc = nullptr;
9079     napi_value resourceName = 0;
9080 
9081     napi_create_string_latin1(env, __func__, NAPI_AUTO_LENGTH, &resourceName);
9082     g_jsData.id = CALL_JS_CB_DATA_TEST_ID;
9083     g_finalData.id = FINAL_CB_DATA_TEST_ID;
9084     g_bIsFinish = false;
9085 
9086     auto status = napi_create_threadsafe_function(env, nullptr, nullptr,
9087         resourceName, 0, 1, &g_finalData, FinalCallBack, &g_jsData, CallJSSlowCallBack, &tsFunc);
9088     EXPECT_EQ(status, napi_ok);
9089 
9090     auto safeAsyncWork = reinterpret_cast<NativeSafeAsyncWork*>(tsFunc);
9091     auto ret = uv_has_ref(reinterpret_cast<uv_handle_t*>(&(safeAsyncWork->asyncHandler_)));
9092     EXPECT_EQ(ret, 1);
9093 
9094     status = napi_release_threadsafe_function(tsFunc, napi_tsfn_release);
9095     EXPECT_EQ(status, napi_ok);
9096     WaitForFinish();
9097 
9098     GTEST_LOG_(INFO) << "ACE_Napi_Ref_Threadsafe_Function_0400 called end";
9099 }
9100 
9101 /*
9102  * @tc.number    : ACE_Napi_Unref_Threadsafe_Function_0100
9103  * @tc.name      : napi_create_threadsafe_function creates a queue and
9104  *                 test napi_call_threadsafe_function none blocking mode with the queue full.
9105  * @tc.desc      :1.The environment engine is created.
9106  *                2.napi_create_threadsafe_function creates a queue
9107  *                3.Call napi_unref_threadsafe_function to set ref flag
9108  *                4.Call uv_has_ref to check if ref flag hasbeen set.
9109  */
9110 HWTEST_F(NativeEngineTest, ACE_Napi_Unref_Threadsafe_Function_0100, testing::ext::TestSize.Level1)
9111 {
9112     GTEST_LOG_(INFO) << "ACE_Napi_Unref_Threadsafe_Function_0100 called start";
9113     napi_env env = (napi_env)engine_;
9114     napi_threadsafe_function tsFunc = nullptr;
9115     napi_value resourceName = 0;
9116 
9117     napi_create_string_latin1(env, __func__, NAPI_AUTO_LENGTH, &resourceName);
9118     g_jsData.id = CALL_JS_CB_DATA_TEST_ID;
9119     g_finalData.id = FINAL_CB_DATA_TEST_ID;
9120     g_bIsFinish = false;
9121 
9122     auto status = napi_create_threadsafe_function(env, nullptr, nullptr,
9123        resourceName, 0, 1, &g_finalData, FinalCallBack, &g_jsData, CallJSSlowCallBack, &tsFunc);
9124     EXPECT_EQ(status, napi_ok);
9125 
9126     status = napi_unref_threadsafe_function(env, tsFunc);
9127     EXPECT_EQ(status, napi_ok);
9128 
9129     auto safeAsyncWork = reinterpret_cast<NativeSafeAsyncWork*>(tsFunc);
9130 
9131     auto ret = uv_has_ref(reinterpret_cast<uv_handle_t*>(&(safeAsyncWork->asyncHandler_)));
9132     EXPECT_EQ(ret, 0);
9133 
9134     status = napi_release_threadsafe_function(tsFunc, napi_tsfn_release);
9135     EXPECT_EQ(status, napi_ok);
9136     WaitForFinish();
9137 
9138     GTEST_LOG_(INFO) << "ACE_Napi_Unref_Threadsafe_Function_0100 called end";
9139 }
9140 
9141 /*
9142  * @tc.number    : ACE_Napi_Unref_Threadsafe_Function_0200
9143  * @tc.name      : napi_create_threadsafe_function creates a queue and
9144  *                 test napi_call_threadsafe_function none blocking mode with the queue full.
9145  * @tc.desc      :1.The environment engine is created.
9146  *                2.napi_create_threadsafe_function creates a queue
9147  *                3.Call napi_unref_threadsafe_function with invalid param
9148  *                4.Check if napi_unref_threadsafe_function fails
9149  */
9150 HWTEST_F(NativeEngineTest, ACE_Napi_Unref_Threadsafe_Function_0200, testing::ext::TestSize.Level2)
9151 {
9152     GTEST_LOG_(INFO) << "ACE_Napi_Unref_Threadsafe_Function_0200 called start";
9153     napi_env env = (napi_env)engine_;
9154     napi_threadsafe_function tsFunc = nullptr;
9155     napi_value resourceName = 0;
9156 
9157     napi_create_string_latin1(env, __func__, NAPI_AUTO_LENGTH, &resourceName);
9158     g_jsData.id = CALL_JS_CB_DATA_TEST_ID;
9159     g_finalData.id = FINAL_CB_DATA_TEST_ID;
9160     g_bIsFinish = false;
9161 
9162     auto status = napi_create_threadsafe_function(env, nullptr, nullptr,
9163         resourceName, 0, 1, &g_finalData, FinalCallBack, &g_jsData, CallJSSlowCallBack, &tsFunc);
9164     EXPECT_EQ(status, napi_ok);
9165 
9166     status = napi_unref_threadsafe_function(env, nullptr);
9167     EXPECT_NE(status, napi_ok);
9168 
9169     status = napi_release_threadsafe_function(tsFunc, napi_tsfn_release);
9170     EXPECT_EQ(status, napi_ok);
9171     WaitForFinish();
9172 
9173     GTEST_LOG_(INFO) << "ACE_Napi_Unref_Threadsafe_Function_0200 called end";
9174 }
9175 
9176 /*
9177  * @tc.number    : ACE_Napi_Unref_Threadsafe_Function_0300
9178  * @tc.name      : napi_create_threadsafe_function creates a queue and
9179  *                 test napi_call_threadsafe_function none blocking mode with the queue full.
9180  * @tc.desc      :1.The environment engine is created.
9181  *                2.napi_create_threadsafe_function creates a queue
9182  *                3.Create child thread napi_unref_threadsafe_function to set ref flag
9183  *                4.Check if ref flag has been set.
9184  */
9185 HWTEST_F(NativeEngineTest, ACE_Napi_Unref_Threadsafe_Function_0300, testing::ext::TestSize.Level2)
9186 {
9187     GTEST_LOG_(INFO) << "ACE_Napi_Unref_Threadsafe_Function_0300 called start";
9188     napi_env env = (napi_env)engine_;
9189     napi_threadsafe_function tsFunc = nullptr;
9190     napi_value resourceName = 0;
9191 
9192     napi_create_string_latin1(env, __func__, NAPI_AUTO_LENGTH, &resourceName);
9193     g_jsData.id = CALL_JS_CB_DATA_TEST_ID;
9194     g_finalData.id = FINAL_CB_DATA_TEST_ID;
9195     g_bIsFinish = false;
9196 
9197     auto status = napi_create_threadsafe_function(env, nullptr, nullptr,
9198         resourceName, 0, 1, &g_finalData, FinalCallBack, &g_jsData, CallJSSlowCallBack, &tsFunc);
9199     EXPECT_EQ(status, napi_ok);
9200 
9201     uv_thread_t newChildTid;
9202     g_stEnv = env;
9203     if (uv_thread_create(&newChildTid, NewChildUnRef, tsFunc) != 0) {
9204         GTEST_LOG_(INFO) << "NewChildThreadMuti Failed to create uv thread!";
9205     }
9206     if (uv_thread_join(&newChildTid) != 0) {
9207         GTEST_LOG_(INFO) << "uv_thread_join(&newChildTid)!";
9208     }
9209 
9210     auto safeAsyncWork = reinterpret_cast<NativeSafeAsyncWork*>(tsFunc);
9211 
9212     auto ret = uv_has_ref(reinterpret_cast<uv_handle_t*>(&(safeAsyncWork->asyncHandler_)));
9213     EXPECT_EQ(ret, 1);
9214 
9215     status = napi_release_threadsafe_function(tsFunc, napi_tsfn_release);
9216     EXPECT_EQ(status, napi_ok);
9217     WaitForFinish();
9218 
9219     GTEST_LOG_(INFO) << "ACE_Napi_Unref_Threadsafe_Function_0300 called end";
9220 }
9221