From 89e7d51df404a4adc2a940c8a308ec83e2955ac8 Mon Sep 17 00:00:00 2001 From: xl1 Date: Sat, 15 Sep 2018 23:02:36 +0900 Subject: [PATCH] Add tests --- tests/cases/compiler/typedArrays.ts | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/cases/compiler/typedArrays.ts b/tests/cases/compiler/typedArrays.ts index 602e15dc2d7..591b00aadc6 100644 --- a/tests/cases/compiler/typedArrays.ts +++ b/tests/cases/compiler/typedArrays.ts @@ -105,6 +105,21 @@ function CreateTypedArraysOf2() { return typedArrays; } +function CreateTypedArraysFromMapFn2(obj:ArrayLike, mapFn: (n:T, v:number)=> number) { + var typedArrays = []; + typedArrays[0] = Int8Array.from(obj, mapFn); + typedArrays[1] = Uint8Array.from(obj, mapFn); + typedArrays[2] = Int16Array.from(obj, mapFn); + typedArrays[3] = Uint16Array.from(obj, mapFn); + typedArrays[4] = Int32Array.from(obj, mapFn); + typedArrays[5] = Uint32Array.from(obj, mapFn); + typedArrays[6] = Float32Array.from(obj, mapFn); + typedArrays[7] = Float64Array.from(obj, mapFn); + typedArrays[8] = Uint8ClampedArray.from(obj, mapFn); + + return typedArrays; +} + function CreateTypedArraysFromMapFn(obj:ArrayLike, mapFn: (n:number, v:number)=> number) { var typedArrays = []; typedArrays[0] = Int8Array.from(obj, mapFn); @@ -132,5 +147,20 @@ function CreateTypedArraysFromThisObj(obj:ArrayLike, mapFn: (n:number, v typedArrays[7] = Float64Array.from(obj, mapFn, thisArg); typedArrays[8] = Uint8ClampedArray.from(obj, mapFn, thisArg); + return typedArrays; +} + +function CreateTypedArraysFromThisObj2(obj:ArrayLike, mapFn: (n:T, v:number)=> number, thisArg: {}) { + var typedArrays = []; + typedArrays[0] = Int8Array.from(obj, mapFn, thisArg); + typedArrays[1] = Uint8Array.from(obj, mapFn, thisArg); + typedArrays[2] = Int16Array.from(obj, mapFn, thisArg); + typedArrays[3] = Uint16Array.from(obj, mapFn, thisArg); + typedArrays[4] = Int32Array.from(obj, mapFn, thisArg); + typedArrays[5] = Uint32Array.from(obj, mapFn, thisArg); + typedArrays[6] = Float32Array.from(obj, mapFn, thisArg); + typedArrays[7] = Float64Array.from(obj, mapFn, thisArg); + typedArrays[8] = Uint8ClampedArray.from(obj, mapFn, thisArg); + return typedArrays; } \ No newline at end of file