Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
Hello UTS
提交
95cc26fa
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看板
提交
95cc26fa
编写于
7月 15, 2024
作者:
M
mahaifeng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[array-buffer]添加some测试用例
上级
d776682b
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
163 addition
and
5 deletion
+163
-5
uni_modules/uts-tests/utssdk/ArrayBuffer.uts
uni_modules/uts-tests/utssdk/ArrayBuffer.uts
+29
-1
uni_modules/uts-tests/utssdk/TFloat32Array.uts
uni_modules/uts-tests/utssdk/TFloat32Array.uts
+15
-0
uni_modules/uts-tests/utssdk/TFloat64Array.uts
uni_modules/uts-tests/utssdk/TFloat64Array.uts
+14
-0
uni_modules/uts-tests/utssdk/TInt16Array.uts
uni_modules/uts-tests/utssdk/TInt16Array.uts
+14
-0
uni_modules/uts-tests/utssdk/TInt32Array.uts
uni_modules/uts-tests/utssdk/TInt32Array.uts
+14
-0
uni_modules/uts-tests/utssdk/TInt8Array.uts
uni_modules/uts-tests/utssdk/TInt8Array.uts
+16
-1
uni_modules/uts-tests/utssdk/TUInt8Array.uts
uni_modules/uts-tests/utssdk/TUInt8Array.uts
+18
-3
uni_modules/uts-tests/utssdk/TUInt8ClampedArray.uts
uni_modules/uts-tests/utssdk/TUInt8ClampedArray.uts
+14
-0
uni_modules/uts-tests/utssdk/TUint16Array.uts
uni_modules/uts-tests/utssdk/TUint16Array.uts
+14
-0
uni_modules/uts-tests/utssdk/TUint32Array.uts
uni_modules/uts-tests/utssdk/TUint32Array.uts
+15
-0
未找到文件。
uni_modules/uts-tests/utssdk/ArrayBuffer.uts
浏览文件 @
95cc26fa
...
@@ -23,6 +23,7 @@ const int16 = new TInt16Array()
...
@@ -23,6 +23,7 @@ const int16 = new TInt16Array()
export function testArrayBuffer() : Result {
export function testArrayBuffer() : Result {
return describe("ArrayBuffer", () => {
return describe("ArrayBuffer", () => {
// #ifdef APP-ANDROID
//dataview start
//dataview start
test('dataview_constructor', () => {
test('dataview_constructor', () => {
tDataView.setConstructor()
tDataView.setConstructor()
...
@@ -75,6 +76,9 @@ export function testArrayBuffer() : Result {
...
@@ -75,6 +76,9 @@ export function testArrayBuffer() : Result {
test('float32_testSet', () => {
test('float32_testSet', () => {
float32.testSet()
float32.testSet()
})
})
test('float32_testSome', () => {
float32.testSome()
})
test('float32_testFrom', () => {
test('float32_testFrom', () => {
float32.from()
float32.from()
})
})
...
@@ -212,6 +216,9 @@ export function testArrayBuffer() : Result {
...
@@ -212,6 +216,9 @@ export function testArrayBuffer() : Result {
test('float64_arrayBufferSlice', () => {
test('float64_arrayBufferSlice', () => {
float64.arrayBufferSlice()
float64.arrayBufferSlice()
})
})
test('float64_testSome', () => {
float64.testSome()
})
//float64 end
//float64 end
//int8 start
//int8 start
...
@@ -284,6 +291,9 @@ export function testArrayBuffer() : Result {
...
@@ -284,6 +291,9 @@ export function testArrayBuffer() : Result {
test('int8_arrayBufferSlice', () => {
test('int8_arrayBufferSlice', () => {
int8.arrayBufferSlice()
int8.arrayBufferSlice()
})
})
test('int8_testSome', () => {
int8.testSome()
})
// //int8 end
// //int8 end
...
@@ -357,6 +367,9 @@ export function testArrayBuffer() : Result {
...
@@ -357,6 +367,9 @@ export function testArrayBuffer() : Result {
test('int16_arrayBufferSlice', () => {
test('int16_arrayBufferSlice', () => {
int16.arrayBufferSlice()
int16.arrayBufferSlice()
})
})
test('int16_testSome', () => {
int16.testSome()
})
//int16 end
//int16 end
...
@@ -430,6 +443,9 @@ export function testArrayBuffer() : Result {
...
@@ -430,6 +443,9 @@ export function testArrayBuffer() : Result {
test('int32_arrayBufferSlice', () => {
test('int32_arrayBufferSlice', () => {
int32.arrayBufferSlice()
int32.arrayBufferSlice()
})
})
test('int32_testSome', () => {
int32.testSome()
})
//int32 end
//int32 end
...
@@ -506,6 +522,9 @@ export function testArrayBuffer() : Result {
...
@@ -506,6 +522,9 @@ export function testArrayBuffer() : Result {
test('uint8_arrayBufferSlice', () => {
test('uint8_arrayBufferSlice', () => {
uint8.arrayBufferSlice()
uint8.arrayBufferSlice()
})
})
test('uint8_testSome', () => {
uint8.testSome()
})
//uint8 end
//uint8 end
...
@@ -579,6 +598,9 @@ export function testArrayBuffer() : Result {
...
@@ -579,6 +598,9 @@ export function testArrayBuffer() : Result {
test('uint8Clamped_arrayBufferSlice', () => {
test('uint8Clamped_arrayBufferSlice', () => {
uint8Clamped.arrayBufferSlice()
uint8Clamped.arrayBufferSlice()
})
})
test('uint8Clamped_testSome', () => {
uint8Clamped.testSome()
})
//uint8Clamped end
//uint8Clamped end
...
@@ -652,6 +674,9 @@ export function testArrayBuffer() : Result {
...
@@ -652,6 +674,9 @@ export function testArrayBuffer() : Result {
test('uint16_arrayBufferSlice', () => {
test('uint16_arrayBufferSlice', () => {
uint16.arrayBufferSlice()
uint16.arrayBufferSlice()
})
})
test('uint16_testSome', () => {
uint16.testSome()
})
//uint16 end
//uint16 end
...
@@ -725,7 +750,10 @@ export function testArrayBuffer() : Result {
...
@@ -725,7 +750,10 @@ export function testArrayBuffer() : Result {
test('uint32_arrayBufferSlice', () => {
test('uint32_arrayBufferSlice', () => {
uint32.arrayBufferSlice()
uint32.arrayBufferSlice()
})
})
test('uint32_testSome', () => {
uint32.testSome()
})
// #endif
//uint32 end
//uint32 end
})
})
}
}
\ No newline at end of file
uni_modules/uts-tests/utssdk/TFloat32Array.uts
浏览文件 @
95cc26fa
...
@@ -324,5 +324,20 @@ export class TFloat32Array {
...
@@ -324,5 +324,20 @@ export class TFloat32Array {
// #END
// #END
}
}
testSome() {
// #TEST Float32Array.some
const float32 = new Float32Array([-10, 20, -30, 40, -50]);
const positives = new Float32Array([10, 20, 30, 40, 50]);
expect(float32.some((element : number, index : number, array : Float32Array) : boolean =>
element < 0
)).toEqual(true);
expect(positives.some((element : number, index : number, array : Float32Array) : boolean =>
element < 0
)).toEqual(false);
// #END
}
// #endif
// #endif
}
}
\ No newline at end of file
uni_modules/uts-tests/utssdk/TFloat64Array.uts
浏览文件 @
95cc26fa
...
@@ -317,6 +317,20 @@ export class TFloat64Array {
...
@@ -317,6 +317,20 @@ export class TFloat64Array {
// #END
// #END
}
}
testSome() {
// #TEST Float64Array.some
const float64 = new Float64Array([-10, 20, -30, 40, -50]);
const positives = new Float64Array([10, 20, 30, 40, 50]);
expect(float64.some((element : number, index : number, array : Float64Array) : boolean =>
element < 0
)).toEqual(true);
expect(positives.some((element : number, index : number, array : Float64Array) : boolean =>
element < 0
)).toEqual(false);
// #END
}
// #endif
// #endif
}
}
\ No newline at end of file
uni_modules/uts-tests/utssdk/TInt16Array.uts
浏览文件 @
95cc26fa
...
@@ -292,6 +292,20 @@ export class TInt16Array {
...
@@ -292,6 +292,20 @@ export class TInt16Array {
// #END
// #END
}
}
testSome() {
// #TEST Int16Array.some
const int16 = new Int16Array([-10, 20, -30, 40, -50]);
const positives = new Int16Array([10, 20, 30, 40, 50]);
expect(int16.some((element : number, index : number, array : Int16Array) : boolean =>
element < 0
)).toEqual(true);
expect(positives.some((element : number, index : number, array : Int16Array) : boolean =>
element < 0
)).toEqual(false);
// #END
}
// #endif
// #endif
}
}
\ No newline at end of file
uni_modules/uts-tests/utssdk/TInt32Array.uts
浏览文件 @
95cc26fa
...
@@ -311,6 +311,20 @@ export class TInt32Array {
...
@@ -311,6 +311,20 @@ export class TInt32Array {
// #END
// #END
}
}
testSome() {
// #TEST Int32Array.some
const int32 = new Int32Array([-10, 20, -30, 40, -50]);
const positives = new Int32Array([10, 20, 30, 40, 50]);
expect(int32.some((element : number, index : number, array : Int32Array) : boolean =>
element < 0
)).toEqual(true);
expect(positives.some((element : number, index : number, array : Int32Array) : boolean =>
element < 0
)).toEqual(false);
// #END
}
// #endif
// #endif
}
}
\ No newline at end of file
uni_modules/uts-tests/utssdk/TInt8Array.uts
浏览文件 @
95cc26fa
...
@@ -53,7 +53,7 @@ export class TInt8Array {
...
@@ -53,7 +53,7 @@ export class TInt8Array {
}
}
testCopyWith() {
testCopyWith() {
// #TEST Int8Array.copyWith
// #TEST Int8Array.copyWith
in
let int8 = new Int8Array(8);
let int8 = new Int8Array(8);
int8.set([1, 2, 3], 1);
int8.set([1, 2, 3], 1);
int8.copyWithin(3, 0, 3);
int8.copyWithin(3, 0, 3);
...
@@ -308,5 +308,20 @@ export class TInt8Array {
...
@@ -308,5 +308,20 @@ export class TInt8Array {
}
}
testSome() {
// #TEST Int8Array.some
const int8 = new Int8Array([-10, 20, -30, 40, -50]);
const positives = new Int8Array([10, 20, 30, 40, 50]);
expect(int8.some((element : number, index : number, array : Int8Array) : boolean =>
element < 0
)).toEqual(true);
expect(positives.some((element : number, index : number, array : Int8Array) : boolean =>
element < 0
)).toEqual(false);
// #END
}
// #endif
// #endif
}
}
\ No newline at end of file
uni_modules/uts-tests/utssdk/TUInt8Array.uts
浏览文件 @
95cc26fa
...
@@ -293,7 +293,7 @@ export class TUint8Array {
...
@@ -293,7 +293,7 @@ export class TUint8Array {
}
}
arrayBufferSlice() {
arrayBufferSlice() {
// #TEST ArrayBuffer.slice
// #TEST ArrayBuffer.slice
let buffer = new ArrayBuffer(16);
let buffer = new ArrayBuffer(16);
let uint8 = new Uint8Array(buffer);
let uint8 = new Uint8Array(buffer);
...
@@ -304,8 +304,23 @@ export class TUint8Array {
...
@@ -304,8 +304,23 @@ export class TUint8Array {
let sliced = new Uint8Array(res);
let sliced = new Uint8Array(res);
expect(sliced[0]).toEqual(42);
expect(sliced[0]).toEqual(42);
// #END
// #END
}
}
testSome() {
// #TEST Uint8Array.some
const uint8 = new Uint8Array([8, 20, 30, 40, 50]);
const positives = new Uint8Array([10, 20, 30, 40, 50]);
var res = uint8.some((element : number, index : number, array : Uint8Array) : boolean =>
element < 10
)
expect(res).toEqual(true);
console.log('uint8',res)
res = positives.some((element : number, index : number, array : Uint8Array) : boolean =>
element < 0
)
console.log('uint8',res)
expect(res).toEqual(false);
// #END
}
// #endif
// #endif
}
}
\ No newline at end of file
uni_modules/uts-tests/utssdk/TUInt8ClampedArray.uts
浏览文件 @
95cc26fa
...
@@ -303,6 +303,20 @@ export class TUint8ClampedArray {
...
@@ -303,6 +303,20 @@ export class TUint8ClampedArray {
expect(sliced[0]).toEqual(42);
expect(sliced[0]).toEqual(42);
// #END
// #END
}
}
testSome() {
// #TEST Uint8ClampedArray.some
const uint8Clamped = new Uint8ClampedArray([8, 20, 30, 40, 50]);
const positives = new Uint8ClampedArray([10, 20, 30, 40, 50]);
expect(uint8Clamped.some((element : number, index : number, array : Uint8ClampedArray) : boolean =>
element < 10
)).toEqual(true);
expect(positives.some((element : number, index : number, array : Uint8ClampedArray) : boolean =>
element < 0
)).toEqual(false);
// #END
}
// #endif
// #endif
}
}
\ No newline at end of file
uni_modules/uts-tests/utssdk/TUint16Array.uts
浏览文件 @
95cc26fa
...
@@ -318,7 +318,21 @@ export class TUint16Array {
...
@@ -318,7 +318,21 @@ export class TUint16Array {
// #END
// #END
}
}
testSome() {
// #TEST Uint16Array.some
const uint16 = new Uint16Array([8, 20, 30, 40, 50]);
const positives = new Uint16Array([10, 20, 30, 40, 50]);
expect(uint16.some((element : number, index : number, array : Uint16Array) : boolean =>
element < 10
)).toEqual(true);
expect(positives.some((element : number, index : number, array : Uint16Array) : boolean =>
element < 0
)).toEqual(false);
// #END
}
// #endif
// #endif
}
}
\ No newline at end of file
uni_modules/uts-tests/utssdk/TUint32Array.uts
浏览文件 @
95cc26fa
...
@@ -312,6 +312,21 @@ export class TUint32Array {
...
@@ -312,6 +312,21 @@ export class TUint32Array {
// #END
// #END
}
}
testSome() {
// #TEST Uint32Array.some
const uint32 = new Uint32Array([8, 20, 30, 40, 50]);
const positives = new Uint32Array([10, 20, 30, 40, 50]);
expect(uint32.some((element : number, index : number, array : Uint32Array) : boolean =>
element < 10
)).toEqual(true);
expect(positives.some((element : number, index : number, array : Uint32Array) : boolean =>
element < 0
)).toEqual(false);
// #END
}
// #endif
// #endif
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录