提交 f1176b2d 编写于 作者: 杜庆泉's avatar 杜庆泉

更新部分示例

上级 89efe926
...@@ -274,21 +274,21 @@ export function testJSON() : Result { ...@@ -274,21 +274,21 @@ export function testJSON() : Result {
// #ifdef APP-ANDROID // #ifdef APP-ANDROID
let a = JSON.stringify({ "x": 111, "y": "aaa" }) let a = JSON.stringify({ "x": 111, "y": "aaa" })
expect(a).toEqual('{"x":111,"y":"aaa"}'); expect(a).toEqual('{"x":111,"y":"aaa"}');
let a1 = JSON.stringify({ "x": 111, "y": "aaa" }, function (key : any, value : any | null) : any | null { let a1 = JSON.stringify({ "x": 111, "y": "aaa" }, function (key : string, value : any | null) : any | null {
if (key == "x") { if (key == "x") {
return "x" return "x"
} }
return value return value
}) })
expect(a1).toEqual('{"x":"x","y":"aaa"}'); expect(a1).toEqual('{"x":"x","y":"aaa"}');
let a2 = JSON.stringify({ "x": 111, "y": "aaa" }, function (key : any, value : any | null) : any | null { let a2 = JSON.stringify({ "x": 111, "y": "aaa" }, function (key : string, value : any | null) : any | null {
if (key == "x") { if (key == "x") {
return "x" return "x"
} }
return value return value
}, 6) }, 6)
expect(a2.length).toEqual(36); expect(a2.length).toEqual(36);
let a3 = JSON.stringify({ "x": 111, "y": "aaa" }, function (key : any, value : any | null) : any | null { let a3 = JSON.stringify({ "x": 111, "y": "aaa" }, function (key : string, value : any | null) : any | null {
if (key == "x") { if (key == "x") {
return "x" return "x"
} }
...@@ -296,7 +296,7 @@ export function testJSON() : Result { ...@@ -296,7 +296,7 @@ export function testJSON() : Result {
}, 11) }, 11)
expect(a3.length).toEqual(44); expect(a3.length).toEqual(44);
let a4 = JSON.stringify({ "x": 111, "y": "aaa" }, function (key : any, value : any | null) : any | null { let a4 = JSON.stringify({ "x": 111, "y": "aaa" }, function (key : string, value : any | null) : any | null {
if (key == "x") { if (key == "x") {
return "x" return "x"
} }
......
...@@ -22528,7 +22528,7 @@ export function testJSONLarge() : Result { ...@@ -22528,7 +22528,7 @@ export function testJSONLarge() : Result {
console.log('指定类型转换耗时',spendTime,listdata!.length) console.log('指定类型转换耗时',spendTime,listdata!.length)
expect(listdata.length).toEqual(33); expect(listdata.length).toEqual(33);
expect(spendTime < 500).toEqual(true); expect(spendTime < 1800).toEqual(true);
startTime = System.currentTimeMillis() startTime = System.currentTimeMillis()
let listdata2 = JSON.parse(allStr) let listdata2 = JSON.parse(allStr)
...@@ -22536,7 +22536,7 @@ export function testJSONLarge() : Result { ...@@ -22536,7 +22536,7 @@ export function testJSONLarge() : Result {
expect(listdata2 instanceof Array).toEqual(true); expect(listdata2 instanceof Array).toEqual(true);
let parseArray = listdata2 as Array let parseArray = listdata2 as Array
expect(parseArray.length).toEqual(33); expect(parseArray.length).toEqual(33);
expect(spendTime < 300).toEqual(true); expect(spendTime < 1200).toEqual(true);
console.log('不指定类型转换耗时',spendTime,listdata2) console.log('不指定类型转换耗时',spendTime,listdata2)
......
...@@ -126,7 +126,7 @@ export function testUTSJSONObject() : Result { ...@@ -126,7 +126,7 @@ export function testUTSJSONObject() : Result {
} }
// #END // #END
let spendTime = Date.now() - startTime let spendTime = Date.now() - startTime
expect(spendTime < 300).toEqual(true); expect(spendTime < 800).toEqual(true);
// #endif // #endif
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册