diff --git a/uni_modules/uts-tests/utssdk/TFloat32Array.uts b/uni_modules/uts-tests/utssdk/TFloat32Array.uts index 10044a1d02a078ca8006087be8fb5b3832e47b7c..d24a1e8916a91811fffbfaa537c7a50d4236603b 100644 --- a/uni_modules/uts-tests/utssdk/TFloat32Array.uts +++ b/uni_modules/uts-tests/utssdk/TFloat32Array.uts @@ -36,9 +36,19 @@ export class TFloat32Array { } // #ifdef APP-ANDROID || WEB from() { + // #TEST Float32Array.from var float32Array = Float32Array.from([1, 2, 3], (v : number, _ : number) : number => v + v); + console.log(float32Array.toString()); // '2,4,6' + // #END expect(float32Array.toString()).toEqual('2,4,6'); } + of() { + // #TEST Float32Array.of + var float32Array = Float32Array.of(1, 2, 3) + console.log(float32Array.toString()); // '1,2,3' + // #END + expect(float32Array.toString()).toEqual("1,2,3"); + } testfloat32() { let float32 = new Float32Array(2); diff --git a/uni_modules/uts-tests/utssdk/TFloat64Array.uts b/uni_modules/uts-tests/utssdk/TFloat64Array.uts index 72d005034efbd3743b7ed6f8ea999465f85b379e..5803f79b945eddbbac65080c8ace77014ad86dc7 100644 --- a/uni_modules/uts-tests/utssdk/TFloat64Array.uts +++ b/uni_modules/uts-tests/utssdk/TFloat64Array.uts @@ -35,6 +35,20 @@ export class TFloat64Array { // #endif } // #ifdef APP-ANDROID || WEB + from() { + // #TEST Float64Array.from + var float64Array = Float64Array.from([1, 2, 3], (v : number, _ : number) : number => v + v); + console.log(float64Array.toString()); // '2,4,6' + // #END + expect(float64Array.toString()).toEqual('2,4,6'); + } + of() { + // #TEST Float64Array.of + var float64Array = Float64Array.of(1, 2, 3) + console.log(float64Array.toString()); // '1,2,3' + // #END + expect(float64Array.toString()).toEqual("1,2,3"); + } testfloat64() { let float64 = new Float64Array(2); float64[0] = 42; diff --git a/uni_modules/uts-tests/utssdk/TInt16Array.uts b/uni_modules/uts-tests/utssdk/TInt16Array.uts index 94af5e724aaed92e0cdd9010e6dd5545b605f4a0..7a8a9af8a8f420586efef27eb05f5f71ae1c7bf1 100644 --- a/uni_modules/uts-tests/utssdk/TInt16Array.uts +++ b/uni_modules/uts-tests/utssdk/TInt16Array.uts @@ -35,7 +35,20 @@ export class TInt16Array { } // #ifdef APP-ANDROID || WEB - + from() { + // #TEST Int16Array.from + var array = Int16Array.from([1, 2, 3], (v : number, _ : number) : number => v + v); + console.log(array.toString()); // '2,4,6' + // #END + expect(array.toString()).toEqual('2,4,6'); + } + of() { + // #TEST Int16Array.of + var array = Int16Array.of(1, 2, 3) + console.log(array.toString()); // '1,2,3' + // #END + expect(array.toString()).toEqual("1,2,3"); + } testConstructor() { let buffer = new ArrayBuffer(16); let int16 = new Int16Array(buffer); diff --git a/uni_modules/uts-tests/utssdk/TInt32Array.uts b/uni_modules/uts-tests/utssdk/TInt32Array.uts index 8309ac80ea2decc9bd94d00ca6e00f9c1e7180dc..c870b5c17cceda90ae08837d85432a8b90102f76 100644 --- a/uni_modules/uts-tests/utssdk/TInt32Array.uts +++ b/uni_modules/uts-tests/utssdk/TInt32Array.uts @@ -37,7 +37,20 @@ export class TInt32Array { } // #ifdef APP-ANDROID || WEB - + from() { + // #TEST Int32Array.from + var array = Int32Array.from([1, 2, 3], (v : number, _ : number) : number => v + v); + console.log(array.toString()); // '2,4,6' + // #END + expect(array.toString()).toEqual('2,4,6'); + } + of() { + // #TEST Int32Array.of + var array = Int32Array.of(1, 2, 3) + console.log(array.toString()); // '1,2,3' + // #END + expect(array.toString()).toEqual("1,2,3"); + } testInt32Array() { let int32 = new Int32Array(2); int32[0] = 42; diff --git a/uni_modules/uts-tests/utssdk/TInt8Array.uts b/uni_modules/uts-tests/utssdk/TInt8Array.uts index 7c1b82e8eb7c805d339c069d26e1d7a2fdb7b887..4e628055d7c23fbb8ac28f70b4b131be90fd95af 100644 --- a/uni_modules/uts-tests/utssdk/TInt8Array.uts +++ b/uni_modules/uts-tests/utssdk/TInt8Array.uts @@ -37,7 +37,20 @@ export class TInt8Array { } // #ifdef APP-ANDROID || WEB - + from() { + // #TEST Int8Array.from + var array = Int8Array.from([1, 2, 3], (v : number, _ : number) : number => v + v); + console.log(array.toString()); // '2,4,6' + // #END + expect(array.toString()).toEqual('2,4,6'); + } + of() { + // #TEST Int8Array.of + var array = Int8Array.of(1, 2, 3) + console.log(array.toString()); // '1,2,3' + // #END + expect(array.toString()).toEqual("1,2,3"); + } testConstructor() { let buffer = new ArrayBuffer(16); let int8View = new Int8Array(buffer); diff --git a/uni_modules/uts-tests/utssdk/TUInt8Array.uts b/uni_modules/uts-tests/utssdk/TUInt8Array.uts index 4972cd84d71ddd43486f10a04487c9c251e7e80e..5c6b90cba556049a32e513d62a4d1cd742f03c39 100644 --- a/uni_modules/uts-tests/utssdk/TUInt8Array.uts +++ b/uni_modules/uts-tests/utssdk/TUInt8Array.uts @@ -36,12 +36,20 @@ export class TUint8Array { // #endif } // #ifdef APP-ANDROID || WEB - + of() { + // #TEST Uint8Array.of + var array = Uint8Array.of(1, 2, 3) + console.log(array.toString()); // '1,2,3' + // #END + expect(array.toString()).toEqual("1,2,3"); + } from() { + // #TEST Uint8Array.from var s = new Set([1, 2, 3]); var unit8 = Uint8Array.from(s); + console.log(unit8.toString()); // '1,2,3' + // #END expect(unit8.toString()).toEqual('1,2,3'); - console.log(unit8.toString()) } testMAX() { let uint8 = new Uint8Array(16); diff --git a/uni_modules/uts-tests/utssdk/TUInt8ClampedArray.uts b/uni_modules/uts-tests/utssdk/TUInt8ClampedArray.uts index 48b2cd6e0f80b783145d9cd26e06e3c5799675e8..f0b6fc57232bfff84985ae794e58fb03d0a22264 100644 --- a/uni_modules/uts-tests/utssdk/TUInt8ClampedArray.uts +++ b/uni_modules/uts-tests/utssdk/TUInt8ClampedArray.uts @@ -37,7 +37,20 @@ export class TUint8ClampedArray { } // #ifdef APP-ANDROID || WEB - + from() { + // #TEST Uint8ClampedArray.from + var array = Uint8ClampedArray.from([1, 2, 3], (v : number, _ : number) : number => v + v); + console.log(array.toString()); // '2,4,6' + // #END + expect(array.toString()).toEqual('2,4,6'); + } + of() { + // #TEST Uint8ClampedArray.of + var array = Uint8ClampedArray.of(1, 2, 3) + console.log(array.toString()); // '1,2,3' + // #END + expect(array.toString()).toEqual("1,2,3"); + } testMAX() { let uint8Clamped = new Uint8ClampedArray(16); uint8Clamped[0] = 255; diff --git a/uni_modules/uts-tests/utssdk/TUint16Array.uts b/uni_modules/uts-tests/utssdk/TUint16Array.uts index 7d0d9ab040c09c0aa8e0457960d687bcce3acde3..3b313cecec656d5a06b1260d59f1ea82dc970fb2 100644 --- a/uni_modules/uts-tests/utssdk/TUint16Array.uts +++ b/uni_modules/uts-tests/utssdk/TUint16Array.uts @@ -36,6 +36,20 @@ export class TUint16Array { } // #ifdef APP-ANDROID || WEB + from() { + // #TEST Uint16Array.from + var array = Uint16Array.from([1, 2, 3], (v : number, _ : number) : number => v + v); + console.log(array.toString()); // '2,4,6' + // #END + expect(array.toString()).toEqual('2,4,6'); + } + of() { + // #TEST Uint16Array.of + var array = Uint16Array.of(1, 2, 3) + console.log(array.toString()); // '1,2,3' + // #END + expect(array.toString()).toEqual("1,2,3"); + } testuint16() { let uint16 = new Uint16Array(2); uint16[0] = 42; diff --git a/uni_modules/uts-tests/utssdk/TUint32Array.uts b/uni_modules/uts-tests/utssdk/TUint32Array.uts index e1c9f5284e9dd027eb4190b72582db195e0eb75b..73147afc48ece67b981cb505d15a7911bb62d1d0 100644 --- a/uni_modules/uts-tests/utssdk/TUint32Array.uts +++ b/uni_modules/uts-tests/utssdk/TUint32Array.uts @@ -37,6 +37,20 @@ export class TUint32Array { } // #ifdef APP-ANDROID || WEB + from() { + // #TEST Uint32Array.from + var array = Uint32Array.from([1, 2, 3], (v : number, _ : number) : number => v + v); + console.log(array.toString()); // '2,4,6' + // #END + expect(array.toString()).toEqual('2,4,6'); + } + of() { + // #TEST Uint32Array.of + var array = Uint32Array.of(1, 2, 3) + console.log(array.toString()); // '1,2,3' + // #END + expect(array.toString()).toEqual("1,2,3"); + } testuint32() { let uint32 = new Uint32Array(2); uint32[0] = 42;