diff --git a/uni_modules/uts-tests/utssdk/TFloat32Array.uts b/uni_modules/uts-tests/utssdk/TFloat32Array.uts index 682836aa73e0e278b6d0abb2d9b4d54bf6e4b251..c28717f7a08fe2dd48b307c9cac078b4e105928f 100644 --- a/uni_modules/uts-tests/utssdk/TFloat32Array.uts +++ b/uni_modules/uts-tests/utssdk/TFloat32Array.uts @@ -7,6 +7,7 @@ import { export class TFloat32Array { test() { + // #ifdef APP-ANDROID this.testfloat32(); this.testConstructor(); this.testSet(); @@ -31,10 +32,12 @@ export class TFloat32Array { this.subarray(); this.values(); this.arrayBufferSlice(); + // #endif } - from(){ - var float32Array= Float32Array.from([1, 2, 3], (v: number, _: number):number => v + v); - expect(float32Array.toString()).toEqual('2,4,6'); + // #ifdef APP-ANDROID + from() { + var float32Array = Float32Array.from([1, 2, 3], (v : number, _ : number) : number => v + v); + expect(float32Array.toString()).toEqual('2,4,6'); } testfloat32() { @@ -85,7 +88,7 @@ export class TFloat32Array { testEvery() { // const isBelowThreshold = (currentValue: number, index: number, array:Float32Array): boolean => currentValue < 40; - let result = new Float32Array([12, 5, 8, 130, 44]).every((value: number, _: number, _a: Float32Array): + let result = new Float32Array([12, 5, 8, 130, 44]).every((value : number, _ : number, _a : Float32Array) : boolean => value < 40); // expect(result).toEqual(false); } @@ -110,29 +113,29 @@ export class TFloat32Array { testFilter() { // const isBelowThreshold = (currentValue: number, index: number, _): boolean => currentValue >= 10; - let float32 = new Float32Array([12, 5, 8, 44]).filter((value: number, _: number, _a: Float32Array): + let float32 = new Float32Array([12, 5, 8, 44]).filter((value : number, _ : number, _a : Float32Array) : boolean => value >= 10); expect(float32.toString()).toEqual("12,44"); } find() { let float32 = new Float32Array([4, 5, 8, 12]); - let res = float32.find((value: number, _: number, _a: Float32Array): boolean => value > 5); + let res = float32.find((value : number, _ : number, _a : Float32Array) : boolean => value > 5); expect(res).toEqual(8); } findIndex() { let float32 = new Float32Array([4, 6, 8, 12]); - let res = float32.findIndex((value: number, _: number, _a: Float32Array): boolean => value > 100); + let res = float32.findIndex((value : number, _ : number, _a : Float32Array) : boolean => value > 100); expect(res).toEqual(-1); let ufloat32 = new Float32Array([4, 6, 7, 120]); - res = ufloat32.findIndex((value: number, _: number, _a: Float32Array): boolean => value > 100); + res = ufloat32.findIndex((value : number, _ : number, _a : Float32Array) : boolean => value > 100); expect(res).toEqual(3); } foreach() { - new Float32Array([0, 1, 2, 3]).forEach((value: number,index: number, _: Float32Array) => { + new Float32Array([0, 1, 2, 3]).forEach((value : number, index : number, _ : Float32Array) => { console.log(`a[${index}] = ${value}`); }); } @@ -198,31 +201,31 @@ export class TFloat32Array { map() { let numbers = new Float32Array([1, 4, 9]); - let doubles = numbers.map((value: number, _: number, _a: Float32Array): number => value * 2); + let doubles = numbers.map((value : number, _ : number, _a : Float32Array) : number => value * 2); expect(numbers.toString()).toEqual("1,4,9"); expect(doubles.toString()).toEqual("2,8,18"); } reduce() { let total = new Float32Array([0, 1, 2, 3]); - let res = total.reduce((accumulator: number, currentValue: number, _: number, _a: Float32Array): + let res = total.reduce((accumulator : number, currentValue : number, _ : number, _a : Float32Array) : number => accumulator + currentValue); expect(res).toEqual(6); total = new Float32Array([0, 1, 2, 3]); - res = total.reduce((accumulator: number, currentValue: number, _: number, _a: Float32Array): + res = total.reduce((accumulator : number, currentValue : number, _ : number, _a : Float32Array) : number => accumulator + currentValue, 8); expect(res).toEqual(14); } reduceRight() { let total = new Float32Array([0, 1, 2, 3]); - let res = total.reduceRight((accumulator: number, currentValue: number, _: number, _a: - Float32Array): number => accumulator + currentValue); + let res = total.reduceRight((accumulator : number, currentValue : number, _ : number, _a : + Float32Array) : number => accumulator + currentValue); expect(res).toEqual(6); total = new Float32Array([0, 1, 2, 3]); - res = total.reduceRight((accumulator: number, currentValue: number, _: number, _a: Float32Array): + res = total.reduceRight((accumulator : number, currentValue : number, _ : number, _a : Float32Array) : number => accumulator + currentValue, 8); expect(res).toEqual(14); } @@ -253,7 +256,7 @@ export class TFloat32Array { numbers.sort(); expect(numbers.toString()).toEqual("1,5,40"); - numbers.sort((a, b): number => a - b); + numbers.sort((a, b) : number => a - b); expect(numbers.toString()).toEqual("1,5,40"); } @@ -285,4 +288,5 @@ export class TFloat32Array { let sliced = new Float32Array(res); expect(sliced[1]).toEqual(42); } + // #endif } \ No newline at end of file diff --git a/uni_modules/uts-tests/utssdk/TFloat64Array.uts b/uni_modules/uts-tests/utssdk/TFloat64Array.uts index 531735139c5d8ea550d30a5d4402059bab5f6b61..cc4251f127d261406ced9251651baafa2b01e487 100644 --- a/uni_modules/uts-tests/utssdk/TFloat64Array.uts +++ b/uni_modules/uts-tests/utssdk/TFloat64Array.uts @@ -34,10 +34,10 @@ export class TFloat64Array { } testfloat64() { - let float32 = new Float64Array(2); - float32[0] = 42; - expect(float32[0]).toEqual(42); - expect(float32.length).toEqual(2); + let float64 = new Float64Array(2); + float64[0] = 42; + expect(float64[0]).toEqual(42); + expect(float64.length).toEqual(2); expect(Float64Array.BYTES_PER_ELEMENT).toEqual(8); let x = new Float64Array([21, 31, 3]); @@ -54,23 +54,23 @@ export class TFloat64Array { testConstructor() { let buffer = new ArrayBuffer(16); - let float32 = new Float64Array(buffer); - float32[1] = 42; - expect(float32.toString()).toEqual("0,42"); + let float64 = new Float64Array(buffer); + float64[1] = 42; + expect(float64.toString()).toEqual("0,42"); } testSet() { - let float32 = new Float64Array(8); + let float64 = new Float64Array(8); var array = [1, 2, 3] - float32.set(array, 1); - expect(float32.toString()).toEqual("0,1,2,3,0,0,0,0"); + float64.set(array, 1); + expect(float64.toString()).toEqual("0,1,2,3,0,0,0,0"); } testCopyWith() { - let float32 = new Float64Array(8); - float32.set([1, 2, 3], 1); - float32.copyWithin(3, 0, 3); - expect(float32.toString()).toEqual("0,1,2,0,1,2,0,0"); + let float64 = new Float64Array(8); + float64.set([1, 2, 3], 1); + float64.copyWithin(3, 0, 3); + expect(float64.toString()).toEqual("0,1,2,0,1,2,0,0"); } testEvery() { @@ -81,43 +81,43 @@ export class TFloat64Array { } testFill() { - let float32 = new Float64Array([1, 2, 3]).fill(4); - expect(float32.toString()).toEqual("4,4,4"); + let float64 = new Float64Array([1, 2, 3]).fill(4); + expect(float64.toString()).toEqual("4,4,4"); - float32 = new Float64Array([1, 2, 3]).fill(4, 1); - expect(float32.toString()).toEqual("1,4,4"); + float64 = new Float64Array([1, 2, 3]).fill(4, 1); + expect(float64.toString()).toEqual("1,4,4"); - float32 = new Float64Array([1, 2, 3]).fill(4, 1, 2); - expect(float32.toString()).toEqual("1,4,3"); + float64 = new Float64Array([1, 2, 3]).fill(4, 1, 2); + expect(float64.toString()).toEqual("1,4,3"); - float32 = new Float64Array([1, 2, 3]).fill(4, 1, 1); - expect(float32.toString()).toEqual("1,2,3"); + float64 = new Float64Array([1, 2, 3]).fill(4, 1, 1); + expect(float64.toString()).toEqual("1,2,3"); - float32 = new Float64Array([1, 2, 3]).fill(4, -3, -2); - expect(float32.toString()).toEqual("4,2,3"); + float64 = new Float64Array([1, 2, 3]).fill(4, -3, -2); + expect(float64.toString()).toEqual("4,2,3"); } testFilter() { // const isBelowThreshold = (currentValue: number, index: number, _): boolean => currentValue >= 10; - let float32 = new Float64Array([12, 5, 8, 44]).filter((value: number, _: number, _a: Float64Array): + let float64 = new Float64Array([12, 5, 8, 44]).filter((value: number, _: number, _a: Float64Array): boolean => value >= 10); - expect(float32.toString()).toEqual("12,44"); + expect(float64.toString()).toEqual("12,44"); } find() { - let float32 = new Float64Array([4, 5, 8, 12]); - let res = float32.find((value: number, _: number, _a: Float64Array): boolean => value > 5); + let float64 = new Float64Array([4, 5, 8, 12]); + let res = float64.find((value: number, _: number, _a: Float64Array): boolean => value > 5); expect(res).toEqual(8); } findIndex() { - let float32 = new Float64Array([4, 6, 8, 12]); - let res = float32.findIndex((value: number, _: number, _a: Float64Array): boolean => value > 100); + let float64 = new Float64Array([4, 6, 8, 12]); + let res = float64.findIndex((value: number, _: number, _a: Float64Array): boolean => value > 100); expect(res).toEqual(-1); - let ufloat32 = new Float64Array([4, 6, 7, 120]); - res = ufloat32.findIndex((value: number, _: number, _a: Float64Array): boolean => value > 100); + let ufloat64 = new Float64Array([4, 6, 7, 120]); + res = ufloat64.findIndex((value: number, _: number, _a: Float64Array): boolean => value > 100); expect(res).toEqual(3); } @@ -135,44 +135,44 @@ export class TFloat64Array { } includes() { - let float32 = new Float64Array([1, 2, 3]); - let res = float32.includes(2); + let float64 = new Float64Array([1, 2, 3]); + let res = float64.includes(2); expect(res).toEqual(true); - res = float32.includes(4); + res = float64.includes(4); expect(res).toEqual(false); - res = float32.includes(3, 3); + res = float64.includes(3, 3); expect(res).toEqual(false); } indexOf() { - let float32 = new Float64Array([2, 5, 9]); - let res = float32.indexOf(2); + let float64 = new Float64Array([2, 5, 9]); + let res = float64.indexOf(2); expect(res).toEqual(0); - res = float32.indexOf(7); + res = float64.indexOf(7); expect(res).toEqual(-1); - res = float32.indexOf(9, 2); + res = float64.indexOf(9, 2); expect(res).toEqual(2); - res = float32.indexOf(2, -1); + res = float64.indexOf(2, -1); expect(res).toEqual(-1); - res = float32.indexOf(2, -3); + res = float64.indexOf(2, -3); expect(res).toEqual(0); } join() { - let float32 = new Float64Array([1, 2, 3]); - let res = float32.join(); + let float64 = new Float64Array([1, 2, 3]); + let res = float64.join(); expect(res).toEqual("1,2,3"); - res = float32.join(" / "); + res = float64.join(" / "); expect(res).toEqual("1 / 2 / 3"); - res = float32.join(""); + res = float64.join(""); expect(res).toEqual("123"); } @@ -219,23 +219,23 @@ export class TFloat64Array { } reverse() { - let float32 = new Float64Array([1, 2, 3]); - float32.reverse(); - expect(float32.toString()).toEqual("3,2,1"); + let float64 = new Float64Array([1, 2, 3]); + float64.reverse(); + expect(float64.toString()).toEqual("3,2,1"); } slice() { - let float32 = new Float64Array([1, 2, 3]); - let res = float32.slice(1); + let float64 = new Float64Array([1, 2, 3]); + let res = float64.slice(1); expect(res.toString()).toEqual("2,3"); - res = float32.slice(2); + res = float64.slice(2); expect(res.toString()).toEqual("3"); - res = float32.slice(-2); + res = float64.slice(-2); expect(res.toString()).toEqual("2,3"); - res = float32.slice(0, 1); + res = float64.slice(0, 1); expect(res.toString()).toEqual("1"); } @@ -250,11 +250,11 @@ export class TFloat64Array { subarray() { let buffer = new ArrayBuffer(32); - let float32 = new Float64Array(buffer); - float32.set([1, 2, 3]); - expect(float32.toString()).toEqual("1,2,3,0"); + let float64 = new Float64Array(buffer); + float64.set([1, 2, 3]); + expect(float64.toString()).toEqual("1,2,3,0"); - let sub = float32.subarray(0, 4); + let sub = float64.subarray(0, 4); expect(sub.toString()).toEqual("1,2,3,0"); } @@ -268,9 +268,9 @@ export class TFloat64Array { arrayBufferSlice() { let buffer = new ArrayBuffer(16); - let float32 = new Float64Array(buffer); - float32[1] = 42; - expect(float32.toString()).toEqual("0,42"); + let float64 = new Float64Array(buffer); + float64[1] = 42; + expect(float64.toString()).toEqual("0,42"); let res = buffer.slice(8); let sliced = new Float64Array(res); diff --git a/uni_modules/uts-tests/utssdk/TInt16Array.uts b/uni_modules/uts-tests/utssdk/TInt16Array.uts index f9f714510b50c102049e65df4c78cd13ce5a8ba3..ae2eff6628b11f6a25e0b049c693fe1d83e9d662 100644 --- a/uni_modules/uts-tests/utssdk/TInt16Array.uts +++ b/uni_modules/uts-tests/utssdk/TInt16Array.uts @@ -35,26 +35,26 @@ export class TInt16Array { testConstructor() { let buffer = new ArrayBuffer(16); - let float32 = new Int16Array(buffer); - float32[5] = 42; - expect(float32.toString()).toEqual("0,0,0,0,0,42,0,0"); + let int16 = new Int16Array(buffer); + int16[5] = 42; + expect(int16.toString()).toEqual("0,0,0,0,0,42,0,0"); } testSet() { - let float32 = new Int16Array(8); + let int16 = new Int16Array(8); var array = [1, 2, 3] - float32.set(array, 1); - expect(float32.toString()).toEqual("0,1,2,3,0,0,0,0"); + int16.set(array, 1); + expect(int16.toString()).toEqual("0,1,2,3,0,0,0,0"); } testCopyWith() { console.log("testCopyWith 1") - let float32 = new Int16Array(8); - float32.set([1, 2, 3], 1); + let int16 = new Int16Array(8); + int16.set([1, 2, 3], 1); console.log("testCopyWith 1") - float32.copyWithin(3, 0, 3); + int16.copyWithin(3, 0, 3); console.log("testCopyWith 1") - expect(float32.toString()).toEqual("0,1,2,0,1,2,0,0"); + expect(int16.toString()).toEqual("0,1,2,0,1,2,0,0"); } testEvery() { @@ -64,42 +64,42 @@ export class TInt16Array { } testFill() { - let float32 = new Int16Array([1, 2, 3]).fill(4); - expect(float32.toString()).toEqual("4,4,4"); + let int16 = new Int16Array([1, 2, 3]).fill(4); + expect(int16.toString()).toEqual("4,4,4"); - float32 = new Int16Array([1, 2, 3]).fill(4, 1); - expect(float32.toString()).toEqual("1,4,4"); + int16 = new Int16Array([1, 2, 3]).fill(4, 1); + expect(int16.toString()).toEqual("1,4,4"); - float32 = new Int16Array([1, 2, 3]).fill(4, 1, 2); - expect(float32.toString()).toEqual("1,4,3"); + int16 = new Int16Array([1, 2, 3]).fill(4, 1, 2); + expect(int16.toString()).toEqual("1,4,3"); - float32 = new Int16Array([1, 2, 3]).fill(4, 1, 1); - expect(float32.toString()).toEqual("1,2,3"); + int16 = new Int16Array([1, 2, 3]).fill(4, 1, 1); + expect(int16.toString()).toEqual("1,2,3"); - float32 = new Int16Array([1, 2, 3]).fill(4, -3, -2); - expect(float32.toString()).toEqual("4,2,3"); + int16 = new Int16Array([1, 2, 3]).fill(4, -3, -2); + expect(int16.toString()).toEqual("4,2,3"); } testFilter() { // const isBelowThreshold = (currentValue: number, index: number, _): boolean => currentValue >= 10; - let float32 = new Int16Array([12, 5, 8, 44]).filter((value : number, _ : number, _a : Int16Array) : boolean => value >= 10); - expect(float32.toString()).toEqual("12,44"); + let int16 = new Int16Array([12, 5, 8, 44]).filter((value : number, _ : number, _a : Int16Array) : boolean => value >= 10); + expect(int16.toString()).toEqual("12,44"); } find() { - let float32 = new Int16Array([4, 5, 8, 12]); - let res = float32.find((value : number, _ : number, _a : Int16Array) : boolean => value > 5); + let int16 = new Int16Array([4, 5, 8, 12]); + let res = int16.find((value : number, _ : number, _a : Int16Array) : boolean => value > 5); expect(res).toEqual(8); } findIndex() { - let float32 = new Int16Array([4, 6, 8, 12]); - let res = float32.findIndex((value : number, _ : number, _a : Int16Array) : boolean => value > 100); + let int16 = new Int16Array([4, 6, 8, 12]); + let res = int16.findIndex((value : number, _ : number, _a : Int16Array) : boolean => value > 100); expect(res).toEqual(-1); - let ufloat32 = new Int16Array([4, 6, 7, 120]); - res = ufloat32.findIndex((value : number, _ : number, _a : Int16Array) : boolean => value > 100); + int16 = new Int16Array([4, 6, 7, 120]); + res = int16.findIndex((value : number, _ : number, _a : Int16Array) : boolean => value > 100); expect(res).toEqual(3); } @@ -116,44 +116,44 @@ export class TInt16Array { } includes() { - let float32 = new Int16Array([1, 2, 3]); - let res = float32.includes(2); + let int16 = new Int16Array([1, 2, 3]); + let res = int16.includes(2); expect(res).toEqual(true); - res = float32.includes(4); + res = int16.includes(4); expect(res).toEqual(false); - res = float32.includes(3, 3); + res = int16.includes(3, 3); expect(res).toEqual(false); } indexOf() { - let float32 = new Int16Array([2, 5, 9]); - let res = float32.indexOf(2); + let int16 = new Int16Array([2, 5, 9]); + let res = int16.indexOf(2); expect(res).toEqual(0); - res = float32.indexOf(7); + res = int16.indexOf(7); expect(res).toEqual(-1); - res = float32.indexOf(9, 2); + res = int16.indexOf(9, 2); expect(res).toEqual(2); - res = float32.indexOf(2, -1); + res = int16.indexOf(2, -1); expect(res).toEqual(-1); - res = float32.indexOf(2, -3); + res = int16.indexOf(2, -3); expect(res).toEqual(0); } join() { - let float32 = new Int16Array([1, 2, 3]); - let res = float32.join(); + let int16 = new Int16Array([1, 2, 3]); + let res = int16.join(); expect(res).toEqual("1,2,3"); - res = float32.join(" / "); + res = int16.join(" / "); expect(res).toEqual("1 / 2 / 3"); - res = float32.join(""); + res = int16.join(""); expect(res).toEqual("123"); } @@ -195,23 +195,23 @@ export class TInt16Array { } reverse() { - let float32 = new Int16Array([1, 2, 3]); - float32.reverse(); - expect(float32.toString()).toEqual("3,2,1"); + let int16 = new Int16Array([1, 2, 3]); + int16.reverse(); + expect(int16.toString()).toEqual("3,2,1"); } slice() { - let float32 = new Int16Array([1, 2, 3]); - let res = float32.slice(1); + let int16 = new Int16Array([1, 2, 3]); + let res = int16.slice(1); expect(res.toString()).toEqual("2,3"); - res = float32.slice(2); + res = int16.slice(2); expect(res.toString()).toEqual("3"); - res = float32.slice(-2); + res = int16.slice(-2); expect(res.toString()).toEqual("2,3"); - res = float32.slice(0, 1); + res = int16.slice(0, 1); expect(res.toString()).toEqual("1"); } @@ -226,11 +226,11 @@ export class TInt16Array { subarray() { let buffer = new ArrayBuffer(16); - let float32 = new Int16Array(buffer); - float32.set([1, 2, 3]); - expect(float32.toString()).toEqual("1,2,3,0,0,0,0,0"); + let int16 = new Int16Array(buffer); + int16.set([1, 2, 3]); + expect(int16.toString()).toEqual("1,2,3,0,0,0,0,0"); - let sub = float32.subarray(0, 4); + let sub = int16.subarray(0, 4); expect(sub.toString()).toEqual("1,2,3,0"); } @@ -242,9 +242,9 @@ export class TInt16Array { arrayBufferSlice() { let buffer = new ArrayBuffer(16); - let float32 = new Int16Array(buffer); - float32[4] = 42; - expect(float32.toString()).toEqual("0,0,0,0,42,0,0,0"); + let int16 = new Int16Array(buffer); + int16[4] = 42; + expect(int16.toString()).toEqual("0,0,0,0,42,0,0,0"); let res = buffer.slice(8, 12); let sliced = new Int16Array(res); diff --git a/uni_modules/uts-tests/utssdk/TInt32Array.uts b/uni_modules/uts-tests/utssdk/TInt32Array.uts index 9ef3aee7ccc4197fe45ffa9468249764b8ac7ef4..2ff4c3aa51b2e91922de8f60844c288b3089b1fa 100644 --- a/uni_modules/uts-tests/utssdk/TInt32Array.uts +++ b/uni_modules/uts-tests/utssdk/TInt32Array.uts @@ -7,7 +7,8 @@ import { export class TInt32Array { test() { - this.testfloat32(); + // #ifdef APP-ANDROID + this.testInt32Array(); this.testConstructor(); this.testSet(); this.testCopyWith(); @@ -31,13 +32,15 @@ export class TInt32Array { this.subarray(); this.values(); this.arrayBufferSlice(); + // #endif } - testfloat32() { - let float32 = new Int32Array(2); - float32[0] = 42; - expect(float32[0]).toEqual(42); - expect(float32.length).toEqual(2); +// #ifdef APP-ANDROID + testInt32Array() { + let int32 = new Int32Array(2); + int32[0] = 42; + expect(int32[0]).toEqual(42); + expect(int32.length).toEqual(2); expect(Int32Array.BYTES_PER_ELEMENT).toEqual(4); let x = new Int32Array([21, 31, 3]); @@ -54,26 +57,26 @@ export class TInt32Array { testConstructor() { let buffer = new ArrayBuffer(16); - let float32 = new Int32Array(buffer); - float32[1] = 42; - expect(float32.toString()).toEqual("0,42,0,0"); + let int32 = new Int32Array(buffer); + int32[1] = 42; + expect(int32.toString()).toEqual("0,42,0,0"); } testSet() { - let float32 = new Int32Array(8); + let int32 = new Int32Array(8); var array =[1, 2, 3] - float32.set(array, 1); - expect(float32.toString()).toEqual("0,1,2,3,0,0,0,0"); + int32.set(array, 1); + expect(int32.toString()).toEqual("0,1,2,3,0,0,0,0"); } testCopyWith() { console.log("testCopyWith 1") - let float32 = new Int32Array(8); - float32.set([1, 2, 3], 1); + let int32 = new Int32Array(8); + int32.set([1, 2, 3], 1); console.log("testCopyWith 1") - float32.copyWithin(3, 0, 3); + int32.copyWithin(3, 0, 3); console.log("testCopyWith 1") - expect(float32.toString()).toEqual("0,1,2,0,1,2,0,0"); + expect(int32.toString()).toEqual("0,1,2,0,1,2,0,0"); } testEvery() { @@ -83,42 +86,42 @@ export class TInt32Array { } testFill() { - let float32 = new Int32Array([1, 2, 3]).fill(4); - expect(float32.toString()).toEqual("4,4,4"); + let int32 = new Int32Array([1, 2, 3]).fill(4); + expect(int32.toString()).toEqual("4,4,4"); - float32 = new Int32Array([1, 2, 3]).fill(4, 1); - expect(float32.toString()).toEqual("1,4,4"); + int32 = new Int32Array([1, 2, 3]).fill(4, 1); + expect(int32.toString()).toEqual("1,4,4"); - float32 = new Int32Array([1, 2, 3]).fill(4, 1, 2); - expect(float32.toString()).toEqual("1,4,3"); + int32 = new Int32Array([1, 2, 3]).fill(4, 1, 2); + expect(int32.toString()).toEqual("1,4,3"); - float32 = new Int32Array([1, 2, 3]).fill(4, 1, 1); - expect(float32.toString()).toEqual("1,2,3"); + int32 = new Int32Array([1, 2, 3]).fill(4, 1, 1); + expect(int32.toString()).toEqual("1,2,3"); - float32 = new Int32Array([1, 2, 3]).fill(4, -3, -2); - expect(float32.toString()).toEqual("4,2,3"); + int32 = new Int32Array([1, 2, 3]).fill(4, -3, -2); + expect(int32.toString()).toEqual("4,2,3"); } testFilter() { // const isBelowThreshold = (currentValue: number, index: number, _): boolean => currentValue >= 10; - let float32 = new Int32Array([12, 5, 8, 44]).filter((value : number, _ : number, _a : Int32Array): boolean => value>= 10); - expect(float32.toString()).toEqual("12,44"); + let int32 = new Int32Array([12, 5, 8, 44]).filter((value : number, _ : number, _a : Int32Array): boolean => value>= 10); + expect(int32.toString()).toEqual("12,44"); } find() { - let float32 = new Int32Array([4, 5, 8, 12]); - let res = float32.find((value : number, _ : number, _a : Int32Array): boolean => value > 5); + let int32 = new Int32Array([4, 5, 8, 12]); + let res = int32.find((value : number, _ : number, _a : Int32Array): boolean => value > 5); expect(res).toEqual(8); } findIndex() { - let float32 = new Int32Array([4, 6, 8, 12]); - let res = float32.findIndex((value : number, _ : number, _a : Int32Array): boolean => value > 100); + let int32 = new Int32Array([4, 6, 8, 12]); + let res = int32.findIndex((value : number, _ : number, _a : Int32Array): boolean => value > 100); expect(res).toEqual(-1); - let ufloat32 = new Int32Array([4, 6, 7, 120]); - res = ufloat32.findIndex((value : number, _ : number, _a : Int32Array): boolean => value > 100); + int32 = new Int32Array([4, 6, 7, 120]); + res = int32.findIndex((value : number, _ : number, _a : Int32Array): boolean => value > 100); expect(res).toEqual(3); } @@ -136,44 +139,44 @@ export class TInt32Array { } includes() { - let float32 = new Int32Array([1, 2, 3]); - let res = float32.includes(2); + let int32 = new Int32Array([1, 2, 3]); + let res = int32.includes(2); expect(res).toEqual(true); - res = float32.includes(4); + res = int32.includes(4); expect(res).toEqual(false); - res = float32.includes(3, 3); + res = int32.includes(3, 3); expect(res).toEqual(false); } indexOf() { - let float32 = new Int32Array([2, 5, 9]); - let res = float32.indexOf(2); + let int32 = new Int32Array([2, 5, 9]); + let res = int32.indexOf(2); expect(res).toEqual(0); - res = float32.indexOf(7); + res = int32.indexOf(7); expect(res).toEqual(-1); - res = float32.indexOf(9, 2); + res = int32.indexOf(9, 2); expect(res).toEqual(2); - res = float32.indexOf(2, -1); + res = int32.indexOf(2, -1); expect(res).toEqual(-1); - res = float32.indexOf(2, -3); + res = int32.indexOf(2, -3); expect(res).toEqual(0); } join() { - let float32 = new Int32Array([1, 2, 3]); - let res = float32.join(); + let int32 = new Int32Array([1, 2, 3]); + let res = int32.join(); expect(res).toEqual("1,2,3"); - res = float32.join(" / "); + res = int32.join(" / "); expect(res).toEqual("1 / 2 / 3"); - res = float32.join(""); + res = int32.join(""); expect(res).toEqual("123"); } @@ -211,23 +214,23 @@ export class TInt32Array { } reverse() { - let float32 = new Int32Array([1, 2, 3]); - float32.reverse(); - expect(float32.toString()).toEqual("3,2,1"); + let int32 = new Int32Array([1, 2, 3]); + int32.reverse(); + expect(int32.toString()).toEqual("3,2,1"); } slice() { - let float32 = new Int32Array([1, 2, 3]); - let res = float32.slice(1); + let int32 = new Int32Array([1, 2, 3]); + let res = int32.slice(1); expect(res.toString()).toEqual("2,3"); - res = float32.slice(2); + res = int32.slice(2); expect(res.toString()).toEqual("3"); - res = float32.slice(-2); + res = int32.slice(-2); expect(res.toString()).toEqual("2,3"); - res = float32.slice(0, 1); + res = int32.slice(0, 1); expect(res.toString()).toEqual("1"); } @@ -242,11 +245,11 @@ export class TInt32Array { subarray() { let buffer = new ArrayBuffer(16); - let float32 = new Int32Array(buffer); - float32.set([1, 2, 3]); - expect(float32.toString()).toEqual("1,2,3,0"); + let int32 = new Int32Array(buffer); + int32.set([1, 2, 3]); + expect(int32.toString()).toEqual("1,2,3,0"); - let sub = float32.subarray(0, 4); + let sub = int32.subarray(0, 4); expect(sub.toString()).toEqual("1,2,3,0"); } @@ -258,12 +261,13 @@ export class TInt32Array { arrayBufferSlice() { let buffer = new ArrayBuffer(16); - let float32 = new Int32Array(buffer); - float32[3] = 42; - expect(float32.toString()).toEqual("0,0,0,42"); + let int32 = new Int32Array(buffer); + int32[3] = 42; + expect(int32.toString()).toEqual("0,0,0,42"); let res = buffer.slice(8); let sliced = new Int32Array(res); expect(sliced[1]).toEqual(42); } + // #endif } diff --git a/uni_modules/uts-tests/utssdk/TInt8Array.uts b/uni_modules/uts-tests/utssdk/TInt8Array.uts index e89f52e37942a422a78bfa4c6078b117665d2153..2aaf7e7f715f5752c4d3244cbdc67cde0106ddef 100644 --- a/uni_modules/uts-tests/utssdk/TInt8Array.uts +++ b/uni_modules/uts-tests/utssdk/TInt8Array.uts @@ -42,20 +42,20 @@ export class TInt8Array { } testSet() { - let float32 = new Int8Array(8); + let int8 = new Int8Array(8); var array = [1, 2, 3] - float32.set(array, 1); - expect(float32.toString()).toEqual("0,1,2,3,0,0,0,0"); + int8.set(array, 1); + expect(int8.toString()).toEqual("0,1,2,3,0,0,0,0"); } testCopyWith() { console.log("testCopyWith 1") - let float32 = new Int8Array(8); - float32.set([1, 2, 3], 1); + let int8 = new Int8Array(8); + int8.set([1, 2, 3], 1); console.log("testCopyWith 1") - float32.copyWithin(3, 0, 3); + int8.copyWithin(3, 0, 3); console.log("testCopyWith 1") - expect(float32.toString()).toEqual("0,1,2,0,1,2,0,0"); + expect(int8.toString()).toEqual("0,1,2,0,1,2,0,0"); } testEvery() { @@ -66,43 +66,43 @@ export class TInt8Array { } testFill() { - let float32 = new Int8Array([1, 2, 3]).fill(4); - expect(float32.toString()).toEqual("4,4,4"); + let int8 = new Int8Array([1, 2, 3]).fill(4); + expect(int8.toString()).toEqual("4,4,4"); - float32 = new Int8Array([1, 2, 3]).fill(4, 1); - expect(float32.toString()).toEqual("1,4,4"); + int8 = new Int8Array([1, 2, 3]).fill(4, 1); + expect(int8.toString()).toEqual("1,4,4"); - float32 = new Int8Array([1, 2, 3]).fill(4, 1, 2); - expect(float32.toString()).toEqual("1,4,3"); + int8 = new Int8Array([1, 2, 3]).fill(4, 1, 2); + expect(int8.toString()).toEqual("1,4,3"); - float32 = new Int8Array([1, 2, 3]).fill(4, 1, 1); - expect(float32.toString()).toEqual("1,2,3"); + int8 = new Int8Array([1, 2, 3]).fill(4, 1, 1); + expect(int8.toString()).toEqual("1,2,3"); - float32 = new Int8Array([1, 2, 3]).fill(4, -3, -2); - expect(float32.toString()).toEqual("4,2,3"); + int8 = new Int8Array([1, 2, 3]).fill(4, -3, -2); + expect(int8.toString()).toEqual("4,2,3"); } testFilter() { // const isBelowThreshold = (currentValue: number, index: number, _): boolean => currentValue >= 10; - let float32 = new Int8Array([12, 5, 8, 44]).filter((value: number, _: number, _a: Int8Array): boolean => + let int8 = new Int8Array([12, 5, 8, 44]).filter((value: number, _: number, _a: Int8Array): boolean => value >= 10); - expect(float32.toString()).toEqual("12,44"); + expect(int8.toString()).toEqual("12,44"); } find() { - let float32 = new Int8Array([4, 5, 8, 12]); - let res = float32.find((value: number, _: number, _a: Int8Array): boolean => value > 5); + let int8 = new Int8Array([4, 5, 8, 12]); + let res = int8.find((value: number, _: number, _a: Int8Array): boolean => value > 5); expect(res).toEqual(8); } findIndex() { - let float32 = new Int8Array([4, 6, 8, 12]); - let res = float32.findIndex((value: number, _: number, _a: Int8Array): boolean => value > 100); + let int8 = new Int8Array([4, 6, 8, 12]); + let res = int8.findIndex((value: number, _: number, _a: Int8Array): boolean => value > 100); expect(res).toEqual(-1); - let ufloat32 = new Int8Array([4, 6, 7, 120]); - res = ufloat32.findIndex((value: number, _: number, _a: Int8Array): boolean => value > 100); + int8 = new Int8Array([4, 6, 7, 120]); + res = int8.findIndex((value: number, _: number, _a: Int8Array): boolean => value > 100); expect(res).toEqual(3); } @@ -120,44 +120,44 @@ export class TInt8Array { } includes() { - let float32 = new Int8Array([1, 2, 3]); - let res = float32.includes(2); + let int8 = new Int8Array([1, 2, 3]); + let res = int8.includes(2); expect(res).toEqual(true); - res = float32.includes(4); + res = int8.includes(4); expect(res).toEqual(false); - res = float32.includes(3, 3); + res = int8.includes(3, 3); expect(res).toEqual(false); } indexOf() { - let float32 = new Int8Array([2, 5, 9]); - let res = float32.indexOf(2); + let int8 = new Int8Array([2, 5, 9]); + let res = int8.indexOf(2); expect(res).toEqual(0); - res = float32.indexOf(7); + res = int8.indexOf(7); expect(res).toEqual(-1); - res = float32.indexOf(9, 2); + res = int8.indexOf(9, 2); expect(res).toEqual(2); - res = float32.indexOf(2, -1); + res = int8.indexOf(2, -1); expect(res).toEqual(-1); - res = float32.indexOf(2, -3); + res = int8.indexOf(2, -3); expect(res).toEqual(0); } join() { - let float32 = new Int8Array([1, 2, 3]); - let res = float32.join(); + let int8 = new Int8Array([1, 2, 3]); + let res = int8.join(); expect(res).toEqual("1,2,3"); - res = float32.join(" / "); + res = int8.join(" / "); expect(res).toEqual("1 / 2 / 3"); - res = float32.join(""); + res = int8.join(""); expect(res).toEqual("123"); } @@ -204,23 +204,23 @@ export class TInt8Array { } reverse() { - let float32 = new Int8Array([1, 2, 3]); - float32.reverse(); - expect(float32.toString()).toEqual("3,2,1"); + let int8 = new Int8Array([1, 2, 3]); + int8.reverse(); + expect(int8.toString()).toEqual("3,2,1"); } slice() { - let float32 = new Int8Array([1, 2, 3]); - let res = float32.slice(1); + let int8 = new Int8Array([1, 2, 3]); + let res = int8.slice(1); expect(res.toString()).toEqual("2,3"); - res = float32.slice(2); + res = int8.slice(2); expect(res.toString()).toEqual("3"); - res = float32.slice(-2); + res = int8.slice(-2); expect(res.toString()).toEqual("2,3"); - res = float32.slice(0, 1); + res = int8.slice(0, 1); expect(res.toString()).toEqual("1"); } @@ -235,11 +235,11 @@ export class TInt8Array { subarray() { let buffer = new ArrayBuffer(8); - let float32 = new Int8Array(buffer); - float32.set([1, 2, 3]); - expect(float32.toString()).toEqual("1,2,3,0,0,0,0,0"); + let int8 = new Int8Array(buffer); + int8.set([1, 2, 3]); + expect(int8.toString()).toEqual("1,2,3,0,0,0,0,0"); - let sub = float32.subarray(0, 4); + let sub = int8.subarray(0, 4); expect(sub.toString()).toEqual("1,2,3,0"); } @@ -253,9 +253,9 @@ export class TInt8Array { arrayBufferSlice() { let buffer = new ArrayBuffer(16); - let float32 = new Int8Array(buffer); - float32[4] = 42; - expect(float32.toString()).toEqual("0,0,0,0,42,0,0,0,0,0,0,0,0,0,0,0"); + let int8 = new Int8Array(buffer); + int8[4] = 42; + expect(int8.toString()).toEqual("0,0,0,0,42,0,0,0,0,0,0,0,0,0,0,0"); let res = buffer.slice(4, 12); let sliced = new Int8Array(res); diff --git a/uni_modules/uts-tests/utssdk/TUInt8Array.uts b/uni_modules/uts-tests/utssdk/TUInt8Array.uts index c4b417beec1d07e70738986aa9a8ef7e2210b628..6c0ff65d464e0006bf2a8746a9cb0b4be1eb782c 100644 --- a/uni_modules/uts-tests/utssdk/TUInt8Array.uts +++ b/uni_modules/uts-tests/utssdk/TUInt8Array.uts @@ -39,32 +39,32 @@ export class TUint8Array { console.log(unit8.toString()) } testMAX() { - let float32 = new Uint8Array(16); - float32[0] = 255; - expect(float32[0]).toEqual(255); + let uint8 = new Uint8Array(16); + uint8[0] = 255; + expect(uint8[0]).toEqual(255); } testConstructor() { let buffer = new ArrayBuffer(16); - let float32 = new Uint8Array(buffer); - float32[5] = 42; - expect(float32.toString()).toEqual("0,0,0,0,0,42,0,0,0,0,0,0,0,0,0,0"); + let uint8 = new Uint8Array(buffer); + uint8[5] = 42; + expect(uint8.toString()).toEqual("0,0,0,0,0,42,0,0,0,0,0,0,0,0,0,0"); } testSet() { - let float32 = new Uint8Array(8); + let uint8 = new Uint8Array(8); var array = [1, 2, 3] - float32.set(array, 1); - expect(float32.toString()).toEqual("0,1,2,3,0,0,0,0"); + uint8.set(array, 1); + expect(uint8.toString()).toEqual("0,1,2,3,0,0,0,0"); } testCopyWith() { console.log("testCopyWith 1") - let float32 = new Uint8Array(8); - float32.set([1, 2, 3], 1); - float32.copyWithin(3, 0, 3); + let uint8 = new Uint8Array(8); + uint8.set([1, 2, 3], 1); + uint8.copyWithin(3, 0, 3); - expect(float32.toString()).toEqual("0,1,2,0,1,2,0,0"); + expect(uint8.toString()).toEqual("0,1,2,0,1,2,0,0"); } testEvery() { @@ -75,43 +75,43 @@ export class TUint8Array { } testFill() { - let float32 = new Uint8Array([1, 2, 3]).fill(4); - expect(float32.toString()).toEqual("4,4,4"); + let uint8 = new Uint8Array([1, 2, 3]).fill(4); + expect(uint8.toString()).toEqual("4,4,4"); - float32 = new Uint8Array([1, 2, 3]).fill(4, 1); - expect(float32.toString()).toEqual("1,4,4"); + uint8 = new Uint8Array([1, 2, 3]).fill(4, 1); + expect(uint8.toString()).toEqual("1,4,4"); - float32 = new Uint8Array([1, 2, 3]).fill(4, 1, 2); - expect(float32.toString()).toEqual("1,4,3"); + uint8 = new Uint8Array([1, 2, 3]).fill(4, 1, 2); + expect(uint8.toString()).toEqual("1,4,3"); - float32 = new Uint8Array([1, 2, 3]).fill(4, 1, 1); - expect(float32.toString()).toEqual("1,2,3"); + uint8 = new Uint8Array([1, 2, 3]).fill(4, 1, 1); + expect(uint8.toString()).toEqual("1,2,3"); - float32 = new Uint8Array([1, 2, 3]).fill(4, -3, -2); - expect(float32.toString()).toEqual("4,2,3"); + uint8 = new Uint8Array([1, 2, 3]).fill(4, -3, -2); + expect(uint8.toString()).toEqual("4,2,3"); } testFilter() { // const isBelowThreshold = (currentValue: number, index: number, _): boolean => currentValue >= 10; - let float32 = new Uint8Array([12, 5, 8, 44]).filter((value: number, _: number, _a: Uint8Array): boolean => value >= + let uint8 = new Uint8Array([12, 5, 8, 44]).filter((value: number, _: number, _a: Uint8Array): boolean => value >= 10); - expect(float32.toString()).toEqual("12,44"); + expect(uint8.toString()).toEqual("12,44"); } find() { - let float32 = new Uint8Array([4, 5, 8, 12]); - let res = float32.find((value: number, _: number, _a: Uint8Array): boolean => value > 5); + let uint8 = new Uint8Array([4, 5, 8, 12]); + let res = uint8.find((value: number, _: number, _a: Uint8Array): boolean => value > 5); expect(res).toEqual(8); } findIndex() { - let float32 = new Uint8Array([4, 6, 8, 12]); - let res = float32.findIndex((value: number, _: number, _a: Uint8Array): boolean => value > 100); + let uint8 = new Uint8Array([4, 6, 8, 12]); + let res = uint8.findIndex((value: number, _: number, _a: Uint8Array): boolean => value > 100); expect(res).toEqual(-1); - let ufloat32 = new Uint8Array([4, 6, 7, 120]); - res = ufloat32.findIndex((value: number, _: number, _a: Uint8Array): boolean => value > 100); + let uuint8 = new Uint8Array([4, 6, 7, 120]); + res = uuint8.findIndex((value: number, _: number, _a: Uint8Array): boolean => value > 100); expect(res).toEqual(3); } @@ -129,44 +129,44 @@ export class TUint8Array { } includes() { - let float32 = new Uint8Array([1, 2, 3]); - let res = float32.includes(2); + let uint8 = new Uint8Array([1, 2, 3]); + let res = uint8.includes(2); expect(res).toEqual(true); - res = float32.includes(4); + res = uint8.includes(4); expect(res).toEqual(false); - res = float32.includes(3, 3); + res = uint8.includes(3, 3); expect(res).toEqual(false); } indexOf() { - let float32 = new Uint8Array([2, 5, 9]); - let res = float32.indexOf(2); + let uint8 = new Uint8Array([2, 5, 9]); + let res = uint8.indexOf(2); expect(res).toEqual(0); - res = float32.indexOf(7); + res = uint8.indexOf(7); expect(res).toEqual(-1); - res = float32.indexOf(9, 2); + res = uint8.indexOf(9, 2); expect(res).toEqual(2); - res = float32.indexOf(2, -1); + res = uint8.indexOf(2, -1); expect(res).toEqual(-1); - res = float32.indexOf(2, -3); + res = uint8.indexOf(2, -3); expect(res).toEqual(0); } join() { - let float32 = new Uint8Array([1, 2, 3]); - let res = float32.join(); + let uint8 = new Uint8Array([1, 2, 3]); + let res = uint8.join(); expect(res).toEqual("1,2,3"); - res = float32.join(" / "); + res = uint8.join(" / "); expect(res).toEqual("1 / 2 / 3"); - res = float32.join(""); + res = uint8.join(""); expect(res).toEqual("123"); } @@ -208,23 +208,23 @@ export class TUint8Array { } reverse() { - let float32 = new Uint8Array([1, 2, 3]); - float32.reverse(); - expect(float32.toString()).toEqual("3,2,1"); + let uint8 = new Uint8Array([1, 2, 3]); + uint8.reverse(); + expect(uint8.toString()).toEqual("3,2,1"); } slice() { - let float32 = new Uint8Array([1, 2, 3]); - let res = float32.slice(1); + let uint8 = new Uint8Array([1, 2, 3]); + let res = uint8.slice(1); expect(res.toString()).toEqual("2,3"); - res = float32.slice(2); + res = uint8.slice(2); expect(res.toString()).toEqual("3"); - res = float32.slice(-2); + res = uint8.slice(-2); expect(res.toString()).toEqual("2,3"); - res = float32.slice(0, 1); + res = uint8.slice(0, 1); expect(res.toString()).toEqual("1"); } @@ -239,11 +239,11 @@ export class TUint8Array { subarray() { let buffer = new ArrayBuffer(16); - let float32 = new Uint8Array(buffer); - float32.set([1, 2, 3]); - expect(float32.toString()).toEqual("1,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0"); + let uint8 = new Uint8Array(buffer); + uint8.set([1, 2, 3]); + expect(uint8.toString()).toEqual("1,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0"); - let sub = float32.subarray(0, 4); + let sub = uint8.subarray(0, 4); expect(sub.toString()).toEqual("1,2,3,0"); } @@ -256,9 +256,9 @@ export class TUint8Array { arrayBufferSlice() { let buffer = new ArrayBuffer(16); - let float32 = new Uint8Array(buffer); - float32[4] = 42; - expect(float32.toString()).toEqual("0,0,0,0,42,0,0,0,0,0,0,0,0,0,0,0"); + let uint8 = new Uint8Array(buffer); + uint8[4] = 42; + expect(uint8.toString()).toEqual("0,0,0,0,42,0,0,0,0,0,0,0,0,0,0,0"); let res = buffer.slice(4, 12); let sliced = new Uint8Array(res); diff --git a/uni_modules/uts-tests/utssdk/TUInt8ClampedArray.uts b/uni_modules/uts-tests/utssdk/TUInt8ClampedArray.uts index 862e803798cc7f4fb165a0d003634573c03da6fa..ba44ea458bc5d122dfa5ab0deb6a5e8a9c04f397 100644 --- a/uni_modules/uts-tests/utssdk/TUInt8ClampedArray.uts +++ b/uni_modules/uts-tests/utssdk/TUInt8ClampedArray.uts @@ -34,32 +34,32 @@ export class TUint8ClampedArray { } testMAX() { - let float32 = new Uint8ClampedArray(16); - float32[0] = 255; - expect(float32[0]).toEqual(255); + let uint8Clamped = new Uint8ClampedArray(16); + uint8Clamped[0] = 255; + expect(uint8Clamped[0]).toEqual(255); } testConstructor() { let buffer = new ArrayBuffer(16); - let float32 = new Uint8ClampedArray(buffer); - float32[5] = 42; - expect(float32.toString()).toEqual("0,0,0,0,0,42,0,0,0,0,0,0,0,0,0,0"); + let uint8Clamped = new Uint8ClampedArray(buffer); + uint8Clamped[5] = 42; + expect(uint8Clamped.toString()).toEqual("0,0,0,0,0,42,0,0,0,0,0,0,0,0,0,0"); } testSet() { - let float32 = new Uint8ClampedArray(8); + let uint8Clamped = new Uint8ClampedArray(8); var array = [1, 2, 3] - float32.set(array, 1); - expect(float32.toString()).toEqual("0,1,2,3,0,0,0,0"); + uint8Clamped.set(array, 1); + expect(uint8Clamped.toString()).toEqual("0,1,2,3,0,0,0,0"); } testCopyWith() { console.log("testCopyWith 1") - let float32 = new Uint8ClampedArray(8); - float32.set([1, 2, 3], 1); - float32.copyWithin(3, 0, 3); + let uint8Clamped = new Uint8ClampedArray(8); + uint8Clamped.set([1, 2, 3], 1); + uint8Clamped.copyWithin(3, 0, 3); - expect(float32.toString()).toEqual("0,1,2,0,1,2,0,0"); + expect(uint8Clamped.toString()).toEqual("0,1,2,0,1,2,0,0"); } testEvery() { @@ -70,43 +70,43 @@ export class TUint8ClampedArray { } testFill() { - let float32 = new Uint8ClampedArray([1, 2, 3]).fill(4); - expect(float32.toString()).toEqual("4,4,4"); + let uint8Clamped = new Uint8ClampedArray([1, 2, 3]).fill(4); + expect(uint8Clamped.toString()).toEqual("4,4,4"); - float32 = new Uint8ClampedArray([1, 2, 3]).fill(4, 1); - expect(float32.toString()).toEqual("1,4,4"); + uint8Clamped = new Uint8ClampedArray([1, 2, 3]).fill(4, 1); + expect(uint8Clamped.toString()).toEqual("1,4,4"); - float32 = new Uint8ClampedArray([1, 2, 3]).fill(4, 1, 2); - expect(float32.toString()).toEqual("1,4,3"); + uint8Clamped = new Uint8ClampedArray([1, 2, 3]).fill(4, 1, 2); + expect(uint8Clamped.toString()).toEqual("1,4,3"); - float32 = new Uint8ClampedArray([1, 2, 3]).fill(4, 1, 1); - expect(float32.toString()).toEqual("1,2,3"); + uint8Clamped = new Uint8ClampedArray([1, 2, 3]).fill(4, 1, 1); + expect(uint8Clamped.toString()).toEqual("1,2,3"); - float32 = new Uint8ClampedArray([1, 2, 3]).fill(4, -3, -2); - expect(float32.toString()).toEqual("4,2,3"); + uint8Clamped = new Uint8ClampedArray([1, 2, 3]).fill(4, -3, -2); + expect(uint8Clamped.toString()).toEqual("4,2,3"); } testFilter() { // const isBelowThreshold = (currentValue: number, index: number, _): boolean => currentValue >= 10; - let float32 = new Uint8ClampedArray([12, 5, 8, 44]).filter((value: number, _: number, _a: + let uint8Clamped = new Uint8ClampedArray([12, 5, 8, 44]).filter((value: number, _: number, _a: Uint8ClampedArray): boolean => value >= 10); - expect(float32.toString()).toEqual("12,44"); + expect(uint8Clamped.toString()).toEqual("12,44"); } find() { - let float32 = new Uint8ClampedArray([4, 5, 8, 12]); - let res = float32.find((value: number, _: number, _a: Uint8ClampedArray): boolean => value > 5); + let uint8Clamped = new Uint8ClampedArray([4, 5, 8, 12]); + let res = uint8Clamped.find((value: number, _: number, _a: Uint8ClampedArray): boolean => value > 5); expect(res).toEqual(8); } findIndex() { - let float32 = new Uint8ClampedArray([4, 6, 8, 12]); - let res = float32.findIndex((value: number, _: number, _a: Uint8ClampedArray): boolean => value > 100); + let uint8Clamped = new Uint8ClampedArray([4, 6, 8, 12]); + let res = uint8Clamped.findIndex((value: number, _: number, _a: Uint8ClampedArray): boolean => value > 100); expect(res).toEqual(-1); - let ufloat32 = new Uint8ClampedArray([4, 6, 7, 120]); - res = ufloat32.findIndex((value: number, _: number, _a: Uint8ClampedArray): boolean => value > 100); + let uuint8Clamped = new Uint8ClampedArray([4, 6, 7, 120]); + res = uuint8Clamped.findIndex((value: number, _: number, _a: Uint8ClampedArray): boolean => value > 100); expect(res).toEqual(3); } @@ -124,44 +124,44 @@ export class TUint8ClampedArray { } includes() { - let float32 = new Uint8ClampedArray([1, 2, 3]); - let res = float32.includes(2); + let uint8Clamped = new Uint8ClampedArray([1, 2, 3]); + let res = uint8Clamped.includes(2); expect(res).toEqual(true); - res = float32.includes(4); + res = uint8Clamped.includes(4); expect(res).toEqual(false); - res = float32.includes(3, 3); + res = uint8Clamped.includes(3, 3); expect(res).toEqual(false); } indexOf() { - let float32 = new Uint8ClampedArray([2, 5, 9]); - let res = float32.indexOf(2); + let uint8Clamped = new Uint8ClampedArray([2, 5, 9]); + let res = uint8Clamped.indexOf(2); expect(res).toEqual(0); - res = float32.indexOf(7); + res = uint8Clamped.indexOf(7); expect(res).toEqual(-1); - res = float32.indexOf(9, 2); + res = uint8Clamped.indexOf(9, 2); expect(res).toEqual(2); - res = float32.indexOf(2, -1); + res = uint8Clamped.indexOf(2, -1); expect(res).toEqual(-1); - res = float32.indexOf(2, -3); + res = uint8Clamped.indexOf(2, -3); expect(res).toEqual(0); } join() { - let float32 = new Uint8ClampedArray([1, 2, 3]); - let res = float32.join(); + let uint8Clamped = new Uint8ClampedArray([1, 2, 3]); + let res = uint8Clamped.join(); expect(res).toEqual("1,2,3"); - res = float32.join(" / "); + res = uint8Clamped.join(" / "); expect(res).toEqual("1 / 2 / 3"); - res = float32.join(""); + res = uint8Clamped.join(""); expect(res).toEqual("123"); } @@ -203,23 +203,23 @@ export class TUint8ClampedArray { } reverse() { - let float32 = new Uint8ClampedArray([1, 2, 3]); - float32.reverse(); - expect(float32.toString()).toEqual("3,2,1"); + let uint8Clamped = new Uint8ClampedArray([1, 2, 3]); + uint8Clamped.reverse(); + expect(uint8Clamped.toString()).toEqual("3,2,1"); } slice() { - let float32 = new Uint8ClampedArray([1, 2, 3]); - let res = float32.slice(1); + let uint8Clamped = new Uint8ClampedArray([1, 2, 3]); + let res = uint8Clamped.slice(1); expect(res.toString()).toEqual("2,3"); - res = float32.slice(2); + res = uint8Clamped.slice(2); expect(res.toString()).toEqual("3"); - res = float32.slice(-2); + res = uint8Clamped.slice(-2); expect(res.toString()).toEqual("2,3"); - res = float32.slice(0, 1); + res = uint8Clamped.slice(0, 1); expect(res.toString()).toEqual("1"); } @@ -234,11 +234,11 @@ export class TUint8ClampedArray { subarray() { let buffer = new ArrayBuffer(16); - let float32 = new Uint8ClampedArray(buffer); - float32.set([1, 2, 3]); - expect(float32.toString()).toEqual("1,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0"); + let uint8Clamped = new Uint8ClampedArray(buffer); + uint8Clamped.set([1, 2, 3]); + expect(uint8Clamped.toString()).toEqual("1,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0"); - let sub = float32.subarray(0, 4); + let sub = uint8Clamped.subarray(0, 4); expect(sub.toString()).toEqual("1,2,3,0"); } @@ -251,9 +251,9 @@ export class TUint8ClampedArray { arrayBufferSlice() { let buffer = new ArrayBuffer(16); - let float32 = new Uint8ClampedArray(buffer); - float32[4] = 42; - expect(float32.toString()).toEqual("0,0,0,0,42,0,0,0,0,0,0,0,0,0,0,0"); + let uint8Clamped = new Uint8ClampedArray(buffer); + uint8Clamped[4] = 42; + expect(uint8Clamped.toString()).toEqual("0,0,0,0,42,0,0,0,0,0,0,0,0,0,0,0"); let res = buffer.slice(4, 12); let sliced = new Uint8ClampedArray(res); diff --git a/uni_modules/uts-tests/utssdk/TUint16Array.uts b/uni_modules/uts-tests/utssdk/TUint16Array.uts index 06f5a7cd9965c72952b79e8ae22fc469b895a43e..7be38bba76f7a260c568db70c75eaa9aca71ab2c 100644 --- a/uni_modules/uts-tests/utssdk/TUint16Array.uts +++ b/uni_modules/uts-tests/utssdk/TUint16Array.uts @@ -7,7 +7,8 @@ import { export class TUint16Array { test() { - this.testfloat32(); + // #ifdef APP-ANDROID + this.testuint16(); this.testConstructor(); this.testSet(); this.testCopyWith(); @@ -31,13 +32,15 @@ export class TUint16Array { this.subarray(); this.values(); this.arrayBufferSlice(); + // #endif } - - testfloat32() { - let float32 = new Uint16Array(2); - float32[0] = 42; - expect(float32[0]).toEqual(42); - expect(float32.length).toEqual(2); + + // #ifdef APP-ANDROID + testuint16() { + let uint16 = new Uint16Array(2); + uint16[0] = 42; + expect(uint16[0]).toEqual(42); + expect(uint16.length).toEqual(2); expect(Uint16Array.BYTES_PER_ELEMENT).toEqual(4); let x = new Uint16Array([21, 31, 3]); @@ -54,26 +57,26 @@ export class TUint16Array { testConstructor() { let buffer = new ArrayBuffer(16); - let float32 = new Uint16Array(buffer); - float32[1] = 42; - expect(float32.toString()).toEqual("0,42,0,0,0,0,0,0"); + let uint16 = new Uint16Array(buffer); + uint16[1] = 42; + expect(uint16.toString()).toEqual("0,42,0,0,0,0,0,0"); } testSet() { - let float32 = new Uint16Array(8); + let uint16 = new Uint16Array(8); var array = [1, 2, 3] - float32.set(array, 1); - expect(float32.toString()).toEqual("0,1,2,3,0,0,0,0"); + uint16.set(array, 1); + expect(uint16.toString()).toEqual("0,1,2,3,0,0,0,0"); } testCopyWith() { console.log("testCopyWith 1") - let float32 = new Uint16Array(8); - float32.set([1, 2, 3], 1); + let uint16 = new Uint16Array(8); + uint16.set([1, 2, 3], 1); console.log("testCopyWith 1") - float32.copyWithin(3, 0, 3); + uint16.copyWithin(3, 0, 3); console.log("testCopyWith 1") - expect(float32.toString()).toEqual("0,1,2,0,1,2,0,0"); + expect(uint16.toString()).toEqual("0,1,2,0,1,2,0,0"); } testEvery() { @@ -84,43 +87,43 @@ export class TUint16Array { } testFill() { - let float32 = new Uint16Array([1, 2, 3]).fill(4); - expect(float32.toString()).toEqual("4,4,4"); + let uint16 = new Uint16Array([1, 2, 3]).fill(4); + expect(uint16.toString()).toEqual("4,4,4"); - float32 = new Uint16Array([1, 2, 3]).fill(4, 1); - expect(float32.toString()).toEqual("1,4,4"); + uint16 = new Uint16Array([1, 2, 3]).fill(4, 1); + expect(uint16.toString()).toEqual("1,4,4"); - float32 = new Uint16Array([1, 2, 3]).fill(4, 1, 2); - expect(float32.toString()).toEqual("1,4,3"); + uint16 = new Uint16Array([1, 2, 3]).fill(4, 1, 2); + expect(uint16.toString()).toEqual("1,4,3"); - float32 = new Uint16Array([1, 2, 3]).fill(4, 1, 1); - expect(float32.toString()).toEqual("1,2,3"); + uint16 = new Uint16Array([1, 2, 3]).fill(4, 1, 1); + expect(uint16.toString()).toEqual("1,2,3"); - float32 = new Uint16Array([1, 2, 3]).fill(4, -3, -2); - expect(float32.toString()).toEqual("4,2,3"); + uint16 = new Uint16Array([1, 2, 3]).fill(4, -3, -2); + expect(uint16.toString()).toEqual("4,2,3"); } testFilter() { // const isBelowThreshold = (currentValue: number, index: number, _): boolean => currentValue >= 10; - let float32 = new Uint16Array([12, 5, 8, 44]).filter((value: number, _: number, _a: Uint16Array): + let uint16 = new Uint16Array([12, 5, 8, 44]).filter((value: number, _: number, _a: Uint16Array): boolean => value >= 10); - expect(float32.toString()).toEqual("12,44"); + expect(uint16.toString()).toEqual("12,44"); } find() { - let float32 = new Uint16Array([4, 5, 8, 12]); - let res = float32.find((value: number, _: number, _a: Uint16Array): boolean => value > 5); + let uint16 = new Uint16Array([4, 5, 8, 12]); + let res = uint16.find((value: number, _: number, _a: Uint16Array): boolean => value > 5); expect(res).toEqual(8); } findIndex() { - let float32 = new Uint16Array([4, 6, 8, 12]); - let res = float32.findIndex((value: number, _: number, _a: Uint16Array): boolean => value > 100); + let uint16 = new Uint16Array([4, 6, 8, 12]); + let res = uint16.findIndex((value: number, _: number, _a: Uint16Array): boolean => value > 100); expect(res).toEqual(-1); - let ufloat32 = new Uint16Array([4, 6, 7, 120]); - res = ufloat32.findIndex((value: number, _: number, _a: Uint16Array): boolean => value > 100); + let uuint16 = new Uint16Array([4, 6, 7, 120]); + res = uuint16.findIndex((value: number, _: number, _a: Uint16Array): boolean => value > 100); expect(res).toEqual(3); } @@ -138,44 +141,44 @@ export class TUint16Array { } includes() { - let float32 = new Uint16Array([1, 2, 3]); - let res = float32.includes(2); + let uint16 = new Uint16Array([1, 2, 3]); + let res = uint16.includes(2); expect(res).toEqual(true); - res = float32.includes(4); + res = uint16.includes(4); expect(res).toEqual(false); - res = float32.includes(3, 3); + res = uint16.includes(3, 3); expect(res).toEqual(false); } indexOf() { - let float32 = new Uint16Array([2, 5, 9]); - let res = float32.indexOf(2); + let uint16 = new Uint16Array([2, 5, 9]); + let res = uint16.indexOf(2); expect(res).toEqual(0); - res = float32.indexOf(7); + res = uint16.indexOf(7); expect(res).toEqual(-1); - res = float32.indexOf(9, 2); + res = uint16.indexOf(9, 2); expect(res).toEqual(2); - res = float32.indexOf(2, -1); + res = uint16.indexOf(2, -1); expect(res).toEqual(-1); - res = float32.indexOf(2, -3); + res = uint16.indexOf(2, -3); expect(res).toEqual(0); } join() { - let float32 = new Uint16Array([1, 2, 3]); - let res = float32.join(); + let uint16 = new Uint16Array([1, 2, 3]); + let res = uint16.join(); expect(res).toEqual("1,2,3"); - res = float32.join(" / "); + res = uint16.join(" / "); expect(res).toEqual("1 / 2 / 3"); - res = float32.join(""); + res = uint16.join(""); expect(res).toEqual("123"); } @@ -217,23 +220,23 @@ export class TUint16Array { } reverse() { - let float32 = new Uint16Array([1, 2, 3]); - float32.reverse(); - expect(float32.toString()).toEqual("3,2,1"); + let uint16 = new Uint16Array([1, 2, 3]); + uint16.reverse(); + expect(uint16.toString()).toEqual("3,2,1"); } slice() { - let float32 = new Uint16Array([1, 2, 3]); - let res = float32.slice(1); + let uint16 = new Uint16Array([1, 2, 3]); + let res = uint16.slice(1); expect(res.toString()).toEqual("2,3"); - res = float32.slice(2); + res = uint16.slice(2); expect(res.toString()).toEqual("3"); - res = float32.slice(-2); + res = uint16.slice(-2); expect(res.toString()).toEqual("2,3"); - res = float32.slice(0, 1); + res = uint16.slice(0, 1); expect(res.toString()).toEqual("1"); } @@ -248,11 +251,11 @@ export class TUint16Array { subarray() { let buffer = new ArrayBuffer(16); - let float32 = new Uint16Array(buffer); - float32.set([1, 2, 3]); - expect(float32.toString()).toEqual("1,2,3,0,0,0,0,0"); + let uint16 = new Uint16Array(buffer); + uint16.set([1, 2, 3]); + expect(uint16.toString()).toEqual("1,2,3,0,0,0,0,0"); - let sub = float32.subarray(0, 4); + let sub = uint16.subarray(0, 4); expect(sub.toString()).toEqual("1,2,3,0"); } @@ -265,12 +268,14 @@ export class TUint16Array { arrayBufferSlice() { let buffer = new ArrayBuffer(16); - let float32 = new Uint16Array(buffer); - float32[4] = 42; - expect(float32.toString()).toEqual("0,0,0,0,42,0,0,0"); + let uint16 = new Uint16Array(buffer); + uint16[4] = 42; + expect(uint16.toString()).toEqual("0,0,0,0,42,0,0,0"); let res = buffer.slice(8); let sliced = new Uint16Array(res); expect(sliced[0]).toEqual(42); } + // #endif + } \ No newline at end of file diff --git a/uni_modules/uts-tests/utssdk/TUint32Array.uts b/uni_modules/uts-tests/utssdk/TUint32Array.uts index ac621d799f6058679369538ddac6184476188a41..752278036a0489fccaee33546b14712b5b7f136b 100644 --- a/uni_modules/uts-tests/utssdk/TUint32Array.uts +++ b/uni_modules/uts-tests/utssdk/TUint32Array.uts @@ -7,7 +7,8 @@ import { export class TUint32Array { test() { - this.testfloat32(); + // #ifdef APP-ANDROID + this.testuint32(); this.testConstructor(); this.testSet(); this.testCopyWith(); @@ -31,13 +32,15 @@ export class TUint32Array { this.subarray(); this.values(); this.arrayBufferSlice(); + // #endif } - testfloat32() { - let float32 = new Uint32Array(2); - float32[0] = 42; - expect(float32[0]).toEqual(42); - expect(float32.length).toEqual(2); +// #ifdef APP-ANDROID + testuint32() { + let uint32 = new Uint32Array(2); + uint32[0] = 42; + expect(uint32[0]).toEqual(42); + expect(uint32.length).toEqual(2); expect(Uint32Array.BYTES_PER_ELEMENT).toEqual(4); let x = new Uint32Array([21, 31, 3]); @@ -54,26 +57,26 @@ export class TUint32Array { testConstructor() { let buffer = new ArrayBuffer(16); - let float32 = new Uint32Array(buffer); - float32[1] = 42; - expect(float32.toString()).toEqual("0,42,0,0"); + let uint32 = new Uint32Array(buffer); + uint32[1] = 42; + expect(uint32.toString()).toEqual("0,42,0,0"); } testSet() { - let float32 = new Uint32Array(8); + let uint32 = new Uint32Array(8); var array = [1, 2, 3] - float32.set(array, 1); - expect(float32.toString()).toEqual("0,1,2,3,0,0,0,0"); + uint32.set(array, 1); + expect(uint32.toString()).toEqual("0,1,2,3,0,0,0,0"); } testCopyWith() { console.log("testCopyWith 1") - let float32 = new Uint32Array(8); - float32.set([1, 2, 3], 1); + let uint32 = new Uint32Array(8); + uint32.set([1, 2, 3], 1); console.log("testCopyWith 1") - float32.copyWithin(3, 0, 3); + uint32.copyWithin(3, 0, 3); console.log("testCopyWith 1") - expect(float32.toString()).toEqual("0,1,2,0,1,2,0,0"); + expect(uint32.toString()).toEqual("0,1,2,0,1,2,0,0"); } testEvery() { @@ -84,43 +87,43 @@ export class TUint32Array { } testFill() { - let float32 = new Uint32Array([1, 2, 3]).fill(4); - expect(float32.toString()).toEqual("4,4,4"); + let uint32 = new Uint32Array([1, 2, 3]).fill(4); + expect(uint32.toString()).toEqual("4,4,4"); - float32 = new Uint32Array([1, 2, 3]).fill(4, 1); - expect(float32.toString()).toEqual("1,4,4"); + uint32 = new Uint32Array([1, 2, 3]).fill(4, 1); + expect(uint32.toString()).toEqual("1,4,4"); - float32 = new Uint32Array([1, 2, 3]).fill(4, 1, 2); - expect(float32.toString()).toEqual("1,4,3"); + uint32 = new Uint32Array([1, 2, 3]).fill(4, 1, 2); + expect(uint32.toString()).toEqual("1,4,3"); - float32 = new Uint32Array([1, 2, 3]).fill(4, 1, 1); - expect(float32.toString()).toEqual("1,2,3"); + uint32 = new Uint32Array([1, 2, 3]).fill(4, 1, 1); + expect(uint32.toString()).toEqual("1,2,3"); - float32 = new Uint32Array([1, 2, 3]).fill(4, -3, -2); - expect(float32.toString()).toEqual("4,2,3"); + uint32 = new Uint32Array([1, 2, 3]).fill(4, -3, -2); + expect(uint32.toString()).toEqual("4,2,3"); } testFilter() { // const isBelowThreshold = (currentValue: number, index: number, _): boolean => currentValue >= 10; - let float32 = new Uint32Array([12, 5, 8, 44]).filter((value: number, _: number, _a: Uint32Array): + let uint32 = new Uint32Array([12, 5, 8, 44]).filter((value: number, _: number, _a: Uint32Array): boolean => value >= 10); - expect(float32.toString()).toEqual("12,44"); + expect(uint32.toString()).toEqual("12,44"); } find() { - let float32 = new Uint32Array([4, 5, 8, 12]); - let res = float32.find((value: number, _: number, _a: Uint32Array): boolean => value > 5); + let uint32 = new Uint32Array([4, 5, 8, 12]); + let res = uint32.find((value: number, _: number, _a: Uint32Array): boolean => value > 5); expect(res).toEqual(8); } findIndex() { - let float32 = new Uint32Array([4, 6, 8, 12]); - let res = float32.findIndex((value: number, _: number, _a: Uint32Array): boolean => value > 100); + let uint32 = new Uint32Array([4, 6, 8, 12]); + let res = uint32.findIndex((value: number, _: number, _a: Uint32Array): boolean => value > 100); expect(res).toEqual(-1); - let ufloat32 = new Uint32Array([4, 6, 7, 120]); - res = ufloat32.findIndex((value: number, _: number, _a: Uint32Array): boolean => value > 100); + let uuint32 = new Uint32Array([4, 6, 7, 120]); + res = uuint32.findIndex((value: number, _: number, _a: Uint32Array): boolean => value > 100); expect(res).toEqual(3); } @@ -138,44 +141,44 @@ export class TUint32Array { } includes() { - let float32 = new Uint32Array([1, 2, 3]); - let res = float32.includes(2); + let uint32 = new Uint32Array([1, 2, 3]); + let res = uint32.includes(2); expect(res).toEqual(true); - res = float32.includes(4); + res = uint32.includes(4); expect(res).toEqual(false); - res = float32.includes(3, 3); + res = uint32.includes(3, 3); expect(res).toEqual(false); } indexOf() { - let float32 = new Uint32Array([2, 5, 9]); - let res = float32.indexOf(2); + let uint32 = new Uint32Array([2, 5, 9]); + let res = uint32.indexOf(2); expect(res).toEqual(0); - res = float32.indexOf(7); + res = uint32.indexOf(7); expect(res).toEqual(-1); - res = float32.indexOf(9, 2); + res = uint32.indexOf(9, 2); expect(res).toEqual(2); - res = float32.indexOf(2, -1); + res = uint32.indexOf(2, -1); expect(res).toEqual(-1); - res = float32.indexOf(2, -3); + res = uint32.indexOf(2, -3); expect(res).toEqual(0); } join() { - let float32 = new Uint32Array([1, 2, 3]); - let res = float32.join(); + let uint32 = new Uint32Array([1, 2, 3]); + let res = uint32.join(); expect(res).toEqual("1,2,3"); - res = float32.join(" / "); + res = uint32.join(" / "); expect(res).toEqual("1 / 2 / 3"); - res = float32.join(""); + res = uint32.join(""); expect(res).toEqual("123"); } @@ -217,23 +220,23 @@ export class TUint32Array { } reverse() { - let float32 = new Uint32Array([1, 2, 3]); - float32.reverse(); - expect(float32.toString()).toEqual("3,2,1"); + let uint32 = new Uint32Array([1, 2, 3]); + uint32.reverse(); + expect(uint32.toString()).toEqual("3,2,1"); } slice() { - let float32 = new Uint32Array([1, 2, 3]); - let res = float32.slice(1); + let uint32 = new Uint32Array([1, 2, 3]); + let res = uint32.slice(1); expect(res.toString()).toEqual("2,3"); - res = float32.slice(2); + res = uint32.slice(2); expect(res.toString()).toEqual("3"); - res = float32.slice(-2); + res = uint32.slice(-2); expect(res.toString()).toEqual("2,3"); - res = float32.slice(0, 1); + res = uint32.slice(0, 1); expect(res.toString()).toEqual("1"); } @@ -248,11 +251,11 @@ export class TUint32Array { subarray() { let buffer = new ArrayBuffer(16); - let float32 = new Uint32Array(buffer); - float32.set([1, 2, 3]); - expect(float32.toString()).toEqual("1,2,3,0"); + let uint32 = new Uint32Array(buffer); + uint32.set([1, 2, 3]); + expect(uint32.toString()).toEqual("1,2,3,0"); - let sub = float32.subarray(0, 4); + let sub = uint32.subarray(0, 4); expect(sub.toString()).toEqual("1,2,3,0"); } @@ -265,12 +268,13 @@ export class TUint32Array { arrayBufferSlice() { let buffer = new ArrayBuffer(16); - let float32 = new Uint32Array(buffer); - float32[3] = 42; - expect(float32.toString()).toEqual("0,0,0,42"); + let uint32 = new Uint32Array(buffer); + uint32[3] = 42; + expect(uint32.toString()).toEqual("0,0,0,42"); let res = buffer.slice(8); let sliced = new Uint32Array(res); expect(sliced[1]).toEqual(42); } + // #endif } \ No newline at end of file