From 265a633de043fac58ab868f42fc3e0d11c9fda00 Mon Sep 17 00:00:00 2001 From: duqingquan Date: Fri, 16 Aug 2024 11:10:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9EUTSNumber=20=E5=8D=95?= =?UTF-8?q?=E7=9B=AE=E8=BF=90=E7=AE=97=E7=AC=A6=E6=B5=8B=E8=AF=95=E7=94=A8?= =?UTF-8?q?=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 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/uni_modules/uts-tests/utssdk/Number.uts b/uni_modules/uts-tests/utssdk/Number.uts index 1c22340..1411f96 100644 --- a/uni_modules/uts-tests/utssdk/Number.uts +++ b/uni_modules/uts-tests/utssdk/Number.uts @@ -125,6 +125,25 @@ export function testNumber() : Result { expect(Number.isInteger(-213123112.01)).toEqual(false); expect(Number.isInteger(-213123112)).toEqual(true); }) + + test('Unary-Operators', () => { + let a = JSON.parse("1") as Number + a++; + expect(a.toString()).toEqual("2"); + a--; + expect(a.toString()).toEqual("1"); + a /= 0.5; + expect(a.toString()).toEqual("2"); + a *= 5; + expect(a.toString()).toEqual("10"); + a += -1; + expect(a.toString()).toEqual("9"); + a -= -2; + expect(a.toString()).toEqual("11"); + let a2 = a % 5 + expect(a2.toString()).toEqual("1"); + + }) test('isNaN', () => { expect(isNaN(0)).toEqual(false); -- GitLab