mirror of
https://github.com/tc39/test262.git
synced 2025-05-04 23:10:27 +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)
92 lines
2.1 KiB
JavaScript
92 lines
2.1 KiB
JavaScript
function shouldBe(actual, expected) {
|
|
if (actual !== expected)
|
|
throw new Error(`bad value: ${String(actual)} ${String(expected)}`);
|
|
}
|
|
|
|
function testJNSTRICTEQ(a, b)
|
|
{
|
|
if (a === b) {
|
|
return 42;
|
|
}
|
|
return 30;
|
|
}
|
|
noInline(testJNSTRICTEQ);
|
|
|
|
function testJSTRICTEQ(a, b)
|
|
{
|
|
if (a !== b) {
|
|
return 42;
|
|
}
|
|
return 30;
|
|
}
|
|
noInline(testJSTRICTEQ);
|
|
|
|
function testJNSTRICTEQB(a, b)
|
|
{
|
|
var i = 0;
|
|
do {
|
|
++i;
|
|
} while (!(a === b));
|
|
return i;
|
|
}
|
|
noInline(testJNSTRICTEQB);
|
|
|
|
function testJSTRICTEQB(a, b)
|
|
{
|
|
var i = 0;
|
|
do {
|
|
++i;
|
|
} while (!(a !== b));
|
|
return i;
|
|
}
|
|
noInline(testJSTRICTEQB);
|
|
|
|
function testJNSTRICTEQF(a, b)
|
|
{
|
|
var i = 0;
|
|
while (!(a === b))
|
|
++i;
|
|
return i;
|
|
}
|
|
noInline(testJNSTRICTEQF);
|
|
|
|
function testJSTRICTEQF(a, b)
|
|
{
|
|
var i = 0;
|
|
while (!(a !== b))
|
|
++i;
|
|
return i;
|
|
}
|
|
noInline(testJSTRICTEQF);
|
|
|
|
for (var i = 0; i < 1e4; ++i) {
|
|
shouldBe(testJNSTRICTEQ('hello', 'world'), 30);
|
|
shouldBe(testJSTRICTEQ('hello', 'world'), 42);
|
|
shouldBe(testJNSTRICTEQ('world', 'world'), 42);
|
|
shouldBe(testJSTRICTEQ('world', 'world'), 30);
|
|
shouldBe(testJNSTRICTEQ(20.5, 'world'), 30);
|
|
shouldBe(testJSTRICTEQ(20.5, 'world'), 42);
|
|
|
|
shouldBe(testJNSTRICTEQ(20.5, 21.3), 30);
|
|
shouldBe(testJSTRICTEQ(20.5, 21.3), 42);
|
|
shouldBe(testJNSTRICTEQ(20.5, 20.5), 42);
|
|
shouldBe(testJSTRICTEQ(20.5, 20.5), 30);
|
|
|
|
shouldBe(testJNSTRICTEQB(0, 0), 1);
|
|
shouldBe(testJSTRICTEQB(0, 1), 1);
|
|
shouldBe(testJNSTRICTEQB('hello', 'hello'), 1);
|
|
shouldBe(testJSTRICTEQB('hello', 'world'), 1);
|
|
shouldBe(testJNSTRICTEQB(20.4, 20.4), 1);
|
|
shouldBe(testJSTRICTEQB('hello', 20.4), 1);
|
|
shouldBe(testJNSTRICTEQB(0, -0), 1);
|
|
|
|
shouldBe(testJNSTRICTEQF(0, 0), 0);
|
|
shouldBe(testJSTRICTEQF(0, 1), 0);
|
|
shouldBe(testJNSTRICTEQF(20.4, 20.4), 0);
|
|
shouldBe(testJSTRICTEQF(20.4, 10.5), 0);
|
|
shouldBe(testJNSTRICTEQF(0, -0), 0);
|
|
shouldBe(testJSTRICTEQF('hello', 10.5), 0);
|
|
shouldBe(testJNSTRICTEQF('hello', 'hello'), 0);
|
|
shouldBe(testJSTRICTEQF('hello', 'world'), 0);
|
|
}
|