mirror of
https://github.com/tc39/test262.git
synced 2025-06-14 19:10:29 +02:00
which have resulted in it being able to run negative test cases which corrupt the global JavaScript environment. This lets us enable fifty plus more Sputnik test cases. Another positive result from this test harness refactoring is that Opera no longer hangs when running the tests.
22 lines
444 B
JavaScript
22 lines
444 B
JavaScript
// Copyright 2009 the Sputnik authors. All rights reserved.
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
function ToInteger(p) {
|
|
x = Number(p);
|
|
|
|
if(isNaN(x)){
|
|
return +0;
|
|
}
|
|
|
|
if((x === +0)
|
|
|| (x === -0)
|
|
|| (x === Number.POSITIVE_INFINITY)
|
|
|| (x === Number.NEGATIVE_INFINITY)){
|
|
return x;
|
|
}
|
|
|
|
var sign = ( x < 0 ) ? -1 : 1;
|
|
|
|
return (sign*Math.floor(Math.abs(x)));
|
|
}
|