Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
Hello UTS
提交
b94d2b7e
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看板
提交
b94d2b7e
编写于
7月 02, 2024
作者:
WOSHIMAHAIFENG
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev_arraybuffer' into 'dev'
[arraybuffer]修改测试用例 See merge request
!11
上级
905b5874
0d70f8e2
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
40 addition
and
39 deletion
+40
-39
uni_modules/uts-tests/utssdk/TFloat32Array.js
uni_modules/uts-tests/utssdk/TFloat32Array.js
+4
-4
uni_modules/uts-tests/utssdk/TFloat64Array.js
uni_modules/uts-tests/utssdk/TFloat64Array.js
+4
-4
uni_modules/uts-tests/utssdk/TInt16Array.js
uni_modules/uts-tests/utssdk/TInt16Array.js
+4
-4
uni_modules/uts-tests/utssdk/TInt8Array.js
uni_modules/uts-tests/utssdk/TInt8Array.js
+5
-4
uni_modules/uts-tests/utssdk/TUInt8Array.js
uni_modules/uts-tests/utssdk/TUInt8Array.js
+7
-7
uni_modules/uts-tests/utssdk/TUInt8ClampedArray.js
uni_modules/uts-tests/utssdk/TUInt8ClampedArray.js
+7
-7
uni_modules/uts-tests/utssdk/TUint16Array.js
uni_modules/uts-tests/utssdk/TUint16Array.js
+9
-9
未找到文件。
uni_modules/uts-tests/utssdk/TFloat32Array.js
浏览文件 @
b94d2b7e
...
@@ -203,24 +203,24 @@ export class TFloat32Array {
...
@@ -203,24 +203,24 @@ export class TFloat32Array {
let
total
=
new
Float32Array
([
0
,
1
,
2
,
3
]);
let
total
=
new
Float32Array
([
0
,
1
,
2
,
3
]);
let
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Float32Array
):
let
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Float32Array
):
number
=>
accumulator
+
currentValue
);
number
=>
accumulator
+
currentValue
);
expect
(
res
).
toEqual
(
6
.0
);
expect
(
res
).
toEqual
(
6
);
total
=
new
Float32Array
([
0
,
1
,
2
,
3
]);
total
=
new
Float32Array
([
0
,
1
,
2
,
3
]);
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Float32Array
):
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Float32Array
):
number
=>
accumulator
+
currentValue
,
8
);
number
=>
accumulator
+
currentValue
,
8
);
expect
(
res
).
toEqual
(
14
.0
);
expect
(
res
).
toEqual
(
14
);
}
}
reduceRight
()
{
reduceRight
()
{
let
total
=
new
Float32Array
([
0
,
1
,
2
,
3
]);
let
total
=
new
Float32Array
([
0
,
1
,
2
,
3
]);
let
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
let
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Float32Array
):
number
=>
accumulator
+
currentValue
);
Float32Array
):
number
=>
accumulator
+
currentValue
);
expect
(
res
).
toEqual
(
6
.0
);
expect
(
res
).
toEqual
(
6
);
total
=
new
Float32Array
([
0
,
1
,
2
,
3
]);
total
=
new
Float32Array
([
0
,
1
,
2
,
3
]);
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Float32Array
):
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Float32Array
):
number
=>
accumulator
+
currentValue
,
8
);
number
=>
accumulator
+
currentValue
,
8
);
expect
(
res
).
toEqual
(
14
.0
);
expect
(
res
).
toEqual
(
14
);
}
}
reverse
()
{
reverse
()
{
...
...
uni_modules/uts-tests/utssdk/TFloat64Array.js
浏览文件 @
b94d2b7e
...
@@ -198,24 +198,24 @@ export class TFloat64Array {
...
@@ -198,24 +198,24 @@ export class TFloat64Array {
let
total
=
new
Float64Array
([
0
,
1
,
2
,
3
]);
let
total
=
new
Float64Array
([
0
,
1
,
2
,
3
]);
let
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Float64Array
):
let
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Float64Array
):
number
=>
accumulator
+
currentValue
);
number
=>
accumulator
+
currentValue
);
expect
(
res
).
toEqual
(
6
.0
);
expect
(
res
).
toEqual
(
6
);
total
=
new
Float64Array
([
0
,
1
,
2
,
3
]);
total
=
new
Float64Array
([
0
,
1
,
2
,
3
]);
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Float64Array
):
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Float64Array
):
number
=>
accumulator
+
currentValue
,
8
);
number
=>
accumulator
+
currentValue
,
8
);
expect
(
res
).
toEqual
(
14
.0
);
expect
(
res
).
toEqual
(
14
);
}
}
reduceRight
()
{
reduceRight
()
{
let
total
=
new
Float64Array
([
0
,
1
,
2
,
3
]);
let
total
=
new
Float64Array
([
0
,
1
,
2
,
3
]);
let
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
let
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Float64Array
):
number
=>
accumulator
+
currentValue
);
Float64Array
):
number
=>
accumulator
+
currentValue
);
expect
(
res
).
toEqual
(
6
.0
);
expect
(
res
).
toEqual
(
6
);
total
=
new
Float64Array
([
0
,
1
,
2
,
3
]);
total
=
new
Float64Array
([
0
,
1
,
2
,
3
]);
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Float64Array
):
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Float64Array
):
number
=>
accumulator
+
currentValue
,
8
);
number
=>
accumulator
+
currentValue
,
8
);
expect
(
res
).
toEqual
(
14
.0
);
expect
(
res
).
toEqual
(
14
);
}
}
reverse
()
{
reverse
()
{
...
...
uni_modules/uts-tests/utssdk/TInt16Array.js
浏览文件 @
b94d2b7e
...
@@ -177,21 +177,21 @@ export class TInt16Array {
...
@@ -177,21 +177,21 @@ export class TInt16Array {
reduce
()
{
reduce
()
{
let
total
=
new
Int16Array
([
0
,
1
,
2
,
3
]);
let
total
=
new
Int16Array
([
0
,
1
,
2
,
3
]);
let
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Int16Array
):
number
=>
accumulator
+
currentValue
);
let
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Int16Array
):
number
=>
accumulator
+
currentValue
);
expect
(
res
).
toEqual
(
6
.0
);
expect
(
res
).
toEqual
(
6
);
total
=
new
Int16Array
([
0
,
1
,
2
,
3
]);
total
=
new
Int16Array
([
0
,
1
,
2
,
3
]);
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Int16Array
):
number
=>
accumulator
+
currentValue
,
8
);
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Int16Array
):
number
=>
accumulator
+
currentValue
,
8
);
expect
(
res
).
toEqual
(
14
.0
);
expect
(
res
).
toEqual
(
14
);
}
}
reduceRight
()
{
reduceRight
()
{
let
total
=
new
Int16Array
([
0
,
1
,
2
,
3
]);
let
total
=
new
Int16Array
([
0
,
1
,
2
,
3
]);
let
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Int16Array
):
number
=>
accumulator
+
currentValue
);
let
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Int16Array
):
number
=>
accumulator
+
currentValue
);
expect
(
res
).
toEqual
(
6
.0
);
expect
(
res
).
toEqual
(
6
);
total
=
new
Int16Array
([
0
,
1
,
2
,
3
]);
total
=
new
Int16Array
([
0
,
1
,
2
,
3
]);
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Int16Array
):
number
=>
accumulator
+
currentValue
,
8
);
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Int16Array
):
number
=>
accumulator
+
currentValue
,
8
);
expect
(
res
).
toEqual
(
14
.0
);
expect
(
res
).
toEqual
(
14
);
}
}
reverse
()
{
reverse
()
{
...
...
uni_modules/uts-tests/utssdk/TInt8Array.js
浏览文件 @
b94d2b7e
...
@@ -2,6 +2,7 @@ import {
...
@@ -2,6 +2,7 @@ import {
describe
,
describe
,
test
,
test
,
expect
,
expect
,
expectNumber
,
Result
Result
}
from
'
./tests.uts
'
}
from
'
./tests.uts
'
...
@@ -181,25 +182,25 @@ export class TInt8Array {
...
@@ -181,25 +182,25 @@ export class TInt8Array {
let
total
=
new
Int8Array
([
0
,
1
,
2
,
3
]);
let
total
=
new
Int8Array
([
0
,
1
,
2
,
3
]);
let
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Int8Array
):
let
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Int8Array
):
number
=>
accumulator
+
currentValue
);
number
=>
accumulator
+
currentValue
);
expect
(
res
).
toEqual
(
6
.0
);
expect
(
res
).
toEqual
(
6
);
total
=
new
Int8Array
([
0
,
1
,
2
,
3
]);
total
=
new
Int8Array
([
0
,
1
,
2
,
3
]);
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Int8Array
):
number
=>
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Int8Array
):
number
=>
accumulator
+
currentValue
,
8
);
accumulator
+
currentValue
,
8
);
expect
(
res
).
toEqual
(
14
.0
);
expect
(
res
).
toEqual
(
14
);
}
}
reduceRight
()
{
reduceRight
()
{
let
total
=
new
Int8Array
([
0
,
1
,
2
,
3
]);
let
total
=
new
Int8Array
([
0
,
1
,
2
,
3
]);
let
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Int8Array
):
let
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Int8Array
):
number
=>
accumulator
+
currentValue
);
number
=>
accumulator
+
currentValue
);
expect
(
res
).
toEqual
(
6
.0
);
expect
(
res
).
toEqual
(
6
);
total
=
new
Int8Array
([
0
,
1
,
2
,
3
]);
total
=
new
Int8Array
([
0
,
1
,
2
,
3
]);
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Int8Array
):
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Int8Array
):
number
=>
accumulator
+
currentValue
,
8
);
number
=>
accumulator
+
currentValue
,
8
);
expect
(
res
).
toEqual
(
14
.0
);
expect
(
res
).
toEqual
(
14
);
}
}
reverse
()
{
reverse
()
{
...
...
uni_modules/uts-tests/utssdk/TUInt8Array.js
浏览文件 @
b94d2b7e
...
@@ -123,13 +123,13 @@ export class TUint8Array {
...
@@ -123,13 +123,13 @@ export class TUint8Array {
includes
()
{
includes
()
{
let
float32
=
new
Uint8Array
([
1
,
2
,
3
]);
let
float32
=
new
Uint8Array
([
1
,
2
,
3
]);
let
res
=
float32
.
includes
(
2
.0
);
let
res
=
float32
.
includes
(
2
);
expect
(
res
).
toEqual
(
true
);
expect
(
res
).
toEqual
(
true
);
res
=
float32
.
includes
(
4
.0
);
res
=
float32
.
includes
(
4
);
expect
(
res
).
toEqual
(
false
);
expect
(
res
).
toEqual
(
false
);
res
=
float32
.
includes
(
3
.0
,
3
);
res
=
float32
.
includes
(
3
,
3
);
expect
(
res
).
toEqual
(
false
);
expect
(
res
).
toEqual
(
false
);
}
}
...
@@ -179,21 +179,21 @@ export class TUint8Array {
...
@@ -179,21 +179,21 @@ export class TUint8Array {
reduce
()
{
reduce
()
{
let
total
=
new
Uint8Array
([
0
,
1
,
2
,
3
]);
let
total
=
new
Uint8Array
([
0
,
1
,
2
,
3
]);
let
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Uint8Array
):
number
=>
accumulator
+
currentValue
);
let
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Uint8Array
):
number
=>
accumulator
+
currentValue
);
expect
(
res
).
toEqual
(
6
.0
);
expect
(
res
).
toEqual
(
6
);
total
=
new
Uint8Array
([
0
,
1
,
2
,
3
]);
total
=
new
Uint8Array
([
0
,
1
,
2
,
3
]);
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Uint8Array
):
number
=>
accumulator
+
currentValue
,
8
);
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Uint8Array
):
number
=>
accumulator
+
currentValue
,
8
);
expect
(
res
).
toEqual
(
14
.0
);
expect
(
res
).
toEqual
(
14
);
}
}
reduceRight
()
{
reduceRight
()
{
let
total
=
new
Uint8Array
([
0
,
1
,
2
,
3
]);
let
total
=
new
Uint8Array
([
0
,
1
,
2
,
3
]);
let
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Uint8Array
):
number
=>
accumulator
+
currentValue
);
let
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Uint8Array
):
number
=>
accumulator
+
currentValue
);
expect
(
res
).
toEqual
(
6
.0
);
expect
(
res
).
toEqual
(
6
);
total
=
new
Uint8Array
([
0
,
1
,
2
,
3
]);
total
=
new
Uint8Array
([
0
,
1
,
2
,
3
]);
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Uint8Array
):
number
=>
accumulator
+
currentValue
,
8
);
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Uint8Array
):
number
=>
accumulator
+
currentValue
,
8
);
expect
(
res
).
toEqual
(
14
.0
);
expect
(
res
).
toEqual
(
14
);
}
}
reverse
()
{
reverse
()
{
...
...
uni_modules/uts-tests/utssdk/TUInt8ClampedArray.js
浏览文件 @
b94d2b7e
...
@@ -125,13 +125,13 @@ export class TUint8ClampedArray {
...
@@ -125,13 +125,13 @@ export class TUint8ClampedArray {
includes
()
{
includes
()
{
let
float32
=
new
Uint8ClampedArray
([
1
,
2
,
3
]);
let
float32
=
new
Uint8ClampedArray
([
1
,
2
,
3
]);
let
res
=
float32
.
includes
(
2
.0
);
let
res
=
float32
.
includes
(
2
);
expect
(
res
).
toEqual
(
true
);
expect
(
res
).
toEqual
(
true
);
res
=
float32
.
includes
(
4
.0
);
res
=
float32
.
includes
(
4
);
expect
(
res
).
toEqual
(
false
);
expect
(
res
).
toEqual
(
false
);
res
=
float32
.
includes
(
3
.0
,
3
);
res
=
float32
.
includes
(
3
,
3
);
expect
(
res
).
toEqual
(
false
);
expect
(
res
).
toEqual
(
false
);
}
}
...
@@ -182,24 +182,24 @@ export class TUint8ClampedArray {
...
@@ -182,24 +182,24 @@ export class TUint8ClampedArray {
let
total
=
new
Uint8ClampedArray
([
0
,
1
,
2
,
3
]);
let
total
=
new
Uint8ClampedArray
([
0
,
1
,
2
,
3
]);
let
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
let
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Uint8ClampedArray
):
number
=>
accumulator
+
currentValue
);
Uint8ClampedArray
):
number
=>
accumulator
+
currentValue
);
expect
(
res
).
toEqual
(
6
.0
);
expect
(
res
).
toEqual
(
6
);
total
=
new
Uint8ClampedArray
([
0
,
1
,
2
,
3
]);
total
=
new
Uint8ClampedArray
([
0
,
1
,
2
,
3
]);
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Uint8ClampedArray
):
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Uint8ClampedArray
):
number
=>
accumulator
+
currentValue
,
8
);
number
=>
accumulator
+
currentValue
,
8
);
expect
(
res
).
toEqual
(
14
.0
);
expect
(
res
).
toEqual
(
14
);
}
}
reduceRight
()
{
reduceRight
()
{
let
total
=
new
Uint8ClampedArray
([
0
,
1
,
2
,
3
]);
let
total
=
new
Uint8ClampedArray
([
0
,
1
,
2
,
3
]);
let
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
let
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Uint8ClampedArray
):
number
=>
accumulator
+
currentValue
);
Uint8ClampedArray
):
number
=>
accumulator
+
currentValue
);
expect
(
res
).
toEqual
(
6
.0
);
expect
(
res
).
toEqual
(
6
);
total
=
new
Uint8ClampedArray
([
0
,
1
,
2
,
3
]);
total
=
new
Uint8ClampedArray
([
0
,
1
,
2
,
3
]);
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Uint8ClampedArray
):
number
=>
accumulator
+
currentValue
,
8
);
Uint8ClampedArray
):
number
=>
accumulator
+
currentValue
,
8
);
expect
(
res
).
toEqual
(
14
.0
);
expect
(
res
).
toEqual
(
14
);
}
}
reverse
()
{
reverse
()
{
...
...
uni_modules/uts-tests/utssdk/TUint16Array.js
浏览文件 @
b94d2b7e
...
@@ -139,13 +139,13 @@ export class TUint16Array {
...
@@ -139,13 +139,13 @@ export class TUint16Array {
includes
()
{
includes
()
{
let
float32
=
new
Uint16Array
([
1
,
2
,
3
]);
let
float32
=
new
Uint16Array
([
1
,
2
,
3
]);
let
res
=
float32
.
includes
(
2
.0
);
let
res
=
float32
.
includes
(
2
);
expect
(
res
).
toEqual
(
true
);
expect
(
res
).
toEqual
(
true
);
res
=
float32
.
includes
(
4
.0
);
res
=
float32
.
includes
(
4
);
expect
(
res
).
toEqual
(
false
);
expect
(
res
).
toEqual
(
false
);
res
=
float32
.
includes
(
3
.0
,
3
);
res
=
float32
.
includes
(
3
,
3
);
expect
(
res
).
toEqual
(
false
);
expect
(
res
).
toEqual
(
false
);
}
}
...
@@ -196,24 +196,24 @@ export class TUint16Array {
...
@@ -196,24 +196,24 @@ export class TUint16Array {
let
total
=
new
Uint16Array
([
0
,
1
,
2
,
3
]);
let
total
=
new
Uint16Array
([
0
,
1
,
2
,
3
]);
let
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Uint16Array
):
let
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Uint16Array
):
number
=>
accumulator
+
currentValue
);
number
=>
accumulator
+
currentValue
);
expect
(
res
).
toEqual
(
6
.0
);
expect
(
res
).
toEqual
(
6
);
total
=
new
Uint16Array
([
0
,
1
,
2
,
3
]);
total
=
new
Uint16Array
([
0
,
1
,
2
,
3
]);
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Uint16Array
):
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Uint16Array
):
number
=>
accumulator
+
currentValue
,
8
);
number
=>
accumulator
+
currentValue
,
8
);
expect
(
res
).
toEqual
(
14
.0
);
expect
(
res
).
toEqual
(
14
);
}
}
reduceRight
()
{
reduceRight
()
{
let
total
=
new
Uint16Array
([
0
,
1
,
2
,
3
]);
let
total
=
new
Uint16Array
([
0
,
1
,
2
,
3
]);
let
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Uint16Array
):
let
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Uint16Array
):
number
=>
accumulator
+
currentValue
);
number
=>
accumulator
+
currentValue
);
expect
(
res
).
toEqual
(
6
.0
);
expect
(
res
).
toEqual
(
6
);
total
=
new
Uint16Array
([
0
,
1
,
2
,
3
]);
total
=
new
Uint16Array
([
0
,
1
,
2
,
3
]);
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Uint16Array
):
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Uint16Array
):
number
=>
accumulator
+
currentValue
,
8
);
number
=>
accumulator
+
currentValue
,
8
);
expect
(
res
).
toEqual
(
14
.0
);
expect
(
res
).
toEqual
(
14
);
}
}
reverse
()
{
reverse
()
{
...
@@ -266,8 +266,8 @@ export class TUint16Array {
...
@@ -266,8 +266,8 @@ export class TUint16Array {
arrayBufferSlice
()
{
arrayBufferSlice
()
{
let
buffer
=
new
ArrayBuffer
(
16
);
let
buffer
=
new
ArrayBuffer
(
16
);
let
float32
=
new
Uint16Array
(
buffer
);
let
float32
=
new
Uint16Array
(
buffer
);
float32
[
3
]
=
42
;
float32
[
4
]
=
42
;
expect
(
float32
.
toString
()).
toEqual
(
"
0,0,0,
42,0
,0,0,0
"
);
expect
(
float32
.
toString
()).
toEqual
(
"
0,0,0,
0,42
,0,0,0
"
);
let
res
=
buffer
.
slice
(
8
);
let
res
=
buffer
.
slice
(
8
);
let
sliced
=
new
Uint16Array
(
res
);
let
sliced
=
new
Uint16Array
(
res
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录