提交 5635c4ac 编写于 作者: M mahaifeng

Revert "[arraybuffer]修改测试用例"

This reverts commit 71ae0de1.
上级 b0532d6d
...@@ -203,24 +203,24 @@ export class TFloat32Array { ...@@ -203,24 +203,24 @@ export class TFloat32Array {
let total = new Float32Array([0, 1, 2, 3]); let total = new Float32Array([0, 1, 2, 3]);
let res = total.reduce((accumulator: number, currentValue: number, currentIndex: number, array: Float32Array): let res = total.reduce((accumulator: number, currentValue: number, currentIndex: number, array: Float32Array):
number => accumulator + currentValue); number => accumulator + currentValue);
expect(res).toEqual(6); expect(res).toEqual(6.0);
total = new Float32Array([0, 1, 2, 3]); total = new Float32Array([0, 1, 2, 3]);
res = total.reduce((accumulator: number, currentValue: number, currentIndex: number, array: Float32Array): res = total.reduce((accumulator: number, currentValue: number, currentIndex: number, array: Float32Array):
number => accumulator + currentValue, 8); number => accumulator + currentValue, 8);
expect(res).toEqual(14); expect(res).toEqual(14.0);
} }
reduceRight() { reduceRight() {
let total = new Float32Array([0, 1, 2, 3]); let total = new Float32Array([0, 1, 2, 3]);
let res = total.reduceRight((accumulator: number, currentValue: number, currentIndex: number, array: let res = total.reduceRight((accumulator: number, currentValue: number, currentIndex: number, array:
Float32Array): number => accumulator + currentValue); Float32Array): number => accumulator + currentValue);
expect(res).toEqual(6); expect(res).toEqual(6.0);
total = new Float32Array([0, 1, 2, 3]); total = new Float32Array([0, 1, 2, 3]);
res = total.reduceRight((accumulator: number, currentValue: number, currentIndex: number, array: Float32Array): res = total.reduceRight((accumulator: number, currentValue: number, currentIndex: number, array: Float32Array):
number => accumulator + currentValue, 8); number => accumulator + currentValue, 8);
expect(res).toEqual(14); expect(res).toEqual(14.0);
} }
reverse() { reverse() {
......
...@@ -198,24 +198,24 @@ export class TFloat64Array { ...@@ -198,24 +198,24 @@ export class TFloat64Array {
let total = new Float64Array([0, 1, 2, 3]); let total = new Float64Array([0, 1, 2, 3]);
let res = total.reduce((accumulator: number, currentValue: number, currentIndex: number, array: Float64Array): let res = total.reduce((accumulator: number, currentValue: number, currentIndex: number, array: Float64Array):
number => accumulator + currentValue); number => accumulator + currentValue);
expect(res).toEqual(6); expect(res).toEqual(6.0);
total = new Float64Array([0, 1, 2, 3]); total = new Float64Array([0, 1, 2, 3]);
res = total.reduce((accumulator: number, currentValue: number, currentIndex: number, array: Float64Array): res = total.reduce((accumulator: number, currentValue: number, currentIndex: number, array: Float64Array):
number => accumulator + currentValue, 8); number => accumulator + currentValue, 8);
expect(res).toEqual(14); expect(res).toEqual(14.0);
} }
reduceRight() { reduceRight() {
let total = new Float64Array([0, 1, 2, 3]); let total = new Float64Array([0, 1, 2, 3]);
let res = total.reduceRight((accumulator: number, currentValue: number, currentIndex: number, array: let res = total.reduceRight((accumulator: number, currentValue: number, currentIndex: number, array:
Float64Array): number => accumulator + currentValue); Float64Array): number => accumulator + currentValue);
expect(res).toEqual(6); expect(res).toEqual(6.0);
total = new Float64Array([0, 1, 2, 3]); total = new Float64Array([0, 1, 2, 3]);
res = total.reduceRight((accumulator: number, currentValue: number, currentIndex: number, array: Float64Array): res = total.reduceRight((accumulator: number, currentValue: number, currentIndex: number, array: Float64Array):
number => accumulator + currentValue, 8); number => accumulator + currentValue, 8);
expect(res).toEqual(14); expect(res).toEqual(14.0);
} }
reverse() { reverse() {
......
...@@ -177,21 +177,21 @@ export class TInt16Array { ...@@ -177,21 +177,21 @@ export class TInt16Array {
reduce() { reduce() {
let total = new Int16Array([0, 1, 2, 3]); let total = new Int16Array([0, 1, 2, 3]);
let res = total.reduce((accumulator : number, currentValue : number, currentIndex : number, array : Int16Array): number => accumulator + currentValue); let res = total.reduce((accumulator : number, currentValue : number, currentIndex : number, array : Int16Array): number => accumulator + currentValue);
expect(res).toEqual(6); expect(res).toEqual(6.0);
total = new Int16Array([0, 1, 2, 3]); total = new Int16Array([0, 1, 2, 3]);
res = total.reduce((accumulator : number, currentValue : number, currentIndex : number, array : Int16Array): number => accumulator + currentValue, 8); res = total.reduce((accumulator : number, currentValue : number, currentIndex : number, array : Int16Array): number => accumulator + currentValue, 8);
expect(res).toEqual(14); expect(res).toEqual(14.0);
} }
reduceRight() { reduceRight() {
let total = new Int16Array([0, 1, 2, 3]); let total = new Int16Array([0, 1, 2, 3]);
let res = total.reduceRight((accumulator: number, currentValue : number, currentIndex : number, array : Int16Array): number => accumulator + currentValue); let res = total.reduceRight((accumulator: number, currentValue : number, currentIndex : number, array : Int16Array): number => accumulator + currentValue);
expect(res).toEqual(6); expect(res).toEqual(6.0);
total = new Int16Array([0, 1, 2, 3]); total = new Int16Array([0, 1, 2, 3]);
res = total.reduceRight((accumulator: number, currentValue : number, currentIndex : number, array : Int16Array): number => accumulator + currentValue, 8); res = total.reduceRight((accumulator: number, currentValue : number, currentIndex : number, array : Int16Array): number => accumulator + currentValue, 8);
expect(res).toEqual(14); expect(res).toEqual(14.0);
} }
reverse() { reverse() {
......
...@@ -2,7 +2,6 @@ import { ...@@ -2,7 +2,6 @@ import {
describe, describe,
test, test,
expect, expect,
expectNumber,
Result Result
} from './tests.uts' } from './tests.uts'
...@@ -182,25 +181,25 @@ export class TInt8Array { ...@@ -182,25 +181,25 @@ export class TInt8Array {
let total = new Int8Array([0, 1, 2, 3]); let total = new Int8Array([0, 1, 2, 3]);
let res = total.reduce((accumulator: number, currentValue: number, currentIndex: number, array: Int8Array): let res = total.reduce((accumulator: number, currentValue: number, currentIndex: number, array: Int8Array):
number => accumulator + currentValue); number => accumulator + currentValue);
expect(res).toEqual(6); expect(res).toEqual(6.0);
total = new Int8Array([0, 1, 2, 3]); total = new Int8Array([0, 1, 2, 3]);
res = total.reduce((accumulator: number, currentValue: number, currentIndex: number, array: Int8Array): number => res = total.reduce((accumulator: number, currentValue: number, currentIndex: number, array: Int8Array): number =>
accumulator + currentValue, 8); accumulator + currentValue, 8);
expect(res).toEqual(14); expect(res).toEqual(14.0);
} }
reduceRight() { reduceRight() {
let total = new Int8Array([0, 1, 2, 3]); let total = new Int8Array([0, 1, 2, 3]);
let res = total.reduceRight((accumulator: number, currentValue: number, currentIndex: number, array: Int8Array): let res = total.reduceRight((accumulator: number, currentValue: number, currentIndex: number, array: Int8Array):
number => accumulator + currentValue); number => accumulator + currentValue);
expect(res).toEqual(6); expect(res).toEqual(6.0);
total = new Int8Array([0, 1, 2, 3]); total = new Int8Array([0, 1, 2, 3]);
res = total.reduceRight((accumulator: number, currentValue: number, currentIndex: number, array: Int8Array): res = total.reduceRight((accumulator: number, currentValue: number, currentIndex: number, array: Int8Array):
number => accumulator + currentValue, 8); number => accumulator + currentValue, 8);
expect(res).toEqual(14); expect(res).toEqual(14.0);
} }
reverse() { reverse() {
......
...@@ -123,13 +123,13 @@ export class TUint8Array { ...@@ -123,13 +123,13 @@ export class TUint8Array {
includes() { includes() {
let float32 = new Uint8Array([1, 2, 3]); let float32 = new Uint8Array([1, 2, 3]);
let res = float32.includes(2); let res = float32.includes(2.0);
expect(res).toEqual(true); expect(res).toEqual(true);
res = float32.includes(4); res = float32.includes(4.0);
expect(res).toEqual(false); expect(res).toEqual(false);
res = float32.includes(3, 3); res = float32.includes(3.0, 3);
expect(res).toEqual(false); expect(res).toEqual(false);
} }
...@@ -179,21 +179,21 @@ export class TUint8Array { ...@@ -179,21 +179,21 @@ export class TUint8Array {
reduce() { reduce() {
let total = new Uint8Array([0, 1, 2, 3]); let total = new Uint8Array([0, 1, 2, 3]);
let res = total.reduce((accumulator : number, currentValue : number, currentIndex : number, array : Uint8Array): number => accumulator + currentValue); let res = total.reduce((accumulator : number, currentValue : number, currentIndex : number, array : Uint8Array): number => accumulator + currentValue);
expect(res).toEqual(6); expect(res).toEqual(6.0);
total = new Uint8Array([0, 1, 2, 3]); total = new Uint8Array([0, 1, 2, 3]);
res = total.reduce((accumulator : number, currentValue : number, currentIndex : number, array : Uint8Array): number => accumulator + currentValue, 8); res = total.reduce((accumulator : number, currentValue : number, currentIndex : number, array : Uint8Array): number => accumulator + currentValue, 8);
expect(res).toEqual(14); expect(res).toEqual(14.0);
} }
reduceRight() { reduceRight() {
let total = new Uint8Array([0, 1, 2, 3]); let total = new Uint8Array([0, 1, 2, 3]);
let res = total.reduceRight((accumulator: number, currentValue : number, currentIndex : number, array : Uint8Array): number => accumulator + currentValue); let res = total.reduceRight((accumulator: number, currentValue : number, currentIndex : number, array : Uint8Array): number => accumulator + currentValue);
expect(res).toEqual(6); expect(res).toEqual(6.0);
total = new Uint8Array([0, 1, 2, 3]); total = new Uint8Array([0, 1, 2, 3]);
res = total.reduceRight((accumulator: number, currentValue : number, currentIndex : number, array : Uint8Array): number => accumulator + currentValue, 8); res = total.reduceRight((accumulator: number, currentValue : number, currentIndex : number, array : Uint8Array): number => accumulator + currentValue, 8);
expect(res).toEqual(14); expect(res).toEqual(14.0);
} }
reverse() { reverse() {
......
...@@ -125,13 +125,13 @@ export class TUint8ClampedArray { ...@@ -125,13 +125,13 @@ export class TUint8ClampedArray {
includes() { includes() {
let float32 = new Uint8ClampedArray([1, 2, 3]); let float32 = new Uint8ClampedArray([1, 2, 3]);
let res = float32.includes(2); let res = float32.includes(2.0);
expect(res).toEqual(true); expect(res).toEqual(true);
res = float32.includes(4); res = float32.includes(4.0);
expect(res).toEqual(false); expect(res).toEqual(false);
res = float32.includes(3, 3); res = float32.includes(3.0, 3);
expect(res).toEqual(false); expect(res).toEqual(false);
} }
...@@ -182,24 +182,24 @@ export class TUint8ClampedArray { ...@@ -182,24 +182,24 @@ export class TUint8ClampedArray {
let total = new Uint8ClampedArray([0, 1, 2, 3]); let total = new Uint8ClampedArray([0, 1, 2, 3]);
let res = total.reduce((accumulator: number, currentValue: number, currentIndex: number, array: let res = total.reduce((accumulator: number, currentValue: number, currentIndex: number, array:
Uint8ClampedArray): number => accumulator + currentValue); Uint8ClampedArray): number => accumulator + currentValue);
expect(res).toEqual(6); expect(res).toEqual(6.0);
total = new Uint8ClampedArray([0, 1, 2, 3]); total = new Uint8ClampedArray([0, 1, 2, 3]);
res = total.reduce((accumulator: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray): res = total.reduce((accumulator: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray):
number => accumulator + currentValue, 8); number => accumulator + currentValue, 8);
expect(res).toEqual(14); expect(res).toEqual(14.0);
} }
reduceRight() { reduceRight() {
let total = new Uint8ClampedArray([0, 1, 2, 3]); let total = new Uint8ClampedArray([0, 1, 2, 3]);
let res = total.reduceRight((accumulator: number, currentValue: number, currentIndex: number, array: let res = total.reduceRight((accumulator: number, currentValue: number, currentIndex: number, array:
Uint8ClampedArray): number => accumulator + currentValue); Uint8ClampedArray): number => accumulator + currentValue);
expect(res).toEqual(6); expect(res).toEqual(6.0);
total = new Uint8ClampedArray([0, 1, 2, 3]); total = new Uint8ClampedArray([0, 1, 2, 3]);
res = total.reduceRight((accumulator: number, currentValue: number, currentIndex: number, array: res = total.reduceRight((accumulator: number, currentValue: number, currentIndex: number, array:
Uint8ClampedArray): number => accumulator + currentValue, 8); Uint8ClampedArray): number => accumulator + currentValue, 8);
expect(res).toEqual(14); expect(res).toEqual(14.0);
} }
reverse() { reverse() {
......
...@@ -139,13 +139,13 @@ export class TUint16Array { ...@@ -139,13 +139,13 @@ export class TUint16Array {
includes() { includes() {
let float32 = new Uint16Array([1, 2, 3]); let float32 = new Uint16Array([1, 2, 3]);
let res = float32.includes(2); let res = float32.includes(2.0);
expect(res).toEqual(true); expect(res).toEqual(true);
res = float32.includes(4); res = float32.includes(4.0);
expect(res).toEqual(false); expect(res).toEqual(false);
res = float32.includes(3, 3); res = float32.includes(3.0, 3);
expect(res).toEqual(false); expect(res).toEqual(false);
} }
...@@ -196,24 +196,24 @@ export class TUint16Array { ...@@ -196,24 +196,24 @@ export class TUint16Array {
let total = new Uint16Array([0, 1, 2, 3]); let total = new Uint16Array([0, 1, 2, 3]);
let res = total.reduce((accumulator: number, currentValue: number, currentIndex: number, array: Uint16Array): let res = total.reduce((accumulator: number, currentValue: number, currentIndex: number, array: Uint16Array):
number => accumulator + currentValue); number => accumulator + currentValue);
expect(res).toEqual(6); expect(res).toEqual(6.0);
total = new Uint16Array([0, 1, 2, 3]); total = new Uint16Array([0, 1, 2, 3]);
res = total.reduce((accumulator: number, currentValue: number, currentIndex: number, array: Uint16Array): res = total.reduce((accumulator: number, currentValue: number, currentIndex: number, array: Uint16Array):
number => accumulator + currentValue, 8); number => accumulator + currentValue, 8);
expect(res).toEqual(14); expect(res).toEqual(14.0);
} }
reduceRight() { reduceRight() {
let total = new Uint16Array([0, 1, 2, 3]); let total = new Uint16Array([0, 1, 2, 3]);
let res = total.reduceRight((accumulator: number, currentValue: number, currentIndex: number, array: Uint16Array): let res = total.reduceRight((accumulator: number, currentValue: number, currentIndex: number, array: Uint16Array):
number => accumulator + currentValue); number => accumulator + currentValue);
expect(res).toEqual(6); expect(res).toEqual(6.0);
total = new Uint16Array([0, 1, 2, 3]); total = new Uint16Array([0, 1, 2, 3]);
res = total.reduceRight((accumulator: number, currentValue: number, currentIndex: number, array: Uint16Array): res = total.reduceRight((accumulator: number, currentValue: number, currentIndex: number, array: Uint16Array):
number => accumulator + currentValue, 8); number => accumulator + currentValue, 8);
expect(res).toEqual(14); expect(res).toEqual(14.0);
} }
reverse() { reverse() {
...@@ -266,8 +266,8 @@ export class TUint16Array { ...@@ -266,8 +266,8 @@ export class TUint16Array {
arrayBufferSlice() { arrayBufferSlice() {
let buffer = new ArrayBuffer(16); let buffer = new ArrayBuffer(16);
let float32 = new Uint16Array(buffer); let float32 = new Uint16Array(buffer);
float32[4] = 42; float32[3] = 42;
expect(float32.toString()).toEqual("0,0,0,0,42,0,0,0"); expect(float32.toString()).toEqual("0,0,0,42,0,0,0,0");
let res = buffer.slice(8); let res = buffer.slice(8);
let sliced = new Uint16Array(res); let sliced = new Uint16Array(res);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册