From e8fa83a2ca47e18096b1559e6002a68124d42f00 Mon Sep 17 00:00:00 2001 From: duqingquan Date: Fri, 14 Jun 2024 17:08:56 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85UTSNumber=20=E9=83=A8?= =?UTF-8?q?=E5=88=86=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uni_modules/uts-tests/utssdk/Number.uts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/uni_modules/uts-tests/utssdk/Number.uts b/uni_modules/uts-tests/utssdk/Number.uts index 6044348..1ef6e64 100644 --- a/uni_modules/uts-tests/utssdk/Number.uts +++ b/uni_modules/uts-tests/utssdk/Number.uts @@ -70,22 +70,32 @@ export function testNumber() : Result { expect(aj?.a == 1 as number).toEqual(true); expect(aj?.a == 1.0).toEqual(true); expect(aj?.a == 1.0 as number).toEqual(true); + expect(aj?.a === 1).toEqual(true); + expect(aj?.a === 1 as number).toEqual(true); + expect(aj?.a === 1.0).toEqual(true); + expect(aj?.a === 1.0 as number).toEqual(true); let ki:Int = 1; let kd:Double = 1.0; let kf:Float = (1.0).toFloat(); expect(aj?.a == ki).toEqual(true); expect(aj?.a == kd).toEqual(true); expect(aj?.a == kf).toEqual(true); + expect(aj?.a === ki).toEqual(true); + expect(aj?.a === kd).toEqual(true); + expect(aj?.a === kf).toEqual(true); // 对比JSON.parse 和 new 得到的对象属性 let newA = A(1) expect(aj?.a == newA.a).toEqual(true); + expect(aj?.a === newA.a).toEqual(true); newA.a = 1.0 expect(aj?.a == newA.a).toEqual(true); + expect(aj?.a === newA.a).toEqual(true); newA.a = 1.1 expect(aj?.a == newA.a).toEqual(false); - + expect(aj?.a === newA.a).toEqual(false); }) + test('isInteger', () => { expect(Number.isInteger(12)).toEqual(true); expect(Number.isInteger(12.01)).toEqual(false); -- GitLab