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

手动增加 UTSJSONObject getSpeed测试示例

上级 73887989
import { describe, test, expect, expectNumber, Result } from './tests.uts'
export function testUTSJSONObject() : Result {
return describe("utsjsonobject", () => {
test('keys', () => {
......@@ -12,6 +10,7 @@ export function testUTSJSONObject() : Result {
expect(UTSJSONObject.keys(obj).length).toEqual(2);
console.log(UTSJSONObject.keys(obj))
})
test('toJSONObject', () => {
// #ifdef APP-ANDROID
let result = {}
......@@ -37,7 +36,6 @@ export function testUTSJSONObject() : Result {
// #endif
})
test('assign-notype', () => {
// #ifdef APP-ANDROID
const target = { a: 1, b: 2 };
......@@ -87,6 +85,24 @@ export function testUTSJSONObject() : Result {
// #endif
})
test('get-speed', () => {
// #ifdef APP-ANDROID
const utsObj: UTSJSONObject = {} as any as UTSJSONObject
for (let i = 0; i < 100; i++) {
utsObj.set('' + i, '' + i)
}
console.log('--start--')
let startTime = Date.now()
for (let i = 0; i < 10000; i++) {
utsObj.getString('0')
}
let spendTime = Date.now() - startTime
expect(spendTime < 300).toEqual(true);
// #endif
})
test('assign-withtype', () => {
// #ifdef APP-ANDROID
type User = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册