diff --git a/uni_modules/uts-advance/utssdk/app-android/index.uts b/uni_modules/uts-advance/utssdk/app-android/index.uts index a1746d973ac05668537e116bfde63cf3a45c4ea1..e7bbff0e218d4f737db3f6802d3e67eb11564980 100644 --- a/uni_modules/uts-advance/utssdk/app-android/index.uts +++ b/uni_modules/uts-advance/utssdk/app-android/index.uts @@ -444,6 +444,8 @@ export function logFloatTest() { } export function logIntTest() { console.log(2023) + console.log(2023.0) + console.log(2023.002) } export function logObjectTest(){ diff --git a/uni_modules/uts-tests/utssdk/Array.uts b/uni_modules/uts-tests/utssdk/Array.uts index b0eac597d68b1b99d6ade175605f3e19f35cb166..6ec6872cd4cb03dacf43ea7ebacd48fe4adeee7f 100644 --- a/uni_modules/uts-tests/utssdk/Array.uts +++ b/uni_modules/uts-tests/utssdk/Array.uts @@ -176,6 +176,10 @@ export function testArray(): Result { expect(index).toEqual(3); index = array.lastIndexOf(2, 2); expect(index).toEqual(0); + + + + }) test("map", () => { const array1: number[] = [1, 4, 9, 16]; diff --git a/uni_modules/uts-tests/utssdk/Number.uts b/uni_modules/uts-tests/utssdk/Number.uts index 8c3b41743da6c6137d4b0afcc435dc674c1844dd..1e43aae6603f7e44e7eaba0eba3fce6edd08eba4 100644 --- a/uni_modules/uts-tests/utssdk/Number.uts +++ b/uni_modules/uts-tests/utssdk/Number.uts @@ -2,6 +2,7 @@ import { describe, test, expect, Result } from './tests.uts' export function testNumber(): Result { return describe("Number", () => { + test('toFixed', () => { function financial(x: Number): String { return x.toFixed(2); @@ -10,6 +11,16 @@ export function testNumber(): Result { expect(financial(0.004)).toEqual("0.00"); expect(financial(0)).toEqual("0.00"); expect(financial(1)).toEqual("1.00"); + + let num1: number = -1.1 / 0 + let num2: number = -1.1 / 0.1 + let num3: number = -1.1 / -0.1 + console.warn(num1) + console.warn(num2) + console.warn(num3) + let obj = {"id":"3be2c600-894c-4231-aa56-82fd989cc961","result":{"result":[num1, num2, num3]}} + console.log(JSON.stringify(obj)) + }) test('parseInt', () => { @@ -51,5 +62,12 @@ export function testNumber(): Result { expect((0xf).valueOf()).toEqual(15); }) + // 数据转换操作示例 + test('toX', () => { + let num = 10.123 + expect(num.toInt()).toEqual(10); + expect(num.toDouble()).toEqual(10.123); + }) + }) }