From 5635c4ac522cec6dfeb88ecb1a790a01db4a7e31 Mon Sep 17 00:00:00 2001 From: mahaifeng Date: Mon, 15 Jul 2024 17:08:11 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"[arraybuffer]=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 71ae0de1c09cb937f6ce72b23a890a3447fcc348. --- uni_modules/uts-tests/utssdk/TFloat32Array.js | 8 ++++---- uni_modules/uts-tests/utssdk/TFloat64Array.js | 8 ++++---- uni_modules/uts-tests/utssdk/TInt16Array.js | 8 ++++---- uni_modules/uts-tests/utssdk/TInt8Array.js | 9 ++++----- uni_modules/uts-tests/utssdk/TUInt8Array.js | 14 +++++++------- .../uts-tests/utssdk/TUInt8ClampedArray.js | 14 +++++++------- uni_modules/uts-tests/utssdk/TUint16Array.js | 18 +++++++++--------- 7 files changed, 39 insertions(+), 40 deletions(-) diff --git a/uni_modules/uts-tests/utssdk/TFloat32Array.js b/uni_modules/uts-tests/utssdk/TFloat32Array.js index e12839c..f53690a 100644 --- a/uni_modules/uts-tests/utssdk/TFloat32Array.js +++ b/uni_modules/uts-tests/utssdk/TFloat32Array.js @@ -203,24 +203,24 @@ export class TFloat32Array { let total = new Float32Array([0, 1, 2, 3]); let res = total.reduce((accumulator: number, currentValue: number, currentIndex: number, array: Float32Array): number => accumulator + currentValue); - expect(res).toEqual(6); + expect(res).toEqual(6.0); total = new Float32Array([0, 1, 2, 3]); res = total.reduce((accumulator: number, currentValue: number, currentIndex: number, array: Float32Array): number => accumulator + currentValue, 8); - expect(res).toEqual(14); + expect(res).toEqual(14.0); } reduceRight() { let total = new Float32Array([0, 1, 2, 3]); let res = total.reduceRight((accumulator: number, currentValue: number, currentIndex: number, array: Float32Array): number => accumulator + currentValue); - expect(res).toEqual(6); + expect(res).toEqual(6.0); total = new Float32Array([0, 1, 2, 3]); res = total.reduceRight((accumulator: number, currentValue: number, currentIndex: number, array: Float32Array): number => accumulator + currentValue, 8); - expect(res).toEqual(14); + expect(res).toEqual(14.0); } reverse() { diff --git a/uni_modules/uts-tests/utssdk/TFloat64Array.js b/uni_modules/uts-tests/utssdk/TFloat64Array.js index fda866d..170a0e6 100644 --- a/uni_modules/uts-tests/utssdk/TFloat64Array.js +++ b/uni_modules/uts-tests/utssdk/TFloat64Array.js @@ -198,24 +198,24 @@ export class TFloat64Array { let total = new Float64Array([0, 1, 2, 3]); let res = total.reduce((accumulator: number, currentValue: number, currentIndex: number, array: Float64Array): number => accumulator + currentValue); - expect(res).toEqual(6); + expect(res).toEqual(6.0); total = new Float64Array([0, 1, 2, 3]); res = total.reduce((accumulator: number, currentValue: number, currentIndex: number, array: Float64Array): number => accumulator + currentValue, 8); - expect(res).toEqual(14); + expect(res).toEqual(14.0); } reduceRight() { let total = new Float64Array([0, 1, 2, 3]); let res = total.reduceRight((accumulator: number, currentValue: number, currentIndex: number, array: Float64Array): number => accumulator + currentValue); - expect(res).toEqual(6); + expect(res).toEqual(6.0); total = new Float64Array([0, 1, 2, 3]); res = total.reduceRight((accumulator: number, currentValue: number, currentIndex: number, array: Float64Array): number => accumulator + currentValue, 8); - expect(res).toEqual(14); + expect(res).toEqual(14.0); } reverse() { diff --git a/uni_modules/uts-tests/utssdk/TInt16Array.js b/uni_modules/uts-tests/utssdk/TInt16Array.js index 422c6a4..90c2f31 100644 --- a/uni_modules/uts-tests/utssdk/TInt16Array.js +++ b/uni_modules/uts-tests/utssdk/TInt16Array.js @@ -177,21 +177,21 @@ export class TInt16Array { reduce() { let total = new Int16Array([0, 1, 2, 3]); let res = total.reduce((accumulator : number, currentValue : number, currentIndex : number, array : Int16Array): number => accumulator + currentValue); - expect(res).toEqual(6); + expect(res).toEqual(6.0); total = new Int16Array([0, 1, 2, 3]); res = total.reduce((accumulator : number, currentValue : number, currentIndex : number, array : Int16Array): number => accumulator + currentValue, 8); - expect(res).toEqual(14); + expect(res).toEqual(14.0); } reduceRight() { let total = new Int16Array([0, 1, 2, 3]); let res = total.reduceRight((accumulator: number, currentValue : number, currentIndex : number, array : Int16Array): number => accumulator + currentValue); - expect(res).toEqual(6); + expect(res).toEqual(6.0); total = new Int16Array([0, 1, 2, 3]); res = total.reduceRight((accumulator: number, currentValue : number, currentIndex : number, array : Int16Array): number => accumulator + currentValue, 8); - expect(res).toEqual(14); + expect(res).toEqual(14.0); } reverse() { diff --git a/uni_modules/uts-tests/utssdk/TInt8Array.js b/uni_modules/uts-tests/utssdk/TInt8Array.js index 91a84fa..3bc37bb 100644 --- a/uni_modules/uts-tests/utssdk/TInt8Array.js +++ b/uni_modules/uts-tests/utssdk/TInt8Array.js @@ -2,7 +2,6 @@ import { describe, test, expect, - expectNumber, Result } from './tests.uts' @@ -182,25 +181,25 @@ export class TInt8Array { let total = new Int8Array([0, 1, 2, 3]); let res = total.reduce((accumulator: number, currentValue: number, currentIndex: number, array: Int8Array): number => accumulator + currentValue); - expect(res).toEqual(6); + expect(res).toEqual(6.0); total = new Int8Array([0, 1, 2, 3]); res = total.reduce((accumulator: number, currentValue: number, currentIndex: number, array: Int8Array): number => accumulator + currentValue, 8); - expect(res).toEqual(14); + expect(res).toEqual(14.0); } reduceRight() { let total = new Int8Array([0, 1, 2, 3]); let res = total.reduceRight((accumulator: number, currentValue: number, currentIndex: number, array: Int8Array): number => accumulator + currentValue); - expect(res).toEqual(6); + expect(res).toEqual(6.0); total = new Int8Array([0, 1, 2, 3]); res = total.reduceRight((accumulator: number, currentValue: number, currentIndex: number, array: Int8Array): number => accumulator + currentValue, 8); - expect(res).toEqual(14); + expect(res).toEqual(14.0); } reverse() { diff --git a/uni_modules/uts-tests/utssdk/TUInt8Array.js b/uni_modules/uts-tests/utssdk/TUInt8Array.js index 018471a..65c0ebf 100644 --- a/uni_modules/uts-tests/utssdk/TUInt8Array.js +++ b/uni_modules/uts-tests/utssdk/TUInt8Array.js @@ -123,13 +123,13 @@ export class TUint8Array { includes() { let float32 = new Uint8Array([1, 2, 3]); - let res = float32.includes(2); + let res = float32.includes(2.0); expect(res).toEqual(true); - res = float32.includes(4); + res = float32.includes(4.0); expect(res).toEqual(false); - res = float32.includes(3, 3); + res = float32.includes(3.0, 3); expect(res).toEqual(false); } @@ -179,21 +179,21 @@ export class TUint8Array { reduce() { let total = new Uint8Array([0, 1, 2, 3]); let res = total.reduce((accumulator : number, currentValue : number, currentIndex : number, array : Uint8Array): number => accumulator + currentValue); - expect(res).toEqual(6); + expect(res).toEqual(6.0); total = new Uint8Array([0, 1, 2, 3]); res = total.reduce((accumulator : number, currentValue : number, currentIndex : number, array : Uint8Array): number => accumulator + currentValue, 8); - expect(res).toEqual(14); + expect(res).toEqual(14.0); } reduceRight() { let total = new Uint8Array([0, 1, 2, 3]); let res = total.reduceRight((accumulator: number, currentValue : number, currentIndex : number, array : Uint8Array): number => accumulator + currentValue); - expect(res).toEqual(6); + expect(res).toEqual(6.0); total = new Uint8Array([0, 1, 2, 3]); res = total.reduceRight((accumulator: number, currentValue : number, currentIndex : number, array : Uint8Array): number => accumulator + currentValue, 8); - expect(res).toEqual(14); + expect(res).toEqual(14.0); } reverse() { diff --git a/uni_modules/uts-tests/utssdk/TUInt8ClampedArray.js b/uni_modules/uts-tests/utssdk/TUInt8ClampedArray.js index a51e5b4..6739cdc 100644 --- a/uni_modules/uts-tests/utssdk/TUInt8ClampedArray.js +++ b/uni_modules/uts-tests/utssdk/TUInt8ClampedArray.js @@ -125,13 +125,13 @@ export class TUint8ClampedArray { includes() { let float32 = new Uint8ClampedArray([1, 2, 3]); - let res = float32.includes(2); + let res = float32.includes(2.0); expect(res).toEqual(true); - res = float32.includes(4); + res = float32.includes(4.0); expect(res).toEqual(false); - res = float32.includes(3, 3); + res = float32.includes(3.0, 3); expect(res).toEqual(false); } @@ -182,24 +182,24 @@ export class TUint8ClampedArray { let total = new Uint8ClampedArray([0, 1, 2, 3]); let res = total.reduce((accumulator: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray): number => accumulator + currentValue); - expect(res).toEqual(6); + expect(res).toEqual(6.0); total = new Uint8ClampedArray([0, 1, 2, 3]); res = total.reduce((accumulator: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray): number => accumulator + currentValue, 8); - expect(res).toEqual(14); + expect(res).toEqual(14.0); } reduceRight() { let total = new Uint8ClampedArray([0, 1, 2, 3]); let res = total.reduceRight((accumulator: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray): number => accumulator + currentValue); - expect(res).toEqual(6); + expect(res).toEqual(6.0); total = new Uint8ClampedArray([0, 1, 2, 3]); res = total.reduceRight((accumulator: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray): number => accumulator + currentValue, 8); - expect(res).toEqual(14); + expect(res).toEqual(14.0); } reverse() { diff --git a/uni_modules/uts-tests/utssdk/TUint16Array.js b/uni_modules/uts-tests/utssdk/TUint16Array.js index b6294a9..c15c635 100644 --- a/uni_modules/uts-tests/utssdk/TUint16Array.js +++ b/uni_modules/uts-tests/utssdk/TUint16Array.js @@ -139,13 +139,13 @@ export class TUint16Array { includes() { let float32 = new Uint16Array([1, 2, 3]); - let res = float32.includes(2); + let res = float32.includes(2.0); expect(res).toEqual(true); - res = float32.includes(4); + res = float32.includes(4.0); expect(res).toEqual(false); - res = float32.includes(3, 3); + res = float32.includes(3.0, 3); expect(res).toEqual(false); } @@ -196,24 +196,24 @@ export class TUint16Array { let total = new Uint16Array([0, 1, 2, 3]); let res = total.reduce((accumulator: number, currentValue: number, currentIndex: number, array: Uint16Array): number => accumulator + currentValue); - expect(res).toEqual(6); + expect(res).toEqual(6.0); total = new Uint16Array([0, 1, 2, 3]); res = total.reduce((accumulator: number, currentValue: number, currentIndex: number, array: Uint16Array): number => accumulator + currentValue, 8); - expect(res).toEqual(14); + expect(res).toEqual(14.0); } reduceRight() { let total = new Uint16Array([0, 1, 2, 3]); let res = total.reduceRight((accumulator: number, currentValue: number, currentIndex: number, array: Uint16Array): number => accumulator + currentValue); - expect(res).toEqual(6); + expect(res).toEqual(6.0); total = new Uint16Array([0, 1, 2, 3]); res = total.reduceRight((accumulator: number, currentValue: number, currentIndex: number, array: Uint16Array): number => accumulator + currentValue, 8); - expect(res).toEqual(14); + expect(res).toEqual(14.0); } reverse() { @@ -266,8 +266,8 @@ 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"); + float32[3] = 42; + expect(float32.toString()).toEqual("0,0,0,42,0,0,0,0"); let res = buffer.slice(8); let sliced = new Uint16Array(res); -- GitLab