mirror of https://github.com/tc39/test262.git
Improve coverage for ops involving negative zero
Prior to this commit, the modified tests used the strict equality operator to compare computed values with negative zero. Due to the semantics of that operator, these tests would spuriously pass if the value under test was in fact positive zero. Update the tests to be more precise by instead asserting equality with the `assert.sameValue` utility method (since that method correctly distinguishes between negative zero and positive zero).
This commit is contained in:
parent
93ecde9f3a
commit
650e7add4a
|
@ -14,7 +14,5 @@ exponents[1] = -111;
|
|||
exponents[0] = -111111;
|
||||
|
||||
for (var i = 0; i < exponents.length; i++) {
|
||||
if ((base ** exponents[i]) !== -0) {
|
||||
throw new Test262Error("(" + base + " ** " + exponents[i] + ") !== -0");
|
||||
}
|
||||
assert.sameValue(base ** exponents[i], -0, base + " ** " + exponents[i]);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,5 @@ exponents[1] = 111;
|
|||
exponents[2] = 111111;
|
||||
|
||||
for (var i = 0; i < exponents.length; i++) {
|
||||
if ((base ** exponents[i]) !== -0) {
|
||||
throw new Test262Error("(" + base + " ** " + exponents[i] + ") !== -0");
|
||||
}
|
||||
assert.sameValue(base ** exponents[i], -0, base + " ** " + exponents[i]);
|
||||
}
|
||||
|
|
|
@ -71,5 +71,5 @@ try{
|
|||
throw -0;
|
||||
}
|
||||
catch(e){
|
||||
if (e!==-0) throw new Test262Error('#8: Exception ===-0. Actual: Exception ==='+ e );
|
||||
assert.sameValue(e, -0);
|
||||
}
|
||||
|
|
|
@ -96,5 +96,5 @@ try{
|
|||
throw -0;
|
||||
}
|
||||
catch(e){
|
||||
if (e!==-0) throw new Test262Error('#11: Exception ===-0. Actual: Exception ==='+ e );
|
||||
assert.sameValue(e, -0);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue