Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
Hello UTS
提交
bcb5b721
H
Hello UTS
项目概览
DCloud
/
Hello UTS
通知
1598
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看板
提交
bcb5b721
编写于
7月 02, 2024
作者:
M
mahaifeng
1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[array-buffer]消除告警
上级
71ae0de1
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
99 addition
and
99 deletion
+99
-99
uni_modules/uts-tests/utssdk/TFloat32Array.js
uni_modules/uts-tests/utssdk/TFloat32Array.js
+11
-11
uni_modules/uts-tests/utssdk/TFloat64Array.js
uni_modules/uts-tests/utssdk/TFloat64Array.js
+11
-11
uni_modules/uts-tests/utssdk/TInt16Array.js
uni_modules/uts-tests/utssdk/TInt16Array.js
+11
-11
uni_modules/uts-tests/utssdk/TInt32Array.js
uni_modules/uts-tests/utssdk/TInt32Array.js
+11
-11
uni_modules/uts-tests/utssdk/TInt8Array.js
uni_modules/uts-tests/utssdk/TInt8Array.js
+11
-11
uni_modules/uts-tests/utssdk/TUInt8Array.js
uni_modules/uts-tests/utssdk/TUInt8Array.js
+11
-11
uni_modules/uts-tests/utssdk/TUInt8ClampedArray.js
uni_modules/uts-tests/utssdk/TUInt8ClampedArray.js
+11
-11
uni_modules/uts-tests/utssdk/TUint16Array.js
uni_modules/uts-tests/utssdk/TUint16Array.js
+11
-11
uni_modules/uts-tests/utssdk/TUint32Array.js
uni_modules/uts-tests/utssdk/TUint32Array.js
+11
-11
未找到文件。
uni_modules/uts-tests/utssdk/TFloat32Array.js
浏览文件 @
bcb5b721
...
@@ -81,7 +81,7 @@ export class TFloat32Array {
...
@@ -81,7 +81,7 @@ export class TFloat32Array {
testEvery
()
{
testEvery
()
{
// const isBelowThreshold = (currentValue: number, index: number, array:Float32Array): boolean => currentValue < 40;
// const isBelowThreshold = (currentValue: number, index: number, array:Float32Array): boolean => currentValue < 40;
let
result
=
new
Float32Array
([
12
,
5
,
8
,
130
,
44
]).
every
((
value
:
number
,
index
:
number
,
array
:
Float32Array
):
let
result
=
new
Float32Array
([
12
,
5
,
8
,
130
,
44
]).
every
((
value
:
number
,
_
:
number
,
_
:
Float32Array
):
boolean
=>
value
<
40
);
//
boolean
=>
value
<
40
);
//
expect
(
result
).
toEqual
(
false
);
expect
(
result
).
toEqual
(
false
);
}
}
...
@@ -106,29 +106,29 @@ export class TFloat32Array {
...
@@ -106,29 +106,29 @@ export class TFloat32Array {
testFilter
()
{
testFilter
()
{
// const isBelowThreshold = (currentValue: number, index: number, _): boolean => currentValue >= 10;
// const isBelowThreshold = (currentValue: number, index: number, _): boolean => currentValue >= 10;
let
float32
=
new
Float32Array
([
12
,
5
,
8
,
44
]).
filter
((
value
:
number
,
index
:
number
,
array
:
Float32Array
):
let
float32
=
new
Float32Array
([
12
,
5
,
8
,
44
]).
filter
((
value
:
number
,
_
:
number
,
_
:
Float32Array
):
boolean
=>
value
>=
10
);
boolean
=>
value
>=
10
);
expect
(
float32
.
toString
()).
toEqual
(
"
12,44
"
);
expect
(
float32
.
toString
()).
toEqual
(
"
12,44
"
);
}
}
find
()
{
find
()
{
let
float32
=
new
Float32Array
([
4
,
5
,
8
,
12
]);
let
float32
=
new
Float32Array
([
4
,
5
,
8
,
12
]);
let
res
=
float32
.
find
((
value
:
number
,
index
:
number
,
obj
:
Float32Array
):
boolean
=>
value
>
5
);
let
res
=
float32
.
find
((
value
:
number
,
_
:
number
,
_
:
Float32Array
):
boolean
=>
value
>
5
);
expect
(
res
).
toEqual
(
8
);
expect
(
res
).
toEqual
(
8
);
}
}
findIndex
()
{
findIndex
()
{
let
float32
=
new
Float32Array
([
4
,
6
,
8
,
12
]);
let
float32
=
new
Float32Array
([
4
,
6
,
8
,
12
]);
let
res
=
float32
.
findIndex
((
value
:
number
,
index
:
number
,
obj
:
Float32Array
):
boolean
=>
value
>
100
);
let
res
=
float32
.
findIndex
((
value
:
number
,
_
:
number
,
_
:
Float32Array
):
boolean
=>
value
>
100
);
expect
(
res
).
toEqual
(
-
1
);
expect
(
res
).
toEqual
(
-
1
);
let
ufloat32
=
new
Float32Array
([
4
,
6
,
7
,
120
]);
let
ufloat32
=
new
Float32Array
([
4
,
6
,
7
,
120
]);
res
=
ufloat32
.
findIndex
((
value
:
number
,
index
:
number
,
obj
:
Float32Array
):
boolean
=>
value
>
100
);
res
=
ufloat32
.
findIndex
((
value
:
number
,
_
:
number
,
_
:
Float32Array
):
boolean
=>
value
>
100
);
expect
(
res
).
toEqual
(
3
);
expect
(
res
).
toEqual
(
3
);
}
}
foreach
()
{
foreach
()
{
new
Float32Array
([
0
,
1
,
2
,
3
]).
forEach
((
value
:
number
,
index
:
number
,
array
:
Float32Array
)
=>
{
new
Float32Array
([
0
,
1
,
2
,
3
]).
forEach
((
value
:
number
,
index
:
number
,
_
:
Float32Array
)
=>
{
console
.
log
(
`a[
${
index
}
] =
${
value
}
`
);
console
.
log
(
`a[
${
index
}
] =
${
value
}
`
);
});
});
}
}
...
@@ -194,31 +194,31 @@ export class TFloat32Array {
...
@@ -194,31 +194,31 @@ export class TFloat32Array {
map
()
{
map
()
{
let
numbers
=
new
Float32Array
([
1
,
4
,
9
]);
let
numbers
=
new
Float32Array
([
1
,
4
,
9
]);
let
doubles
=
numbers
.
map
((
value
:
number
,
index
:
number
,
array
:
Float32Array
):
number
=>
value
*
2
);
let
doubles
=
numbers
.
map
((
value
:
number
,
_
:
number
,
_
:
Float32Array
):
number
=>
value
*
2
);
expect
(
numbers
.
toString
()).
toEqual
(
"
1,4,9
"
);
expect
(
numbers
.
toString
()).
toEqual
(
"
1,4,9
"
);
expect
(
doubles
.
toString
()).
toEqual
(
"
2,8,18
"
);
expect
(
doubles
.
toString
()).
toEqual
(
"
2,8,18
"
);
}
}
reduce
()
{
reduce
()
{
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
,
_
:
number
,
_
:
Float32Array
):
number
=>
accumulator
+
currentValue
);
number
=>
accumulator
+
currentValue
);
expect
(
res
).
toEqual
(
6
);
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
,
_
:
number
,
_
:
Float32Array
):
number
=>
accumulator
+
currentValue
,
8
);
number
=>
accumulator
+
currentValue
,
8
);
expect
(
res
).
toEqual
(
14
);
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
,
_
:
number
,
_
:
Float32Array
):
number
=>
accumulator
+
currentValue
);
Float32Array
):
number
=>
accumulator
+
currentValue
);
expect
(
res
).
toEqual
(
6
);
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
,
_
:
number
,
_
:
Float32Array
):
number
=>
accumulator
+
currentValue
,
8
);
number
=>
accumulator
+
currentValue
,
8
);
expect
(
res
).
toEqual
(
14
);
expect
(
res
).
toEqual
(
14
);
}
}
...
...
uni_modules/uts-tests/utssdk/TFloat64Array.js
浏览文件 @
bcb5b721
...
@@ -75,7 +75,7 @@ export class TFloat64Array {
...
@@ -75,7 +75,7 @@ export class TFloat64Array {
testEvery
()
{
testEvery
()
{
// const isBelowThreshold = (currentValue: number, index: number, array:Float64Array): boolean => currentValue < 40;
// const isBelowThreshold = (currentValue: number, index: number, array:Float64Array): boolean => currentValue < 40;
let
result
=
new
Float64Array
([
-
10
,
-
20
,
-
30
,
-
40
,
-
50
]).
every
((
value
:
number
,
index
:
number
,
array
:
let
result
=
new
Float64Array
([
-
10
,
-
20
,
-
30
,
-
40
,
-
50
]).
every
((
value
:
number
,
_
:
number
,
_
:
Float64Array
):
boolean
=>
value
<
0
);
//
Float64Array
):
boolean
=>
value
<
0
);
//
expect
(
result
).
toEqual
(
true
);
expect
(
result
).
toEqual
(
true
);
}
}
...
@@ -100,29 +100,29 @@ export class TFloat64Array {
...
@@ -100,29 +100,29 @@ export class TFloat64Array {
testFilter
()
{
testFilter
()
{
// const isBelowThreshold = (currentValue: number, index: number, _): boolean => currentValue >= 10;
// const isBelowThreshold = (currentValue: number, index: number, _): boolean => currentValue >= 10;
let
float32
=
new
Float64Array
([
12
,
5
,
8
,
44
]).
filter
((
value
:
number
,
index
:
number
,
array
:
Float64Array
):
let
float32
=
new
Float64Array
([
12
,
5
,
8
,
44
]).
filter
((
value
:
number
,
_
:
number
,
_
:
Float64Array
):
boolean
=>
value
>=
10
);
boolean
=>
value
>=
10
);
expect
(
float32
.
toString
()).
toEqual
(
"
12,44
"
);
expect
(
float32
.
toString
()).
toEqual
(
"
12,44
"
);
}
}
find
()
{
find
()
{
let
float32
=
new
Float64Array
([
4
,
5
,
8
,
12
]);
let
float32
=
new
Float64Array
([
4
,
5
,
8
,
12
]);
let
res
=
float32
.
find
((
value
:
number
,
index
:
number
,
obj
:
Float64Array
):
boolean
=>
value
>
5
);
let
res
=
float32
.
find
((
value
:
number
,
_
:
number
,
_
:
Float64Array
):
boolean
=>
value
>
5
);
expect
(
res
).
toEqual
(
8
);
expect
(
res
).
toEqual
(
8
);
}
}
findIndex
()
{
findIndex
()
{
let
float32
=
new
Float64Array
([
4
,
6
,
8
,
12
]);
let
float32
=
new
Float64Array
([
4
,
6
,
8
,
12
]);
let
res
=
float32
.
findIndex
((
value
:
number
,
index
:
number
,
obj
:
Float64Array
):
boolean
=>
value
>
100
);
let
res
=
float32
.
findIndex
((
value
:
number
,
_
:
number
,
_
:
Float64Array
):
boolean
=>
value
>
100
);
expect
(
res
).
toEqual
(
-
1
);
expect
(
res
).
toEqual
(
-
1
);
let
ufloat32
=
new
Float64Array
([
4
,
6
,
7
,
120
]);
let
ufloat32
=
new
Float64Array
([
4
,
6
,
7
,
120
]);
res
=
ufloat32
.
findIndex
((
value
:
number
,
index
:
number
,
obj
:
Float64Array
):
boolean
=>
value
>
100
);
res
=
ufloat32
.
findIndex
((
value
:
number
,
_
:
number
,
_
:
Float64Array
):
boolean
=>
value
>
100
);
expect
(
res
).
toEqual
(
3
);
expect
(
res
).
toEqual
(
3
);
}
}
foreach
()
{
foreach
()
{
new
Float64Array
([
0
,
1
,
2
,
3
]).
forEach
((
value
:
number
,
index
:
number
,
array
:
Float64Array
)
=>
{
new
Float64Array
([
0
,
1
,
2
,
3
]).
forEach
((
value
:
number
,
index
:
number
,
_
:
Float64Array
)
=>
{
console
.
log
(
`a[
${
index
}
] =
${
value
}
`
);
console
.
log
(
`a[
${
index
}
] =
${
value
}
`
);
});
});
}
}
...
@@ -189,31 +189,31 @@ export class TFloat64Array {
...
@@ -189,31 +189,31 @@ export class TFloat64Array {
map
()
{
map
()
{
let
numbers
=
new
Float64Array
([
1
,
4
,
9
]);
let
numbers
=
new
Float64Array
([
1
,
4
,
9
]);
let
doubles
=
numbers
.
map
((
value
:
number
,
index
:
number
,
array
:
Float64Array
):
number
=>
value
*
2
);
let
doubles
=
numbers
.
map
((
value
:
number
,
_
:
number
,
_
:
Float64Array
):
number
=>
value
*
2
);
expect
(
numbers
.
toString
()).
toEqual
(
"
1,4,9
"
);
expect
(
numbers
.
toString
()).
toEqual
(
"
1,4,9
"
);
expect
(
doubles
.
toString
()).
toEqual
(
"
2,8,18
"
);
expect
(
doubles
.
toString
()).
toEqual
(
"
2,8,18
"
);
}
}
reduce
()
{
reduce
()
{
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
,
_
:
number
,
_
:
Float64Array
):
number
=>
accumulator
+
currentValue
);
number
=>
accumulator
+
currentValue
);
expect
(
res
).
toEqual
(
6
);
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
,
_
:
number
,
_
:
Float64Array
):
number
=>
accumulator
+
currentValue
,
8
);
number
=>
accumulator
+
currentValue
,
8
);
expect
(
res
).
toEqual
(
14
);
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
,
_
:
number
,
_
:
Float64Array
):
number
=>
accumulator
+
currentValue
);
Float64Array
):
number
=>
accumulator
+
currentValue
);
expect
(
res
).
toEqual
(
6
);
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
,
_
:
number
,
_
:
Float64Array
):
number
=>
accumulator
+
currentValue
,
8
);
number
=>
accumulator
+
currentValue
,
8
);
expect
(
res
).
toEqual
(
14
);
expect
(
res
).
toEqual
(
14
);
}
}
...
...
uni_modules/uts-tests/utssdk/TInt16Array.js
浏览文件 @
bcb5b721
...
@@ -59,7 +59,7 @@ export class TInt16Array {
...
@@ -59,7 +59,7 @@ export class TInt16Array {
testEvery
()
{
testEvery
()
{
// const isBelowThreshold = (currentValue: number, index: number, array:Int16Array): boolean => currentValue < 40;
// const isBelowThreshold = (currentValue: number, index: number, array:Int16Array): boolean => currentValue < 40;
let
result
=
new
Int16Array
([
12
,
5
,
8
,
130
,
44
]).
every
((
value
:
number
,
index
:
number
,
array
:
Int16Array
):
boolean
=>
value
<
40
);
//
let
result
=
new
Int16Array
([
12
,
5
,
8
,
130
,
44
]).
every
((
value
:
number
,
_
:
number
,
_
:
Int16Array
):
boolean
=>
value
<
40
);
//
expect
(
result
).
toEqual
(
false
);
expect
(
result
).
toEqual
(
false
);
}
}
...
@@ -83,28 +83,28 @@ export class TInt16Array {
...
@@ -83,28 +83,28 @@ export class TInt16Array {
testFilter
()
{
testFilter
()
{
// const isBelowThreshold = (currentValue: number, index: number, _): boolean => currentValue >= 10;
// const isBelowThreshold = (currentValue: number, index: number, _): boolean => currentValue >= 10;
let
float32
=
new
Int16Array
([
12
,
5
,
8
,
44
]).
filter
((
value
:
number
,
index
:
number
,
array
:
Int16Array
):
boolean
=>
value
>=
10
);
let
float32
=
new
Int16Array
([
12
,
5
,
8
,
44
]).
filter
((
value
:
number
,
_
:
number
,
_
:
Int16Array
):
boolean
=>
value
>=
10
);
expect
(
float32
.
toString
()).
toEqual
(
"
12,44
"
);
expect
(
float32
.
toString
()).
toEqual
(
"
12,44
"
);
}
}
find
()
{
find
()
{
let
float32
=
new
Int16Array
([
4
,
5
,
8
,
12
]);
let
float32
=
new
Int16Array
([
4
,
5
,
8
,
12
]);
let
res
=
float32
.
find
((
value
:
number
,
index
:
number
,
obj
:
Int16Array
):
boolean
=>
value
>
5
);
let
res
=
float32
.
find
((
value
:
number
,
_
:
number
,
_
:
Int16Array
):
boolean
=>
value
>
5
);
expect
(
res
).
toEqual
(
8
);
expect
(
res
).
toEqual
(
8
);
}
}
findIndex
()
{
findIndex
()
{
let
float32
=
new
Int16Array
([
4
,
6
,
8
,
12
]);
let
float32
=
new
Int16Array
([
4
,
6
,
8
,
12
]);
let
res
=
float32
.
findIndex
((
value
:
number
,
index
:
number
,
obj
:
Int16Array
):
boolean
=>
value
>
100
);
let
res
=
float32
.
findIndex
((
value
:
number
,
_
:
number
,
_
:
Int16Array
):
boolean
=>
value
>
100
);
expect
(
res
).
toEqual
(
-
1
);
expect
(
res
).
toEqual
(
-
1
);
let
ufloat32
=
new
Int16Array
([
4
,
6
,
7
,
120
]);
let
ufloat32
=
new
Int16Array
([
4
,
6
,
7
,
120
]);
res
=
ufloat32
.
findIndex
((
value
:
number
,
index
:
number
,
obj
:
Int16Array
):
boolean
=>
value
>
100
);
res
=
ufloat32
.
findIndex
((
value
:
number
,
_
:
number
,
_
:
Int16Array
):
boolean
=>
value
>
100
);
expect
(
res
).
toEqual
(
3
);
expect
(
res
).
toEqual
(
3
);
}
}
foreach
()
{
foreach
()
{
new
Int16Array
([
0
,
1
,
2
,
3
]).
forEach
((
value
:
number
,
index
:
number
,
array
:
Int16Array
)
=>
{
new
Int16Array
([
0
,
1
,
2
,
3
]).
forEach
((
value
:
number
,
index
:
number
,
_
:
Int16Array
)
=>
{
console
.
log
(
`a[
${
index
}
] =
${
value
}
`
);
console
.
log
(
`a[
${
index
}
] =
${
value
}
`
);
});
});
}
}
...
@@ -169,28 +169,28 @@ export class TInt16Array {
...
@@ -169,28 +169,28 @@ export class TInt16Array {
map
()
{
map
()
{
let
numbers
=
new
Int16Array
([
1
,
4
,
9
]);
let
numbers
=
new
Int16Array
([
1
,
4
,
9
]);
let
doubles
=
numbers
.
map
((
value
:
number
,
index
:
number
,
array
:
Int16Array
):
number
=>
value
*
2
);
let
doubles
=
numbers
.
map
((
value
:
number
,
_
:
number
,
_
:
Int16Array
):
number
=>
value
*
2
);
expect
(
numbers
.
toString
()).
toEqual
(
"
1,4,9
"
);
expect
(
numbers
.
toString
()).
toEqual
(
"
1,4,9
"
);
expect
(
doubles
.
toString
()).
toEqual
(
"
2,8,18
"
);
expect
(
doubles
.
toString
()).
toEqual
(
"
2,8,18
"
);
}
}
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
,
_
:
number
,
_
:
Int16Array
):
number
=>
accumulator
+
currentValue
);
expect
(
res
).
toEqual
(
6
);
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
,
_
:
number
,
_
:
Int16Array
):
number
=>
accumulator
+
currentValue
,
8
);
expect
(
res
).
toEqual
(
14
);
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
,
_
:
number
,
_
:
Int16Array
):
number
=>
accumulator
+
currentValue
);
expect
(
res
).
toEqual
(
6
);
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
,
_
:
number
,
_
:
Int16Array
):
number
=>
accumulator
+
currentValue
,
8
);
expect
(
res
).
toEqual
(
14
);
expect
(
res
).
toEqual
(
14
);
}
}
...
...
uni_modules/uts-tests/utssdk/TInt32Array.js
浏览文件 @
bcb5b721
...
@@ -78,7 +78,7 @@ export class TInt32Array {
...
@@ -78,7 +78,7 @@ export class TInt32Array {
testEvery
()
{
testEvery
()
{
// const isBelowThreshold = (currentValue: number, index: number, array:Int32Array): boolean => currentValue < 40;
// const isBelowThreshold = (currentValue: number, index: number, array:Int32Array): boolean => currentValue < 40;
let
result
=
new
Int32Array
([
12
,
5
,
8
,
130
,
44
]).
every
((
value
:
number
,
index
:
number
,
array
:
Int32Array
):
boolean
=>
value
<
40
);
//
let
result
=
new
Int32Array
([
12
,
5
,
8
,
130
,
44
]).
every
((
value
:
number
,
_
:
number
,
_
:
Int32Array
):
boolean
=>
value
<
40
);
//
expect
(
result
).
toEqual
(
false
);
expect
(
result
).
toEqual
(
false
);
}
}
...
@@ -102,28 +102,28 @@ export class TInt32Array {
...
@@ -102,28 +102,28 @@ export class TInt32Array {
testFilter
()
{
testFilter
()
{
// const isBelowThreshold = (currentValue: number, index: number, _): boolean => currentValue >= 10;
// const isBelowThreshold = (currentValue: number, index: number, _): boolean => currentValue >= 10;
let
float32
=
new
Int32Array
([
12
,
5
,
8
,
44
]).
filter
((
value
:
number
,
index
:
number
,
array
:
Int32Array
):
boolean
=>
value
>=
10
);
let
float32
=
new
Int32Array
([
12
,
5
,
8
,
44
]).
filter
((
value
:
number
,
_
:
number
,
_
:
Int32Array
):
boolean
=>
value
>=
10
);
expect
(
float32
.
toString
()).
toEqual
(
"
12,44
"
);
expect
(
float32
.
toString
()).
toEqual
(
"
12,44
"
);
}
}
find
()
{
find
()
{
let
float32
=
new
Int32Array
([
4
,
5
,
8
,
12
]);
let
float32
=
new
Int32Array
([
4
,
5
,
8
,
12
]);
let
res
=
float32
.
find
((
value
:
number
,
index
:
number
,
obj
:
Int32Array
):
boolean
=>
value
>
5
);
let
res
=
float32
.
find
((
value
:
number
,
_
:
number
,
_
:
Int32Array
):
boolean
=>
value
>
5
);
expect
(
res
).
toEqual
(
8
);
expect
(
res
).
toEqual
(
8
);
}
}
findIndex
()
{
findIndex
()
{
let
float32
=
new
Int32Array
([
4
,
6
,
8
,
12
]);
let
float32
=
new
Int32Array
([
4
,
6
,
8
,
12
]);
let
res
=
float32
.
findIndex
((
value
:
number
,
index
:
number
,
obj
:
Int32Array
):
boolean
=>
value
>
100
);
let
res
=
float32
.
findIndex
((
value
:
number
,
_
:
number
,
_
:
Int32Array
):
boolean
=>
value
>
100
);
expect
(
res
).
toEqual
(
-
1
);
expect
(
res
).
toEqual
(
-
1
);
let
ufloat32
=
new
Int32Array
([
4
,
6
,
7
,
120
]);
let
ufloat32
=
new
Int32Array
([
4
,
6
,
7
,
120
]);
res
=
ufloat32
.
findIndex
((
value
:
number
,
index
:
number
,
obj
:
Int32Array
):
boolean
=>
value
>
100
);
res
=
ufloat32
.
findIndex
((
value
:
number
,
_
:
number
,
_
:
Int32Array
):
boolean
=>
value
>
100
);
expect
(
res
).
toEqual
(
3
);
expect
(
res
).
toEqual
(
3
);
}
}
foreach
()
{
foreach
()
{
new
Int32Array
([
0
,
1
,
2
,
3
]).
forEach
((
value
:
number
,
index
:
number
,
array
:
Int32Array
)
=>
{
new
Int32Array
([
0
,
1
,
2
,
3
]).
forEach
((
value
:
number
,
index
:
number
,
_
:
Int32Array
)
=>
{
console
.
log
(
`a[
${
index
}
] =
${
value
}
`
);
console
.
log
(
`a[
${
index
}
] =
${
value
}
`
);
});
});
}
}
...
@@ -185,28 +185,28 @@ export class TInt32Array {
...
@@ -185,28 +185,28 @@ export class TInt32Array {
map
()
{
map
()
{
let
numbers
=
new
Int32Array
([
1
,
4
,
9
]);
let
numbers
=
new
Int32Array
([
1
,
4
,
9
]);
let
doubles
=
numbers
.
map
((
value
:
number
,
index
:
number
,
array
:
Int32Array
):
number
=>
value
*
2
);
let
doubles
=
numbers
.
map
((
value
:
number
,
_
:
number
,
_
:
Int32Array
):
number
=>
value
*
2
);
expect
(
numbers
.
toString
()).
toEqual
(
"
1,4,9
"
);
expect
(
numbers
.
toString
()).
toEqual
(
"
1,4,9
"
);
expect
(
doubles
.
toString
()).
toEqual
(
"
2,8,18
"
);
expect
(
doubles
.
toString
()).
toEqual
(
"
2,8,18
"
);
}
}
reduce
()
{
reduce
()
{
let
total
=
new
Int32Array
([
0
,
1
,
2
,
3
]);
let
total
=
new
Int32Array
([
0
,
1
,
2
,
3
]);
let
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Int32Array
):
number
=>
accumulator
+
currentValue
);
let
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
_
:
number
,
_
:
Int32Array
):
number
=>
accumulator
+
currentValue
);
expect
(
res
).
toEqual
(
6
);
expect
(
res
).
toEqual
(
6
);
total
=
new
Int32Array
([
0
,
1
,
2
,
3
]);
total
=
new
Int32Array
([
0
,
1
,
2
,
3
]);
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Int32Array
):
number
=>
accumulator
+
currentValue
,
8
);
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
_
:
number
,
_
:
Int32Array
):
number
=>
accumulator
+
currentValue
,
8
);
expect
(
res
).
toEqual
(
14
);
expect
(
res
).
toEqual
(
14
);
}
}
reduceRight
()
{
reduceRight
()
{
let
total
=
new
Int32Array
([
0
,
1
,
2
,
3
]);
let
total
=
new
Int32Array
([
0
,
1
,
2
,
3
]);
let
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Int32Array
):
number
=>
accumulator
+
currentValue
);
let
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
_
:
number
,
_
:
Int32Array
):
number
=>
accumulator
+
currentValue
);
expect
(
res
).
toEqual
(
6
);
expect
(
res
).
toEqual
(
6
);
total
=
new
Int32Array
([
0
,
1
,
2
,
3
]);
total
=
new
Int32Array
([
0
,
1
,
2
,
3
]);
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Int32Array
):
number
=>
accumulator
+
currentValue
,
8
);
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
_
:
number
,
_
:
Int32Array
):
number
=>
accumulator
+
currentValue
,
8
);
expect
(
res
).
toEqual
(
14
);
expect
(
res
).
toEqual
(
14
);
}
}
...
...
uni_modules/uts-tests/utssdk/TInt8Array.js
浏览文件 @
bcb5b721
...
@@ -60,7 +60,7 @@ export class TInt8Array {
...
@@ -60,7 +60,7 @@ export class TInt8Array {
testEvery
()
{
testEvery
()
{
// const isBelowThreshold = (currentValue: number, index: number, array:Int8Array): boolean => currentValue < 40;
// const isBelowThreshold = (currentValue: number, index: number, array:Int8Array): boolean => currentValue < 40;
let
result
=
new
Int8Array
([
12
,
5
,
8
,
130
,
44
]).
every
((
value
:
number
,
index
:
number
,
array
:
Int8Array
):
boolean
=>
let
result
=
new
Int8Array
([
12
,
5
,
8
,
130
,
44
]).
every
((
value
:
number
,
_
:
number
,
_
:
Int8Array
):
boolean
=>
value
<
40
);
//
value
<
40
);
//
expect
(
result
).
toEqual
(
false
);
expect
(
result
).
toEqual
(
false
);
}
}
...
@@ -85,29 +85,29 @@ export class TInt8Array {
...
@@ -85,29 +85,29 @@ export class TInt8Array {
testFilter
()
{
testFilter
()
{
// const isBelowThreshold = (currentValue: number, index: number, _): boolean => currentValue >= 10;
// const isBelowThreshold = (currentValue: number, index: number, _): boolean => currentValue >= 10;
let
float32
=
new
Int8Array
([
12
,
5
,
8
,
44
]).
filter
((
value
:
number
,
index
:
number
,
array
:
Int8Array
):
boolean
=>
let
float32
=
new
Int8Array
([
12
,
5
,
8
,
44
]).
filter
((
value
:
number
,
_
:
number
,
_
:
Int8Array
):
boolean
=>
value
>=
10
);
value
>=
10
);
expect
(
float32
.
toString
()).
toEqual
(
"
12,44
"
);
expect
(
float32
.
toString
()).
toEqual
(
"
12,44
"
);
}
}
find
()
{
find
()
{
let
float32
=
new
Int8Array
([
4
,
5
,
8
,
12
]);
let
float32
=
new
Int8Array
([
4
,
5
,
8
,
12
]);
let
res
=
float32
.
find
((
value
:
number
,
index
:
number
,
obj
:
Int8Array
):
boolean
=>
value
>
5
);
let
res
=
float32
.
find
((
value
:
number
,
_
:
number
,
_
:
Int8Array
):
boolean
=>
value
>
5
);
expect
(
res
).
toEqual
(
8
);
expect
(
res
).
toEqual
(
8
);
}
}
findIndex
()
{
findIndex
()
{
let
float32
=
new
Int8Array
([
4
,
6
,
8
,
12
]);
let
float32
=
new
Int8Array
([
4
,
6
,
8
,
12
]);
let
res
=
float32
.
findIndex
((
value
:
number
,
index
:
number
,
obj
:
Int8Array
):
boolean
=>
value
>
100
);
let
res
=
float32
.
findIndex
((
value
:
number
,
_
:
number
,
_
:
Int8Array
):
boolean
=>
value
>
100
);
expect
(
res
).
toEqual
(
-
1
);
expect
(
res
).
toEqual
(
-
1
);
let
ufloat32
=
new
Int8Array
([
4
,
6
,
7
,
120
]);
let
ufloat32
=
new
Int8Array
([
4
,
6
,
7
,
120
]);
res
=
ufloat32
.
findIndex
((
value
:
number
,
index
:
number
,
obj
:
Int8Array
):
boolean
=>
value
>
100
);
res
=
ufloat32
.
findIndex
((
value
:
number
,
_
:
number
,
_
:
Int8Array
):
boolean
=>
value
>
100
);
expect
(
res
).
toEqual
(
3
);
expect
(
res
).
toEqual
(
3
);
}
}
foreach
()
{
foreach
()
{
new
Int8Array
([
0
,
1
,
2
,
3
]).
forEach
((
value
:
number
,
index
:
number
,
array
:
Int8Array
)
=>
{
new
Int8Array
([
0
,
1
,
2
,
3
]).
forEach
((
value
:
number
,
index
:
number
,
_
:
Int8Array
)
=>
{
console
.
log
(
`a[
${
index
}
] =
${
value
}
`
);
console
.
log
(
`a[
${
index
}
] =
${
value
}
`
);
});
});
}
}
...
@@ -173,31 +173,31 @@ export class TInt8Array {
...
@@ -173,31 +173,31 @@ export class TInt8Array {
map
()
{
map
()
{
let
numbers
=
new
Int8Array
([
1
,
4
,
9
]);
let
numbers
=
new
Int8Array
([
1
,
4
,
9
]);
let
doubles
=
numbers
.
map
((
value
:
number
,
index
:
number
,
array
:
Int8Array
):
number
=>
value
*
2
);
let
doubles
=
numbers
.
map
((
value
:
number
,
_
:
number
,
_
:
Int8Array
):
number
=>
value
*
2
);
expect
(
numbers
.
toString
()).
toEqual
(
"
1,4,9
"
);
expect
(
numbers
.
toString
()).
toEqual
(
"
1,4,9
"
);
expect
(
doubles
.
toString
()).
toEqual
(
"
2,8,18
"
);
expect
(
doubles
.
toString
()).
toEqual
(
"
2,8,18
"
);
}
}
reduce
()
{
reduce
()
{
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
,
_
:
number
,
_
:
Int8Array
):
number
=>
accumulator
+
currentValue
);
number
=>
accumulator
+
currentValue
);
expect
(
res
).
toEqual
(
6
);
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
,
_
:
number
,
_
:
Int8Array
):
number
=>
accumulator
+
currentValue
,
8
);
accumulator
+
currentValue
,
8
);
expect
(
res
).
toEqual
(
14
);
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
,
_
:
number
,
_
:
Int8Array
):
number
=>
accumulator
+
currentValue
);
number
=>
accumulator
+
currentValue
);
expect
(
res
).
toEqual
(
6
);
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
,
_
:
number
,
_
:
Int8Array
):
number
=>
accumulator
+
currentValue
,
8
);
number
=>
accumulator
+
currentValue
,
8
);
expect
(
res
).
toEqual
(
14
);
expect
(
res
).
toEqual
(
14
);
...
...
uni_modules/uts-tests/utssdk/TUInt8Array.js
浏览文件 @
bcb5b721
...
@@ -64,7 +64,7 @@ export class TUint8Array {
...
@@ -64,7 +64,7 @@ export class TUint8Array {
testEvery
()
{
testEvery
()
{
// const isBelowThreshold = (currentValue: number, index: number, array:Uint8Array): boolean => currentValue < 40;
// const isBelowThreshold = (currentValue: number, index: number, array:Uint8Array): boolean => currentValue < 40;
let
result
=
new
Uint8Array
([
12
,
5
,
8
,
130
,
44
]).
every
((
value
:
number
,
index
:
number
,
array
:
Uint8Array
):
boolean
=>
value
<
40
);
//
let
result
=
new
Uint8Array
([
12
,
5
,
8
,
130
,
44
]).
every
((
value
:
number
,
_
:
number
,
_
:
Uint8Array
):
boolean
=>
value
<
40
);
//
expect
(
result
).
toEqual
(
false
);
expect
(
result
).
toEqual
(
false
);
}
}
...
@@ -88,28 +88,28 @@ export class TUint8Array {
...
@@ -88,28 +88,28 @@ export class TUint8Array {
testFilter
()
{
testFilter
()
{
// const isBelowThreshold = (currentValue: number, index: number, _): boolean => currentValue >= 10;
// const isBelowThreshold = (currentValue: number, index: number, _): boolean => currentValue >= 10;
let
float32
=
new
Uint8Array
([
12
,
5
,
8
,
44
]).
filter
((
value
:
number
,
index
:
number
,
array
:
Uint8Array
):
boolean
=>
value
>=
10
);
let
float32
=
new
Uint8Array
([
12
,
5
,
8
,
44
]).
filter
((
value
:
number
,
_
:
number
,
_
:
Uint8Array
):
boolean
=>
value
>=
10
);
expect
(
float32
.
toString
()).
toEqual
(
"
12,44
"
);
expect
(
float32
.
toString
()).
toEqual
(
"
12,44
"
);
}
}
find
()
{
find
()
{
let
float32
=
new
Uint8Array
([
4
,
5
,
8
,
12
]);
let
float32
=
new
Uint8Array
([
4
,
5
,
8
,
12
]);
let
res
=
float32
.
find
((
value
:
number
,
index
:
number
,
obj
:
Uint8Array
):
boolean
=>
value
>
5
);
let
res
=
float32
.
find
((
value
:
number
,
_
:
number
,
_
:
Uint8Array
):
boolean
=>
value
>
5
);
expect
(
res
).
toEqual
(
8
);
expect
(
res
).
toEqual
(
8
);
}
}
findIndex
()
{
findIndex
()
{
let
float32
=
new
Uint8Array
([
4
,
6
,
8
,
12
]);
let
float32
=
new
Uint8Array
([
4
,
6
,
8
,
12
]);
let
res
=
float32
.
findIndex
((
value
:
number
,
index
:
number
,
obj
:
Uint8Array
):
boolean
=>
value
>
100
);
let
res
=
float32
.
findIndex
((
value
:
number
,
_
:
number
,
_
:
Uint8Array
):
boolean
=>
value
>
100
);
expect
(
res
).
toEqual
(
-
1
);
expect
(
res
).
toEqual
(
-
1
);
let
ufloat32
=
new
Uint8Array
([
4
,
6
,
7
,
120
]);
let
ufloat32
=
new
Uint8Array
([
4
,
6
,
7
,
120
]);
res
=
ufloat32
.
findIndex
((
value
:
number
,
index
:
number
,
obj
:
Uint8Array
):
boolean
=>
value
>
100
);
res
=
ufloat32
.
findIndex
((
value
:
number
,
_
:
number
,
_
:
Uint8Array
):
boolean
=>
value
>
100
);
expect
(
res
).
toEqual
(
3
);
expect
(
res
).
toEqual
(
3
);
}
}
foreach
()
{
foreach
()
{
new
Uint8Array
([
0
,
1
,
2
,
3
]).
forEach
((
value
:
number
,
index
:
number
,
array
:
Uint8Array
)
=>
{
new
Uint8Array
([
0
,
1
,
2
,
3
]).
forEach
((
value
:
number
,
index
:
number
,
_
:
Uint8Array
)
=>
{
console
.
log
(
`a[
${
index
}
] =
${
value
}
`
);
console
.
log
(
`a[
${
index
}
] =
${
value
}
`
);
});
});
}
}
...
@@ -171,28 +171,28 @@ export class TUint8Array {
...
@@ -171,28 +171,28 @@ export class TUint8Array {
map
()
{
map
()
{
let
numbers
=
new
Uint8Array
([
1
,
4
,
9
]);
let
numbers
=
new
Uint8Array
([
1
,
4
,
9
]);
let
doubles
=
numbers
.
map
((
value
:
number
,
index
:
number
,
array
:
Uint8Array
):
number
=>
value
*
2
);
let
doubles
=
numbers
.
map
((
value
:
number
,
_
:
number
,
_
:
Uint8Array
):
number
=>
value
*
2
);
expect
(
numbers
.
toString
()).
toEqual
(
"
1,4,9
"
);
expect
(
numbers
.
toString
()).
toEqual
(
"
1,4,9
"
);
expect
(
doubles
.
toString
()).
toEqual
(
"
2,8,18
"
);
expect
(
doubles
.
toString
()).
toEqual
(
"
2,8,18
"
);
}
}
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
,
_
:
number
,
_
:
Uint8Array
):
number
=>
accumulator
+
currentValue
);
expect
(
res
).
toEqual
(
6
);
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
,
_
:
number
,
_
:
Uint8Array
):
number
=>
accumulator
+
currentValue
,
8
);
expect
(
res
).
toEqual
(
14
);
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
,
_
:
number
,
_
:
Uint8Array
):
number
=>
accumulator
+
currentValue
);
expect
(
res
).
toEqual
(
6
);
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
,
_
:
number
,
_
:
Uint8Array
):
number
=>
accumulator
+
currentValue
,
8
);
expect
(
res
).
toEqual
(
14
);
expect
(
res
).
toEqual
(
14
);
}
}
...
...
uni_modules/uts-tests/utssdk/TUInt8ClampedArray.js
浏览文件 @
bcb5b721
...
@@ -64,7 +64,7 @@ export class TUint8ClampedArray {
...
@@ -64,7 +64,7 @@ export class TUint8ClampedArray {
testEvery
()
{
testEvery
()
{
// const isBelowThreshold = (currentValue: number, index: number, array:Uint8ClampedArray): boolean => currentValue < 40;
// const isBelowThreshold = (currentValue: number, index: number, array:Uint8ClampedArray): boolean => currentValue < 40;
let
result
=
new
Uint8ClampedArray
([
12
,
5
,
8
,
130
,
44
]).
every
((
value
:
number
,
index
:
number
,
array
:
let
result
=
new
Uint8ClampedArray
([
12
,
5
,
8
,
130
,
44
]).
every
((
value
:
number
,
_
:
number
,
_
:
Uint8ClampedArray
):
boolean
=>
value
<
40
);
//
Uint8ClampedArray
):
boolean
=>
value
<
40
);
//
expect
(
result
).
toEqual
(
false
);
expect
(
result
).
toEqual
(
false
);
}
}
...
@@ -89,29 +89,29 @@ export class TUint8ClampedArray {
...
@@ -89,29 +89,29 @@ export class TUint8ClampedArray {
testFilter
()
{
testFilter
()
{
// const isBelowThreshold = (currentValue: number, index: number, _): boolean => currentValue >= 10;
// const isBelowThreshold = (currentValue: number, index: number, _): boolean => currentValue >= 10;
let
float32
=
new
Uint8ClampedArray
([
12
,
5
,
8
,
44
]).
filter
((
value
:
number
,
index
:
number
,
array
:
let
float32
=
new
Uint8ClampedArray
([
12
,
5
,
8
,
44
]).
filter
((
value
:
number
,
_
:
number
,
_
:
Uint8ClampedArray
):
boolean
=>
value
>=
10
);
Uint8ClampedArray
):
boolean
=>
value
>=
10
);
expect
(
float32
.
toString
()).
toEqual
(
"
12,44
"
);
expect
(
float32
.
toString
()).
toEqual
(
"
12,44
"
);
}
}
find
()
{
find
()
{
let
float32
=
new
Uint8ClampedArray
([
4
,
5
,
8
,
12
]);
let
float32
=
new
Uint8ClampedArray
([
4
,
5
,
8
,
12
]);
let
res
=
float32
.
find
((
value
:
number
,
index
:
number
,
obj
:
Uint8ClampedArray
):
boolean
=>
value
>
5
);
let
res
=
float32
.
find
((
value
:
number
,
_
:
number
,
_
:
Uint8ClampedArray
):
boolean
=>
value
>
5
);
expect
(
res
).
toEqual
(
8
);
expect
(
res
).
toEqual
(
8
);
}
}
findIndex
()
{
findIndex
()
{
let
float32
=
new
Uint8ClampedArray
([
4
,
6
,
8
,
12
]);
let
float32
=
new
Uint8ClampedArray
([
4
,
6
,
8
,
12
]);
let
res
=
float32
.
findIndex
((
value
:
number
,
index
:
number
,
obj
:
Uint8ClampedArray
):
boolean
=>
value
>
100
);
let
res
=
float32
.
findIndex
((
value
:
number
,
_
:
number
,
_
:
Uint8ClampedArray
):
boolean
=>
value
>
100
);
expect
(
res
).
toEqual
(
-
1
);
expect
(
res
).
toEqual
(
-
1
);
let
ufloat32
=
new
Uint8ClampedArray
([
4
,
6
,
7
,
120
]);
let
ufloat32
=
new
Uint8ClampedArray
([
4
,
6
,
7
,
120
]);
res
=
ufloat32
.
findIndex
((
value
:
number
,
index
:
number
,
obj
:
Uint8ClampedArray
):
boolean
=>
value
>
100
);
res
=
ufloat32
.
findIndex
((
value
:
number
,
_
:
number
,
_
:
Uint8ClampedArray
):
boolean
=>
value
>
100
);
expect
(
res
).
toEqual
(
3
);
expect
(
res
).
toEqual
(
3
);
}
}
foreach
()
{
foreach
()
{
new
Uint8ClampedArray
([
0
,
1
,
2
,
3
]).
forEach
((
value
:
number
,
index
:
number
,
array
:
Uint8ClampedArray
)
=>
{
new
Uint8ClampedArray
([
0
,
1
,
2
,
3
]).
forEach
((
value
:
number
,
index
:
number
,
_
:
Uint8ClampedArray
)
=>
{
console
.
log
(
`a[
${
index
}
] =
${
value
}
`
);
console
.
log
(
`a[
${
index
}
] =
${
value
}
`
);
});
});
}
}
...
@@ -173,31 +173,31 @@ export class TUint8ClampedArray {
...
@@ -173,31 +173,31 @@ export class TUint8ClampedArray {
map
()
{
map
()
{
let
numbers
=
new
Uint8ClampedArray
([
1
,
4
,
9
]);
let
numbers
=
new
Uint8ClampedArray
([
1
,
4
,
9
]);
let
doubles
=
numbers
.
map
((
value
:
number
,
index
:
number
,
array
:
Uint8ClampedArray
):
number
=>
value
*
2
);
let
doubles
=
numbers
.
map
((
value
:
number
,
_
:
number
,
_
:
Uint8ClampedArray
):
number
=>
value
*
2
);
expect
(
numbers
.
toString
()).
toEqual
(
"
1,4,9
"
);
expect
(
numbers
.
toString
()).
toEqual
(
"
1,4,9
"
);
expect
(
doubles
.
toString
()).
toEqual
(
"
2,8,18
"
);
expect
(
doubles
.
toString
()).
toEqual
(
"
2,8,18
"
);
}
}
reduce
()
{
reduce
()
{
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
,
_
:
number
,
_
:
Uint8ClampedArray
):
number
=>
accumulator
+
currentValue
);
Uint8ClampedArray
):
number
=>
accumulator
+
currentValue
);
expect
(
res
).
toEqual
(
6
);
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
,
_
:
number
,
_
:
Uint8ClampedArray
):
number
=>
accumulator
+
currentValue
,
8
);
number
=>
accumulator
+
currentValue
,
8
);
expect
(
res
).
toEqual
(
14
);
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
,
_
:
number
,
_
:
Uint8ClampedArray
):
number
=>
accumulator
+
currentValue
);
Uint8ClampedArray
):
number
=>
accumulator
+
currentValue
);
expect
(
res
).
toEqual
(
6
);
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
,
_
:
number
,
_
:
Uint8ClampedArray
):
number
=>
accumulator
+
currentValue
,
8
);
Uint8ClampedArray
):
number
=>
accumulator
+
currentValue
,
8
);
expect
(
res
).
toEqual
(
14
);
expect
(
res
).
toEqual
(
14
);
}
}
...
...
uni_modules/uts-tests/utssdk/TUint16Array.js
浏览文件 @
bcb5b721
...
@@ -78,7 +78,7 @@ export class TUint16Array {
...
@@ -78,7 +78,7 @@ export class TUint16Array {
testEvery
()
{
testEvery
()
{
// const isBelowThreshold = (currentValue: number, index: number, array:Uint16Array): boolean => currentValue < 40;
// const isBelowThreshold = (currentValue: number, index: number, array:Uint16Array): boolean => currentValue < 40;
let
result
=
new
Uint16Array
([
12
,
5
,
8
,
130
,
44
]).
every
((
value
:
number
,
index
:
number
,
array
:
Uint16Array
):
let
result
=
new
Uint16Array
([
12
,
5
,
8
,
130
,
44
]).
every
((
value
:
number
,
_
:
number
,
_
:
Uint16Array
):
boolean
=>
value
<
40
);
//
boolean
=>
value
<
40
);
//
expect
(
result
).
toEqual
(
false
);
expect
(
result
).
toEqual
(
false
);
}
}
...
@@ -103,29 +103,29 @@ export class TUint16Array {
...
@@ -103,29 +103,29 @@ export class TUint16Array {
testFilter
()
{
testFilter
()
{
// const isBelowThreshold = (currentValue: number, index: number, _): boolean => currentValue >= 10;
// const isBelowThreshold = (currentValue: number, index: number, _): boolean => currentValue >= 10;
let
float32
=
new
Uint16Array
([
12
,
5
,
8
,
44
]).
filter
((
value
:
number
,
index
:
number
,
array
:
Uint16Array
):
let
float32
=
new
Uint16Array
([
12
,
5
,
8
,
44
]).
filter
((
value
:
number
,
_
:
number
,
_
:
Uint16Array
):
boolean
=>
value
>=
10
);
boolean
=>
value
>=
10
);
expect
(
float32
.
toString
()).
toEqual
(
"
12,44
"
);
expect
(
float32
.
toString
()).
toEqual
(
"
12,44
"
);
}
}
find
()
{
find
()
{
let
float32
=
new
Uint16Array
([
4
,
5
,
8
,
12
]);
let
float32
=
new
Uint16Array
([
4
,
5
,
8
,
12
]);
let
res
=
float32
.
find
((
value
:
number
,
index
:
number
,
obj
:
Uint16Array
):
boolean
=>
value
>
5
);
let
res
=
float32
.
find
((
value
:
number
,
_
:
number
,
_
:
Uint16Array
):
boolean
=>
value
>
5
);
expect
(
res
).
toEqual
(
8
);
expect
(
res
).
toEqual
(
8
);
}
}
findIndex
()
{
findIndex
()
{
let
float32
=
new
Uint16Array
([
4
,
6
,
8
,
12
]);
let
float32
=
new
Uint16Array
([
4
,
6
,
8
,
12
]);
let
res
=
float32
.
findIndex
((
value
:
number
,
index
:
number
,
obj
:
Uint16Array
):
boolean
=>
value
>
100
);
let
res
=
float32
.
findIndex
((
value
:
number
,
_
:
number
,
_
:
Uint16Array
):
boolean
=>
value
>
100
);
expect
(
res
).
toEqual
(
-
1
);
expect
(
res
).
toEqual
(
-
1
);
let
ufloat32
=
new
Uint16Array
([
4
,
6
,
7
,
120
]);
let
ufloat32
=
new
Uint16Array
([
4
,
6
,
7
,
120
]);
res
=
ufloat32
.
findIndex
((
value
:
number
,
index
:
number
,
obj
:
Uint16Array
):
boolean
=>
value
>
100
);
res
=
ufloat32
.
findIndex
((
value
:
number
,
_
:
number
,
_
:
Uint16Array
):
boolean
=>
value
>
100
);
expect
(
res
).
toEqual
(
3
);
expect
(
res
).
toEqual
(
3
);
}
}
foreach
()
{
foreach
()
{
new
Uint16Array
([
0
,
1
,
2
,
3
]).
forEach
((
value
:
number
,
index
:
number
,
array
:
Uint16Array
)
=>
{
new
Uint16Array
([
0
,
1
,
2
,
3
]).
forEach
((
value
:
number
,
index
:
number
,
_
:
Uint16Array
)
=>
{
console
.
log
(
`a[
${
index
}
] =
${
value
}
`
);
console
.
log
(
`a[
${
index
}
] =
${
value
}
`
);
});
});
}
}
...
@@ -187,31 +187,31 @@ export class TUint16Array {
...
@@ -187,31 +187,31 @@ export class TUint16Array {
map
()
{
map
()
{
let
numbers
=
new
Uint16Array
([
1
,
4
,
9
]);
let
numbers
=
new
Uint16Array
([
1
,
4
,
9
]);
let
doubles
=
numbers
.
map
((
value
:
number
,
index
:
number
,
array
:
Uint16Array
):
number
=>
value
*
2
);
let
doubles
=
numbers
.
map
((
value
:
number
,
_
:
number
,
_
:
Uint16Array
):
number
=>
value
*
2
);
expect
(
numbers
.
toString
()).
toEqual
(
"
1,4,9
"
);
expect
(
numbers
.
toString
()).
toEqual
(
"
1,4,9
"
);
expect
(
doubles
.
toString
()).
toEqual
(
"
2,8,18
"
);
expect
(
doubles
.
toString
()).
toEqual
(
"
2,8,18
"
);
}
}
reduce
()
{
reduce
()
{
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
,
_
:
number
,
_
:
Uint16Array
):
number
=>
accumulator
+
currentValue
);
number
=>
accumulator
+
currentValue
);
expect
(
res
).
toEqual
(
6
);
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
,
_
:
number
,
_
:
Uint16Array
):
number
=>
accumulator
+
currentValue
,
8
);
number
=>
accumulator
+
currentValue
,
8
);
expect
(
res
).
toEqual
(
14
);
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
,
_
:
number
,
_
:
Uint16Array
):
number
=>
accumulator
+
currentValue
);
number
=>
accumulator
+
currentValue
);
expect
(
res
).
toEqual
(
6
);
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
,
_
:
number
,
_
:
Uint16Array
):
number
=>
accumulator
+
currentValue
,
8
);
number
=>
accumulator
+
currentValue
,
8
);
expect
(
res
).
toEqual
(
14
);
expect
(
res
).
toEqual
(
14
);
}
}
...
...
uni_modules/uts-tests/utssdk/TUint32Array.js
浏览文件 @
bcb5b721
...
@@ -78,7 +78,7 @@ export class TUint32Array {
...
@@ -78,7 +78,7 @@ export class TUint32Array {
testEvery
()
{
testEvery
()
{
// const isBelowThreshold = (currentValue: number, index: number, array:Uint32Array): boolean => currentValue < 40;
// const isBelowThreshold = (currentValue: number, index: number, array:Uint32Array): boolean => currentValue < 40;
let
result
=
new
Uint32Array
([
12
,
5
,
8
,
130
,
44
]).
every
((
value
:
number
,
index
:
number
,
array
:
Uint32Array
):
let
result
=
new
Uint32Array
([
12
,
5
,
8
,
130
,
44
]).
every
((
value
:
number
,
_
:
number
,
_
:
Uint32Array
):
boolean
=>
value
<
40
);
//
boolean
=>
value
<
40
);
//
expect
(
result
).
toEqual
(
false
);
expect
(
result
).
toEqual
(
false
);
}
}
...
@@ -103,29 +103,29 @@ export class TUint32Array {
...
@@ -103,29 +103,29 @@ export class TUint32Array {
testFilter
()
{
testFilter
()
{
// const isBelowThreshold = (currentValue: number, index: number, _): boolean => currentValue >= 10;
// const isBelowThreshold = (currentValue: number, index: number, _): boolean => currentValue >= 10;
let
float32
=
new
Uint32Array
([
12
,
5
,
8
,
44
]).
filter
((
value
:
number
,
index
:
number
,
array
:
Uint32Array
):
let
float32
=
new
Uint32Array
([
12
,
5
,
8
,
44
]).
filter
((
value
:
number
,
_
:
number
,
_
:
Uint32Array
):
boolean
=>
value
>=
10
);
boolean
=>
value
>=
10
);
expect
(
float32
.
toString
()).
toEqual
(
"
12,44
"
);
expect
(
float32
.
toString
()).
toEqual
(
"
12,44
"
);
}
}
find
()
{
find
()
{
let
float32
=
new
Uint32Array
([
4
,
5
,
8
,
12
]);
let
float32
=
new
Uint32Array
([
4
,
5
,
8
,
12
]);
let
res
=
float32
.
find
((
value
:
number
,
index
:
number
,
obj
:
Uint32Array
):
boolean
=>
value
>
5
);
let
res
=
float32
.
find
((
value
:
number
,
_
:
number
,
_
:
Uint32Array
):
boolean
=>
value
>
5
);
expect
(
res
).
toEqual
(
8
);
expect
(
res
).
toEqual
(
8
);
}
}
findIndex
()
{
findIndex
()
{
let
float32
=
new
Uint32Array
([
4
,
6
,
8
,
12
]);
let
float32
=
new
Uint32Array
([
4
,
6
,
8
,
12
]);
let
res
=
float32
.
findIndex
((
value
:
number
,
index
:
number
,
obj
:
Uint32Array
):
boolean
=>
value
>
100
);
let
res
=
float32
.
findIndex
((
value
:
number
,
_
:
number
,
_
:
Uint32Array
):
boolean
=>
value
>
100
);
expect
(
res
).
toEqual
(
-
1
);
expect
(
res
).
toEqual
(
-
1
);
let
ufloat32
=
new
Uint32Array
([
4
,
6
,
7
,
120
]);
let
ufloat32
=
new
Uint32Array
([
4
,
6
,
7
,
120
]);
res
=
ufloat32
.
findIndex
((
value
:
number
,
index
:
number
,
obj
:
Uint32Array
):
boolean
=>
value
>
100
);
res
=
ufloat32
.
findIndex
((
value
:
number
,
_
:
number
,
_
:
Uint32Array
):
boolean
=>
value
>
100
);
expect
(
res
).
toEqual
(
3
);
expect
(
res
).
toEqual
(
3
);
}
}
foreach
()
{
foreach
()
{
new
Uint32Array
([
0
,
1
,
2
,
3
]).
forEach
((
value
:
number
,
index
:
number
,
array
:
Uint32Array
)
=>
{
new
Uint32Array
([
0
,
1
,
2
,
3
]).
forEach
((
value
:
number
,
index
:
number
,
_
:
Uint32Array
)
=>
{
console
.
log
(
`a[
${
index
}
] =
${
value
}
`
);
console
.
log
(
`a[
${
index
}
] =
${
value
}
`
);
});
});
}
}
...
@@ -187,31 +187,31 @@ export class TUint32Array {
...
@@ -187,31 +187,31 @@ export class TUint32Array {
map
()
{
map
()
{
let
numbers
=
new
Uint32Array
([
1
,
4
,
9
]);
let
numbers
=
new
Uint32Array
([
1
,
4
,
9
]);
let
doubles
=
numbers
.
map
((
value
:
number
,
index
:
number
,
array
:
Uint32Array
):
number
=>
value
*
2
);
let
doubles
=
numbers
.
map
((
value
:
number
,
_
:
number
,
_
:
Uint32Array
):
number
=>
value
*
2
);
expect
(
numbers
.
toString
()).
toEqual
(
"
1,4,9
"
);
expect
(
numbers
.
toString
()).
toEqual
(
"
1,4,9
"
);
expect
(
doubles
.
toString
()).
toEqual
(
"
2,8,18
"
);
expect
(
doubles
.
toString
()).
toEqual
(
"
2,8,18
"
);
}
}
reduce
()
{
reduce
()
{
let
total
=
new
Uint32Array
([
0
,
1
,
2
,
3
]);
let
total
=
new
Uint32Array
([
0
,
1
,
2
,
3
]);
let
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Uint32Array
):
let
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
_
:
number
,
_
:
Uint32Array
):
number
=>
accumulator
+
currentValue
);
number
=>
accumulator
+
currentValue
);
expect
(
res
).
toEqual
(
6
);
expect
(
res
).
toEqual
(
6
);
total
=
new
Uint32Array
([
0
,
1
,
2
,
3
]);
total
=
new
Uint32Array
([
0
,
1
,
2
,
3
]);
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Uint32Array
):
res
=
total
.
reduce
((
accumulator
:
number
,
currentValue
:
number
,
_
:
number
,
_
:
Uint32Array
):
number
=>
accumulator
+
currentValue
,
8
);
number
=>
accumulator
+
currentValue
,
8
);
expect
(
res
).
toEqual
(
14
);
expect
(
res
).
toEqual
(
14
);
}
}
reduceRight
()
{
reduceRight
()
{
let
total
=
new
Uint32Array
([
0
,
1
,
2
,
3
]);
let
total
=
new
Uint32Array
([
0
,
1
,
2
,
3
]);
let
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Uint32Array
):
let
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
_
:
number
,
_
:
Uint32Array
):
number
=>
accumulator
+
currentValue
);
number
=>
accumulator
+
currentValue
);
expect
(
res
).
toEqual
(
6
);
expect
(
res
).
toEqual
(
6
);
total
=
new
Uint32Array
([
0
,
1
,
2
,
3
]);
total
=
new
Uint32Array
([
0
,
1
,
2
,
3
]);
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
currentIndex
:
number
,
array
:
Uint32Array
):
res
=
total
.
reduceRight
((
accumulator
:
number
,
currentValue
:
number
,
_
:
number
,
_
:
Uint32Array
):
number
=>
accumulator
+
currentValue
,
8
);
number
=>
accumulator
+
currentValue
,
8
);
expect
(
res
).
toEqual
(
14
);
expect
(
res
).
toEqual
(
14
);
}
}
...
...
WOSHIMAHAIFENG
@WOSHIMAHAIFENG
mentioned in commit
b0532d6d
·
7月 15, 2024
mentioned in commit
b0532d6d
mentioned in commit b0532d6de59a2cc22e9ea9ab1cef2b5bc6378171
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录