Skip to content

Commit f93ed99

Browse files
committed
Add more min/max tests
1 parent d59321b commit f93ed99

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

test/index.js

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ exports.testMinMax = asmAssert(
234234
function m(stdlib, foreign, heap) {
235235
"use asm";
236236
var max = stdlib.Math.max;
237-
var min = stdlib.Math.max;
237+
var min = stdlib.Math.min;
238238
function f(i0, i1, d0, d1) {
239239
i0 = i0|0;
240240
i1 = i1|0;
@@ -252,3 +252,42 @@ exports.testMinMax = asmAssert(
252252
}
253253
return f;
254254
}, { pass: true });
255+
256+
exports.testMinWrongArgumentType = asmAssert(
257+
"min argument types don't match",
258+
function m(stdlib, foreign, heap) {
259+
"use asm";
260+
var min = stdlib.Math.min;
261+
function f(i0, d1) {
262+
i0 = i0|0;
263+
d1 = +d1;
264+
min(i0, d1)|0;
265+
}
266+
return f;
267+
}, { pass: false });
268+
269+
exports.testMaxWrongArgumentType = asmAssert(
270+
"min argument types don't match",
271+
function m(stdlib, foreign, heap) {
272+
"use asm";
273+
var max = stdlib.Math.max;
274+
function f(d0, i1) {
275+
d0 = +d0;
276+
i1 = i1|0;
277+
+max(d0, i1);
278+
}
279+
return f;
280+
}, { pass: false });
281+
282+
exports.testMaxWrongReturnType = asmAssert(
283+
"min argument types don't match",
284+
function m(stdlib, foreign, heap) {
285+
"use asm";
286+
var max = stdlib.Math.max;
287+
function f(i0, i1) {
288+
i0 = i0|0;
289+
i1 = i1|0;
290+
+max(i0, i1);
291+
}
292+
return f;
293+
}, { pass: false });

0 commit comments

Comments
 (0)