diff --git a/uni_modules/uts-tests/utssdk/Global.uts b/uni_modules/uts-tests/utssdk/Global.uts index 92e135e8a511283eb02a0606836c8994a72528e3..b36b15dac82f5d14c34366c7c4d23eb4e6ef77ba 100644 --- a/uni_modules/uts-tests/utssdk/Global.uts +++ b/uni_modules/uts-tests/utssdk/Global.uts @@ -32,9 +32,9 @@ export function testGlobal(): Result { expect(isNaN(parseInt("345", 2))).toEqual(true) expect(isNaN(parseInt("hello"))).toEqual(true) expect(parseInt("6.022e23")).toEqual(6) - expect(parseInt("9223372036854775807")).toEqual(9.223372036854778e+18) - expect(parseInt("9223372036854775807000")).toEqual(9.223372036854777e+21) - expect(parseInt("922337203685477580700099999999999999999999999999999999999999999999999999999999999999999")).toEqual(9.223372036854776e+86) + expect(parseInt("9223372036854775807")).toEqualNumber(9.223372036854778e+18) + expect(parseInt("9223372036854775807000")).toEqualNumber(9.223372036854777e+21) + expect(parseInt("922337203685477580700099999999999999999999999999999999999999999999999999999999999999999")).toEqualNumber(9.223372036854776e+86) expect(parseInt("50") / 100).toEqualNumber(0.5); expect(parseInt("500") / 100).toEqualNumber(5); diff --git a/uni_modules/uts-tests/utssdk/Number.uts b/uni_modules/uts-tests/utssdk/Number.uts index 8775305759cc869d9aafb8186f5165b34e2c8df8..a9ab25ee65d71cddf7108825e6e36932a2838f99 100644 --- a/uni_modules/uts-tests/utssdk/Number.uts +++ b/uni_modules/uts-tests/utssdk/Number.uts @@ -98,7 +98,13 @@ export function testNumber() : Result { expect(a.toString(2).substring(0,32)).toEqual("10010110011101101001100101010000"); expect(a.toString(2).substring(100)).toEqual("000000000000000000000000000"); const b = 1e22 - expect(b.toString(12)).toEqual("27373a86ba1a194a65054"); + const bStr12 = b.toString(12) + /** + * 移动端: 27373a86ba1a194a65054 + * 浏览器端:27373a86ba1a195400000 + */ + expect(bStr12.length).toEqual(21); + expect(bStr12.substring(0,14)).toEqual("27373a86ba1a19"); })