mirror of
https://github.com/tc39/test262.git
synced 2025-05-03 22:40:28 +02:00
* [javascriptcore-test262-automation] changes from git@github.com:WebKit/webkit.git at sha 949e26452cfa153a7f4afe593da97e2fe9e1b706 on Tue Jul 03 2018 14:35:15 GMT-0400 (Eastern Daylight Time)
45 lines
2.1 KiB
JavaScript
45 lines
2.1 KiB
JavaScript
"use strict"
|
|
|
|
function useForMath(undefinedArgument, nullArgument, polymorphicArgument) {
|
|
var a = (null == undefinedArgument) + (undefinedArgument == null) + (undefined == undefinedArgument) + (undefinedArgument == undefined);
|
|
var b = (null == nullArgument) + (nullArgument == null) + (undefined == nullArgument) + (nullArgument == undefined);
|
|
var c = (null == polymorphicArgument) + (polymorphicArgument == null) + (undefined == polymorphicArgument) + (polymorphicArgument == undefined);
|
|
var d = (5 == null) + (null == true) + (undefined == Math.LN2) + ("const" == undefined);
|
|
var e = (5 == undefinedArgument) + (nullArgument == true) + (nullArgument == Math.LN2) + ("const" == undefinedArgument);
|
|
|
|
return a + b - c + d - e;
|
|
}
|
|
noInline(useForMath);
|
|
|
|
function testUseForMath() {
|
|
for (let i = 0; i < 1e4; ++i) {
|
|
var value = useForMath(undefined, null, 5);
|
|
if (value != 8)
|
|
throw "Failed useForMath(undefined, null, 5), value = " + value + " with i = " + i;
|
|
|
|
var value = useForMath(undefined, null, null);
|
|
if (value != 4)
|
|
throw "Failed useForMath(undefined, null, null), value = " + value + " with i = " + i;
|
|
|
|
var value = useForMath(undefined, null, undefined);
|
|
if (value != 4)
|
|
throw "Failed useForMath(undefined, null, undefined), value = " + value + " with i = " + i;
|
|
|
|
var value = useForMath(undefined, null, { foo: "bar" });
|
|
if (value != 8)
|
|
throw "Failed useForMath(undefined, null, { foo: \"bar\" }), value = " + value + " with i = " + i;
|
|
|
|
var value = useForMath(undefined, null, true);
|
|
if (value != 8)
|
|
throw "Failed useForMath(undefined, null, true), value = " + value + " with i = " + i;
|
|
|
|
var value = useForMath(undefined, null, [1, 2, 3]);
|
|
if (value != 8)
|
|
throw "Failed useForMath(undefined, null, true), value = " + value + " with i = " + i;
|
|
|
|
var value = useForMath(undefined, null, "WebKit!");
|
|
if (value != 8)
|
|
throw "Failed useForMath(undefined, null, true), value = " + value + " with i = " + i;
|
|
}
|
|
}
|
|
testUseForMath(); |