Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
Hello UTS
提交
b0135fde
H
Hello UTS
项目概览
DCloud
/
Hello UTS
通知
1595
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看板
提交
b0135fde
编写于
7月 03, 2024
作者:
M
mahaifeng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[array-buffer]修改测试用例,将Int,Number类型去掉
上级
7f44bb89
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
25 addition
and
25 deletion
+25
-25
uni_modules/uts-tests/utssdk/TDataView.uts
uni_modules/uts-tests/utssdk/TDataView.uts
+16
-16
uni_modules/uts-tests/utssdk/TFloat32Array.uts
uni_modules/uts-tests/utssdk/TFloat32Array.uts
+1
-1
uni_modules/uts-tests/utssdk/TFloat64Array.uts
uni_modules/uts-tests/utssdk/TFloat64Array.uts
+1
-1
uni_modules/uts-tests/utssdk/TInt16Array.uts
uni_modules/uts-tests/utssdk/TInt16Array.uts
+1
-1
uni_modules/uts-tests/utssdk/TInt32Array.uts
uni_modules/uts-tests/utssdk/TInt32Array.uts
+1
-1
uni_modules/uts-tests/utssdk/TInt8Array.uts
uni_modules/uts-tests/utssdk/TInt8Array.uts
+1
-1
uni_modules/uts-tests/utssdk/TUInt8Array.uts
uni_modules/uts-tests/utssdk/TUInt8Array.uts
+1
-1
uni_modules/uts-tests/utssdk/TUInt8ClampedArray.uts
uni_modules/uts-tests/utssdk/TUInt8ClampedArray.uts
+1
-1
uni_modules/uts-tests/utssdk/TUint16Array.uts
uni_modules/uts-tests/utssdk/TUint16Array.uts
+1
-1
uni_modules/uts-tests/utssdk/TUint32Array.uts
uni_modules/uts-tests/utssdk/TUint32Array.uts
+1
-1
未找到文件。
uni_modules/uts-tests/utssdk/TDataView.uts
浏览文件 @
b0135fde
...
@@ -45,7 +45,7 @@ export class TDataView {
...
@@ -45,7 +45,7 @@ export class TDataView {
// Create an ArrayBuffer with a size in bytes
// Create an ArrayBuffer with a size in bytes
let buffer = new ArrayBuffer(16);
let buffer = new ArrayBuffer(16);
let view = new DataView(buffer);
let view = new DataView(buffer);
view.setFloat32(1,
Math.PI.toFloat()
);
view.setFloat32(1,
3.1415927
);
expect(this.numberEquals(3.1415927, view.getFloat32(1).toFloat())).toEqual(true);
expect(this.numberEquals(3.1415927, view.getFloat32(1).toFloat())).toEqual(true);
}
}
...
@@ -97,7 +97,7 @@ export class TDataView {
...
@@ -97,7 +97,7 @@ export class TDataView {
expect(this.numberEquals(255, view.getUint8(1))).toEqual(true);
expect(this.numberEquals(255, view.getUint8(1))).toEqual(true);
}
}
numberEquals(a:
Number, b: N
umber): Boolean {
numberEquals(a:
number, b: n
umber): Boolean {
return a == b
return a == b
}
}
...
@@ -138,10 +138,10 @@ export class TDataView {
...
@@ -138,10 +138,10 @@ export class TDataView {
}
}
}
}
makeBuffer(size:
Int
, littleEndian: boolean): ArrayBuffer {
makeBuffer(size:
number
, littleEndian: boolean): ArrayBuffer {
var buffer = new ArrayBuffer(
size
* 14);
var buffer = new ArrayBuffer(
1000
* 14);
var view = new DataView(buffer);
var view = new DataView(buffer);
for (var i = 0; i <
size
; ++i) {
for (var i = 0; i <
1000
; ++i) {
view.setInt8(i * 14, i);
view.setInt8(i * 14, i);
view.setUint8(i * 14 + 1, i);
view.setUint8(i * 14 + 1, i);
view.setInt16(i * 14 + 2, i * i, littleEndian);
view.setInt16(i * 14 + 2, i * i, littleEndian);
...
@@ -180,21 +180,21 @@ export class TDataView {
...
@@ -180,21 +180,21 @@ export class TDataView {
}
}
expect(xor).toEqual(0);
expect(xor).toEqual(0);
} else {
} else {
var reader = new BigEndian(buffer);
var reader
1
= new BigEndian(buffer);
for (var i = 0; i < buffer.byteLength; i += 14) {
for (var i = 0; i < buffer.byteLength; i += 14) {
xor ^= reader.getInt8(i);
xor ^= reader
1
.getInt8(i);
xor ^= reader.getUint8(i + 1);
xor ^= reader
1
.getUint8(i + 1);
xor ^= reader.getInt16(i + 2);
xor ^= reader
1
.getInt16(i + 2);
xor ^= reader.getUint16(i + 4);
xor ^= reader
1
.getUint16(i + 4);
xor ^= reader.getInt32(i + 6);
xor ^= reader
1
.getInt32(i + 6);
xor ^= reader.getUint32(i + 10);
xor ^= reader
1
.getUint32(i + 10);
}
}
}
}
}
}
doFloatIterations(dataView: boolean) {
doFloatIterations(dataView: boolean) {
var buffer =
makeFloatBuffer(1000
);
var buffer =
this.makeFloatBuffer(
);
var iterations = 10;
var iterations = 10;
if (dataView) {
if (dataView) {
for (var i = 0; i < iterations; i++)
for (var i = 0; i < iterations; i++)
...
@@ -205,10 +205,10 @@ export class TDataView {
...
@@ -205,10 +205,10 @@ export class TDataView {
}
}
}
}
makeFloatBuffer(
size: Int
): ArrayBuffer {
makeFloatBuffer(): ArrayBuffer {
var buffer = new ArrayBuffer(
size
* 16);
var buffer = new ArrayBuffer(
1000
* 16);
var view = new DataView(buffer);
var view = new DataView(buffer);
for (var i = 0; i <
size
; i++) {
for (var i = 0; i <
1000
; i++) {
view.setFloat64(i * 16, Math.log10(i + 1));
view.setFloat64(i * 16, Math.log10(i + 1));
view.setFloat32(i * 16 + 8, Math.sqrt(i));
view.setFloat32(i * 16 + 8, Math.sqrt(i));
view.setFloat32(i * 16 + 12, Math.cos(i));
view.setFloat32(i * 16 + 12, Math.cos(i));
...
...
uni_modules/uts-tests/utssdk/TFloat32Array.uts
浏览文件 @
b0135fde
...
@@ -253,7 +253,7 @@ export class TFloat32Array {
...
@@ -253,7 +253,7 @@ export class TFloat32Array {
numbers.sort();
numbers.sort();
expect(numbers.toString()).toEqual("1,5,40");
expect(numbers.toString()).toEqual("1,5,40");
numbers.sort((a, b):
N
umber => a - b);
numbers.sort((a, b):
n
umber => a - b);
expect(numbers.toString()).toEqual("1,5,40");
expect(numbers.toString()).toEqual("1,5,40");
}
}
...
...
uni_modules/uts-tests/utssdk/TFloat64Array.uts
浏览文件 @
b0135fde
...
@@ -244,7 +244,7 @@ export class TFloat64Array {
...
@@ -244,7 +244,7 @@ export class TFloat64Array {
numbers.sort();
numbers.sort();
expect(numbers.toString()).toEqual("1,5,40");
expect(numbers.toString()).toEqual("1,5,40");
numbers.sort((a, b):
N
umber => a - b);
numbers.sort((a, b):
n
umber => a - b);
expect(numbers.toString()).toEqual("1,5,40");
expect(numbers.toString()).toEqual("1,5,40");
}
}
...
...
uni_modules/uts-tests/utssdk/TInt16Array.uts
浏览文件 @
b0135fde
...
@@ -220,7 +220,7 @@ export class TInt16Array {
...
@@ -220,7 +220,7 @@ export class TInt16Array {
numbers.sort();
numbers.sort();
expect(numbers.toString()).toEqual("1,5,40");
expect(numbers.toString()).toEqual("1,5,40");
numbers.sort((a, b):
N
umber => a - b);
numbers.sort((a, b):
n
umber => a - b);
expect(numbers.toString()).toEqual("1,5,40");
expect(numbers.toString()).toEqual("1,5,40");
}
}
...
...
uni_modules/uts-tests/utssdk/TInt32Array.uts
浏览文件 @
b0135fde
...
@@ -236,7 +236,7 @@ export class TInt32Array {
...
@@ -236,7 +236,7 @@ export class TInt32Array {
numbers.sort();
numbers.sort();
expect(numbers.toString()).toEqual("1,5,40");
expect(numbers.toString()).toEqual("1,5,40");
numbers.sort((a, b):
N
umber => a - b);
numbers.sort((a, b):
n
umber => a - b);
expect(numbers.toString()).toEqual("1,5,40");
expect(numbers.toString()).toEqual("1,5,40");
}
}
...
...
uni_modules/uts-tests/utssdk/TInt8Array.uts
浏览文件 @
b0135fde
...
@@ -229,7 +229,7 @@ export class TInt8Array {
...
@@ -229,7 +229,7 @@ export class TInt8Array {
numbers.sort();
numbers.sort();
expect(numbers.toString()).toEqual("1,5,40");
expect(numbers.toString()).toEqual("1,5,40");
numbers.sort((a, b):
N
umber => a - b);
numbers.sort((a, b):
n
umber => a - b);
expect(numbers.toString()).toEqual("1,5,40");
expect(numbers.toString()).toEqual("1,5,40");
}
}
...
...
uni_modules/uts-tests/utssdk/TUInt8Array.uts
浏览文件 @
b0135fde
...
@@ -233,7 +233,7 @@ export class TUint8Array {
...
@@ -233,7 +233,7 @@ export class TUint8Array {
numbers.sort();
numbers.sort();
expect(numbers.toString()).toEqual("1,5,40");
expect(numbers.toString()).toEqual("1,5,40");
numbers.sort((a, b):
N
umber => a - b);
numbers.sort((a, b):
n
umber => a - b);
expect(numbers.toString()).toEqual("1,5,40");
expect(numbers.toString()).toEqual("1,5,40");
}
}
...
...
uni_modules/uts-tests/utssdk/TUInt8ClampedArray.uts
浏览文件 @
b0135fde
...
@@ -228,7 +228,7 @@ export class TUint8ClampedArray {
...
@@ -228,7 +228,7 @@ export class TUint8ClampedArray {
numbers.sort();
numbers.sort();
expect(numbers.toString()).toEqual("1,5,40");
expect(numbers.toString()).toEqual("1,5,40");
numbers.sort((a, b):
N
umber => a - b);
numbers.sort((a, b):
n
umber => a - b);
expect(numbers.toString()).toEqual("1,5,40");
expect(numbers.toString()).toEqual("1,5,40");
}
}
...
...
uni_modules/uts-tests/utssdk/TUint16Array.uts
浏览文件 @
b0135fde
...
@@ -242,7 +242,7 @@ export class TUint16Array {
...
@@ -242,7 +242,7 @@ export class TUint16Array {
numbers.sort();
numbers.sort();
expect(numbers.toString()).toEqual("1,5,40");
expect(numbers.toString()).toEqual("1,5,40");
numbers.sort((a, b):
N
umber => a - b);
numbers.sort((a, b):
n
umber => a - b);
expect(numbers.toString()).toEqual("1,5,40");
expect(numbers.toString()).toEqual("1,5,40");
}
}
...
...
uni_modules/uts-tests/utssdk/TUint32Array.uts
浏览文件 @
b0135fde
...
@@ -242,7 +242,7 @@ export class TUint32Array {
...
@@ -242,7 +242,7 @@ export class TUint32Array {
numbers.sort();
numbers.sort();
expect(numbers.toString()).toEqual("1,5,40");
expect(numbers.toString()).toEqual("1,5,40");
numbers.sort((a, b):
N
umber => a - b);
numbers.sort((a, b):
n
umber => a - b);
expect(numbers.toString()).toEqual("1,5,40");
expect(numbers.toString()).toEqual("1,5,40");
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录