diff --git a/uni_modules/uts-tests/utssdk/Math.uts b/uni_modules/uts-tests/utssdk/Math.uts index 8e88f5da6746c075e51be6dccb49833230c2452b..9afc1ba8f2814c3b37e8d9d39023dec867122fb4 100644 --- a/uni_modules/uts-tests/utssdk/Math.uts +++ b/uni_modules/uts-tests/utssdk/Math.uts @@ -106,6 +106,14 @@ export function testMath() : Result { expect(difference(3, 5)).toEqual(2); expect(difference(5, 3)).toEqual(2); expect(difference(1.23456, 7.89012)).toEqual(6.6555599999999995); + + let utsNumber1 = JSON.parse("-160")! as Number + expect(Math.abs(utsNumber1)).toEqual(160); + + let utsNumber2 = Math.abs(0) - 0.123456 + expect(Math.abs(utsNumber2)).toEqual(0.123456); + + }) test('acos', () => { diff --git a/uni_modules/uts-tests/utssdk/Operators.uts b/uni_modules/uts-tests/utssdk/Operators.uts index 7907c3360930a6682492157931c7b7b0ce767d9a..1abe68c06bbec9502e73c68c84fb0b889b54b8ac 100644 --- a/uni_modules/uts-tests/utssdk/Operators.uts +++ b/uni_modules/uts-tests/utssdk/Operators.uts @@ -119,10 +119,19 @@ export function testOperators(): Result { // web 返回 Infinity // todo 统一处理 // expect(divide(1, 0)).toEqual(); - expect(divide(16788990011, 5)).toEqualNumber(3357798002.2); - expect(divide(16788990015, 5)).toEqualNumber(3357798003); - expectNumber(divide(16788990015, 10088990000)).toEqualDouble(1.6640902622561822); - + expect(divide(16788990011, 5)).toEqualNumber(3357798002.2); + expect(divide(16788990015, 5)).toEqualNumber(3357798003); + expectNumber(divide(16788990015, 10088990000)).toEqualDouble(1.6640902622561822); + + let utsNum1 = JSON.parse("0.123456")! as Number + let utsNum2 = JSON.parse("0.123456")! as Number + + let utsNum3 = utsNum1 / utsNum2 + expect(utsNum3).toEqualNumber(1); + + let utsNum4 = 0.030864 / utsNum2 + expect(utsNum4).toEqualNumber(0.25); + }) test('/=', () => { let a:number = 3;