14514f5e3Sopenharmony_ci/*
24514f5e3Sopenharmony_ci * Copyright (c) 2021 Huawei Device Co., Ltd.
34514f5e3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
44514f5e3Sopenharmony_ci * you may not use this file except in compliance with the License.
54514f5e3Sopenharmony_ci * You may obtain a copy of the License at
64514f5e3Sopenharmony_ci *
74514f5e3Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
84514f5e3Sopenharmony_ci *
94514f5e3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
104514f5e3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
114514f5e3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
124514f5e3Sopenharmony_ci * See the License for the specific language governing permissions and
134514f5e3Sopenharmony_ci * limitations under the License.
144514f5e3Sopenharmony_ci */
154514f5e3Sopenharmony_ci
164514f5e3Sopenharmony_ci#include "ecmascript/builtins/builtins_math.h"
174514f5e3Sopenharmony_ci
184514f5e3Sopenharmony_ci#include "ecmascript/base/number_helper.h"
194514f5e3Sopenharmony_ci#include "ecmascript/ecma_runtime_call_info.h"
204514f5e3Sopenharmony_ci#include "ecmascript/ecma_vm.h"
214514f5e3Sopenharmony_ci#include "ecmascript/js_tagged_value-inl.h"
224514f5e3Sopenharmony_ci#include "ecmascript/js_tagged_value.h"
234514f5e3Sopenharmony_ci#include "ecmascript/js_thread.h"
244514f5e3Sopenharmony_ci#include "ecmascript/object_factory.h"
254514f5e3Sopenharmony_ci#include "ecmascript/tests/test_helper.h"
264514f5e3Sopenharmony_ci
274514f5e3Sopenharmony_ciusing namespace panda::ecmascript;
284514f5e3Sopenharmony_ciusing namespace panda::ecmascript::builtins;
294514f5e3Sopenharmony_ciusing namespace panda::ecmascript::base;
304514f5e3Sopenharmony_ci
314514f5e3Sopenharmony_cinamespace panda::test {
324514f5e3Sopenharmony_ciclass BuiltinsMathTest : public testing::Test {
334514f5e3Sopenharmony_cipublic:
344514f5e3Sopenharmony_ci    // Workaround: Avoid thread local leak [F/runtime: cannot create thread specific key for __cxa_get_globals()]
354514f5e3Sopenharmony_ci    static void SetUpTestCase()
364514f5e3Sopenharmony_ci    {
374514f5e3Sopenharmony_ci        TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_);
384514f5e3Sopenharmony_ci    }
394514f5e3Sopenharmony_ci
404514f5e3Sopenharmony_ci    static void TearDownTestCase()
414514f5e3Sopenharmony_ci    {
424514f5e3Sopenharmony_ci        TestHelper::DestroyEcmaVMWithScope(instance_, scope_);
434514f5e3Sopenharmony_ci    }
444514f5e3Sopenharmony_ci
454514f5e3Sopenharmony_ci    static EcmaVM *instance_;
464514f5e3Sopenharmony_ci    static EcmaHandleScope *scope_;
474514f5e3Sopenharmony_ci    static JSThread *thread_;
484514f5e3Sopenharmony_ci};
494514f5e3Sopenharmony_ciEcmaVM *BuiltinsMathTest::instance_ = nullptr;
504514f5e3Sopenharmony_ciEcmaHandleScope *BuiltinsMathTest::scope_ = nullptr;
514514f5e3Sopenharmony_ciJSThread *BuiltinsMathTest::thread_ = nullptr;
524514f5e3Sopenharmony_ci
534514f5e3Sopenharmony_ci// Math.abs(-10)
544514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Abs)
554514f5e3Sopenharmony_ci{
564514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
574514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
584514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
594514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(-10)));
604514f5e3Sopenharmony_ci
614514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
624514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Abs(ecmaRuntimeCallInfo);
634514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
644514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedInt(10);
654514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
664514f5e3Sopenharmony_ci}
674514f5e3Sopenharmony_ci
684514f5e3Sopenharmony_ci// Math.abs(10)
694514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Abs_1)
704514f5e3Sopenharmony_ci{
714514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
724514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
734514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
744514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(10)));
754514f5e3Sopenharmony_ci
764514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
774514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Abs(ecmaRuntimeCallInfo);
784514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
794514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedInt(10);
804514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
814514f5e3Sopenharmony_ci}
824514f5e3Sopenharmony_ci
834514f5e3Sopenharmony_ci// Math.abs(0)
844514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Abs_2)
854514f5e3Sopenharmony_ci{
864514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
874514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
884514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
894514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(0)));
904514f5e3Sopenharmony_ci
914514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
924514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Abs(ecmaRuntimeCallInfo);
934514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
944514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedInt(0);
954514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
964514f5e3Sopenharmony_ci}
974514f5e3Sopenharmony_ci
984514f5e3Sopenharmony_ci// Math.abs(null)
994514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Abs_3)
1004514f5e3Sopenharmony_ci{
1014514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
1024514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
1034514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
1044514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Null());
1054514f5e3Sopenharmony_ci
1064514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
1074514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Abs(ecmaRuntimeCallInfo);
1084514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
1094514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedInt(0);
1104514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
1114514f5e3Sopenharmony_ci}
1124514f5e3Sopenharmony_ci
1134514f5e3Sopenharmony_ci// Math.abs("hello")
1144514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Abs_4)
1154514f5e3Sopenharmony_ci{
1164514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("helloworld");
1174514f5e3Sopenharmony_ci
1184514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
1194514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
1204514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
1214514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
1224514f5e3Sopenharmony_ci
1234514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
1244514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Abs(ecmaRuntimeCallInfo);
1254514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
1264514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
1274514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
1284514f5e3Sopenharmony_ci}
1294514f5e3Sopenharmony_ci
1304514f5e3Sopenharmony_ci// Math.abs(Number.MAX_VALUE + 1)
1314514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Abs_5)
1324514f5e3Sopenharmony_ci{
1334514f5e3Sopenharmony_ci    const double testValue = base::MAX_VALUE + 1;
1344514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
1354514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
1364514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
1374514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(testValue));
1384514f5e3Sopenharmony_ci
1394514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
1404514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Abs(ecmaRuntimeCallInfo);
1414514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
1424514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::MAX_VALUE);
1434514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
1444514f5e3Sopenharmony_ci}
1454514f5e3Sopenharmony_ci
1464514f5e3Sopenharmony_ci// Math.abs(Number.MIN_VALUE)
1474514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Abs_6)
1484514f5e3Sopenharmony_ci{
1494514f5e3Sopenharmony_ci    const double testValue = base::MIN_VALUE + 1;
1504514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
1514514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
1524514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
1534514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(testValue));
1544514f5e3Sopenharmony_ci
1554514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
1564514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Abs(ecmaRuntimeCallInfo);
1574514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
1584514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(1.0);
1594514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
1604514f5e3Sopenharmony_ci}
1614514f5e3Sopenharmony_ci
1624514f5e3Sopenharmony_ci// Math.abs(Number.POSITIVE_INFINITY + 1)
1634514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Abs_7)
1644514f5e3Sopenharmony_ci{
1654514f5e3Sopenharmony_ci    const double testValue = base::POSITIVE_INFINITY + 1;
1664514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
1674514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
1684514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
1694514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(testValue));
1704514f5e3Sopenharmony_ci
1714514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
1724514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Abs(ecmaRuntimeCallInfo);
1734514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
1744514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::POSITIVE_INFINITY);
1754514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
1764514f5e3Sopenharmony_ci}
1774514f5e3Sopenharmony_ci
1784514f5e3Sopenharmony_ci// Math.abs(Number.NEGATIVE_INFINITY - 1)
1794514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Abs_8)
1804514f5e3Sopenharmony_ci{
1814514f5e3Sopenharmony_ci    const double testValue = -base::POSITIVE_INFINITY - 1;
1824514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
1834514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
1844514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
1854514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(testValue));
1864514f5e3Sopenharmony_ci
1874514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
1884514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Abs(ecmaRuntimeCallInfo);
1894514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
1904514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::POSITIVE_INFINITY);
1914514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
1924514f5e3Sopenharmony_ci}
1934514f5e3Sopenharmony_ci
1944514f5e3Sopenharmony_ci// Math.abs(Number.NAN_VALUE)
1954514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Abs_9)
1964514f5e3Sopenharmony_ci{
1974514f5e3Sopenharmony_ci    const double testValue = base::NAN_VALUE;
1984514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
1994514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
2004514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
2014514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(testValue));
2024514f5e3Sopenharmony_ci
2034514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
2044514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Abs(ecmaRuntimeCallInfo);
2054514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
2064514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
2074514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
2084514f5e3Sopenharmony_ci}
2094514f5e3Sopenharmony_ci
2104514f5e3Sopenharmony_ci// Math.abs(VALUE_UNDEFINED)
2114514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Abs_10)
2124514f5e3Sopenharmony_ci{
2134514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
2144514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
2154514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
2164514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Undefined());
2174514f5e3Sopenharmony_ci
2184514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
2194514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Abs(ecmaRuntimeCallInfo);
2204514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
2214514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
2224514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
2234514f5e3Sopenharmony_ci}
2244514f5e3Sopenharmony_ci
2254514f5e3Sopenharmony_ci// Math.abs(true)
2264514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Abs_11)
2274514f5e3Sopenharmony_ci{
2284514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
2294514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
2304514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
2314514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::True());
2324514f5e3Sopenharmony_ci
2334514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
2344514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Abs(ecmaRuntimeCallInfo);
2354514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
2364514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedInt(1);
2374514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
2384514f5e3Sopenharmony_ci}
2394514f5e3Sopenharmony_ci
2404514f5e3Sopenharmony_ci// Math.abs(false)
2414514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Abs_12)
2424514f5e3Sopenharmony_ci{
2434514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
2444514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
2454514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
2464514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::False());
2474514f5e3Sopenharmony_ci
2484514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
2494514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Abs(ecmaRuntimeCallInfo);
2504514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
2514514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedInt(0);
2524514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
2534514f5e3Sopenharmony_ci}
2544514f5e3Sopenharmony_ci
2554514f5e3Sopenharmony_ci// Math.abs(hole)
2564514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Abs_13)
2574514f5e3Sopenharmony_ci{
2584514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
2594514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
2604514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
2614514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Hole());
2624514f5e3Sopenharmony_ci
2634514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
2644514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Abs(ecmaRuntimeCallInfo);
2654514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
2664514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
2674514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
2684514f5e3Sopenharmony_ci}
2694514f5e3Sopenharmony_ci
2704514f5e3Sopenharmony_ci// Math.abs("100.12")
2714514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Abs_14)
2724514f5e3Sopenharmony_ci{
2734514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("100.12");
2744514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
2754514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
2764514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
2774514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
2784514f5e3Sopenharmony_ci
2794514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
2804514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Abs(ecmaRuntimeCallInfo);
2814514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
2824514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(100.12);
2834514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
2844514f5e3Sopenharmony_ci}
2854514f5e3Sopenharmony_ci
2864514f5e3Sopenharmony_ci// Math.acos(-1)
2874514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Acos)
2884514f5e3Sopenharmony_ci{
2894514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
2904514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
2914514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
2924514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(-1)));
2934514f5e3Sopenharmony_ci
2944514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
2954514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Acos(ecmaRuntimeCallInfo);
2964514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
2974514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(BuiltinsMath::PI);
2984514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
2994514f5e3Sopenharmony_ci}
3004514f5e3Sopenharmony_ci
3014514f5e3Sopenharmony_ci// Math.acos(1)
3024514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Acos_1)
3034514f5e3Sopenharmony_ci{
3044514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
3054514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
3064514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
3074514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(1)));
3084514f5e3Sopenharmony_ci
3094514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
3104514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Acos(ecmaRuntimeCallInfo);
3114514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
3124514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
3134514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
3144514f5e3Sopenharmony_ci}
3154514f5e3Sopenharmony_ci
3164514f5e3Sopenharmony_ci// Math.acos(-1.5)
3174514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Acos_2)
3184514f5e3Sopenharmony_ci{
3194514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
3204514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
3214514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
3224514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-1.5));
3234514f5e3Sopenharmony_ci
3244514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
3254514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Acos(ecmaRuntimeCallInfo);
3264514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
3274514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
3284514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
3294514f5e3Sopenharmony_ci}
3304514f5e3Sopenharmony_ci
3314514f5e3Sopenharmony_ci// Math.acos(null)
3324514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Acos_3)
3334514f5e3Sopenharmony_ci{
3344514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
3354514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
3364514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
3374514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Null());
3384514f5e3Sopenharmony_ci
3394514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
3404514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Acos(ecmaRuntimeCallInfo);
3414514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
3424514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(1.5707963267948966);
3434514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
3444514f5e3Sopenharmony_ci}
3454514f5e3Sopenharmony_ci
3464514f5e3Sopenharmony_ci// Math.acos(UNDEFINED)
3474514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Acos_4)
3484514f5e3Sopenharmony_ci{
3494514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
3504514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
3514514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
3524514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Undefined());
3534514f5e3Sopenharmony_ci
3544514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
3554514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Acos(ecmaRuntimeCallInfo);
3564514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
3574514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
3584514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
3594514f5e3Sopenharmony_ci}
3604514f5e3Sopenharmony_ci
3614514f5e3Sopenharmony_ci// Math.acos(true)
3624514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Acos_5)
3634514f5e3Sopenharmony_ci{
3644514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
3654514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
3664514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
3674514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::True());
3684514f5e3Sopenharmony_ci
3694514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
3704514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Acos(ecmaRuntimeCallInfo);
3714514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
3724514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0.0);
3734514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
3744514f5e3Sopenharmony_ci}
3754514f5e3Sopenharmony_ci
3764514f5e3Sopenharmony_ci// Math.acos(false)
3774514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Acos_6)
3784514f5e3Sopenharmony_ci{
3794514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
3804514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
3814514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
3824514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::False());
3834514f5e3Sopenharmony_ci
3844514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
3854514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Acos(ecmaRuntimeCallInfo);
3864514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
3874514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(1.5707963267948966);
3884514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
3894514f5e3Sopenharmony_ci}
3904514f5e3Sopenharmony_ci
3914514f5e3Sopenharmony_ci// Math.acos("0.1")
3924514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Acos_7)
3934514f5e3Sopenharmony_ci{
3944514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("0.1");
3954514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
3964514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
3974514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
3984514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
3994514f5e3Sopenharmony_ci
4004514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
4014514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Acos(ecmaRuntimeCallInfo);
4024514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
4034514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(1.4706289056333368);
4044514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
4054514f5e3Sopenharmony_ci}
4064514f5e3Sopenharmony_ci
4074514f5e3Sopenharmony_ci// Math.acos("")
4084514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Acos_8)
4094514f5e3Sopenharmony_ci{
4104514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("");
4114514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
4124514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
4134514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
4144514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
4154514f5e3Sopenharmony_ci
4164514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
4174514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Acos(ecmaRuntimeCallInfo);
4184514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
4194514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(1.5707963267948966);
4204514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
4214514f5e3Sopenharmony_ci}
4224514f5e3Sopenharmony_ci
4234514f5e3Sopenharmony_ci// Math.acos(-NaN)
4244514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Acos_9)
4254514f5e3Sopenharmony_ci{
4264514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
4274514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
4284514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
4294514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::NAN_VALUE));
4304514f5e3Sopenharmony_ci
4314514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
4324514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Acos(ecmaRuntimeCallInfo);
4334514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
4344514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
4354514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
4364514f5e3Sopenharmony_ci}
4374514f5e3Sopenharmony_ci
4384514f5e3Sopenharmony_ci// Math.acosh(1.1)
4394514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Acosh)
4404514f5e3Sopenharmony_ci{
4414514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
4424514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
4434514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
4444514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(1.1));
4454514f5e3Sopenharmony_ci
4464514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
4474514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Acosh(ecmaRuntimeCallInfo);
4484514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
4494514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0.4435682543851154);
4504514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
4514514f5e3Sopenharmony_ci}
4524514f5e3Sopenharmony_ci
4534514f5e3Sopenharmony_ci// Math.acosh(0.5)
4544514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Acosh_1)
4554514f5e3Sopenharmony_ci{
4564514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
4574514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
4584514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
4594514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(0.5));
4604514f5e3Sopenharmony_ci
4614514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
4624514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Acosh(ecmaRuntimeCallInfo);
4634514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
4644514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
4654514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
4664514f5e3Sopenharmony_ci}
4674514f5e3Sopenharmony_ci
4684514f5e3Sopenharmony_ci// Math.acosh(base::POSITIVE_INFINITY)
4694514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Acosh_2)
4704514f5e3Sopenharmony_ci{
4714514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
4724514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
4734514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
4744514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(base::POSITIVE_INFINITY));
4754514f5e3Sopenharmony_ci
4764514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
4774514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Acosh(ecmaRuntimeCallInfo);
4784514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
4794514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::POSITIVE_INFINITY);
4804514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
4814514f5e3Sopenharmony_ci}
4824514f5e3Sopenharmony_ci
4834514f5e3Sopenharmony_ci// Math.acosh(null)
4844514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Acosh_3)
4854514f5e3Sopenharmony_ci{
4864514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
4874514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
4884514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
4894514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Null());
4904514f5e3Sopenharmony_ci
4914514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
4924514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Acosh(ecmaRuntimeCallInfo);
4934514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
4944514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
4954514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
4964514f5e3Sopenharmony_ci}
4974514f5e3Sopenharmony_ci
4984514f5e3Sopenharmony_ci// Math.acosh(VALUE_UNDEFINED)
4994514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Acosh_4)
5004514f5e3Sopenharmony_ci{
5014514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
5024514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
5034514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
5044514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Undefined());
5054514f5e3Sopenharmony_ci
5064514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
5074514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Acosh(ecmaRuntimeCallInfo);
5084514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
5094514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
5104514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
5114514f5e3Sopenharmony_ci}
5124514f5e3Sopenharmony_ci
5134514f5e3Sopenharmony_ci// Math.acosh(true)
5144514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Acosh_5)
5154514f5e3Sopenharmony_ci{
5164514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
5174514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
5184514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
5194514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::True());
5204514f5e3Sopenharmony_ci
5214514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
5224514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Acosh(ecmaRuntimeCallInfo);
5234514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
5244514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0.0);
5254514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
5264514f5e3Sopenharmony_ci}
5274514f5e3Sopenharmony_ci
5284514f5e3Sopenharmony_ci// Math.acosh(false)
5294514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Acosh_6)
5304514f5e3Sopenharmony_ci{
5314514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
5324514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
5334514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
5344514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::False());
5354514f5e3Sopenharmony_ci
5364514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
5374514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Acosh(ecmaRuntimeCallInfo);
5384514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
5394514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
5404514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
5414514f5e3Sopenharmony_ci}
5424514f5e3Sopenharmony_ci
5434514f5e3Sopenharmony_ci// Math.acosh(hole)
5444514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Acosh_7)
5454514f5e3Sopenharmony_ci{
5464514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
5474514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
5484514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
5494514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Hole());
5504514f5e3Sopenharmony_ci
5514514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
5524514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Acosh(ecmaRuntimeCallInfo);
5534514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
5544514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
5554514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
5564514f5e3Sopenharmony_ci}
5574514f5e3Sopenharmony_ci
5584514f5e3Sopenharmony_ci// Math.acosh("1")
5594514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Acosh_8)
5604514f5e3Sopenharmony_ci{
5614514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("1");
5624514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
5634514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
5644514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
5654514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
5664514f5e3Sopenharmony_ci
5674514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
5684514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Acosh(ecmaRuntimeCallInfo);
5694514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
5704514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
5714514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
5724514f5e3Sopenharmony_ci}
5734514f5e3Sopenharmony_ci
5744514f5e3Sopenharmony_ci// Math.acosh("")
5754514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Acosh_9)
5764514f5e3Sopenharmony_ci{
5774514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("");
5784514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
5794514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
5804514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
5814514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
5824514f5e3Sopenharmony_ci
5834514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
5844514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Acosh(ecmaRuntimeCallInfo);
5854514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
5864514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
5874514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
5884514f5e3Sopenharmony_ci}
5894514f5e3Sopenharmony_ci
5904514f5e3Sopenharmony_ci// Math.acosh(-NaN)
5914514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Acosh_10)
5924514f5e3Sopenharmony_ci{
5934514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
5944514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
5954514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
5964514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::NAN_VALUE));
5974514f5e3Sopenharmony_ci
5984514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
5994514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Acosh(ecmaRuntimeCallInfo);
6004514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
6014514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
6024514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
6034514f5e3Sopenharmony_ci}
6044514f5e3Sopenharmony_ci
6054514f5e3Sopenharmony_ci// Math.asin(-1)
6064514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Asin)
6074514f5e3Sopenharmony_ci{
6084514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
6094514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
6104514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
6114514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(-1)));
6124514f5e3Sopenharmony_ci
6134514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
6144514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Asin(ecmaRuntimeCallInfo);
6154514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
6164514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-1.5707963267948966);
6174514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
6184514f5e3Sopenharmony_ci}
6194514f5e3Sopenharmony_ci
6204514f5e3Sopenharmony_ci// Math.asin(1)
6214514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Asin_1)
6224514f5e3Sopenharmony_ci{
6234514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
6244514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
6254514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
6264514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(1)));
6274514f5e3Sopenharmony_ci
6284514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
6294514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Asin(ecmaRuntimeCallInfo);
6304514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
6314514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(1.5707963267948966);
6324514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
6334514f5e3Sopenharmony_ci}
6344514f5e3Sopenharmony_ci
6354514f5e3Sopenharmony_ci// Math.asin(-NaN)
6364514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Asin_2)
6374514f5e3Sopenharmony_ci{
6384514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
6394514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
6404514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
6414514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::NAN_VALUE));
6424514f5e3Sopenharmony_ci
6434514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
6444514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Asin(ecmaRuntimeCallInfo);
6454514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
6464514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
6474514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
6484514f5e3Sopenharmony_ci}
6494514f5e3Sopenharmony_ci
6504514f5e3Sopenharmony_ci// Math.asin(null)
6514514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Asin_3)
6524514f5e3Sopenharmony_ci{
6534514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
6544514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
6554514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
6564514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Null());
6574514f5e3Sopenharmony_ci
6584514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
6594514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Asin(ecmaRuntimeCallInfo);
6604514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
6614514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
6624514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
6634514f5e3Sopenharmony_ci}
6644514f5e3Sopenharmony_ci
6654514f5e3Sopenharmony_ci// Math.asin(UNDEFINED)
6664514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Asin_4)
6674514f5e3Sopenharmony_ci{
6684514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
6694514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
6704514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
6714514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Undefined());
6724514f5e3Sopenharmony_ci
6734514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
6744514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Asin(ecmaRuntimeCallInfo);
6754514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
6764514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
6774514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
6784514f5e3Sopenharmony_ci}
6794514f5e3Sopenharmony_ci
6804514f5e3Sopenharmony_ci// Math.asin(true)
6814514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Asin_5)
6824514f5e3Sopenharmony_ci{
6834514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
6844514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
6854514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
6864514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::True());
6874514f5e3Sopenharmony_ci
6884514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
6894514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Asin(ecmaRuntimeCallInfo);
6904514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
6914514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(1.5707963267948966);
6924514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
6934514f5e3Sopenharmony_ci}
6944514f5e3Sopenharmony_ci
6954514f5e3Sopenharmony_ci// Math.asin(false)
6964514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Asin_6)
6974514f5e3Sopenharmony_ci{
6984514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
6994514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
7004514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
7014514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::False());
7024514f5e3Sopenharmony_ci
7034514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
7044514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Asin(ecmaRuntimeCallInfo);
7054514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
7064514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
7074514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
7084514f5e3Sopenharmony_ci}
7094514f5e3Sopenharmony_ci
7104514f5e3Sopenharmony_ci// Math.asin(""")
7114514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Asin_7)
7124514f5e3Sopenharmony_ci{
7134514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("");
7144514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
7154514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
7164514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
7174514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
7184514f5e3Sopenharmony_ci
7194514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
7204514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Asin(ecmaRuntimeCallInfo);
7214514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
7224514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
7234514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
7244514f5e3Sopenharmony_ci}
7254514f5e3Sopenharmony_ci
7264514f5e3Sopenharmony_ci// Math.asin("1")
7274514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Asin_8)
7284514f5e3Sopenharmony_ci{
7294514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("1");
7304514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
7314514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
7324514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
7334514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
7344514f5e3Sopenharmony_ci
7354514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
7364514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Asin(ecmaRuntimeCallInfo);
7374514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
7384514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(1.5707963267948966);
7394514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
7404514f5e3Sopenharmony_ci}
7414514f5e3Sopenharmony_ci
7424514f5e3Sopenharmony_ci// Math.asinh(-1)
7434514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Asinh)
7444514f5e3Sopenharmony_ci{
7454514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
7464514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
7474514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
7484514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(-1)));
7494514f5e3Sopenharmony_ci
7504514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
7514514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Asinh(ecmaRuntimeCallInfo);
7524514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
7534514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-0.881373587019543);
7544514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
7554514f5e3Sopenharmony_ci}
7564514f5e3Sopenharmony_ci
7574514f5e3Sopenharmony_ci// Math.asinh(1)
7584514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Asinh_1)
7594514f5e3Sopenharmony_ci{
7604514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
7614514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
7624514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
7634514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(1)));
7644514f5e3Sopenharmony_ci
7654514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
7664514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Asinh(ecmaRuntimeCallInfo);
7674514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
7684514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
7694514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0.881373587019543);
7704514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
7714514f5e3Sopenharmony_ci}
7724514f5e3Sopenharmony_ci
7734514f5e3Sopenharmony_ci// Math.asinh(null)
7744514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Asinh_2)
7754514f5e3Sopenharmony_ci{
7764514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
7774514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
7784514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
7794514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Null());
7804514f5e3Sopenharmony_ci
7814514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
7824514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Asinh(ecmaRuntimeCallInfo);
7834514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
7844514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
7854514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
7864514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
7874514f5e3Sopenharmony_ci}
7884514f5e3Sopenharmony_ci
7894514f5e3Sopenharmony_ci// Math.asinh(-NaN)
7904514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Asinh_3)
7914514f5e3Sopenharmony_ci{
7924514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
7934514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
7944514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
7954514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::NAN_VALUE));
7964514f5e3Sopenharmony_ci
7974514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
7984514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Asinh(ecmaRuntimeCallInfo);
7994514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
8004514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
8014514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
8024514f5e3Sopenharmony_ci}
8034514f5e3Sopenharmony_ci
8044514f5e3Sopenharmony_ci// Math.asinh(NEGATIVE_INFINITY)
8054514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Asinh_4)
8064514f5e3Sopenharmony_ci{
8074514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
8084514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
8094514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
8104514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::POSITIVE_INFINITY));
8114514f5e3Sopenharmony_ci
8124514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
8134514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Asinh(ecmaRuntimeCallInfo);
8144514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
8154514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-base::POSITIVE_INFINITY);
8164514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
8174514f5e3Sopenharmony_ci}
8184514f5e3Sopenharmony_ci
8194514f5e3Sopenharmony_ci// Math.asinh(true)
8204514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Asinh_5)
8214514f5e3Sopenharmony_ci{
8224514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
8234514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
8244514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
8254514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::True());
8264514f5e3Sopenharmony_ci
8274514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
8284514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Asinh(ecmaRuntimeCallInfo);
8294514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
8304514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0.881373587019543);
8314514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
8324514f5e3Sopenharmony_ci}
8334514f5e3Sopenharmony_ci
8344514f5e3Sopenharmony_ci// Math.asinh(false)
8354514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Asinh_6)
8364514f5e3Sopenharmony_ci{
8374514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
8384514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
8394514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
8404514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::False());
8414514f5e3Sopenharmony_ci
8424514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
8434514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Asinh(ecmaRuntimeCallInfo);
8444514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
8454514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
8464514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
8474514f5e3Sopenharmony_ci}
8484514f5e3Sopenharmony_ci
8494514f5e3Sopenharmony_ci// Math.asinh("")
8504514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Asinh_7)
8514514f5e3Sopenharmony_ci{
8524514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("");
8534514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
8544514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
8554514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
8564514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
8574514f5e3Sopenharmony_ci
8584514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
8594514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Asinh(ecmaRuntimeCallInfo);
8604514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
8614514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
8624514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
8634514f5e3Sopenharmony_ci}
8644514f5e3Sopenharmony_ci
8654514f5e3Sopenharmony_ci// Math.asinh("-5.7")
8664514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Asinh_8)
8674514f5e3Sopenharmony_ci{
8684514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("-5.7");
8694514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
8704514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
8714514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
8724514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
8734514f5e3Sopenharmony_ci
8744514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
8754514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Asinh(ecmaRuntimeCallInfo);
8764514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
8774514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-2.44122070725561);
8784514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
8794514f5e3Sopenharmony_ci}
8804514f5e3Sopenharmony_ci
8814514f5e3Sopenharmony_ci// Math.asinh(-0.0)
8824514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Asinh_9)
8834514f5e3Sopenharmony_ci{
8844514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
8854514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
8864514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
8874514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-0.0));
8884514f5e3Sopenharmony_ci
8894514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
8904514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Asinh(ecmaRuntimeCallInfo);
8914514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
8924514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-0.0);
8934514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
8944514f5e3Sopenharmony_ci}
8954514f5e3Sopenharmony_ci
8964514f5e3Sopenharmony_ci// Math.asinh(+0.0)
8974514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Asinh_10)
8984514f5e3Sopenharmony_ci{
8994514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
9004514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
9014514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
9024514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(+0.0));
9034514f5e3Sopenharmony_ci
9044514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
9054514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Asinh(ecmaRuntimeCallInfo);
9064514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
9074514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(+0.0);
9084514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
9094514f5e3Sopenharmony_ci}
9104514f5e3Sopenharmony_ci
9114514f5e3Sopenharmony_ci// Math.atan(-1)
9124514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Atan)
9134514f5e3Sopenharmony_ci{
9144514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
9154514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
9164514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
9174514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(-1)));
9184514f5e3Sopenharmony_ci
9194514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
9204514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Atan(ecmaRuntimeCallInfo);
9214514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
9224514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-0.7853981633974483);
9234514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
9244514f5e3Sopenharmony_ci}
9254514f5e3Sopenharmony_ci
9264514f5e3Sopenharmony_ci// Math.atan(1)
9274514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Atan_1)
9284514f5e3Sopenharmony_ci{
9294514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
9304514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
9314514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
9324514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(1)));
9334514f5e3Sopenharmony_ci
9344514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
9354514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Atan(ecmaRuntimeCallInfo);
9364514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
9374514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0.7853981633974483);
9384514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
9394514f5e3Sopenharmony_ci}
9404514f5e3Sopenharmony_ci
9414514f5e3Sopenharmony_ci// Math.atan(null)
9424514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Atan_2)
9434514f5e3Sopenharmony_ci{
9444514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
9454514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
9464514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
9474514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Null());
9484514f5e3Sopenharmony_ci
9494514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
9504514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Atan(ecmaRuntimeCallInfo);
9514514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
9524514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
9534514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
9544514f5e3Sopenharmony_ci}
9554514f5e3Sopenharmony_ci
9564514f5e3Sopenharmony_ci// Math.atan(-NaN)
9574514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Atan_3)
9584514f5e3Sopenharmony_ci{
9594514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
9604514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
9614514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
9624514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::NAN_VALUE));
9634514f5e3Sopenharmony_ci
9644514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
9654514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Atan(ecmaRuntimeCallInfo);
9664514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
9674514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
9684514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
9694514f5e3Sopenharmony_ci}
9704514f5e3Sopenharmony_ci
9714514f5e3Sopenharmony_ci// Math.atan(POSITIVE_INFINITY)
9724514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Atan_4)
9734514f5e3Sopenharmony_ci{
9744514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
9754514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
9764514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
9774514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(base::POSITIVE_INFINITY));
9784514f5e3Sopenharmony_ci
9794514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
9804514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Atan(ecmaRuntimeCallInfo);
9814514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
9824514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(BuiltinsMath::PI / 2);
9834514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
9844514f5e3Sopenharmony_ci}
9854514f5e3Sopenharmony_ci
9864514f5e3Sopenharmony_ci// Math.atan(true)
9874514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Atan_5)
9884514f5e3Sopenharmony_ci{
9894514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
9904514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
9914514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
9924514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::True());
9934514f5e3Sopenharmony_ci
9944514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
9954514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Atan(ecmaRuntimeCallInfo);
9964514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
9974514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0.7853981633974483);
9984514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
9994514f5e3Sopenharmony_ci}
10004514f5e3Sopenharmony_ci
10014514f5e3Sopenharmony_ci// Math.atan(false)
10024514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Atan_6)
10034514f5e3Sopenharmony_ci{
10044514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
10054514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
10064514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
10074514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::False());
10084514f5e3Sopenharmony_ci
10094514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
10104514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Atan(ecmaRuntimeCallInfo);
10114514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
10124514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
10134514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
10144514f5e3Sopenharmony_ci}
10154514f5e3Sopenharmony_ci
10164514f5e3Sopenharmony_ci// Math.atan("")
10174514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Atan_7)
10184514f5e3Sopenharmony_ci{
10194514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII(" ");
10204514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
10214514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
10224514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
10234514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
10244514f5e3Sopenharmony_ci
10254514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
10264514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Atan(ecmaRuntimeCallInfo);
10274514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
10284514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
10294514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
10304514f5e3Sopenharmony_ci}
10314514f5e3Sopenharmony_ci
10324514f5e3Sopenharmony_ci// Math.atan("-1")
10334514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Atan_8)
10344514f5e3Sopenharmony_ci{
10354514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("-1");
10364514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
10374514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
10384514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
10394514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
10404514f5e3Sopenharmony_ci
10414514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
10424514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Atan(ecmaRuntimeCallInfo);
10434514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
10444514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-0.7853981633974483);
10454514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
10464514f5e3Sopenharmony_ci}
10474514f5e3Sopenharmony_ci
10484514f5e3Sopenharmony_ci// Math.atanh(-1)
10494514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Atanh)
10504514f5e3Sopenharmony_ci{
10514514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
10524514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
10534514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
10544514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(-1)));
10554514f5e3Sopenharmony_ci
10564514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
10574514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Atanh(ecmaRuntimeCallInfo);
10584514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
10594514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-base::POSITIVE_INFINITY);
10604514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
10614514f5e3Sopenharmony_ci}
10624514f5e3Sopenharmony_ci
10634514f5e3Sopenharmony_ci// Math.atanh(1)
10644514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Atanh_1)
10654514f5e3Sopenharmony_ci{
10664514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
10674514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
10684514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
10694514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(1)));
10704514f5e3Sopenharmony_ci
10714514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
10724514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Atanh(ecmaRuntimeCallInfo);
10734514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
10744514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::POSITIVE_INFINITY);
10754514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
10764514f5e3Sopenharmony_ci}
10774514f5e3Sopenharmony_ci
10784514f5e3Sopenharmony_ci// Math.atanh(null)
10794514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Atanh_2)
10804514f5e3Sopenharmony_ci{
10814514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
10824514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
10834514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
10844514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Null());
10854514f5e3Sopenharmony_ci
10864514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
10874514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Atanh(ecmaRuntimeCallInfo);
10884514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
10894514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
10904514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
10914514f5e3Sopenharmony_ci}
10924514f5e3Sopenharmony_ci
10934514f5e3Sopenharmony_ci// Math.atanh(-NaN)
10944514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Atanh_3)
10954514f5e3Sopenharmony_ci{
10964514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
10974514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
10984514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
10994514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::NAN_VALUE));
11004514f5e3Sopenharmony_ci
11014514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
11024514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Atanh(ecmaRuntimeCallInfo);
11034514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
11044514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
11054514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
11064514f5e3Sopenharmony_ci}
11074514f5e3Sopenharmony_ci
11084514f5e3Sopenharmony_ci// Math.atanh(1.5)
11094514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Atanh_4)
11104514f5e3Sopenharmony_ci{
11114514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
11124514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
11134514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
11144514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(1.5));
11154514f5e3Sopenharmony_ci
11164514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
11174514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Atanh(ecmaRuntimeCallInfo);
11184514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
11194514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
11204514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
11214514f5e3Sopenharmony_ci}
11224514f5e3Sopenharmony_ci
11234514f5e3Sopenharmony_ci// Math.atanh(true)
11244514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Atanh_5)
11254514f5e3Sopenharmony_ci{
11264514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
11274514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
11284514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
11294514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::True());
11304514f5e3Sopenharmony_ci
11314514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
11324514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Atanh(ecmaRuntimeCallInfo);
11334514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
11344514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::POSITIVE_INFINITY);
11354514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
11364514f5e3Sopenharmony_ci}
11374514f5e3Sopenharmony_ci
11384514f5e3Sopenharmony_ci// Math.atanh(false)
11394514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Atanh_6)
11404514f5e3Sopenharmony_ci{
11414514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
11424514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
11434514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
11444514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::False());
11454514f5e3Sopenharmony_ci
11464514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
11474514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Atanh(ecmaRuntimeCallInfo);
11484514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
11494514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
11504514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
11514514f5e3Sopenharmony_ci}
11524514f5e3Sopenharmony_ci
11534514f5e3Sopenharmony_ci// Math.atanh("")
11544514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Atanh_7)
11554514f5e3Sopenharmony_ci{
11564514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII(" ");
11574514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
11584514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
11594514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
11604514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
11614514f5e3Sopenharmony_ci
11624514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
11634514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Atanh(ecmaRuntimeCallInfo);
11644514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
11654514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
11664514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
11674514f5e3Sopenharmony_ci}
11684514f5e3Sopenharmony_ci
11694514f5e3Sopenharmony_ci// Math.atanh("-1")
11704514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Atanh_8)
11714514f5e3Sopenharmony_ci{
11724514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("-1");
11734514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
11744514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
11754514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
11764514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
11774514f5e3Sopenharmony_ci
11784514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
11794514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Atanh(ecmaRuntimeCallInfo);
11804514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
11814514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-base::POSITIVE_INFINITY);
11824514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
11834514f5e3Sopenharmony_ci}
11844514f5e3Sopenharmony_ci
11854514f5e3Sopenharmony_ci// Math.atanh(-0.0)
11864514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Atanh_9)
11874514f5e3Sopenharmony_ci{
11884514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
11894514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
11904514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
11914514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-0.0));
11924514f5e3Sopenharmony_ci
11934514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
11944514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Atanh(ecmaRuntimeCallInfo);
11954514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
11964514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-0.0);
11974514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
11984514f5e3Sopenharmony_ci}
11994514f5e3Sopenharmony_ci
12004514f5e3Sopenharmony_ci// Math.atanh(+0.0)
12014514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Atanh_10)
12024514f5e3Sopenharmony_ci{
12034514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
12044514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
12054514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
12064514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(+0.0));
12074514f5e3Sopenharmony_ci
12084514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
12094514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Atanh(ecmaRuntimeCallInfo);
12104514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
12114514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(+0.0);
12124514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
12134514f5e3Sopenharmony_ci}
12144514f5e3Sopenharmony_ci
12154514f5e3Sopenharmony_ci// Math.atan2(NaN, 1.5)
12164514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Atan2)
12174514f5e3Sopenharmony_ci{
12184514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8);
12194514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
12204514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
12214514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(base::NAN_VALUE));
12224514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(1.5));
12234514f5e3Sopenharmony_ci
12244514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
12254514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Atan2(ecmaRuntimeCallInfo);
12264514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
12274514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
12284514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
12294514f5e3Sopenharmony_ci}
12304514f5e3Sopenharmony_ci
12314514f5e3Sopenharmony_ci// Math.atan2(-1, 1.5)
12324514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Atan2_1)
12334514f5e3Sopenharmony_ci{
12344514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8);
12354514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
12364514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
12374514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(-1)));
12384514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(1.5));
12394514f5e3Sopenharmony_ci
12404514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
12414514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Atan2(ecmaRuntimeCallInfo);
12424514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
12434514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-0.5880026035475675);
12444514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
12454514f5e3Sopenharmony_ci}
12464514f5e3Sopenharmony_ci
12474514f5e3Sopenharmony_ci// Math.atan2(1, -0)
12484514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Atan2_2)
12494514f5e3Sopenharmony_ci{
12504514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8);
12514514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
12524514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
12534514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(1)));
12544514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(-0.0));
12554514f5e3Sopenharmony_ci
12564514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
12574514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Atan2(ecmaRuntimeCallInfo);
12584514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
12594514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(BuiltinsMath::PI / 2);
12604514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
12614514f5e3Sopenharmony_ci}
12624514f5e3Sopenharmony_ci
12634514f5e3Sopenharmony_ci// Math.atan2(0, 1)
12644514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Atan2_3)
12654514f5e3Sopenharmony_ci{
12664514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8);
12674514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
12684514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
12694514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(0)));
12704514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast<int32_t>(1)));
12714514f5e3Sopenharmony_ci
12724514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
12734514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Atan2(ecmaRuntimeCallInfo);
12744514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
12754514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
12764514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
12774514f5e3Sopenharmony_ci}
12784514f5e3Sopenharmony_ci
12794514f5e3Sopenharmony_ci// Math.atan2(0, -0)
12804514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Atan2_4)
12814514f5e3Sopenharmony_ci{
12824514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8);
12834514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
12844514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
12854514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(0)));
12864514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(-0.0));
12874514f5e3Sopenharmony_ci
12884514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
12894514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Atan2(ecmaRuntimeCallInfo);
12904514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
12914514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(BuiltinsMath::PI);
12924514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
12934514f5e3Sopenharmony_ci}
12944514f5e3Sopenharmony_ci
12954514f5e3Sopenharmony_ci// Math.atan2(-0, 0)
12964514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Atan2_5)
12974514f5e3Sopenharmony_ci{
12984514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8);
12994514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
13004514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
13014514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-0.0));
13024514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast<int32_t>(0)));
13034514f5e3Sopenharmony_ci
13044514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
13054514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Atan2(ecmaRuntimeCallInfo);
13064514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
13074514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-0.0);
13084514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
13094514f5e3Sopenharmony_ci}
13104514f5e3Sopenharmony_ci
13114514f5e3Sopenharmony_ci// Math.atan2(-0, -0)
13124514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Atan2_6)
13134514f5e3Sopenharmony_ci{
13144514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8);
13154514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
13164514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
13174514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-0.0));
13184514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(-0.0));
13194514f5e3Sopenharmony_ci
13204514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
13214514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Atan2(ecmaRuntimeCallInfo);
13224514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
13234514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-BuiltinsMath::PI);
13244514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
13254514f5e3Sopenharmony_ci}
13264514f5e3Sopenharmony_ci
13274514f5e3Sopenharmony_ci// Math.atan2(true, false)
13284514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Atan2_7)
13294514f5e3Sopenharmony_ci{
13304514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8);
13314514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
13324514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
13334514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::True());
13344514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue::False());
13354514f5e3Sopenharmony_ci
13364514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
13374514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Atan2(ecmaRuntimeCallInfo);
13384514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
13394514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(1.5707963267948966);
13404514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
13414514f5e3Sopenharmony_ci}
13424514f5e3Sopenharmony_ci
13434514f5e3Sopenharmony_ci// Math.atan2(false, true)
13444514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Atan2_8)
13454514f5e3Sopenharmony_ci{
13464514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8);
13474514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
13484514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
13494514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::False());
13504514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue::True());
13514514f5e3Sopenharmony_ci
13524514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
13534514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Atan2(ecmaRuntimeCallInfo);
13544514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
13554514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
13564514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
13574514f5e3Sopenharmony_ci}
13584514f5e3Sopenharmony_ci
13594514f5e3Sopenharmony_ci// Math.atan2("-1","")
13604514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Atan2_9)
13614514f5e3Sopenharmony_ci{
13624514f5e3Sopenharmony_ci    JSHandle<EcmaString> test_1 = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("-1");
13634514f5e3Sopenharmony_ci    JSHandle<EcmaString> test_2 = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("");
13644514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8);
13654514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
13664514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
13674514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test_1.GetTaggedValue());
13684514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(1, test_2.GetTaggedValue());
13694514f5e3Sopenharmony_ci
13704514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
13714514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Atan2(ecmaRuntimeCallInfo);
13724514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
13734514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-1.5707963267948966);
13744514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
13754514f5e3Sopenharmony_ci}
13764514f5e3Sopenharmony_ci
13774514f5e3Sopenharmony_ci// Math.atan2("0.23","0.72")
13784514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Atan2_10)
13794514f5e3Sopenharmony_ci{
13804514f5e3Sopenharmony_ci    JSHandle<EcmaString> test_1 = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("0.23");
13814514f5e3Sopenharmony_ci    JSHandle<EcmaString> test_2 = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("0.72");
13824514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8);
13834514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
13844514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
13854514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test_1.GetTaggedValue());
13864514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(1, test_2.GetTaggedValue());
13874514f5e3Sopenharmony_ci
13884514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
13894514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Atan2(ecmaRuntimeCallInfo);
13904514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
13914514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0.3091989123270746);
13924514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
13934514f5e3Sopenharmony_ci}
13944514f5e3Sopenharmony_ci
13954514f5e3Sopenharmony_ci// Math.atan2(-NaN, 1.5)
13964514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Atan2_11)
13974514f5e3Sopenharmony_ci{
13984514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8);
13994514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
14004514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
14014514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::NAN_VALUE));
14024514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(-1.5));
14034514f5e3Sopenharmony_ci
14044514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
14054514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Atan2(ecmaRuntimeCallInfo);
14064514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
14074514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
14084514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
14094514f5e3Sopenharmony_ci}
14104514f5e3Sopenharmony_ci
14114514f5e3Sopenharmony_ci// Math.cbrt(0)
14124514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Cbrt)
14134514f5e3Sopenharmony_ci{
14144514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
14154514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
14164514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
14174514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(0)));
14184514f5e3Sopenharmony_ci
14194514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
14204514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Cbrt(ecmaRuntimeCallInfo);
14214514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
14224514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
14234514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
14244514f5e3Sopenharmony_ci}
14254514f5e3Sopenharmony_ci
14264514f5e3Sopenharmony_ci// Math.cbrt(-0)
14274514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Cbrt_1)
14284514f5e3Sopenharmony_ci{
14294514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
14304514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
14314514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
14324514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-0.0));
14334514f5e3Sopenharmony_ci
14344514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
14354514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Cbrt(ecmaRuntimeCallInfo);
14364514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
14374514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-0.0);
14384514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
14394514f5e3Sopenharmony_ci}
14404514f5e3Sopenharmony_ci
14414514f5e3Sopenharmony_ci// Math.cbrt(NEGATIVE_INFINITY)
14424514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Cbrt_2)
14434514f5e3Sopenharmony_ci{
14444514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
14454514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
14464514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
14474514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::POSITIVE_INFINITY));
14484514f5e3Sopenharmony_ci
14494514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
14504514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Cbrt(ecmaRuntimeCallInfo);
14514514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
14524514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-base::POSITIVE_INFINITY);
14534514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
14544514f5e3Sopenharmony_ci}
14554514f5e3Sopenharmony_ci
14564514f5e3Sopenharmony_ci// Math.cbrt(POSITIVE_INFINITY)
14574514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Cbrt_3)
14584514f5e3Sopenharmony_ci{
14594514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
14604514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
14614514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
14624514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(base::POSITIVE_INFINITY));
14634514f5e3Sopenharmony_ci
14644514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
14654514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Cbrt(ecmaRuntimeCallInfo);
14664514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
14674514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::POSITIVE_INFINITY);
14684514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
14694514f5e3Sopenharmony_ci}
14704514f5e3Sopenharmony_ci
14714514f5e3Sopenharmony_ci// Math.cbrt(VALUE_UNDEFINED)
14724514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Cbrt_4)
14734514f5e3Sopenharmony_ci{
14744514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
14754514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
14764514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
14774514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Undefined());
14784514f5e3Sopenharmony_ci
14794514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
14804514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Cbrt(ecmaRuntimeCallInfo);
14814514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
14824514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
14834514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
14844514f5e3Sopenharmony_ci}
14854514f5e3Sopenharmony_ci
14864514f5e3Sopenharmony_ci// Math.cbrt(true)
14874514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Cbrt_5)
14884514f5e3Sopenharmony_ci{
14894514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
14904514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
14914514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
14924514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::True());
14934514f5e3Sopenharmony_ci
14944514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
14954514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Cbrt(ecmaRuntimeCallInfo);
14964514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
14974514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(1.0);
14984514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
14994514f5e3Sopenharmony_ci}
15004514f5e3Sopenharmony_ci
15014514f5e3Sopenharmony_ci// Math.cbrt(false)
15024514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Cbrt_6)
15034514f5e3Sopenharmony_ci{
15044514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
15054514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
15064514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
15074514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::False());
15084514f5e3Sopenharmony_ci
15094514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
15104514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Cbrt(ecmaRuntimeCallInfo);
15114514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
15124514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
15134514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
15144514f5e3Sopenharmony_ci}
15154514f5e3Sopenharmony_ci
15164514f5e3Sopenharmony_ci// Math.cbrt("")
15174514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Cbrt_7)
15184514f5e3Sopenharmony_ci{
15194514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII(" ");
15204514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
15214514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
15224514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
15234514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
15244514f5e3Sopenharmony_ci
15254514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
15264514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Cbrt(ecmaRuntimeCallInfo);
15274514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
15284514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
15294514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
15304514f5e3Sopenharmony_ci}
15314514f5e3Sopenharmony_ci
15324514f5e3Sopenharmony_ci// Math.cbrt("1.23")
15334514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Cbrt_8)
15344514f5e3Sopenharmony_ci{
15354514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("1.23");
15364514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
15374514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
15384514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
15394514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
15404514f5e3Sopenharmony_ci
15414514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
15424514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Cbrt(ecmaRuntimeCallInfo);
15434514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
15444514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(1.0714412696907731);
15454514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
15464514f5e3Sopenharmony_ci}
15474514f5e3Sopenharmony_ci
15484514f5e3Sopenharmony_ci// Math.cbrt(-NaN)
15494514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Cbrt_9)
15504514f5e3Sopenharmony_ci{
15514514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
15524514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
15534514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
15544514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::NAN_VALUE));
15554514f5e3Sopenharmony_ci
15564514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
15574514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Cbrt(ecmaRuntimeCallInfo);
15584514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
15594514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
15604514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
15614514f5e3Sopenharmony_ci}
15624514f5e3Sopenharmony_ci
15634514f5e3Sopenharmony_ci// Math.ceil(3.25)
15644514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Ceil)
15654514f5e3Sopenharmony_ci{
15664514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
15674514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
15684514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
15694514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(3.25));
15704514f5e3Sopenharmony_ci
15714514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
15724514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Ceil(ecmaRuntimeCallInfo);
15734514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
15744514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(4.0);
15754514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
15764514f5e3Sopenharmony_ci}
15774514f5e3Sopenharmony_ci
15784514f5e3Sopenharmony_ci// Math.ceil(POSITIVE_INFINITY)
15794514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Ceil_1)
15804514f5e3Sopenharmony_ci{
15814514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
15824514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
15834514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
15844514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(base::POSITIVE_INFINITY));
15854514f5e3Sopenharmony_ci
15864514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
15874514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Ceil(ecmaRuntimeCallInfo);
15884514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
15894514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::POSITIVE_INFINITY);
15904514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
15914514f5e3Sopenharmony_ci}
15924514f5e3Sopenharmony_ci
15934514f5e3Sopenharmony_ci// Math.ceil(-0.0)
15944514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Ceil_2)
15954514f5e3Sopenharmony_ci{
15964514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
15974514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
15984514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
15994514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-0.0));
16004514f5e3Sopenharmony_ci
16014514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
16024514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Ceil(ecmaRuntimeCallInfo);
16034514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
16044514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-0.0);
16054514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
16064514f5e3Sopenharmony_ci}
16074514f5e3Sopenharmony_ci
16084514f5e3Sopenharmony_ci// Math.ceil(null)
16094514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Ceil_3)
16104514f5e3Sopenharmony_ci{
16114514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
16124514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
16134514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
16144514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Null());
16154514f5e3Sopenharmony_ci
16164514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
16174514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Ceil(ecmaRuntimeCallInfo);
16184514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
16194514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
16204514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
16214514f5e3Sopenharmony_ci}
16224514f5e3Sopenharmony_ci
16234514f5e3Sopenharmony_ci// Math.ceil(0)
16244514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Ceil_4)
16254514f5e3Sopenharmony_ci{
16264514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
16274514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
16284514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
16294514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(0)));
16304514f5e3Sopenharmony_ci
16314514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
16324514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Ceil(ecmaRuntimeCallInfo);
16334514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
16344514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
16354514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
16364514f5e3Sopenharmony_ci}
16374514f5e3Sopenharmony_ci
16384514f5e3Sopenharmony_ci// Math.ceil(true)
16394514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Ceil_5)
16404514f5e3Sopenharmony_ci{
16414514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
16424514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
16434514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
16444514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::True());
16454514f5e3Sopenharmony_ci
16464514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
16474514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Ceil(ecmaRuntimeCallInfo);
16484514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
16494514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(1.0);
16504514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
16514514f5e3Sopenharmony_ci}
16524514f5e3Sopenharmony_ci
16534514f5e3Sopenharmony_ci// Math.ceil(false)
16544514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Ceil_6)
16554514f5e3Sopenharmony_ci{
16564514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
16574514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
16584514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
16594514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::False());
16604514f5e3Sopenharmony_ci
16614514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
16624514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Ceil(ecmaRuntimeCallInfo);
16634514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
16644514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
16654514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
16664514f5e3Sopenharmony_ci}
16674514f5e3Sopenharmony_ci
16684514f5e3Sopenharmony_ci// Math.ceil("")
16694514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Ceil_7)
16704514f5e3Sopenharmony_ci{
16714514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("");
16724514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
16734514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
16744514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
16754514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
16764514f5e3Sopenharmony_ci
16774514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
16784514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Ceil(ecmaRuntimeCallInfo);
16794514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
16804514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
16814514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
16824514f5e3Sopenharmony_ci}
16834514f5e3Sopenharmony_ci
16844514f5e3Sopenharmony_ci// Math.ceil("3.23")
16854514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Ceil_8)
16864514f5e3Sopenharmony_ci{
16874514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("3.23");
16884514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
16894514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
16904514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
16914514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
16924514f5e3Sopenharmony_ci
16934514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
16944514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Ceil(ecmaRuntimeCallInfo);
16954514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
16964514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(4.0);
16974514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
16984514f5e3Sopenharmony_ci}
16994514f5e3Sopenharmony_ci
17004514f5e3Sopenharmony_ci// Math.ceil(-NaN)
17014514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Ceil_9)
17024514f5e3Sopenharmony_ci{
17034514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
17044514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
17054514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
17064514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::NAN_VALUE));
17074514f5e3Sopenharmony_ci
17084514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
17094514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Ceil(ecmaRuntimeCallInfo);
17104514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
17114514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
17124514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
17134514f5e3Sopenharmony_ci}
17144514f5e3Sopenharmony_ci
17154514f5e3Sopenharmony_ci// Math.cos(0)
17164514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Cos)
17174514f5e3Sopenharmony_ci{
17184514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
17194514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
17204514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
17214514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(0)));
17224514f5e3Sopenharmony_ci
17234514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
17244514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Cos(ecmaRuntimeCallInfo);
17254514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
17264514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(1.0);
17274514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
17284514f5e3Sopenharmony_ci}
17294514f5e3Sopenharmony_ci
17304514f5e3Sopenharmony_ci// Math.cos(-NAN)
17314514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Cos_1)
17324514f5e3Sopenharmony_ci{
17334514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
17344514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
17354514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
17364514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::NAN_VALUE));
17374514f5e3Sopenharmony_ci
17384514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
17394514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Cos(ecmaRuntimeCallInfo);
17404514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
17414514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
17424514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
17434514f5e3Sopenharmony_ci}
17444514f5e3Sopenharmony_ci
17454514f5e3Sopenharmony_ci// Math.cos(POSITIVE_INFINITY)
17464514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Cos_2)
17474514f5e3Sopenharmony_ci{
17484514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
17494514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
17504514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
17514514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(base::POSITIVE_INFINITY));
17524514f5e3Sopenharmony_ci
17534514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
17544514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Cos(ecmaRuntimeCallInfo);
17554514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
17564514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
17574514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
17584514f5e3Sopenharmony_ci}
17594514f5e3Sopenharmony_ci
17604514f5e3Sopenharmony_ci// Math.cos(-POSITIVE_INFINITY)
17614514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Cos_3)
17624514f5e3Sopenharmony_ci{
17634514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
17644514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
17654514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
17664514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::POSITIVE_INFINITY));
17674514f5e3Sopenharmony_ci
17684514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
17694514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Cos(ecmaRuntimeCallInfo);
17704514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
17714514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
17724514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
17734514f5e3Sopenharmony_ci}
17744514f5e3Sopenharmony_ci
17754514f5e3Sopenharmony_ci// Math.cos(true)
17764514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Cos_4)
17774514f5e3Sopenharmony_ci{
17784514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
17794514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
17804514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
17814514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::True());
17824514f5e3Sopenharmony_ci
17834514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
17844514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Cos(ecmaRuntimeCallInfo);
17854514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
17864514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0.5403023058681398);
17874514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
17884514f5e3Sopenharmony_ci}
17894514f5e3Sopenharmony_ci
17904514f5e3Sopenharmony_ci// Math.cos(false)
17914514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Cos_5)
17924514f5e3Sopenharmony_ci{
17934514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
17944514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
17954514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
17964514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::False());
17974514f5e3Sopenharmony_ci
17984514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
17994514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Cos(ecmaRuntimeCallInfo);
18004514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
18014514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(1.0);
18024514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
18034514f5e3Sopenharmony_ci}
18044514f5e3Sopenharmony_ci
18054514f5e3Sopenharmony_ci// Math.cos("")
18064514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Cos_6)
18074514f5e3Sopenharmony_ci{
18084514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("");
18094514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
18104514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
18114514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
18124514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
18134514f5e3Sopenharmony_ci
18144514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
18154514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Cos(ecmaRuntimeCallInfo);
18164514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
18174514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(1.0);
18184514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
18194514f5e3Sopenharmony_ci}
18204514f5e3Sopenharmony_ci
18214514f5e3Sopenharmony_ci// Math.cos("3.23")
18224514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Cos_7)
18234514f5e3Sopenharmony_ci{
18244514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("3.23");
18254514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
18264514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
18274514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
18284514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
18294514f5e3Sopenharmony_ci
18304514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
18314514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Cos(ecmaRuntimeCallInfo);
18324514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
18334514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-0.9960946152060809);
18344514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
18354514f5e3Sopenharmony_ci}
18364514f5e3Sopenharmony_ci
18374514f5e3Sopenharmony_ci// Math.cosh(0)
18384514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Cosh)
18394514f5e3Sopenharmony_ci{
18404514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
18414514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
18424514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
18434514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(0)));
18444514f5e3Sopenharmony_ci
18454514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
18464514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Cosh(ecmaRuntimeCallInfo);
18474514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
18484514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(1.0);
18494514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
18504514f5e3Sopenharmony_ci}
18514514f5e3Sopenharmony_ci
18524514f5e3Sopenharmony_ci// Math.cosh(-NAN)
18534514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Cosh_1)
18544514f5e3Sopenharmony_ci{
18554514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
18564514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
18574514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
18584514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::NAN_VALUE));
18594514f5e3Sopenharmony_ci
18604514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
18614514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Cosh(ecmaRuntimeCallInfo);
18624514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
18634514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
18644514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
18654514f5e3Sopenharmony_ci}
18664514f5e3Sopenharmony_ci
18674514f5e3Sopenharmony_ci// Math.cosh(POSITIVE_INFINITY)
18684514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Cosh_2)
18694514f5e3Sopenharmony_ci{
18704514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
18714514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
18724514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
18734514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(base::POSITIVE_INFINITY));
18744514f5e3Sopenharmony_ci
18754514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
18764514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Cosh(ecmaRuntimeCallInfo);
18774514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
18784514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::POSITIVE_INFINITY);
18794514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
18804514f5e3Sopenharmony_ci}
18814514f5e3Sopenharmony_ci
18824514f5e3Sopenharmony_ci// Math.cosh(-POSITIVE_INFINITY)
18834514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Cosh_3)
18844514f5e3Sopenharmony_ci{
18854514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
18864514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
18874514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
18884514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::POSITIVE_INFINITY));
18894514f5e3Sopenharmony_ci
18904514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
18914514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Cosh(ecmaRuntimeCallInfo);
18924514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
18934514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::POSITIVE_INFINITY);
18944514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
18954514f5e3Sopenharmony_ci}
18964514f5e3Sopenharmony_ci
18974514f5e3Sopenharmony_ci// Math.cosh(true)
18984514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Cosh_4)
18994514f5e3Sopenharmony_ci{
19004514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
19014514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
19024514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
19034514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::True());
19044514f5e3Sopenharmony_ci
19054514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
19064514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Cosh(ecmaRuntimeCallInfo);
19074514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
19084514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(1.5430806348152437);
19094514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
19104514f5e3Sopenharmony_ci}
19114514f5e3Sopenharmony_ci
19124514f5e3Sopenharmony_ci// Math.cosh(false)
19134514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Cosh_5)
19144514f5e3Sopenharmony_ci{
19154514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
19164514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
19174514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
19184514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::False());
19194514f5e3Sopenharmony_ci
19204514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
19214514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Cosh(ecmaRuntimeCallInfo);
19224514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
19234514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(1.0);
19244514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
19254514f5e3Sopenharmony_ci}
19264514f5e3Sopenharmony_ci
19274514f5e3Sopenharmony_ci// Math.cosh("")
19284514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Cosh_6)
19294514f5e3Sopenharmony_ci{
19304514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII(" ");
19314514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
19324514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
19334514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
19344514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
19354514f5e3Sopenharmony_ci
19364514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
19374514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Cosh(ecmaRuntimeCallInfo);
19384514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
19394514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(1.0);
19404514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
19414514f5e3Sopenharmony_ci}
19424514f5e3Sopenharmony_ci
19434514f5e3Sopenharmony_ci// Math.cosh("3.23")
19444514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Cosh_7)
19454514f5e3Sopenharmony_ci{
19464514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("3.23");
19474514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
19484514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
19494514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
19504514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
19514514f5e3Sopenharmony_ci
19524514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
19534514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Cosh(ecmaRuntimeCallInfo);
19544514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
19554514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(12.659607234875645);
19564514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
19574514f5e3Sopenharmony_ci}
19584514f5e3Sopenharmony_ci
19594514f5e3Sopenharmony_ci// Math.exp(0)
19604514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Exp)
19614514f5e3Sopenharmony_ci{
19624514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
19634514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
19644514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
19654514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(0)));
19664514f5e3Sopenharmony_ci
19674514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
19684514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Exp(ecmaRuntimeCallInfo);
19694514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
19704514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(1.0);
19714514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
19724514f5e3Sopenharmony_ci}
19734514f5e3Sopenharmony_ci
19744514f5e3Sopenharmony_ci// Math.exp(-NAN)
19754514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Exp_1)
19764514f5e3Sopenharmony_ci{
19774514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
19784514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
19794514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
19804514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::NAN_VALUE));
19814514f5e3Sopenharmony_ci
19824514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
19834514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Exp(ecmaRuntimeCallInfo);
19844514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
19854514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
19864514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
19874514f5e3Sopenharmony_ci}
19884514f5e3Sopenharmony_ci
19894514f5e3Sopenharmony_ci// Math.exp(POSITIVE_INFINITY)
19904514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Exp_2)
19914514f5e3Sopenharmony_ci{
19924514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
19934514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
19944514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
19954514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(base::POSITIVE_INFINITY));
19964514f5e3Sopenharmony_ci
19974514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
19984514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Exp(ecmaRuntimeCallInfo);
19994514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
20004514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::POSITIVE_INFINITY);
20014514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
20024514f5e3Sopenharmony_ci}
20034514f5e3Sopenharmony_ci
20044514f5e3Sopenharmony_ci// Math.exp(-POSITIVE_INFINITY)
20054514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Exp_3)
20064514f5e3Sopenharmony_ci{
20074514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
20084514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
20094514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
20104514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::POSITIVE_INFINITY));
20114514f5e3Sopenharmony_ci
20124514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
20134514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Exp(ecmaRuntimeCallInfo);
20144514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
20154514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
20164514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
20174514f5e3Sopenharmony_ci}
20184514f5e3Sopenharmony_ci
20194514f5e3Sopenharmony_ci// Math.exp(true)
20204514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Exp_4)
20214514f5e3Sopenharmony_ci{
20224514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
20234514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
20244514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
20254514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::True());
20264514f5e3Sopenharmony_ci
20274514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
20284514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Exp(ecmaRuntimeCallInfo);
20294514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
20304514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(2.718281828459045);
20314514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
20324514f5e3Sopenharmony_ci}
20334514f5e3Sopenharmony_ci
20344514f5e3Sopenharmony_ci// Math.exp(false)
20354514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Exp_5)
20364514f5e3Sopenharmony_ci{
20374514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
20384514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
20394514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
20404514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::False());
20414514f5e3Sopenharmony_ci
20424514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
20434514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Exp(ecmaRuntimeCallInfo);
20444514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
20454514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(1.0);
20464514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
20474514f5e3Sopenharmony_ci}
20484514f5e3Sopenharmony_ci
20494514f5e3Sopenharmony_ci// Math.exp("")
20504514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Exp_6)
20514514f5e3Sopenharmony_ci{
20524514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("");
20534514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
20544514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
20554514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
20564514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
20574514f5e3Sopenharmony_ci
20584514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
20594514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Exp(ecmaRuntimeCallInfo);
20604514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
20614514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(1.0);
20624514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
20634514f5e3Sopenharmony_ci}
20644514f5e3Sopenharmony_ci
20654514f5e3Sopenharmony_ci// Math.exp("-3.23")
20664514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Exp_7)
20674514f5e3Sopenharmony_ci{
20684514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("-3.23");
20694514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
20704514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
20714514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
20724514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
20734514f5e3Sopenharmony_ci
20744514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
20754514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Exp(ecmaRuntimeCallInfo);
20764514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
20774514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0.039557498788398725);
20784514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
20794514f5e3Sopenharmony_ci}
20804514f5e3Sopenharmony_ci
20814514f5e3Sopenharmony_ci// Math.Expm1(0)
20824514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Expm1)
20834514f5e3Sopenharmony_ci{
20844514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
20854514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
20864514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
20874514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(0)));
20884514f5e3Sopenharmony_ci
20894514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
20904514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Expm1(ecmaRuntimeCallInfo);
20914514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
20924514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
20934514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
20944514f5e3Sopenharmony_ci}
20954514f5e3Sopenharmony_ci
20964514f5e3Sopenharmony_ci// Math.Expm1(-0.0)
20974514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Expm1_1)
20984514f5e3Sopenharmony_ci{
20994514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
21004514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
21014514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
21024514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-0.0));
21034514f5e3Sopenharmony_ci
21044514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
21054514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Expm1(ecmaRuntimeCallInfo);
21064514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
21074514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-0.0);
21084514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
21094514f5e3Sopenharmony_ci}
21104514f5e3Sopenharmony_ci
21114514f5e3Sopenharmony_ci// Math.Expm1(-NAN)
21124514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Expm1_2)
21134514f5e3Sopenharmony_ci{
21144514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
21154514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
21164514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
21174514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::NAN_VALUE));
21184514f5e3Sopenharmony_ci
21194514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
21204514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Expm1(ecmaRuntimeCallInfo);
21214514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
21224514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
21234514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
21244514f5e3Sopenharmony_ci}
21254514f5e3Sopenharmony_ci
21264514f5e3Sopenharmony_ci// Math.Expm1(POSITIVE_INFINITY)
21274514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Expm1_3)
21284514f5e3Sopenharmony_ci{
21294514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
21304514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
21314514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
21324514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(base::POSITIVE_INFINITY));
21334514f5e3Sopenharmony_ci
21344514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
21354514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Expm1(ecmaRuntimeCallInfo);
21364514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
21374514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::POSITIVE_INFINITY);
21384514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
21394514f5e3Sopenharmony_ci}
21404514f5e3Sopenharmony_ci
21414514f5e3Sopenharmony_ci// Math.Expm1(-POSITIVE_INFINITY)
21424514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Expm1_4)
21434514f5e3Sopenharmony_ci{
21444514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
21454514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
21464514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
21474514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::POSITIVE_INFINITY));
21484514f5e3Sopenharmony_ci
21494514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
21504514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Expm1(ecmaRuntimeCallInfo);
21514514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
21524514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-1.0);
21534514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
21544514f5e3Sopenharmony_ci}
21554514f5e3Sopenharmony_ci
21564514f5e3Sopenharmony_ci// Math.expm1(true)
21574514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Expm1_5)
21584514f5e3Sopenharmony_ci{
21594514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
21604514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
21614514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
21624514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::True());
21634514f5e3Sopenharmony_ci
21644514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
21654514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Expm1(ecmaRuntimeCallInfo);
21664514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
21674514f5e3Sopenharmony_ci    double expect = 1.718281828459045;
21684514f5e3Sopenharmony_ci    ASSERT_TRUE(result.IsDouble());
21694514f5e3Sopenharmony_ci    ASSERT_TRUE(std::abs(result.GetDouble() - expect) < 0.00000001);
21704514f5e3Sopenharmony_ci}
21714514f5e3Sopenharmony_ci
21724514f5e3Sopenharmony_ci// Math.expm1(false)
21734514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Expm1_6)
21744514f5e3Sopenharmony_ci{
21754514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
21764514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
21774514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
21784514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::False());
21794514f5e3Sopenharmony_ci
21804514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
21814514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Expm1(ecmaRuntimeCallInfo);
21824514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
21834514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
21844514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
21854514f5e3Sopenharmony_ci}
21864514f5e3Sopenharmony_ci
21874514f5e3Sopenharmony_ci// Math.expm1("")
21884514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Expm1_7)
21894514f5e3Sopenharmony_ci{
21904514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII(" ");
21914514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
21924514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
21934514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
21944514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
21954514f5e3Sopenharmony_ci
21964514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
21974514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Expm1(ecmaRuntimeCallInfo);
21984514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
21994514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
22004514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
22014514f5e3Sopenharmony_ci}
22024514f5e3Sopenharmony_ci
22034514f5e3Sopenharmony_ci// Math.expm1("-3.23")
22044514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Expm1_8)
22054514f5e3Sopenharmony_ci{
22064514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("-3.23");
22074514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
22084514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
22094514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
22104514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
22114514f5e3Sopenharmony_ci
22124514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
22134514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Expm1(ecmaRuntimeCallInfo);
22144514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
22154514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-0.9604425012116012);
22164514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
22174514f5e3Sopenharmony_ci}
22184514f5e3Sopenharmony_ci
22194514f5e3Sopenharmony_ci// Math.expm1("0x12")
22204514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Expm1_9)
22214514f5e3Sopenharmony_ci{
22224514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("0x12");
22234514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
22244514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
22254514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
22264514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
22274514f5e3Sopenharmony_ci
22284514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
22294514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Expm1(ecmaRuntimeCallInfo);
22304514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
22314514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(65659968.13733051);
22324514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
22334514f5e3Sopenharmony_ci}
22344514f5e3Sopenharmony_ci
22354514f5e3Sopenharmony_ci// Math.floor(-0.0)
22364514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Floor)
22374514f5e3Sopenharmony_ci{
22384514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
22394514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
22404514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
22414514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-0.0));
22424514f5e3Sopenharmony_ci
22434514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
22444514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Floor(ecmaRuntimeCallInfo);
22454514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
22464514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-0.0);
22474514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
22484514f5e3Sopenharmony_ci}
22494514f5e3Sopenharmony_ci
22504514f5e3Sopenharmony_ci// Math.floor(-NAN)
22514514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Floor_1)
22524514f5e3Sopenharmony_ci{
22534514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
22544514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
22554514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
22564514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::NAN_VALUE));
22574514f5e3Sopenharmony_ci
22584514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
22594514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Floor(ecmaRuntimeCallInfo);
22604514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
22614514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
22624514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
22634514f5e3Sopenharmony_ci}
22644514f5e3Sopenharmony_ci
22654514f5e3Sopenharmony_ci// Math.floor(POSITIVE_INFINITY)
22664514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Floor_2)
22674514f5e3Sopenharmony_ci{
22684514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
22694514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
22704514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
22714514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(base::POSITIVE_INFINITY));
22724514f5e3Sopenharmony_ci
22734514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
22744514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Floor(ecmaRuntimeCallInfo);
22754514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
22764514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::POSITIVE_INFINITY);
22774514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
22784514f5e3Sopenharmony_ci}
22794514f5e3Sopenharmony_ci
22804514f5e3Sopenharmony_ci// Math.floor(true)
22814514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Floor_3)
22824514f5e3Sopenharmony_ci{
22834514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
22844514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
22854514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
22864514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::True());
22874514f5e3Sopenharmony_ci
22884514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
22894514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Floor(ecmaRuntimeCallInfo);
22904514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
22914514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(1.0);
22924514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
22934514f5e3Sopenharmony_ci}
22944514f5e3Sopenharmony_ci
22954514f5e3Sopenharmony_ci// Math.floor("-3.23")
22964514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Floor_4)
22974514f5e3Sopenharmony_ci{
22984514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("-3.23");
22994514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
23004514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
23014514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
23024514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
23034514f5e3Sopenharmony_ci
23044514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
23054514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Floor(ecmaRuntimeCallInfo);
23064514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
23074514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-4.0);
23084514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
23094514f5e3Sopenharmony_ci}
23104514f5e3Sopenharmony_ci
23114514f5e3Sopenharmony_ci// Math.log(-0.0)
23124514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Log)
23134514f5e3Sopenharmony_ci{
23144514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
23154514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
23164514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
23174514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-0.0));
23184514f5e3Sopenharmony_ci
23194514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
23204514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Log(ecmaRuntimeCallInfo);
23214514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
23224514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-base::POSITIVE_INFINITY);
23234514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
23244514f5e3Sopenharmony_ci}
23254514f5e3Sopenharmony_ci
23264514f5e3Sopenharmony_ci// Math.log(-NAN)
23274514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Log_1)
23284514f5e3Sopenharmony_ci{
23294514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
23304514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
23314514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
23324514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::NAN_VALUE));
23334514f5e3Sopenharmony_ci
23344514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
23354514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Log(ecmaRuntimeCallInfo);
23364514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
23374514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
23384514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
23394514f5e3Sopenharmony_ci}
23404514f5e3Sopenharmony_ci
23414514f5e3Sopenharmony_ci// Math.log(POSITIVE_INFINITY)
23424514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Log_2)
23434514f5e3Sopenharmony_ci{
23444514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
23454514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
23464514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
23474514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(base::POSITIVE_INFINITY));
23484514f5e3Sopenharmony_ci
23494514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
23504514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Log(ecmaRuntimeCallInfo);
23514514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
23524514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::POSITIVE_INFINITY);
23534514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
23544514f5e3Sopenharmony_ci}
23554514f5e3Sopenharmony_ci
23564514f5e3Sopenharmony_ci// Math.log(true)
23574514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Log_3)
23584514f5e3Sopenharmony_ci{
23594514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
23604514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
23614514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
23624514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::True());
23634514f5e3Sopenharmony_ci
23644514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
23654514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Log(ecmaRuntimeCallInfo);
23664514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
23674514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
23684514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
23694514f5e3Sopenharmony_ci}
23704514f5e3Sopenharmony_ci
23714514f5e3Sopenharmony_ci// Math.log("-3.23")
23724514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Log_4)
23734514f5e3Sopenharmony_ci{
23744514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("-3.23");
23754514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
23764514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
23774514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
23784514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
23794514f5e3Sopenharmony_ci
23804514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
23814514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Log(ecmaRuntimeCallInfo);
23824514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
23834514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
23844514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
23854514f5e3Sopenharmony_ci}
23864514f5e3Sopenharmony_ci
23874514f5e3Sopenharmony_ci// Math.log(0.12)
23884514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Log_5)
23894514f5e3Sopenharmony_ci{
23904514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
23914514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
23924514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
23934514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(0.12));
23944514f5e3Sopenharmony_ci
23954514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
23964514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Log(ecmaRuntimeCallInfo);
23974514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
23984514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-2.120263536200091);
23994514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
24004514f5e3Sopenharmony_ci}
24014514f5e3Sopenharmony_ci
24024514f5e3Sopenharmony_ci// Math.log1p(-0.0)
24034514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Log1p)
24044514f5e3Sopenharmony_ci{
24054514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
24064514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
24074514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
24084514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-0.0));
24094514f5e3Sopenharmony_ci
24104514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
24114514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Log1p(ecmaRuntimeCallInfo);
24124514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
24134514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-0.0);
24144514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
24154514f5e3Sopenharmony_ci}
24164514f5e3Sopenharmony_ci
24174514f5e3Sopenharmony_ci// Math.log1p(-NAN)
24184514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Log1p_1)
24194514f5e3Sopenharmony_ci{
24204514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
24214514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
24224514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
24234514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::NAN_VALUE));
24244514f5e3Sopenharmony_ci
24254514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
24264514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Log1p(ecmaRuntimeCallInfo);
24274514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
24284514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
24294514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
24304514f5e3Sopenharmony_ci}
24314514f5e3Sopenharmony_ci
24324514f5e3Sopenharmony_ci// Math.log1p(POSITIVE_INFINITY)
24334514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Log1p_2)
24344514f5e3Sopenharmony_ci{
24354514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
24364514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
24374514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
24384514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(base::POSITIVE_INFINITY));
24394514f5e3Sopenharmony_ci
24404514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
24414514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Log1p(ecmaRuntimeCallInfo);
24424514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
24434514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::POSITIVE_INFINITY);
24444514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
24454514f5e3Sopenharmony_ci}
24464514f5e3Sopenharmony_ci
24474514f5e3Sopenharmony_ci// Math.log1p(true)
24484514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Log1p_3)
24494514f5e3Sopenharmony_ci{
24504514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
24514514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
24524514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
24534514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::True());
24544514f5e3Sopenharmony_ci
24554514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
24564514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Log1p(ecmaRuntimeCallInfo);
24574514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
24584514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0.6931471805599453);
24594514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
24604514f5e3Sopenharmony_ci}
24614514f5e3Sopenharmony_ci
24624514f5e3Sopenharmony_ci// Math.log1p("-3.23")
24634514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Log1p_4)
24644514f5e3Sopenharmony_ci{
24654514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("-3.23");
24664514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
24674514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
24684514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
24694514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
24704514f5e3Sopenharmony_ci
24714514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
24724514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Log1p(ecmaRuntimeCallInfo);
24734514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
24744514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
24754514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
24764514f5e3Sopenharmony_ci}
24774514f5e3Sopenharmony_ci
24784514f5e3Sopenharmony_ci// Math.log1p(0.12)
24794514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Log1p_5)
24804514f5e3Sopenharmony_ci{
24814514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
24824514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
24834514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
24844514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(0.12));
24854514f5e3Sopenharmony_ci
24864514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
24874514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Log1p(ecmaRuntimeCallInfo);
24884514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
24894514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0.11332868530700317);
24904514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
24914514f5e3Sopenharmony_ci}
24924514f5e3Sopenharmony_ci
24934514f5e3Sopenharmony_ci// Math.log10(-0.0)
24944514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Log10)
24954514f5e3Sopenharmony_ci{
24964514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
24974514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
24984514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
24994514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-0.0));
25004514f5e3Sopenharmony_ci
25014514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
25024514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Log10(ecmaRuntimeCallInfo);
25034514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
25044514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-base::POSITIVE_INFINITY);
25054514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
25064514f5e3Sopenharmony_ci}
25074514f5e3Sopenharmony_ci
25084514f5e3Sopenharmony_ci// Math.Log10(-NAN)
25094514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Log10_1)
25104514f5e3Sopenharmony_ci{
25114514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
25124514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
25134514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
25144514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::NAN_VALUE));
25154514f5e3Sopenharmony_ci
25164514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
25174514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Log10(ecmaRuntimeCallInfo);
25184514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
25194514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
25204514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
25214514f5e3Sopenharmony_ci}
25224514f5e3Sopenharmony_ci
25234514f5e3Sopenharmony_ci// Math.Log10(POSITIVE_INFINITY)
25244514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Log10_2)
25254514f5e3Sopenharmony_ci{
25264514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
25274514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
25284514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
25294514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(base::POSITIVE_INFINITY));
25304514f5e3Sopenharmony_ci
25314514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
25324514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Log10(ecmaRuntimeCallInfo);
25334514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
25344514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::POSITIVE_INFINITY);
25354514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
25364514f5e3Sopenharmony_ci}
25374514f5e3Sopenharmony_ci
25384514f5e3Sopenharmony_ci// Math.Log10(true)
25394514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Log10_3)
25404514f5e3Sopenharmony_ci{
25414514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
25424514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
25434514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
25444514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::True());
25454514f5e3Sopenharmony_ci
25464514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
25474514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Log10(ecmaRuntimeCallInfo);
25484514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
25494514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
25504514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
25514514f5e3Sopenharmony_ci}
25524514f5e3Sopenharmony_ci
25534514f5e3Sopenharmony_ci// Math.Log10("2")
25544514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Log10_4)
25554514f5e3Sopenharmony_ci{
25564514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("2");
25574514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
25584514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
25594514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
25604514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
25614514f5e3Sopenharmony_ci
25624514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
25634514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Log10(ecmaRuntimeCallInfo);
25644514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
25654514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0.3010299956639812);
25664514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
25674514f5e3Sopenharmony_ci}
25684514f5e3Sopenharmony_ci
25694514f5e3Sopenharmony_ci// Math.Log10(0.12)
25704514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Log10_5)
25714514f5e3Sopenharmony_ci{
25724514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
25734514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
25744514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
25754514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(0.12));
25764514f5e3Sopenharmony_ci
25774514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
25784514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Log10(ecmaRuntimeCallInfo);
25794514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
25804514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-0.9208187539523752);
25814514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
25824514f5e3Sopenharmony_ci}
25834514f5e3Sopenharmony_ci
25844514f5e3Sopenharmony_ci// Math.log2(-0.0)
25854514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Log2)
25864514f5e3Sopenharmony_ci{
25874514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
25884514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
25894514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
25904514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-0.0));
25914514f5e3Sopenharmony_ci
25924514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
25934514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Log2(ecmaRuntimeCallInfo);
25944514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
25954514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-base::POSITIVE_INFINITY);
25964514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
25974514f5e3Sopenharmony_ci}
25984514f5e3Sopenharmony_ci
25994514f5e3Sopenharmony_ci// Math.log2(-NAN)
26004514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Log2_1)
26014514f5e3Sopenharmony_ci{
26024514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
26034514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
26044514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
26054514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::NAN_VALUE));
26064514f5e3Sopenharmony_ci
26074514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
26084514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Log2(ecmaRuntimeCallInfo);
26094514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
26104514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
26114514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
26124514f5e3Sopenharmony_ci}
26134514f5e3Sopenharmony_ci
26144514f5e3Sopenharmony_ci// Math.log2(POSITIVE_INFINITY)
26154514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Log2_2)
26164514f5e3Sopenharmony_ci{
26174514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
26184514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
26194514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
26204514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(base::POSITIVE_INFINITY));
26214514f5e3Sopenharmony_ci
26224514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
26234514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Log2(ecmaRuntimeCallInfo);
26244514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
26254514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::POSITIVE_INFINITY);
26264514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
26274514f5e3Sopenharmony_ci}
26284514f5e3Sopenharmony_ci
26294514f5e3Sopenharmony_ci// Math.log2(true)
26304514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Log2_3)
26314514f5e3Sopenharmony_ci{
26324514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
26334514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
26344514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
26354514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::True());
26364514f5e3Sopenharmony_ci
26374514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
26384514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Log2(ecmaRuntimeCallInfo);
26394514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
26404514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
26414514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
26424514f5e3Sopenharmony_ci}
26434514f5e3Sopenharmony_ci
26444514f5e3Sopenharmony_ci// Math.log2("2")
26454514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Log2_4)
26464514f5e3Sopenharmony_ci{
26474514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("2");
26484514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
26494514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
26504514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
26514514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
26524514f5e3Sopenharmony_ci
26534514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
26544514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Log2(ecmaRuntimeCallInfo);
26554514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
26564514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(1.0);
26574514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
26584514f5e3Sopenharmony_ci}
26594514f5e3Sopenharmony_ci
26604514f5e3Sopenharmony_ci// Math.log2(1)
26614514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Log2_5)
26624514f5e3Sopenharmony_ci{
26634514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
26644514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
26654514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
26664514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<double>(1)));
26674514f5e3Sopenharmony_ci
26684514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
26694514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Log2(ecmaRuntimeCallInfo);
26704514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
26714514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
26724514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
26734514f5e3Sopenharmony_ci}
26744514f5e3Sopenharmony_ci
26754514f5e3Sopenharmony_ci// Math.Max(NaN,1,POSITIVE_INFINITY)
26764514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Max)
26774514f5e3Sopenharmony_ci{
26784514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10);
26794514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
26804514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
26814514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(base::NAN_VALUE));
26824514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast<int32_t>(1)));
26834514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(base::POSITIVE_INFINITY));
26844514f5e3Sopenharmony_ci
26854514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
26864514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Max(ecmaRuntimeCallInfo);
26874514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
26884514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
26894514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
26904514f5e3Sopenharmony_ci}
26914514f5e3Sopenharmony_ci
26924514f5e3Sopenharmony_ci// Math.Max()
26934514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Max_1)
26944514f5e3Sopenharmony_ci{
26954514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4);
26964514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
26974514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
26984514f5e3Sopenharmony_ci
26994514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
27004514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Max(ecmaRuntimeCallInfo);
27014514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
27024514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-base::POSITIVE_INFINITY);
27034514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
27044514f5e3Sopenharmony_ci}
27054514f5e3Sopenharmony_ci
27064514f5e3Sopenharmony_ci// Math.Max("3",100,2.5)
27074514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Max_2)
27084514f5e3Sopenharmony_ci{
27094514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("3");
27104514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10);
27114514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
27124514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
27134514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
27144514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast<int32_t>(100)));
27154514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(2.5));
27164514f5e3Sopenharmony_ci
27174514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
27184514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Max(ecmaRuntimeCallInfo);
27194514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
27204514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedInt(100);
27214514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
27224514f5e3Sopenharmony_ci}
27234514f5e3Sopenharmony_ci
27244514f5e3Sopenharmony_ci// Math.Max(3,"100",-101.5)
27254514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Max_3)
27264514f5e3Sopenharmony_ci{
27274514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("100");
27284514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10);
27294514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
27304514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
27314514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(3)));
27324514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(1, test.GetTaggedValue());
27334514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(-101.5));
27344514f5e3Sopenharmony_ci
27354514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
27364514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Max(ecmaRuntimeCallInfo);
27374514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
27384514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedInt(100);
27394514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
27404514f5e3Sopenharmony_ci}
27414514f5e3Sopenharmony_ci
27424514f5e3Sopenharmony_ci// Math.Max(-3,"-100",true)
27434514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Max_4)
27444514f5e3Sopenharmony_ci{
27454514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("-100");
27464514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10);
27474514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
27484514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
27494514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(-3)));
27504514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(1, test.GetTaggedValue());
27514514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue::True());
27524514f5e3Sopenharmony_ci
27534514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
27544514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Max(ecmaRuntimeCallInfo);
27554514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
27564514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedInt(1);
27574514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
27584514f5e3Sopenharmony_ci}
27594514f5e3Sopenharmony_ci
27604514f5e3Sopenharmony_ci// Math.min(NaN,1,POSITIVE_INFINITY)
27614514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Min)
27624514f5e3Sopenharmony_ci{
27634514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10);
27644514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
27654514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
27664514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(base::NAN_VALUE));
27674514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast<int32_t>(1)));
27684514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(base::POSITIVE_INFINITY));
27694514f5e3Sopenharmony_ci
27704514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
27714514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Min(ecmaRuntimeCallInfo);
27724514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
27734514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
27744514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
27754514f5e3Sopenharmony_ci}
27764514f5e3Sopenharmony_ci
27774514f5e3Sopenharmony_ci// Math.min()
27784514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Min_1)
27794514f5e3Sopenharmony_ci{
27804514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4);
27814514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
27824514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
27834514f5e3Sopenharmony_ci
27844514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
27854514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Min(ecmaRuntimeCallInfo);
27864514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
27874514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::POSITIVE_INFINITY);
27884514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
27894514f5e3Sopenharmony_ci}
27904514f5e3Sopenharmony_ci
27914514f5e3Sopenharmony_ci// Math.min("3",100,2.5)
27924514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Min_2)
27934514f5e3Sopenharmony_ci{
27944514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("3");
27954514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10);
27964514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
27974514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
27984514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
27994514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast<int32_t>(100)));
28004514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(2.5));
28014514f5e3Sopenharmony_ci
28024514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
28034514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Min(ecmaRuntimeCallInfo);
28044514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
28054514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(2.5);
28064514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
28074514f5e3Sopenharmony_ci}
28084514f5e3Sopenharmony_ci
28094514f5e3Sopenharmony_ci// Math.min(3,"100",-101.5)
28104514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Min_3)
28114514f5e3Sopenharmony_ci{
28124514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("100");
28134514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10);
28144514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
28154514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
28164514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(3)));
28174514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(1, test.GetTaggedValue());
28184514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(-101.5));
28194514f5e3Sopenharmony_ci
28204514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
28214514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Min(ecmaRuntimeCallInfo);
28224514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
28234514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-101.5);
28244514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
28254514f5e3Sopenharmony_ci}
28264514f5e3Sopenharmony_ci
28274514f5e3Sopenharmony_ci// Math.min(3,100,false)
28284514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Min_4)
28294514f5e3Sopenharmony_ci{
28304514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10);
28314514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
28324514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
28334514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(3)));
28344514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast<int32_t>(100)));
28354514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue::False());
28364514f5e3Sopenharmony_ci
28374514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
28384514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Min(ecmaRuntimeCallInfo);
28394514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
28404514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedInt(0);
28414514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
28424514f5e3Sopenharmony_ci}
28434514f5e3Sopenharmony_ci
28444514f5e3Sopenharmony_ci// Math.pow(2,"-2")
28454514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Pow)
28464514f5e3Sopenharmony_ci{
28474514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("-2");
28484514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8);
28494514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
28504514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
28514514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(2)));
28524514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(1, test.GetTaggedValue());
28534514f5e3Sopenharmony_ci
28544514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
28554514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Pow(ecmaRuntimeCallInfo);
28564514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
28574514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0.25);
28584514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
28594514f5e3Sopenharmony_ci}
28604514f5e3Sopenharmony_ci
28614514f5e3Sopenharmony_ci// Math.pow(-NaN,-2)
28624514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Pow_1)
28634514f5e3Sopenharmony_ci{
28644514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8);
28654514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
28664514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
28674514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::NAN_VALUE));
28684514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast<int32_t>(-2)));
28694514f5e3Sopenharmony_ci
28704514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
28714514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Pow(ecmaRuntimeCallInfo);
28724514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
28734514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
28744514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
28754514f5e3Sopenharmony_ci}
28764514f5e3Sopenharmony_ci
28774514f5e3Sopenharmony_ci// Math.pow()
28784514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Pow_2)
28794514f5e3Sopenharmony_ci{
28804514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4);
28814514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
28824514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
28834514f5e3Sopenharmony_ci
28844514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
28854514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Pow(ecmaRuntimeCallInfo);
28864514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
28874514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
28884514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
28894514f5e3Sopenharmony_ci}
28904514f5e3Sopenharmony_ci
28914514f5e3Sopenharmony_ci// Math.pow(false,-2)
28924514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Pow_3)
28934514f5e3Sopenharmony_ci{
28944514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8);
28954514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
28964514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
28974514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::False());
28984514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast<int32_t>(-2)));
28994514f5e3Sopenharmony_ci
29004514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
29014514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Pow(ecmaRuntimeCallInfo);
29024514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
29034514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::POSITIVE_INFINITY);
29044514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
29054514f5e3Sopenharmony_ci}
29064514f5e3Sopenharmony_ci
29074514f5e3Sopenharmony_ci// Math.random()
29084514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Random)
29094514f5e3Sopenharmony_ci{
29104514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4);
29114514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
29124514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
29134514f5e3Sopenharmony_ci
29144514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
29154514f5e3Sopenharmony_ci    JSTaggedValue result1 = BuiltinsMath::Random(ecmaRuntimeCallInfo);
29164514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
29174514f5e3Sopenharmony_ci    double value1 = JSTaggedValue(static_cast<JSTaggedType>(result1.GetRawData())).GetDouble();
29184514f5e3Sopenharmony_ci    ASSERT_TRUE(value1 >= 0);
29194514f5e3Sopenharmony_ci    ASSERT_TRUE(value1 < 1.0);
29204514f5e3Sopenharmony_ci}
29214514f5e3Sopenharmony_ci
29224514f5e3Sopenharmony_ci// Math.random()
29234514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Random_1)
29244514f5e3Sopenharmony_ci{
29254514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4);
29264514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
29274514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
29284514f5e3Sopenharmony_ci
29294514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
29304514f5e3Sopenharmony_ci    JSTaggedValue result1 = BuiltinsMath::Random(ecmaRuntimeCallInfo);
29314514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
29324514f5e3Sopenharmony_ci    JSTaggedValue result2 = BuiltinsMath::Random(ecmaRuntimeCallInfo);
29334514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
29344514f5e3Sopenharmony_ci    double value1 = JSTaggedValue(static_cast<JSTaggedType>(result1.GetRawData())).GetDouble();
29354514f5e3Sopenharmony_ci    double value2 = JSTaggedValue(static_cast<JSTaggedType>(result2.GetRawData())).GetDouble();
29364514f5e3Sopenharmony_ci    ASSERT_TRUE(value1 >= 0);
29374514f5e3Sopenharmony_ci    ASSERT_TRUE(value1 < 1.0);
29384514f5e3Sopenharmony_ci    ASSERT_TRUE(value2 >= 0);
29394514f5e3Sopenharmony_ci    ASSERT_TRUE(value2 < 1.0);
29404514f5e3Sopenharmony_ci}
29414514f5e3Sopenharmony_ci
29424514f5e3Sopenharmony_ci// Math.round(-NaN)
29434514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Round)
29444514f5e3Sopenharmony_ci{
29454514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
29464514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
29474514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
29484514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::NAN_VALUE));
29494514f5e3Sopenharmony_ci
29504514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
29514514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Round(ecmaRuntimeCallInfo);
29524514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
29534514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
29544514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
29554514f5e3Sopenharmony_ci}
29564514f5e3Sopenharmony_ci
29574514f5e3Sopenharmony_ci// Math.round(1.25)
29584514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Round_1)
29594514f5e3Sopenharmony_ci{
29604514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
29614514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
29624514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
29634514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(1.25));
29644514f5e3Sopenharmony_ci
29654514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
29664514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Round(ecmaRuntimeCallInfo);
29674514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
29684514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(1.0);
29694514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
29704514f5e3Sopenharmony_ci}
29714514f5e3Sopenharmony_ci
29724514f5e3Sopenharmony_ci// Math.round(-0.14)
29734514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Round_2)
29744514f5e3Sopenharmony_ci{
29754514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
29764514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
29774514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
29784514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-0.14));
29794514f5e3Sopenharmony_ci
29804514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
29814514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Round(ecmaRuntimeCallInfo);
29824514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
29834514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-0.0);
29844514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
29854514f5e3Sopenharmony_ci}
29864514f5e3Sopenharmony_ci
29874514f5e3Sopenharmony_ci// Math.round(-0.7)
29884514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Round_3)
29894514f5e3Sopenharmony_ci{
29904514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
29914514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
29924514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
29934514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-0.7));
29944514f5e3Sopenharmony_ci
29954514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
29964514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Round(ecmaRuntimeCallInfo);
29974514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
29984514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-1.0);
29994514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
30004514f5e3Sopenharmony_ci}
30014514f5e3Sopenharmony_ci
30024514f5e3Sopenharmony_ci// Math.round(POSITIVE_INFINITY)
30034514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Round_4)
30044514f5e3Sopenharmony_ci{
30054514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
30064514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
30074514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
30084514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(base::POSITIVE_INFINITY));
30094514f5e3Sopenharmony_ci
30104514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
30114514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Round(ecmaRuntimeCallInfo);
30124514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
30134514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::POSITIVE_INFINITY);
30144514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
30154514f5e3Sopenharmony_ci}
30164514f5e3Sopenharmony_ci
30174514f5e3Sopenharmony_ci// Math.fround(POSITIVE_INFINITY)
30184514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Fround)
30194514f5e3Sopenharmony_ci{
30204514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
30214514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
30224514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
30234514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(base::POSITIVE_INFINITY));
30244514f5e3Sopenharmony_ci
30254514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
30264514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Fround(ecmaRuntimeCallInfo);
30274514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
30284514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::POSITIVE_INFINITY);
30294514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
30304514f5e3Sopenharmony_ci}
30314514f5e3Sopenharmony_ci
30324514f5e3Sopenharmony_ci// Math.fround(-NaN)
30334514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Fround_1)
30344514f5e3Sopenharmony_ci{
30354514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
30364514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
30374514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
30384514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::NAN_VALUE));
30394514f5e3Sopenharmony_ci
30404514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
30414514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Fround(ecmaRuntimeCallInfo);
30424514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
30434514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
30444514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
30454514f5e3Sopenharmony_ci}
30464514f5e3Sopenharmony_ci
30474514f5e3Sopenharmony_ci// Math.fround(-0)
30484514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Fround_2)
30494514f5e3Sopenharmony_ci{
30504514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
30514514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
30524514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
30534514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-0.0));
30544514f5e3Sopenharmony_ci
30554514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
30564514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Fround(ecmaRuntimeCallInfo);
30574514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
30584514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-0.0);
30594514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
30604514f5e3Sopenharmony_ci}
30614514f5e3Sopenharmony_ci
30624514f5e3Sopenharmony_ci// Math.fround(1.337)
30634514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Fround_3)
30644514f5e3Sopenharmony_ci{
30654514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
30664514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
30674514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
30684514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(1.337));
30694514f5e3Sopenharmony_ci
30704514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
30714514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Fround(ecmaRuntimeCallInfo);
30724514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
30734514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(1.3370000123977661);
30744514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
30754514f5e3Sopenharmony_ci}
30764514f5e3Sopenharmony_ci
30774514f5e3Sopenharmony_ci// Math.fround(-668523145.253485)
30784514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Fround_4)
30794514f5e3Sopenharmony_ci{
30804514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
30814514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
30824514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
30834514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-668523145.253485));
30844514f5e3Sopenharmony_ci
30854514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
30864514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Fround(ecmaRuntimeCallInfo);
30874514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
30884514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-668523136.0);
30894514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
30904514f5e3Sopenharmony_ci}
30914514f5e3Sopenharmony_ci
30924514f5e3Sopenharmony_ci// Math.clz32(NaN)
30934514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Clz32)
30944514f5e3Sopenharmony_ci{
30954514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
30964514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
30974514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
30984514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::NAN_VALUE));
30994514f5e3Sopenharmony_ci
31004514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
31014514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Clz32(ecmaRuntimeCallInfo);
31024514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
31034514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedInt(32);
31044514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
31054514f5e3Sopenharmony_ci}
31064514f5e3Sopenharmony_ci
31074514f5e3Sopenharmony_ci// Math.clz32(-0)
31084514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Clz32_1)
31094514f5e3Sopenharmony_ci{
31104514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
31114514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
31124514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
31134514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-0.0));
31144514f5e3Sopenharmony_ci
31154514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
31164514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Clz32(ecmaRuntimeCallInfo);
31174514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
31184514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedInt(32);
31194514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
31204514f5e3Sopenharmony_ci}
31214514f5e3Sopenharmony_ci
31224514f5e3Sopenharmony_ci// Math.clz32(1)
31234514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Clz32_2)
31244514f5e3Sopenharmony_ci{
31254514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
31264514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
31274514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
31284514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(1)));
31294514f5e3Sopenharmony_ci
31304514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
31314514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Clz32(ecmaRuntimeCallInfo);
31324514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
31334514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedInt(31);
31344514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
31354514f5e3Sopenharmony_ci}
31364514f5e3Sopenharmony_ci
31374514f5e3Sopenharmony_ci// Math.clz32(568243)
31384514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Clz32_3)
31394514f5e3Sopenharmony_ci{
31404514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
31414514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
31424514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
31434514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(568243)));
31444514f5e3Sopenharmony_ci
31454514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
31464514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Clz32(ecmaRuntimeCallInfo);
31474514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
31484514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedInt(12);
31494514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
31504514f5e3Sopenharmony_ci}
31514514f5e3Sopenharmony_ci
31524514f5e3Sopenharmony_ci// Math.clz32(4294967295)
31534514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Clz32_4)
31544514f5e3Sopenharmony_ci{
31554514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
31564514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
31574514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
31584514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(4294967295)));
31594514f5e3Sopenharmony_ci
31604514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
31614514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Clz32(ecmaRuntimeCallInfo);
31624514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
31634514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedInt(0);
31644514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
31654514f5e3Sopenharmony_ci}
31664514f5e3Sopenharmony_ci
31674514f5e3Sopenharmony_ci// Math.clz32(10000000000.123)
31684514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Clz32_5)
31694514f5e3Sopenharmony_ci{
31704514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
31714514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
31724514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
31734514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(10000000000.123));
31744514f5e3Sopenharmony_ci
31754514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
31764514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Clz32(ecmaRuntimeCallInfo);
31774514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
31784514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedInt(1);
31794514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
31804514f5e3Sopenharmony_ci}
31814514f5e3Sopenharmony_ci
31824514f5e3Sopenharmony_ci// Math.clz32()
31834514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Clz32_6)
31844514f5e3Sopenharmony_ci{
31854514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4);
31864514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
31874514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
31884514f5e3Sopenharmony_ci
31894514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
31904514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Clz32(ecmaRuntimeCallInfo);
31914514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
31924514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedInt(32);
31934514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
31944514f5e3Sopenharmony_ci}
31954514f5e3Sopenharmony_ci
31964514f5e3Sopenharmony_ci// Math.hypot()
31974514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Hypot)
31984514f5e3Sopenharmony_ci{
31994514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4);
32004514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
32014514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
32024514f5e3Sopenharmony_ci
32034514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
32044514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Hypot(ecmaRuntimeCallInfo);
32054514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
32064514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
32074514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
32084514f5e3Sopenharmony_ci}
32094514f5e3Sopenharmony_ci
32104514f5e3Sopenharmony_ci// Math.hypot(-2.1)
32114514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Hypot_1)
32124514f5e3Sopenharmony_ci{
32134514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
32144514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
32154514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
32164514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-2.1));
32174514f5e3Sopenharmony_ci
32184514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
32194514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Hypot(ecmaRuntimeCallInfo);
32204514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
32214514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(2.1);
32224514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
32234514f5e3Sopenharmony_ci}
32244514f5e3Sopenharmony_ci
32254514f5e3Sopenharmony_ci// Math.hypot(-NaN, 1)
32264514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Hypot_2)
32274514f5e3Sopenharmony_ci{
32284514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
32294514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
32304514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
32314514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::NAN_VALUE));
32324514f5e3Sopenharmony_ci
32334514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
32344514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Hypot(ecmaRuntimeCallInfo);
32354514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
32364514f5e3Sopenharmony_ci    ASSERT_TRUE(result.IsDouble());
32374514f5e3Sopenharmony_ci    ASSERT_TRUE(std::isnan(result.GetDouble()));
32384514f5e3Sopenharmony_ci}
32394514f5e3Sopenharmony_ci
32404514f5e3Sopenharmony_ci// Math.hypot(true, 5, 8, -0.2, 90000)
32414514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Hypot_3)
32424514f5e3Sopenharmony_ci{
32434514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 14);
32444514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
32454514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
32464514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::True());
32474514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast<int32_t>(5)));
32484514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast<int32_t>(8)));
32494514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(3, JSTaggedValue(-0.2));
32504514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(4, JSTaggedValue(static_cast<int32_t>(90000)));
32514514f5e3Sopenharmony_ci
32524514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
32534514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Hypot(ecmaRuntimeCallInfo);
32544514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
32554514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(90000.00050022222);
32564514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
32574514f5e3Sopenharmony_ci}
32584514f5e3Sopenharmony_ci
32594514f5e3Sopenharmony_ci// Math.Imul()
32604514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Imul)
32614514f5e3Sopenharmony_ci{
32624514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4);
32634514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
32644514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
32654514f5e3Sopenharmony_ci
32664514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
32674514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Imul(ecmaRuntimeCallInfo);
32684514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
32694514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedInt(0);
32704514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
32714514f5e3Sopenharmony_ci}
32724514f5e3Sopenharmony_ci
32734514f5e3Sopenharmony_ci// Math.Imul("-2",9.256)
32744514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Imul_1)
32754514f5e3Sopenharmony_ci{
32764514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("-2");
32774514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8);
32784514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
32794514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
32804514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
32814514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(9.256));
32824514f5e3Sopenharmony_ci
32834514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
32844514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Imul(ecmaRuntimeCallInfo);
32854514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
32864514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedInt(-18);
32874514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
32884514f5e3Sopenharmony_ci}
32894514f5e3Sopenharmony_ci
32904514f5e3Sopenharmony_ci// Math.Imul(5,0xffffffff)
32914514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Imul_2)
32924514f5e3Sopenharmony_ci{
32934514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8);
32944514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
32954514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
32964514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(5)));
32974514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast<int32_t>(0xffffffff)));
32984514f5e3Sopenharmony_ci
32994514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
33004514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Imul(ecmaRuntimeCallInfo);
33014514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
33024514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedInt(-5);
33034514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
33044514f5e3Sopenharmony_ci}
33054514f5e3Sopenharmony_ci
33064514f5e3Sopenharmony_ci// Math.Imul(5,0xfffffffe)
33074514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Imul_3)
33084514f5e3Sopenharmony_ci{
33094514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8);
33104514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
33114514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
33124514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(5)));
33134514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast<int32_t>(0xfffffffe)));
33144514f5e3Sopenharmony_ci
33154514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
33164514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Imul(ecmaRuntimeCallInfo);
33174514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
33184514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedInt(-10);
33194514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
33204514f5e3Sopenharmony_ci}
33214514f5e3Sopenharmony_ci
33224514f5e3Sopenharmony_ci// Math.sin(-1)
33234514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Sin)
33244514f5e3Sopenharmony_ci{
33254514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
33264514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
33274514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
33284514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(-1)));
33294514f5e3Sopenharmony_ci
33304514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
33314514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Sin(ecmaRuntimeCallInfo);
33324514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
33334514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-0.8414709848078965);
33344514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
33354514f5e3Sopenharmony_ci}
33364514f5e3Sopenharmony_ci
33374514f5e3Sopenharmony_ci// Math.sin(-1.5)
33384514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Sin_2)
33394514f5e3Sopenharmony_ci{
33404514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
33414514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
33424514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
33434514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-1.5));
33444514f5e3Sopenharmony_ci
33454514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
33464514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Sin(ecmaRuntimeCallInfo);
33474514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
33484514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-0.9974949866040544);
33494514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
33504514f5e3Sopenharmony_ci}
33514514f5e3Sopenharmony_ci
33524514f5e3Sopenharmony_ci// Math.sin(null)
33534514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Sin_3)
33544514f5e3Sopenharmony_ci{
33554514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
33564514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
33574514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
33584514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Null());
33594514f5e3Sopenharmony_ci
33604514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
33614514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Sin(ecmaRuntimeCallInfo);
33624514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
33634514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
33644514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
33654514f5e3Sopenharmony_ci}
33664514f5e3Sopenharmony_ci
33674514f5e3Sopenharmony_ci// Math.sin(UNDEFINED)
33684514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Sin_4)
33694514f5e3Sopenharmony_ci{
33704514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
33714514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
33724514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
33734514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Undefined());
33744514f5e3Sopenharmony_ci
33754514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
33764514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Sin(ecmaRuntimeCallInfo);
33774514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
33784514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
33794514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
33804514f5e3Sopenharmony_ci}
33814514f5e3Sopenharmony_ci
33824514f5e3Sopenharmony_ci// Math.sin(true)
33834514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Sin_5)
33844514f5e3Sopenharmony_ci{
33854514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
33864514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
33874514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
33884514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::True());
33894514f5e3Sopenharmony_ci
33904514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
33914514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Sin(ecmaRuntimeCallInfo);
33924514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
33934514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0.8414709848078965);
33944514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
33954514f5e3Sopenharmony_ci}
33964514f5e3Sopenharmony_ci
33974514f5e3Sopenharmony_ci// Math.sin("0.1")
33984514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Sin_6)
33994514f5e3Sopenharmony_ci{
34004514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("0.1");
34014514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
34024514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
34034514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
34044514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
34054514f5e3Sopenharmony_ci
34064514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
34074514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Sin(ecmaRuntimeCallInfo);
34084514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
34094514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0.09983341664682815);
34104514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
34114514f5e3Sopenharmony_ci}
34124514f5e3Sopenharmony_ci
34134514f5e3Sopenharmony_ci// Math.sin(Number.POSITIVE_INFINITY)
34144514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Sin_7)
34154514f5e3Sopenharmony_ci{
34164514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
34174514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
34184514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
34194514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(base::POSITIVE_INFINITY));
34204514f5e3Sopenharmony_ci
34214514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
34224514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Sin(ecmaRuntimeCallInfo);
34234514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
34244514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
34254514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
34264514f5e3Sopenharmony_ci}
34274514f5e3Sopenharmony_ci
34284514f5e3Sopenharmony_ci// Math.sin(-NaN)
34294514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Sin_8)
34304514f5e3Sopenharmony_ci{
34314514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
34324514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
34334514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
34344514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::NAN_VALUE));
34354514f5e3Sopenharmony_ci
34364514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
34374514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Sin(ecmaRuntimeCallInfo);
34384514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
34394514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
34404514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
34414514f5e3Sopenharmony_ci}
34424514f5e3Sopenharmony_ci
34434514f5e3Sopenharmony_ci// Math.sinh(-1)
34444514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Sinh)
34454514f5e3Sopenharmony_ci{
34464514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
34474514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
34484514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
34494514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(-1)));
34504514f5e3Sopenharmony_ci
34514514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
34524514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Sinh(ecmaRuntimeCallInfo);
34534514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
34544514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-1.1752011936438014);
34554514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
34564514f5e3Sopenharmony_ci}
34574514f5e3Sopenharmony_ci
34584514f5e3Sopenharmony_ci// Math.sinh(-1.5)
34594514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Sinh_1)
34604514f5e3Sopenharmony_ci{
34614514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
34624514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
34634514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
34644514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-1.5));
34654514f5e3Sopenharmony_ci
34664514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
34674514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Sinh(ecmaRuntimeCallInfo);
34684514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
34694514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-2.1292794550948173);
34704514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
34714514f5e3Sopenharmony_ci}
34724514f5e3Sopenharmony_ci
34734514f5e3Sopenharmony_ci// Math.sinh(null)
34744514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Sinh_2)
34754514f5e3Sopenharmony_ci{
34764514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
34774514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
34784514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
34794514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Null());
34804514f5e3Sopenharmony_ci
34814514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
34824514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Sinh(ecmaRuntimeCallInfo);
34834514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
34844514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
34854514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
34864514f5e3Sopenharmony_ci}
34874514f5e3Sopenharmony_ci
34884514f5e3Sopenharmony_ci// Math.sinh(UNDEFINED)
34894514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Sinh_3)
34904514f5e3Sopenharmony_ci{
34914514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
34924514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
34934514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
34944514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Undefined());
34954514f5e3Sopenharmony_ci
34964514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
34974514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Sinh(ecmaRuntimeCallInfo);
34984514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
34994514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
35004514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
35014514f5e3Sopenharmony_ci}
35024514f5e3Sopenharmony_ci
35034514f5e3Sopenharmony_ci// Math.sinh(true)
35044514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Sinh_4)
35054514f5e3Sopenharmony_ci{
35064514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
35074514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
35084514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
35094514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::True());
35104514f5e3Sopenharmony_ci
35114514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
35124514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Sinh(ecmaRuntimeCallInfo);
35134514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
35144514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(1.1752011936438014);
35154514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
35164514f5e3Sopenharmony_ci}
35174514f5e3Sopenharmony_ci
35184514f5e3Sopenharmony_ci// Math.sinh("0.1")
35194514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Sinh_5)
35204514f5e3Sopenharmony_ci{
35214514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("0.1");
35224514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
35234514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
35244514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
35254514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
35264514f5e3Sopenharmony_ci
35274514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
35284514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Sinh(ecmaRuntimeCallInfo);
35294514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
35304514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0.10016675001984403);
35314514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
35324514f5e3Sopenharmony_ci}
35334514f5e3Sopenharmony_ci
35344514f5e3Sopenharmony_ci// Math.sinh(-Number.POSITIVE_INFINITY)
35354514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Sinh_6)
35364514f5e3Sopenharmony_ci{
35374514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
35384514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
35394514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
35404514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::POSITIVE_INFINITY));
35414514f5e3Sopenharmony_ci
35424514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
35434514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Sinh(ecmaRuntimeCallInfo);
35444514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
35454514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-base::POSITIVE_INFINITY);
35464514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
35474514f5e3Sopenharmony_ci}
35484514f5e3Sopenharmony_ci
35494514f5e3Sopenharmony_ci// Math.sinh(-NaN)
35504514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Sinh_7)
35514514f5e3Sopenharmony_ci{
35524514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
35534514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
35544514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
35554514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::NAN_VALUE));
35564514f5e3Sopenharmony_ci
35574514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
35584514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Sinh(ecmaRuntimeCallInfo);
35594514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
35604514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
35614514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
35624514f5e3Sopenharmony_ci}
35634514f5e3Sopenharmony_ci
35644514f5e3Sopenharmony_ci// Math.sqrt(-1)
35654514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Sqrt)
35664514f5e3Sopenharmony_ci{
35674514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
35684514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
35694514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
35704514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(-1)));
35714514f5e3Sopenharmony_ci
35724514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
35734514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Sqrt(ecmaRuntimeCallInfo);
35744514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
35754514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
35764514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
35774514f5e3Sopenharmony_ci}
35784514f5e3Sopenharmony_ci
35794514f5e3Sopenharmony_ci// Math.sqrt(-0)
35804514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Sqrt_1)
35814514f5e3Sopenharmony_ci{
35824514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
35834514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
35844514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
35854514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-0.0));
35864514f5e3Sopenharmony_ci
35874514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
35884514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Sqrt(ecmaRuntimeCallInfo);
35894514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
35904514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-0.0);
35914514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
35924514f5e3Sopenharmony_ci}
35934514f5e3Sopenharmony_ci
35944514f5e3Sopenharmony_ci// Math.sqrt(null)
35954514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Sqrt_2)
35964514f5e3Sopenharmony_ci{
35974514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
35984514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
35994514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
36004514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Null());
36014514f5e3Sopenharmony_ci
36024514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
36034514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Sqrt(ecmaRuntimeCallInfo);
36044514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
36054514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
36064514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
36074514f5e3Sopenharmony_ci}
36084514f5e3Sopenharmony_ci
36094514f5e3Sopenharmony_ci// Math.sqrt(true)
36104514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Sqrt_3)
36114514f5e3Sopenharmony_ci{
36124514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
36134514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
36144514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
36154514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::True());
36164514f5e3Sopenharmony_ci
36174514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
36184514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Sqrt(ecmaRuntimeCallInfo);
36194514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
36204514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(1.0);
36214514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
36224514f5e3Sopenharmony_ci}
36234514f5e3Sopenharmony_ci
36244514f5e3Sopenharmony_ci// Math.sqrt("0.1")
36254514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Sqrt_4)
36264514f5e3Sopenharmony_ci{
36274514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("0.1");
36284514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
36294514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
36304514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
36314514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
36324514f5e3Sopenharmony_ci
36334514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
36344514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Sqrt(ecmaRuntimeCallInfo);
36354514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
36364514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0.31622776601683794);
36374514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
36384514f5e3Sopenharmony_ci}
36394514f5e3Sopenharmony_ci
36404514f5e3Sopenharmony_ci// Math.sqrt(Number.POSITIVE_INFINITY)
36414514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Sqrt_5)
36424514f5e3Sopenharmony_ci{
36434514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
36444514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
36454514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
36464514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(base::POSITIVE_INFINITY));
36474514f5e3Sopenharmony_ci
36484514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
36494514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Sqrt(ecmaRuntimeCallInfo);
36504514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
36514514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::POSITIVE_INFINITY);
36524514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
36534514f5e3Sopenharmony_ci}
36544514f5e3Sopenharmony_ci
36554514f5e3Sopenharmony_ci// Math.sqrt(-NaN)
36564514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Sqrt_6)
36574514f5e3Sopenharmony_ci{
36584514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
36594514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
36604514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
36614514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<double>(-base::NAN_VALUE)));
36624514f5e3Sopenharmony_ci
36634514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
36644514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Sqrt(ecmaRuntimeCallInfo);
36654514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
36664514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
36674514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
36684514f5e3Sopenharmony_ci}
36694514f5e3Sopenharmony_ci
36704514f5e3Sopenharmony_ci// Math.tan(-1)
36714514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Tan)
36724514f5e3Sopenharmony_ci{
36734514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
36744514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
36754514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
36764514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(-1)));
36774514f5e3Sopenharmony_ci
36784514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
36794514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Tan(ecmaRuntimeCallInfo);
36804514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
36814514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-1.5574077246549023);
36824514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
36834514f5e3Sopenharmony_ci}
36844514f5e3Sopenharmony_ci
36854514f5e3Sopenharmony_ci// Math.tan(-0)
36864514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Tan_1)
36874514f5e3Sopenharmony_ci{
36884514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
36894514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
36904514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
36914514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-0.0));
36924514f5e3Sopenharmony_ci
36934514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
36944514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Tan(ecmaRuntimeCallInfo);
36954514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
36964514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-0.0);
36974514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
36984514f5e3Sopenharmony_ci}
36994514f5e3Sopenharmony_ci
37004514f5e3Sopenharmony_ci// Math.tan(null)
37014514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Tan_2)
37024514f5e3Sopenharmony_ci{
37034514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
37044514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
37054514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
37064514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Null());
37074514f5e3Sopenharmony_ci
37084514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
37094514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Tan(ecmaRuntimeCallInfo);
37104514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
37114514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
37124514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
37134514f5e3Sopenharmony_ci}
37144514f5e3Sopenharmony_ci
37154514f5e3Sopenharmony_ci// Math.tan(true)
37164514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Tan_3)
37174514f5e3Sopenharmony_ci{
37184514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
37194514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
37204514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
37214514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::True());
37224514f5e3Sopenharmony_ci
37234514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
37244514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Tan(ecmaRuntimeCallInfo);
37254514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
37264514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(1.5574077246549023);
37274514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
37284514f5e3Sopenharmony_ci}
37294514f5e3Sopenharmony_ci
37304514f5e3Sopenharmony_ci// Math.tan("0.1")
37314514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Tan_4)
37324514f5e3Sopenharmony_ci{
37334514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("0.1");
37344514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
37354514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
37364514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
37374514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
37384514f5e3Sopenharmony_ci
37394514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
37404514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Tan(ecmaRuntimeCallInfo);
37414514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
37424514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0.10033467208545055);
37434514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
37444514f5e3Sopenharmony_ci}
37454514f5e3Sopenharmony_ci
37464514f5e3Sopenharmony_ci// Math.tan(Number.POSITIVE_INFINITY)
37474514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Tan_5)
37484514f5e3Sopenharmony_ci{
37494514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
37504514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
37514514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
37524514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(base::POSITIVE_INFINITY));
37534514f5e3Sopenharmony_ci
37544514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
37554514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Tan(ecmaRuntimeCallInfo);
37564514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
37574514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
37584514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
37594514f5e3Sopenharmony_ci}
37604514f5e3Sopenharmony_ci
37614514f5e3Sopenharmony_ci// Math.tan(-NaN)
37624514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Tan_6)
37634514f5e3Sopenharmony_ci{
37644514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
37654514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
37664514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
37674514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::NAN_VALUE));
37684514f5e3Sopenharmony_ci
37694514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
37704514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Tan(ecmaRuntimeCallInfo);
37714514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
37724514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
37734514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
37744514f5e3Sopenharmony_ci}
37754514f5e3Sopenharmony_ci
37764514f5e3Sopenharmony_ci// Math.tanh(-1)
37774514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Tanh)
37784514f5e3Sopenharmony_ci{
37794514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
37804514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
37814514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
37824514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(-1)));
37834514f5e3Sopenharmony_ci
37844514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
37854514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Tanh(ecmaRuntimeCallInfo);
37864514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
37874514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-0.7615941559557649);
37884514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
37894514f5e3Sopenharmony_ci}
37904514f5e3Sopenharmony_ci
37914514f5e3Sopenharmony_ci// Math.tanh(-0)
37924514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Tanh_1)
37934514f5e3Sopenharmony_ci{
37944514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
37954514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
37964514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
37974514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-0.0));
37984514f5e3Sopenharmony_ci
37994514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
38004514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Tanh(ecmaRuntimeCallInfo);
38014514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
38024514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-0.0);
38034514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
38044514f5e3Sopenharmony_ci}
38054514f5e3Sopenharmony_ci
38064514f5e3Sopenharmony_ci// Math.tanh(null)
38074514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Tanh_2)
38084514f5e3Sopenharmony_ci{
38094514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
38104514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
38114514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
38124514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Null());
38134514f5e3Sopenharmony_ci
38144514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
38154514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Tanh(ecmaRuntimeCallInfo);
38164514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
38174514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
38184514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
38194514f5e3Sopenharmony_ci}
38204514f5e3Sopenharmony_ci
38214514f5e3Sopenharmony_ci// Math.tanh(true)
38224514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Tanh_3)
38234514f5e3Sopenharmony_ci{
38244514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
38254514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
38264514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
38274514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::True());
38284514f5e3Sopenharmony_ci
38294514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
38304514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Tanh(ecmaRuntimeCallInfo);
38314514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
38324514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0.7615941559557649);
38334514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
38344514f5e3Sopenharmony_ci}
38354514f5e3Sopenharmony_ci
38364514f5e3Sopenharmony_ci// Math.tanh("0.1")
38374514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Tanh_4)
38384514f5e3Sopenharmony_ci{
38394514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("0.1");
38404514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
38414514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
38424514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
38434514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
38444514f5e3Sopenharmony_ci
38454514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
38464514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Tanh(ecmaRuntimeCallInfo);
38474514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
38484514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0.09966799462495582);
38494514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
38504514f5e3Sopenharmony_ci}
38514514f5e3Sopenharmony_ci
38524514f5e3Sopenharmony_ci// Math.tanh(Number.POSITIVE_INFINITY)
38534514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Tanh_5)
38544514f5e3Sopenharmony_ci{
38554514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
38564514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
38574514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
38584514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(base::POSITIVE_INFINITY));
38594514f5e3Sopenharmony_ci
38604514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
38614514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Tanh(ecmaRuntimeCallInfo);
38624514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
38634514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(1.0);
38644514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
38654514f5e3Sopenharmony_ci}
38664514f5e3Sopenharmony_ci
38674514f5e3Sopenharmony_ci// Math.tanh(-NaN)
38684514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Tanh_6)
38694514f5e3Sopenharmony_ci{
38704514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
38714514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
38724514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
38734514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::NAN_VALUE));
38744514f5e3Sopenharmony_ci
38754514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
38764514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Tanh(ecmaRuntimeCallInfo);
38774514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
38784514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
38794514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
38804514f5e3Sopenharmony_ci}
38814514f5e3Sopenharmony_ci
38824514f5e3Sopenharmony_ci// Math.trunc(-1)
38834514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Trunc)
38844514f5e3Sopenharmony_ci{
38854514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
38864514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
38874514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
38884514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast<int32_t>(-1)));
38894514f5e3Sopenharmony_ci
38904514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
38914514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Trunc(ecmaRuntimeCallInfo);
38924514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
38934514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-1.0);
38944514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
38954514f5e3Sopenharmony_ci}
38964514f5e3Sopenharmony_ci
38974514f5e3Sopenharmony_ci// Math.trunc(-0)
38984514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Trunc_1)
38994514f5e3Sopenharmony_ci{
39004514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
39014514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
39024514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
39034514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-0.0));
39044514f5e3Sopenharmony_ci
39054514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
39064514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Trunc(ecmaRuntimeCallInfo);
39074514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
39084514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-0.0);
39094514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
39104514f5e3Sopenharmony_ci}
39114514f5e3Sopenharmony_ci
39124514f5e3Sopenharmony_ci// Math.trunc(null)
39134514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Trunc_2)
39144514f5e3Sopenharmony_ci{
39154514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
39164514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
39174514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
39184514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Null());
39194514f5e3Sopenharmony_ci
39204514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
39214514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Trunc(ecmaRuntimeCallInfo);
39224514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
39234514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(0);
39244514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
39254514f5e3Sopenharmony_ci}
39264514f5e3Sopenharmony_ci
39274514f5e3Sopenharmony_ci// Math.trunc(true)
39284514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Trunc_3)
39294514f5e3Sopenharmony_ci{
39304514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
39314514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
39324514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
39334514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::True());
39344514f5e3Sopenharmony_ci
39354514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
39364514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Trunc(ecmaRuntimeCallInfo);
39374514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
39384514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(1.0);
39394514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
39404514f5e3Sopenharmony_ci}
39414514f5e3Sopenharmony_ci
39424514f5e3Sopenharmony_ci// Math.trunc("-0.1")
39434514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Trunc_4)
39444514f5e3Sopenharmony_ci{
39454514f5e3Sopenharmony_ci    JSHandle<EcmaString> test = thread_->GetEcmaVM()->GetFactory()->NewFromASCII("-0.1");
39464514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
39474514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
39484514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
39494514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue());
39504514f5e3Sopenharmony_ci
39514514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
39524514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Trunc(ecmaRuntimeCallInfo);
39534514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
39544514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(-0.0);
39554514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
39564514f5e3Sopenharmony_ci}
39574514f5e3Sopenharmony_ci
39584514f5e3Sopenharmony_ci// Math.trunc(Number.POSITIVE_INFINITY)
39594514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Trunc_5)
39604514f5e3Sopenharmony_ci{
39614514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
39624514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
39634514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
39644514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(base::POSITIVE_INFINITY));
39654514f5e3Sopenharmony_ci
39664514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
39674514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Trunc(ecmaRuntimeCallInfo);
39684514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
39694514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::POSITIVE_INFINITY);
39704514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
39714514f5e3Sopenharmony_ci}
39724514f5e3Sopenharmony_ci
39734514f5e3Sopenharmony_ci// Math.trunc(-NaN)
39744514f5e3Sopenharmony_ciHWTEST_F_L0(BuiltinsMathTest, Trunc_6)
39754514f5e3Sopenharmony_ci{
39764514f5e3Sopenharmony_ci    auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6);
39774514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined());
39784514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined());
39794514f5e3Sopenharmony_ci    ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(-base::NAN_VALUE));
39804514f5e3Sopenharmony_ci
39814514f5e3Sopenharmony_ci    [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo);
39824514f5e3Sopenharmony_ci    JSTaggedValue result = BuiltinsMath::Trunc(ecmaRuntimeCallInfo);
39834514f5e3Sopenharmony_ci    TestHelper::TearDownFrame(thread_, prev);
39844514f5e3Sopenharmony_ci    JSTaggedValue expect = BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
39854514f5e3Sopenharmony_ci    ASSERT_EQ(result.GetRawData(), expect.GetRawData());
39864514f5e3Sopenharmony_ci}
39874514f5e3Sopenharmony_ci}  // namespace panda::test
3988