Lines Matching refs:BigInt
40 JSHandle<BigInt> bigint1 = BigIntHelper::SetBigInt(thread, str1);
41 JSHandle<BigInt> bigint2 = BigIntHelper::SetBigInt(thread, str2);
42 JSHandle<BigInt> bigint3 = BigIntHelper::SetBigInt(thread, str3);
43 JSHandle<BigInt> bigint4 = BigIntHelper::SetBigInt(thread, str4);
44 EXPECT_EQ(BigInt::Compare(bigint1.GetTaggedValue(), bigint1.GetTaggedValue()), ComparisonResult::EQUAL);
45 EXPECT_EQ(BigInt::Compare(bigint3.GetTaggedValue(), bigint2.GetTaggedValue()), ComparisonResult::LESS);
46 EXPECT_EQ(BigInt::Compare(bigint1.GetTaggedValue(), bigint2.GetTaggedValue()), ComparisonResult::LESS);
47 EXPECT_EQ(BigInt::Compare(bigint2.GetTaggedValue(), bigint1.GetTaggedValue()), ComparisonResult::GREAT);
48 EXPECT_EQ(BigInt::Compare(bigint2.GetTaggedValue(), bigint3.GetTaggedValue()), ComparisonResult::GREAT);
49 EXPECT_EQ(BigInt::Compare(bigint3.GetTaggedValue(), bigint4.GetTaggedValue()), ComparisonResult::LESS);
50 EXPECT_EQ(BigInt::Compare(bigint4.GetTaggedValue(), bigint3.GetTaggedValue()), ComparisonResult::GREAT);
52 JSHandle<BigInt> zero = BigInt::Uint32ToBigInt(thread, 0);
53 EXPECT_EQ(BigInt::Compare(zero.GetTaggedValue(), bigint1.GetTaggedValue()), ComparisonResult::LESS);
54 EXPECT_EQ(BigInt::Compare(bigint1.GetTaggedValue(), zero.GetTaggedValue()), ComparisonResult::GREAT);
55 EXPECT_EQ(BigInt::Compare(zero.GetTaggedValue(), zero.GetTaggedValue()), ComparisonResult::EQUAL);
56 EXPECT_EQ(BigInt::Compare(zero.GetTaggedValue(), bigint3.GetTaggedValue()), ComparisonResult::GREAT);
57 EXPECT_EQ(BigInt::Compare(bigint3.GetTaggedValue(), zero.GetTaggedValue()), ComparisonResult::LESS);
69 JSHandle<BigInt> bigint = BigInt::CreateBigint(thread, size);
84 JSHandle<BigInt> maxSafeInt = BigIntHelper::SetBigInt(thread, maxSafeIntStr);
85 JSHandle<BigInt> minSafeInt = BigIntHelper::SetBigInt(thread, minSafeIntStr);
88 JSHandle<BigInt> minusMinSafeInt = BigInt::UnaryMinus(thread, minSafeInt);
89 JSHandle<BigInt> minusMaxSafeInt = BigInt::UnaryMinus(thread, maxSafeInt);
90 bool result1 = BigInt::Equal(maxSafeInt.GetTaggedValue(), minSafeInt.GetTaggedValue());
91 bool result2 = BigInt::SameValue(maxSafeInt.GetTaggedValue(), minSafeInt.GetTaggedValue());
92 bool result3 = BigInt::SameValueZero(maxSafeInt.GetTaggedValue(), minSafeInt.GetTaggedValue());
96 result1 = BigInt::Equal(maxSafeInt.GetTaggedValue(), minusMinSafeInt.GetTaggedValue());
97 result2 = BigInt::SameValue(maxSafeInt.GetTaggedValue(), minusMinSafeInt.GetTaggedValue());
98 result3 = BigInt::SameValueZero(maxSafeInt.GetTaggedValue(), minusMinSafeInt.GetTaggedValue());
102 result1 = BigInt::Equal(minSafeInt.GetTaggedValue(), minusMaxSafeInt.GetTaggedValue());
103 result2 = BigInt::SameValue(minSafeInt.GetTaggedValue(), minusMaxSafeInt.GetTaggedValue());
104 result3 = BigInt::SameValueZero(minSafeInt.GetTaggedValue(), minusMaxSafeInt.GetTaggedValue());
112 JSHandle<BigInt> unsafeInt1 = BigIntHelper::SetBigInt(thread, unsafeIntStr1);
113 JSHandle<BigInt> unsafeInt2 = BigIntHelper::SetBigInt(thread, unsafeIntStr2);
114 JSHandle<BigInt> minusUnsafeInt1 = BigInt::UnaryMinus(thread, unsafeInt1);
115 result1 = BigInt::Equal(unsafeInt2.GetTaggedValue(), minusUnsafeInt1.GetTaggedValue());
116 result2 = BigInt::SameValue(unsafeInt2.GetTaggedValue(), minusUnsafeInt1.GetTaggedValue());
117 result3 = BigInt::SameValueZero(unsafeInt2.GetTaggedValue(), minusUnsafeInt1.GetTaggedValue());
132 JSHandle<BigInt> maxSafeIntPlusOne = BigIntHelper::SetBigInt(thread, maxSafeIntPlusOneStr);
162 JSHandle<BigInt> maxSafeInt = BigIntHelper::SetBigInt(thread, maxSafeIntStr, BigInt::BINARY);
163 JSHandle<BigInt> maxSafeIntPlusOne = BigIntHelper::SetBigInt(thread, maxSafeIntPlusOneStr, BigInt::BINARY);
164 JSHandle<BigInt> bigint1 = BigIntHelper::SetBigInt(thread, bigintStr1, BigInt::BINARY);
165 JSHandle<BigInt> bigint2 = BigIntHelper::SetBigInt(thread, bigintStr2, BigInt::BINARY);
166 JSHandle<BigInt> bigint3 = BigInt::UnaryMinus(thread, bigint2);
167 JSHandle<BigInt> bigint4 = BigInt::UnaryMinus(thread, bigint1);
169 JSHandle<BigInt> addOpRes = BigInt::BitwiseOp(thread, Operate::AND, maxSafeIntPlusOne, bigint1);
170 JSHandle<BigInt> andRes = BigInt::BitwiseAND(thread, maxSafeIntPlusOne, bigint1);
171 EXPECT_TRUE(BigInt::Equal(addOpRes.GetTaggedValue(), maxSafeIntPlusOne.GetTaggedValue()));
172 EXPECT_TRUE(BigInt::Equal(andRes.GetTaggedValue(), maxSafeIntPlusOne.GetTaggedValue()));
174 JSHandle<BigInt> addOpRes1 = BigInt::BitwiseOp(thread, Operate::AND, bigint1, bigint2);
175 JSHandle<BigInt> andRes1 = BigInt::BitwiseAND(thread, bigint1, bigint2);
176 EXPECT_TRUE(BigInt::Equal(addOpRes1.GetTaggedValue(), bigint2.GetTaggedValue()));
177 EXPECT_TRUE(BigInt::Equal(andRes1.GetTaggedValue(), bigint2.GetTaggedValue()));
179 JSHandle<BigInt> addOpRes2 = BigInt::BitwiseOp(thread, Operate::AND, bigint2, bigint1);
180 JSHandle<BigInt> andRes2 = BigInt::BitwiseAND(thread, bigint2, bigint1);
181 EXPECT_TRUE(BigInt::Equal(addOpRes2.GetTaggedValue(), bigint2.GetTaggedValue()));
182 EXPECT_TRUE(BigInt::Equal(andRes2.GetTaggedValue(), bigint2.GetTaggedValue()));
185 JSHandle<BigInt> bigint = BigIntHelper::SetBigInt(thread, bigintStr4, BigInt::BINARY);
186 JSHandle<BigInt> andRes3 = BigInt::BitwiseAND(thread, bigint3, bigint1);
187 EXPECT_TRUE(BigInt::Equal(andRes3.GetTaggedValue(), bigint.GetTaggedValue()));
189 JSHandle<BigInt> andRes4 = BigInt::BitwiseAND(thread, bigint1, bigint3);
190 EXPECT_TRUE(BigInt::Equal(andRes4.GetTaggedValue(), bigint.GetTaggedValue()));
193 JSHandle<BigInt> bigint5 = BigIntHelper::SetBigInt(thread, bigintStr5, BigInt::BINARY);
194 JSHandle<BigInt> andRes5 = BigInt::BitwiseAND(thread, bigint3, bigint4);
195 EXPECT_TRUE(BigInt::Equal(andRes5.GetTaggedValue(), bigint5.GetTaggedValue()));
198 JSHandle<BigInt> bigint6 = BigIntHelper::SetBigInt(thread, bigintStr6, BigInt::BINARY);
199 JSHandle<BigInt> andRes6 = BigInt::BitwiseAND(thread, bigint4, bigint3);
200 EXPECT_TRUE(BigInt::Equal(andRes6.GetTaggedValue(), bigint6.GetTaggedValue()));
203 JSHandle<BigInt> orOpRes = BigInt::BitwiseOp(thread, Operate::OR, maxSafeInt, maxSafeIntPlusOne);
204 JSHandle<BigInt> orRes = BigInt::BitwiseOR(thread, maxSafeInt, maxSafeIntPlusOne);
205 EXPECT_TRUE(BigInt::Equal(orOpRes.GetTaggedValue(), bigint1.GetTaggedValue()));
206 EXPECT_TRUE(BigInt::Equal(orRes.GetTaggedValue(), bigint1.GetTaggedValue()));
208 JSHandle<BigInt> orRes1 = BigInt::BitwiseOR(thread, bigint3, maxSafeIntPlusOne);
209 EXPECT_TRUE(BigInt::Equal(orRes1.GetTaggedValue(), bigint3.GetTaggedValue()));
211 JSHandle<BigInt> orRes2 = BigInt::BitwiseOR(thread, maxSafeIntPlusOne, bigint3);
212 EXPECT_TRUE(BigInt::Equal(orRes2.GetTaggedValue(), bigint3.GetTaggedValue()));
215 JSHandle<BigInt> bigint7 = BigIntHelper::SetBigInt(thread, bigintStr7, BigInt::BINARY);
216 JSHandle<BigInt> orRes3 = BigInt::BitwiseOR(thread, bigint3, bigint4);
217 EXPECT_TRUE(BigInt::Equal(orRes3.GetTaggedValue(), bigint7.GetTaggedValue()));
220 JSHandle<BigInt> xorOpRes = BigInt::BitwiseOp(thread, Operate::XOR, maxSafeIntPlusOne, bigint1);
221 JSHandle<BigInt> xorRes = BigInt::BitwiseXOR(thread, maxSafeIntPlusOne, bigint1);
222 EXPECT_TRUE(BigInt::Equal(xorOpRes.GetTaggedValue(), maxSafeInt.GetTaggedValue()));
223 EXPECT_TRUE(BigInt::Equal(xorRes.GetTaggedValue(), maxSafeInt.GetTaggedValue()));
226 JSHandle<BigInt> bigint8 = BigIntHelper::SetBigInt(thread, bigintStr8, BigInt::BINARY);
227 JSHandle<BigInt> xorRes1 = BigInt::BitwiseXOR(thread, bigint3, maxSafeIntPlusOne);
228 EXPECT_TRUE(BigInt::Equal(xorRes1.GetTaggedValue(), bigint8.GetTaggedValue()));
230 JSHandle<BigInt> xorRes2 = BigInt::BitwiseXOR(thread, maxSafeIntPlusOne, bigint3);
231 EXPECT_TRUE(BigInt::Equal(xorRes2.GetTaggedValue(), bigint8.GetTaggedValue()));
234 JSHandle<BigInt> bigint9 = BigIntHelper::SetBigInt(thread, bigintStr9, BigInt::BINARY);
235 JSHandle<BigInt> xorRes3 = BigInt::BitwiseXOR(thread, bigint3, bigint4);
236 EXPECT_TRUE(BigInt::Equal(xorRes3.GetTaggedValue(), bigint9.GetTaggedValue()));
239 JSHandle<BigInt> notRes1 = BigInt::BitwiseNOT(thread, maxSafeInt);
240 JSHandle<BigInt> minusMaxSafeInt = BigInt::UnaryMinus(thread, maxSafeIntPlusOne);
242 EXPECT_TRUE(BigInt::Equal(notRes1.GetTaggedValue(), minusMaxSafeInt.GetTaggedValue()));
243 JSHandle<BigInt> notRes2 = BigInt::BitwiseNOT(thread, minusMaxSafeInt);
245 EXPECT_TRUE(BigInt::Equal(notRes2.GetTaggedValue(), maxSafeInt.GetTaggedValue()));
249 JSHandle<BigInt> subOneRes = BigInt::BitwiseSubOne(thread, maxSafeIntPlusOne, maxSize);
250 EXPECT_TRUE(BigInt::Equal(subOneRes.GetTaggedValue(), maxSafeInt.GetTaggedValue()));
253 JSHandle<BigInt> addOneRes = BigInt::BitwiseAddOne(thread, maxSafeInt);
254 JSHandle<BigInt> minusMaxSafePlusOneInt = BigInt::UnaryMinus(thread, maxSafeIntPlusOne);
255 EXPECT_TRUE(BigInt::Equal(addOneRes.GetTaggedValue(), minusMaxSafePlusOneInt.GetTaggedValue()));
257 JSHandle<BigInt> newBigint = BigInt::CreateBigint(thread, 2);
260 JSHandle<BigInt> addOneRes1 = BigInt::BitwiseAddOne(thread, newBigint);
262 JSHandle<BigInt> newBigint1 = BigInt::CreateBigint(thread, 3);
266 EXPECT_TRUE(BigInt::Equal(addOneRes1.GetTaggedValue(), newBigint1.GetTaggedValue()));
279 JSHandle<BigInt> bigint1 = BigIntHelper::SetBigInt(thread, bigintStdStr1, BigInt::BINARY);
280 JSHandle<BigInt> bigint2 = BigIntHelper::SetBigInt(thread, bigintStdStr2, BigInt::DECIMAL);
282 JSHandle<EcmaString> bigintEcmaStrBin1 = BigInt::ToString(thread, bigint1, BigInt::BINARY);
285 JSHandle<EcmaString> bigintEcmaStrOct1 = BigInt::ToString(thread, bigint1, BigInt::OCTAL);
287 JSHandle<EcmaString> bigintEcmaStrDec1 = BigInt::ToString(thread, bigint1, BigInt::DECIMAL);
289 JSHandle<EcmaString> bigintEcmaStrHex1 = BigInt::ToString(thread, bigint1, BigInt::HEXADECIMAL);
292 JSHandle<EcmaString> bigintEcmaStrBin2 = BigInt::ToString(thread, bigint2, BigInt::BINARY);
296 (bigint2->ToStdString(BigInt::BINARY)).c_str());
298 JSHandle<EcmaString> bigintEcmaStrOct2 = BigInt::ToString(thread, bigint2, BigInt::OCTAL);
301 (bigint2->ToStdString(BigInt::OCTAL)).c_str());
303 JSHandle<EcmaString> bigintEcmaStrDec2 = BigInt::ToString(thread, bigint2, BigInt::DECIMAL);
306 (bigint2->ToStdString(BigInt::DECIMAL)).c_str());
308 JSHandle<EcmaString> bigintEcmaStrHex2 = BigInt::ToString(thread, bigint2, BigInt::HEXADECIMAL);
311 (bigint2->ToStdString(BigInt::HEXADECIMAL)).c_str());
326 JSHandle<BigInt> maxSafeInt = BigIntHelper::SetBigInt(thread, maxSafeIntStr);
327 JSHandle<BigInt> minSafeInt = BigIntHelper::SetBigInt(thread, minSafeIntStr);
328 JSHandle<BigInt> maxSafeIntPlusOne = BigIntHelper::SetBigInt(thread, maxSafeIntPlusOneStr);
329 JSHandle<BigInt> minSafeIntSubOne = BigIntHelper::SetBigInt(thread, minSafeIntSubOneStr);
331 JSHandle<BigInt> minusRes1 = BigInt::UnaryMinus(thread, maxSafeInt);
332 EXPECT_TRUE(BigInt::Equal(minusRes1.GetTaggedValue(), minSafeInt.GetTaggedValue()));
333 JSHandle<BigInt> minusRes2 = BigInt::UnaryMinus(thread, minSafeInt);
334 EXPECT_TRUE(BigInt::Equal(minusRes2.GetTaggedValue(), maxSafeInt.GetTaggedValue()));
335 JSHandle<BigInt> minusRes3 = BigInt::UnaryMinus(thread, maxSafeIntPlusOne);
336 EXPECT_TRUE(BigInt::Equal(minusRes3.GetTaggedValue(), minSafeIntSubOne.GetTaggedValue()));
337 JSHandle<BigInt> minusRes4 = BigInt::UnaryMinus(thread, minSafeIntSubOne);
338 EXPECT_TRUE(BigInt::Equal(minusRes4.GetTaggedValue(), maxSafeIntPlusOne.GetTaggedValue()));
340 JSHandle<BigInt> zero = BigInt::Int32ToBigInt(thread, 0);
341 JSHandle<BigInt> minusRes5 = BigInt::UnaryMinus(thread, zero);
343 EXPECT_TRUE(BigInt::Equal(zero.GetTaggedValue(), minusRes5.GetTaggedValue()));
361 JSHandle<BigInt> baseBigint = BigIntHelper::SetBigInt(thread, baseBigintStr);
362 JSHandle<BigInt> expBigint1 = BigIntHelper::SetBigInt(thread, expBigintStr1);
363 JSHandle<BigInt> expBigint2 = BigIntHelper::SetBigInt(thread, expBigintStr2);
364 JSHandle<BigInt> resBigint1 = BigIntHelper::SetBigInt(thread, resBigintStr1);
365 JSHandle<BigInt> resBigint2 = BigIntHelper::SetBigInt(thread, resBigintStr2);
366 JSHandle<BigInt> resBigint3 = BigIntHelper::SetBigInt(thread, resBigintStr3);
367 JSHandle<BigInt> resBigint4 = BigIntHelper::SetBigInt(thread, resBigintStr4);
368 JSHandle<BigInt> resBigint5 = BigInt::Int32ToBigInt(thread, -1);
369 JSHandle<BigInt> zero = BigInt::Int32ToBigInt(thread, 0);
371 JSHandle<BigInt> expRes1 = BigInt::Exponentiate(thread, baseBigint, expBigint1);
372 EXPECT_TRUE(BigInt::Equal(expRes1.GetTaggedValue(), resBigint1.GetTaggedValue()));
373 JSHandle<BigInt> expRes2 = BigInt::Exponentiate(thread, baseBigint, expBigint2);
374 EXPECT_TRUE(BigInt::Equal(expRes2.GetTaggedValue(), resBigint2.GetTaggedValue()));
375 JSHandle<BigInt> expRes3 = BigInt::Exponentiate(thread, baseBigint, resBigint5);
379 JSHandle<BigInt> mulRes1 = BigInt::Multiply(thread, baseBigint, baseBigint);
381 mulRes1 = BigInt::Multiply(thread, mulRes1, baseBigint);
383 EXPECT_TRUE(BigInt::Equal(mulRes1.GetTaggedValue(), resBigint1.GetTaggedValue()));
384 JSHandle<BigInt> mulRes2 = BigInt::Multiply(thread, baseBigint, baseBigint);
386 mulRes2 = BigInt::Multiply(thread, mulRes2, baseBigint);
388 EXPECT_TRUE(BigInt::Equal(mulRes2.GetTaggedValue(), resBigint2.GetTaggedValue()));
389 JSHandle<BigInt> mulRes3 = BigInt::Multiply(thread, resBigint1, resBigint2);
390 EXPECT_TRUE(BigInt::Equal(mulRes3.GetTaggedValue(), resBigint3.GetTaggedValue()));
394 JSHandle<BigInt> divRes1 = BigInt::Divide(thread, resBigint3, resBigint2);
395 EXPECT_TRUE(BigInt::Equal(divRes1.GetTaggedValue(), resBigint1.GetTaggedValue()));
396 JSHandle<BigInt> divRes2 = BigInt::Divide(thread, resBigint3, resBigint1);
397 EXPECT_TRUE(BigInt::Equal(divRes2.GetTaggedValue(), resBigint2.GetTaggedValue()));
399 JSHandle<BigInt> divRes3 = BigInt::Divide(thread, resBigint4, resBigint1);
400 EXPECT_TRUE(BigInt::Equal(divRes3.GetTaggedValue(), resBigint2.GetTaggedValue()));
401 JSHandle<BigInt> divRes4 = BigInt::Divide(thread, resBigint4, resBigint2);
402 EXPECT_TRUE(BigInt::Equal(divRes4.GetTaggedValue(), resBigint1.GetTaggedValue()));
403 JSHandle<BigInt> divRes5 = BigInt::Divide(thread, baseBigint, zero);
406 JSHandle<BigInt> divRes6 = BigInt::Divide(thread, expBigint2, baseBigint);
407 JSHandle<BigInt> expectRes6 = BigInt::Int32ToBigInt(thread, 27); // 27 : Expected calculation results
408 EXPECT_TRUE(BigInt::Equal(divRes6.GetTaggedValue(), expectRes6.GetTaggedValue()));
409 JSHandle<BigInt> divRes7 = BigInt::Divide(thread, expBigint1, baseBigint);
410 JSHandle<BigInt> expectRes7 = BigInt::Int32ToBigInt(thread, 26); // 26 : Expected calculation results
411 EXPECT_TRUE(BigInt::Equal(divRes7.GetTaggedValue(), expectRes7.GetTaggedValue()));
414 JSHandle<BigInt> remRes1 = BigInt::Remainder(thread, resBigint4, resBigint1);
415 EXPECT_TRUE(BigInt::Equal(remRes1.GetTaggedValue(), expBigint2.GetTaggedValue()));
416 JSHandle<BigInt> remRes2 = BigInt::Remainder(thread, resBigint4, resBigint2);
417 EXPECT_TRUE(BigInt::Equal(remRes2.GetTaggedValue(), expBigint2.GetTaggedValue()));
418 JSHandle<BigInt> remRes3 = BigInt::Remainder(thread, resBigint4, resBigint3);
419 EXPECT_TRUE(BigInt::Equal(remRes3.GetTaggedValue(), expBigint2.GetTaggedValue()));
420 JSHandle<BigInt> remRes4 = BigInt::Remainder(thread, baseBigint, zero);
423 JSHandle<BigInt> remRes5 = BigInt::Remainder(thread, expBigint2, baseBigint);
424 EXPECT_TRUE(BigInt::Equal(remRes5.GetTaggedValue(), zero.GetTaggedValue()));
425 JSHandle<BigInt> remRes6 = BigInt::Remainder(thread, expBigint1, baseBigint);
426 JSHandle<BigInt> expect = BigInt::Int32ToBigInt(thread, 1);
427 EXPECT_TRUE(BigInt::Equal(remRes6.GetTaggedValue(), expect.GetTaggedValue()));
444 JSHandle<BigInt> resBigint1 = BigIntHelper::SetBigInt(thread, resBigintStr1);
445 JSHandle<BigInt> resBigint2 = BigIntHelper::SetBigInt(thread, resBigintStr2);
446 JSHandle<BigInt> resBigint3 = BigIntHelper::SetBigInt(thread, resBigintStr3);
447 JSHandle<BigInt> resBigint4 = BigIntHelper::SetBigInt(thread, resBigintStr4);
448 JSHandle<BigInt> resBigint5 = BigIntHelper::SetBigInt(thread, resBigintStr5);
469 JSHandle<BigInt> resBigint1 = BigIntHelper::SetBigInt(thread, resBigintStr1);
470 JSHandle<BigInt> resBigint2 = BigIntHelper::SetBigInt(thread, resBigintStr2);
471 JSHandle<BigInt> resBigint3 = BigIntHelper::SetBigInt(thread, resBigintStr3);
486 // JSHandle<BigInt> BigInt::Int64ToBigInt(JSThread *thread, const int64_t &number)
487 JSHandle<BigInt> resBigint1 = BigInt::Int64ToBigInt(thread, LLONG_MAX);
488 JSHandle<BigInt> resBigint2 = BigInt::Int64ToBigInt(thread, LLONG_MIN);
489 JSHandle<BigInt> resBigint3 = BigInt::Int64ToBigInt(thread, INT_MAX);
490 JSHandle<BigInt> resBigint4 = BigInt::Int64ToBigInt(thread, INT_MIN);
491 JSHandle<BigInt> resBigint5 = BigInt::Int64ToBigInt(thread, 0);
508 JSHandle<BigInt> resBigint1 = BigInt::Uint64ToBigInt(thread, ULLONG_MAX);
509 JSHandle<BigInt> resBigint2 = BigInt::Uint64ToBigInt(thread, UINT_MAX);
510 JSHandle<BigInt> resBigint3 = BigInt::Uint64ToBigInt(thread, 0);
517 void GetWordsArray(bool *signBit, size_t wordCount, uint64_t *words, JSHandle<BigInt> bigintVal)
545 JSHandle<BigInt> bigintFalse = BigInt::CreateBigWords(thread, false, wordCount, words);
554 JSHandle<BigInt> bigintTrue = BigInt::CreateBigWords(thread, true, wordCount, words);
563 JSHandle<BigInt> bigintFalse1 = BigInt::CreateBigWords(thread, false, wordCount1, words1);
575 JSHandle<BigInt> bigint1 = BigInt::CreateBigWords(thread, true, wordCount2, words2);
578 BigInt::CreateBigWords(thread, true, INT_MAX, words2);
591 JSHandle<BigInt> exponent = BigInt::Int32ToBigInt(thread, 64); // 64 : bits
592 JSHandle<BigInt> exponentone = BigInt::Int32ToBigInt(thread, 63); // 63 : bits
593 JSHandle<BigInt> base = BigInt::Int32ToBigInt(thread, 2); // 2 : base value
594 JSHandle<BigInt> uint64MaxBigint1 = BigInt::Exponentiate(thread, base, exponent);
595 JSHandle<BigInt> uint64MaxBigint2 = BigInt::GetUint64MaxBigInt(thread);
596 EXPECT_TRUE(BigInt::Equal(uint64MaxBigint1.GetTaggedValue(), uint64MaxBigint2.GetTaggedValue()));
597 JSHandle<BigInt> int64MaxBigint1 = BigInt::Exponentiate(thread, base, exponentone);
598 JSHandle<BigInt> int64MaxBigint2 = BigInt::GetInt64MaxBigInt(thread);
599 EXPECT_TRUE(BigInt::Equal(int64MaxBigint1.GetTaggedValue(), int64MaxBigint2.GetTaggedValue()));
610 JSHandle<BigInt> resBigint1 = BigInt::Int32ToBigInt(thread, std::numeric_limits<int32_t>::max());
611 JSHandle<BigInt> resBigint2 = BigInt::Int32ToBigInt(thread, std::numeric_limits<int32_t>::min());
612 JSHandle<BigInt> resBigint3 = BigInt::Int32ToBigInt(thread, 0);
630 JSHandle<BigInt> resBigint1 = BigInt::Uint32ToBigInt(thread, std::numeric_limits<uint32_t>::max());
631 JSHandle<BigInt> resBigint2 = BigInt::Uint32ToBigInt(thread, std::numeric_limits<uint32_t>::min());
632 JSHandle<BigInt> resBigint3 = BigInt::Uint32ToBigInt(thread, 0);
650 JSHandle<BigInt> resBigint1 = BigInt::Int64ToBigInt(thread, LLONG_MAX);
651 JSHandle<BigInt> resBigint2 = BigInt::Int64ToBigInt(thread, LLONG_MIN);
652 JSHandle<BigInt> resBigint3 = BigInt::Int64ToBigInt(thread, INT_MAX);
653 JSHandle<BigInt> resBigint4 = BigInt::Int64ToBigInt(thread, INT_MIN);
654 JSHandle<BigInt> resBigint5 = BigInt::Int64ToBigInt(thread, 0);
657 BigInt::BigIntToInt64(thread, JSHandle<JSTaggedValue>(resBigint1), &cValue, &lossless);
660 BigInt::BigIntToInt64(thread, JSHandle<JSTaggedValue>(resBigint2), &cValue, &lossless);
663 BigInt::BigIntToInt64(thread, JSHandle<JSTaggedValue>(resBigint3), &cValue, &lossless);
666 BigInt::BigIntToInt64(thread, JSHandle<JSTaggedValue>(resBigint4), &cValue, &lossless);
669 BigInt::BigIntToInt64(thread, JSHandle<JSTaggedValue>(resBigint5), &cValue, &lossless);
673 JSHandle<BigInt> resBigint6 = BigInt::CreateBigint(thread, 3); // 3 : bigint length
678 BigInt::BigIntToInt64(thread, JSHandle<JSTaggedValue>(resBigint6), &cValue, &lossless);
684 BigInt::BigIntToInt64(thread, JSHandle<JSTaggedValue>(resBigint6), &cValue, &lossless);
697 JSHandle<BigInt> resBigint1 = BigInt::Uint64ToBigInt(thread, ULLONG_MAX);
698 JSHandle<BigInt> resBigint2 = BigInt::Uint64ToBigInt(thread, UINT_MAX);
699 JSHandle<BigInt> resBigint3 = BigInt::Uint64ToBigInt(thread, 0);
703 BigInt::BigIntToUint64(thread, JSHandle<JSTaggedValue>(resBigint1), &cValue, &lossless);
706 BigInt::BigIntToUint64(thread, JSHandle<JSTaggedValue>(resBigint2), &cValue, &lossless);
709 BigInt::BigIntToUint64(thread, JSHandle<JSTaggedValue>(resBigint3), &cValue, &lossless);
713 JSHandle<BigInt> resBigint4 = BigInt::CreateBigint(thread, 3); // 3 : bigint length
718 BigInt::BigIntToUint64(thread, JSHandle<JSTaggedValue>(resBigint4), &cValue, &lossless);
731 JSHandle<BigInt> resBigint = BigInt::CreateBigint(thread, 2); // 2 : bigint length
735 JSHandle<BigInt> resBigint1 = BigInt::CreateBigint(thread, 2); // 2 : bigint length
739 JSHandle<BigInt> addres = BigInt::Add(thread, resBigint, resBigint1);
742 JSHandle<BigInt> addres1 = BigInt::Add(thread, resBigint1, resBigint);
746 JSHandle<BigInt> resBigint2 = BigInt::Int32ToBigInt(thread, 1);
747 JSHandle<BigInt> addres2 = BigInt::Add(thread, resBigint2, resBigint);
752 JSHandle<BigInt> addres3 = BigInt::Add(thread, resBigint2, resBigint1);
766 JSHandle<BigInt> resBigint = BigInt::CreateBigint(thread, 2); // 2 : bigint length
769 JSHandle<BigInt> resBigint1 = BigInt::CreateBigint(thread, 2); // 2 : bigint length
773 JSHandle<BigInt> addres = BigInt::Subtract(thread, resBigint1, resBigint);
776 JSHandle<BigInt> addres1 = BigInt::Subtract(thread, resBigint1, resBigint);
780 JSHandle<BigInt> resBigint2 = BigInt::Int32ToBigInt(thread, -1);
782 JSHandle<BigInt> addres2 = BigInt::Subtract(thread, resBigint, resBigint2);
783 EXPECT_TRUE(BigInt::Equal(addres2.GetTaggedValue(), resBigint1.GetTaggedValue()));
794 JSHandle<BigInt> resBigint = BigInt::Int32ToBigInt(thread, -1);
796 JSHandle<BigInt> addres = BigInt::BigintSubOne(thread, resBigint);
800 JSHandle<BigInt> resBigint1 = BigInt::Int32ToBigInt(thread, 1);
801 JSHandle<BigInt> addres1 = BigInt::BigintSubOne(thread, resBigint1);
815 JSHandle<BigInt> bigint1 = BigIntHelper::SetBigInt(thread, bigintStr1, BigInt::BINARY);
816 JSHandle<BigInt> shift1 = BigInt::Int32ToBigInt(thread, 20); // 20 : shiftBits
817 JSHandle<BigInt> res1 = BigInt::SignedRightShift(thread, bigint1, shift1);
820 JSHandle<BigInt> expectRes1 = BigIntHelper::SetBigInt(thread, expectResStr1, BigInt::BINARY);
821 EXPECT_TRUE(BigInt::Equal(res1.GetTaggedValue(), expectRes1.GetTaggedValue()));
823 JSHandle<BigInt> shift2 = BigInt::Int32ToBigInt(thread, 0);
824 JSHandle<BigInt> res2 = BigInt::SignedRightShift(thread, bigint1, shift2);
825 EXPECT_TRUE(BigInt::Equal(res2.GetTaggedValue(), bigint1.GetTaggedValue()));
827 JSHandle<BigInt> res3 = BigInt::SignedRightShift(thread, shift2, bigint1);
828 EXPECT_TRUE(BigInt::Equal(res3.GetTaggedValue(), shift2.GetTaggedValue()));
830 JSHandle<BigInt> shift3 = BigInt::Int32ToBigInt(thread, -33); // -33 : shiftBits
831 JSHandle<BigInt> res4 = BigInt::SignedRightShift(thread, bigint1, shift3);
834 JSHandle<BigInt> expectRes4 = BigIntHelper::SetBigInt(thread, expectResStr4, BigInt::BINARY);
835 EXPECT_TRUE(BigInt::Equal(res4.GetTaggedValue(), expectRes4.GetTaggedValue()));
838 JSHandle<BigInt> bigint2 = BigInt::UnaryMinus(thread, bigint1);
842 JSHandle<BigInt> expectRes5 = BigIntHelper::SetBigInt(thread, expectResStr5, BigInt::BINARY);
843 JSHandle<BigInt> res5 = BigInt::SignedRightShift(thread, bigint2, shift1);
844 EXPECT_TRUE(BigInt::Equal(res5.GetTaggedValue(), expectRes5.GetTaggedValue()));
848 JSHandle<BigInt> expectRes6 = BigIntHelper::SetBigInt(thread, expectResStr6, BigInt::BINARY);
849 JSHandle<BigInt> res6 = BigInt::SignedRightShift(thread, bigint2, shift3);
850 EXPECT_TRUE(BigInt::Equal(res6.GetTaggedValue(), expectRes6.GetTaggedValue()));
852 JSHandle<BigInt> res7 = BigInt::SignedRightShift(thread, shift3, bigint1);
853 JSHandle<BigInt> expectRes7 = BigInt::Int32ToBigInt(thread, -1);
854 EXPECT_TRUE(BigInt::Equal(res7.GetTaggedValue(), expectRes7.GetTaggedValue()));
856 JSHandle<BigInt> shift4 = BigInt::Int32ToBigInt(thread, 65); // 65 : shiftBits
857 JSHandle<BigInt> res8 = BigInt::SignedRightShift(thread, shift3, shift4);
858 EXPECT_TRUE(BigInt::Equal(res8.GetTaggedValue(), expectRes7.GetTaggedValue()));
871 JSHandle<BigInt> bigint1 = BigIntHelper::SetBigInt(thread, bigintStr1, BigInt::BINARY);
872 JSHandle<BigInt> shift1 = BigInt::Int32ToBigInt(thread, 20); // 20 : shiftBits
873 JSHandle<BigInt> res1 = BigInt::LeftShift(thread, bigint1, shift1);
877 JSHandle<BigInt> expectRes1 = BigIntHelper::SetBigInt(thread, expectResStr1, BigInt::BINARY);
878 EXPECT_TRUE(BigInt::Equal(res1.GetTaggedValue(), expectRes1.GetTaggedValue()));
880 JSHandle<BigInt> shift2 = BigInt::Int32ToBigInt(thread, 0);
881 JSHandle<BigInt> res2 = BigInt::LeftShift(thread, bigint1, shift2);
882 EXPECT_TRUE(BigInt::Equal(res2.GetTaggedValue(), bigint1.GetTaggedValue()));
884 JSHandle<BigInt> shift3 = BigInt::Int32ToBigInt(thread, -33); // -33 : shiftBits
885 JSHandle<BigInt> res4 = BigInt::LeftShift(thread, bigint1, shift3);
887 JSHandle<BigInt> expectRes4 = BigIntHelper::SetBigInt(thread, expectResStr4, BigInt::BINARY);
888 EXPECT_TRUE(BigInt::Equal(res4.GetTaggedValue(), expectRes4.GetTaggedValue()));
891 JSHandle<BigInt> bigint2 = BigInt::UnaryMinus(thread, bigint1);
895 JSHandle<BigInt> expectRes5 = BigIntHelper::SetBigInt(thread, expectResStr5, BigInt::BINARY);
896 JSHandle<BigInt> res5 = BigInt::LeftShift(thread, bigint2, shift1);
897 EXPECT_TRUE(BigInt::Equal(res5.GetTaggedValue(), expectRes5.GetTaggedValue()));
900 JSHandle<BigInt> expectRes6 = BigIntHelper::SetBigInt(thread, expectResStr6, BigInt::BINARY);
901 JSHandle<BigInt> res6 = BigInt::LeftShift(thread, bigint2, shift3);
902 EXPECT_TRUE(BigInt::Equal(res6.GetTaggedValue(), expectRes6.GetTaggedValue()));