Skip to content

Commit 89e7d51

Browse files
committed
Add tests
1 parent 9819b6b commit 89e7d51

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

tests/cases/compiler/typedArrays.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,21 @@ function CreateTypedArraysOf2() {
105105
return typedArrays;
106106
}
107107

108+
function CreateTypedArraysFromMapFn2<T>(obj:ArrayLike<T>, mapFn: (n:T, v:number)=> number) {
109+
var typedArrays = [];
110+
typedArrays[0] = Int8Array.from(obj, mapFn);
111+
typedArrays[1] = Uint8Array.from(obj, mapFn);
112+
typedArrays[2] = Int16Array.from(obj, mapFn);
113+
typedArrays[3] = Uint16Array.from(obj, mapFn);
114+
typedArrays[4] = Int32Array.from(obj, mapFn);
115+
typedArrays[5] = Uint32Array.from(obj, mapFn);
116+
typedArrays[6] = Float32Array.from(obj, mapFn);
117+
typedArrays[7] = Float64Array.from(obj, mapFn);
118+
typedArrays[8] = Uint8ClampedArray.from(obj, mapFn);
119+
120+
return typedArrays;
121+
}
122+
108123
function CreateTypedArraysFromMapFn(obj:ArrayLike<number>, mapFn: (n:number, v:number)=> number) {
109124
var typedArrays = [];
110125
typedArrays[0] = Int8Array.from(obj, mapFn);
@@ -132,5 +147,20 @@ function CreateTypedArraysFromThisObj(obj:ArrayLike<number>, mapFn: (n:number, v
132147
typedArrays[7] = Float64Array.from(obj, mapFn, thisArg);
133148
typedArrays[8] = Uint8ClampedArray.from(obj, mapFn, thisArg);
134149

150+
return typedArrays;
151+
}
152+
153+
function CreateTypedArraysFromThisObj2<T>(obj:ArrayLike<T>, mapFn: (n:T, v:number)=> number, thisArg: {}) {
154+
var typedArrays = [];
155+
typedArrays[0] = Int8Array.from(obj, mapFn, thisArg);
156+
typedArrays[1] = Uint8Array.from(obj, mapFn, thisArg);
157+
typedArrays[2] = Int16Array.from(obj, mapFn, thisArg);
158+
typedArrays[3] = Uint16Array.from(obj, mapFn, thisArg);
159+
typedArrays[4] = Int32Array.from(obj, mapFn, thisArg);
160+
typedArrays[5] = Uint32Array.from(obj, mapFn, thisArg);
161+
typedArrays[6] = Float32Array.from(obj, mapFn, thisArg);
162+
typedArrays[7] = Float64Array.from(obj, mapFn, thisArg);
163+
typedArrays[8] = Uint8ClampedArray.from(obj, mapFn, thisArg);
164+
135165
return typedArrays;
136166
}

0 commit comments

Comments
 (0)