Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
Hello UTS
提交
224ac5a0
H
Hello UTS
项目概览
DCloud
/
Hello UTS
通知
1594
Star
27
Fork
9
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
2
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
Hello UTS
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
2
Issue
2
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
224ac5a0
编写于
10月 31, 2024
作者:
杜庆泉
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修复Hello uts 因为UTSNumber编译报错的bug
上级
edece136
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
23 addition
and
23 deletion
+23
-23
uni_modules/uts-tests/utssdk/Number.uts
uni_modules/uts-tests/utssdk/Number.uts
+21
-21
uni_modules/uts-tests/utssdk/UTSJSONObject.uts
uni_modules/uts-tests/utssdk/UTSJSONObject.uts
+1
-1
uni_modules/uts-tests/utssdk/console.uts
uni_modules/uts-tests/utssdk/console.uts
+1
-1
未找到文件。
uni_modules/uts-tests/utssdk/Number.uts
浏览文件 @
224ac5a0
...
@@ -69,11 +69,11 @@ export function testNumber() : Result {
...
@@ -69,11 +69,11 @@ export function testNumber() : Result {
expect(isFinite(0)).toEqual(true);
expect(isFinite(0)).toEqual(true);
// #ifdef APP-ANDROID
// #ifdef APP-ANDROID
let aj2 = JSON.parse('{"a":1}') as UTSJSONObject;
let aj2 = JSON.parse('{"a":1}') as UTSJSONObject;
let aNumber = aj2['a'] as
UTS
Number
let aNumber = aj2['a'] as Number
expect(isFinite(aNumber)).toEqual(true);
expect(isFinite(aNumber)).toEqual(true);
expect(
UTS
Number.isFinite(aNumber)).toEqual(true);
expect(Number.isFinite(aNumber)).toEqual(true);
expect(
UTS
Number.isFinite(11.00)).toEqual(true);
expect(Number.isFinite(11.00)).toEqual(true);
expect(
UTS
Number.isFinite(Double.POSITIVE_INFINITY)).toEqual(false);
expect(Number.isFinite(Double.POSITIVE_INFINITY)).toEqual(false);
// #endif
// #endif
})
})
...
@@ -138,39 +138,39 @@ export function testNumber() : Result {
...
@@ -138,39 +138,39 @@ export function testNumber() : Result {
let a = JSON.parse("1") as Number
let a = JSON.parse("1") as Number
a++;
a++;
expect(a.toString()).toEqual("2");
expect(a.toString()).toEqual("2");
expect(UTSAndroid.getJavaClass(a).name).toEqual("
io.dcloud.uts.UTSNumb
er");
expect(UTSAndroid.getJavaClass(a).name).toEqual("
java.lang.Integ
er");
a--;
a--;
expect(a.toString()).toEqual("1");
expect(a.toString()).toEqual("1");
expect(UTSAndroid.getJavaClass(a).name).toEqual("
io.dcloud.uts.UTSNumb
er");
expect(UTSAndroid.getJavaClass(a).name).toEqual("
java.lang.Integ
er");
a /= 0.5;
a /= 0.5;
expect(a.toString()).toEqual("2");
expect(a.toString()).toEqual("2");
expect(UTSAndroid.getJavaClass(a).name).toEqual("
io.dcloud.uts.UTSNumb
er");
expect(UTSAndroid.getJavaClass(a).name).toEqual("
java.lang.Integ
er");
a *= 5;
a *= 5;
expect(a.toString()).toEqual("10");
expect(a.toString()).toEqual("10");
expect(UTSAndroid.getJavaClass(a).name).toEqual("
io.dcloud.uts.UTSNumb
er");
expect(UTSAndroid.getJavaClass(a).name).toEqual("
java.lang.Integ
er");
a += -1;
a += -1;
expect(a.toString()).toEqual("9");
expect(a.toString()).toEqual("9");
expect(UTSAndroid.getJavaClass(a).name).toEqual("
io.dcloud.uts.UTSNumb
er");
expect(UTSAndroid.getJavaClass(a).name).toEqual("
java.lang.Integ
er");
a -= -2;
a -= -2;
expect(a.toString()).toEqual("11");
expect(a.toString()).toEqual("11");
expect(UTSAndroid.getJavaClass(a).name).toEqual("
io.dcloud.uts.UTSNumb
er");
expect(UTSAndroid.getJavaClass(a).name).toEqual("
java.lang.Integ
er");
let a2 = a % 5
let a2 = a % 5
expect(a2.toString()).toEqual("1");
expect(a2.toString()).toEqual("1");
expect(UTSAndroid.getJavaClass(a2).name).toEqual("
io.dcloud.uts.UTSNumb
er");
expect(UTSAndroid.getJavaClass(a2).name).toEqual("
java.lang.Integ
er");
let b = 12
let b = 12
let c1 = b + a2
let c1 = b + a2
expect(c1.toString()).toEqual("13");
expect(c1.toString()).toEqual("13");
expect(UTSAndroid.getJavaClass(c1).name).toEqual("
io.dcloud.uts.UTSNumb
er");
expect(UTSAndroid.getJavaClass(c1).name).toEqual("
java.lang.Integ
er");
let c2 = a2 + 2
let c2 = a2 + 2
expect(c2.toString()).toEqual("3");
expect(c2.toString()).toEqual("3");
expect(UTSAndroid.getJavaClass(c2).name).toEqual("
io.dcloud.uts.UTSNumb
er");
expect(UTSAndroid.getJavaClass(c2).name).toEqual("
java.lang.Integ
er");
let c3 = 2 + a2
let c3 = 2 + a2
expect(c3.toString()).toEqual("3");
expect(c3.toString()).toEqual("3");
expect(UTSAndroid.getJavaClass(c3).name).toEqual("
io.dcloud.uts.UTSNumb
er");
expect(UTSAndroid.getJavaClass(c3).name).toEqual("
java.lang.Integ
er");
// #endif
// #endif
...
@@ -180,12 +180,12 @@ export function testNumber() : Result {
...
@@ -180,12 +180,12 @@ export function testNumber() : Result {
expect(isNaN(0)).toEqual(false);
expect(isNaN(0)).toEqual(false);
// #ifdef APP-ANDROID
// #ifdef APP-ANDROID
let aj2 = JSON.parse('{"a":1}') as UTSJSONObject;
let aj2 = JSON.parse('{"a":1}') as UTSJSONObject;
let aNumber = aj2['a'] as
UTS
Number
let aNumber = aj2['a'] as Number
expect(isNaN(aNumber)).toEqual(false);
expect(isNaN(aNumber)).toEqual(false);
expect(
UTS
Number.isNaN(aNumber)).toEqual(false);
expect(Number.isNaN(aNumber)).toEqual(false);
expect(
UTS
Number.isNaN(11)).toEqual(false);
expect(Number.isNaN(11)).toEqual(false);
expect(
UTS
Number.isNaN(null)).toEqual(false);
expect(Number.isNaN(null)).toEqual(false);
expect(
UTS
Number.isNaN(1 / 0)).toEqual(false);
expect(Number.isNaN(1 / 0)).toEqual(false);
// #endif
// #endif
})
})
...
@@ -233,8 +233,8 @@ export function testNumber() : Result {
...
@@ -233,8 +233,8 @@ export function testNumber() : Result {
// #ifdef APP-ANDROID
// #ifdef APP-ANDROID
expect(0.6.toString()).toEqual("0.6");
expect(0.6.toString()).toEqual("0.6");
expect((
new UTSNumber(2709954670497349.5)).toString(
)).toEqual("2709954670497349.5");
expect((
2709954670497349.5).toString(10
)).toEqual("2709954670497349.5");
expect((
new UTSNumber
(0.00000000000001)).toString()).toEqual("1e-14");
expect(((0.00000000000001)).toString()).toEqual("1e-14");
expect((new UTSNumber(0.000001)).toString()).toEqual("0.000001");
expect((new UTSNumber(0.000001)).toString()).toEqual("0.000001");
expect((new UTSNumber(0.0000001)).toString()).toEqual("1e-7");
expect((new UTSNumber(0.0000001)).toString()).toEqual("1e-7");
expect((new UTSNumber(100000000000000000000.0)).toString()).toEqual("100000000000000000000");
expect((new UTSNumber(100000000000000000000.0)).toString()).toEqual("100000000000000000000");
...
...
uni_modules/uts-tests/utssdk/UTSJSONObject.uts
浏览文件 @
224ac5a0
...
@@ -57,7 +57,7 @@ export function testUTSJSONObject() : Result {
...
@@ -57,7 +57,7 @@ export function testUTSJSONObject() : Result {
}
}
let data2 = JSON.parse<UTSJSONObject>(JSON.stringify(data1))
let data2 = JSON.parse<UTSJSONObject>(JSON.stringify(data1))
expect(data2!.toJSONString()).toEqual('{"str":"test","num":1
.0
,"num2":2.369}')
expect(data2!.toJSONString()).toEqual('{"str":"test","num":1,"num2":2.369}')
class TestData2 implements IJSONStringify{
class TestData2 implements IJSONStringify{
toJSON():any|null{
toJSON():any|null{
...
...
uni_modules/uts-tests/utssdk/console.uts
浏览文件 @
224ac5a0
...
@@ -30,7 +30,7 @@ export function testConsole() : Result {
...
@@ -30,7 +30,7 @@ export function testConsole() : Result {
let aj2 = JSON.parse('{"a":1}') as UTSJSONObject;
let aj2 = JSON.parse('{"a":1}') as UTSJSONObject;
expect(obtainInnerObject(aj2['a']).get("type")).toEqual("
number
");
expect(obtainInnerObject(aj2['a']).get("type")).toEqual("
Int
");
expect(obtainInnerObject(aj2['a']).get("subType")).toEqual("number");
expect(obtainInnerObject(aj2['a']).get("subType")).toEqual("number");
// #endif
// #endif
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录