mirror of
https://github.com/tc39/test262.git
synced 2025-09-24 02:28:05 +02:00
Use assert.sameValue instead of assertEq in harness/sm
This commit is contained in:
parent
a73bdd51c6
commit
5912cd673f
@ -50,10 +50,10 @@ const ONE_MINUS_EPSILON = 1 - Math.pow(2, -53); // 1.0000000000000002
|
||||
ENDIAN = 0; // try little-endian first
|
||||
if (diff(2, 4) === 0x100000) // exact wrong answer we'll get on a big-endian platform
|
||||
ENDIAN = 1;
|
||||
assertEq(diff(2,4), 0x10000000000000);
|
||||
assertEq(diff(0, Number.MIN_VALUE), 1);
|
||||
assertEq(diff(1, ONE_PLUS_EPSILON), 1);
|
||||
assertEq(diff(1, ONE_MINUS_EPSILON), 1);
|
||||
assert.sameValue(diff(2,4), 0x10000000000000);
|
||||
assert.sameValue(diff(0, Number.MIN_VALUE), 1);
|
||||
assert.sameValue(diff(1, ONE_PLUS_EPSILON), 1);
|
||||
assert.sameValue(diff(1, ONE_MINUS_EPSILON), 1);
|
||||
|
||||
var assertNear = function assertNear(a, b, tolerance=1) {
|
||||
if (!Number.isFinite(b)) {
|
||||
|
@ -17,10 +17,10 @@ defines: [assertSetContainsExactOrderedItems, SetLike, SetIteratorLike, LoggingP
|
||||
const SetIteratorPrototypeNext = new Set().values().next;
|
||||
|
||||
function assertSetContainsExactOrderedItems(actual, expected) {
|
||||
assertEq(ReflectGetPrototypeOf(actual), SetPrototype, "actual is a native Set object");
|
||||
assertEq(ArrayIsArray(expected), true, "expected is an Array object");
|
||||
assert.sameValue(ReflectGetPrototypeOf(actual), SetPrototype, "actual is a native Set object");
|
||||
assert.sameValue(ArrayIsArray(expected), true, "expected is an Array object");
|
||||
|
||||
assertEq(ReflectApply(SetPrototypeSize, actual, []), expected.length);
|
||||
assert.sameValue(ReflectApply(SetPrototypeSize, actual, []), expected.length);
|
||||
|
||||
let index = 0;
|
||||
let keys = ReflectApply(SetPrototypeKeys, actual, []);
|
||||
@ -30,7 +30,7 @@ defines: [assertSetContainsExactOrderedItems, SetLike, SetIteratorLike, LoggingP
|
||||
if (done) {
|
||||
break;
|
||||
}
|
||||
assertEq(item, expected[index], `Element at index ${index}:`);
|
||||
assert.sameValue(item, expected[index], `Element at index ${index}:`);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
@ -81,7 +81,7 @@ defines: [assertSetContainsExactOrderedItems, SetLike, SetIteratorLike, LoggingP
|
||||
}
|
||||
|
||||
function LoggingProxy(obj, log) {
|
||||
assertEq(ArrayIsArray(log), true);
|
||||
assert.sameValue(ArrayIsArray(log), true);
|
||||
|
||||
let handler = new Proxy({
|
||||
get(t, pk, r) {
|
||||
|
@ -7,7 +7,7 @@ function ISOFields(monthDay) {
|
||||
|
||||
let str = monthDay.toString({calendarName: "always"});
|
||||
let match = str.match(re);
|
||||
assertEq(match !== null, true, `can't match: ${str}`);
|
||||
assert.sameValue(match !== null, true, `can't match: ${str}`);
|
||||
|
||||
let {year, month, day, calendar} = match.groups;
|
||||
let isoYear = Number(year);
|
||||
@ -17,10 +17,10 @@ function ISOFields(monthDay) {
|
||||
let date = Temporal.PlainDate.from(str);
|
||||
let isoDate = date.withCalendar("iso8601");
|
||||
|
||||
assertEq(calendar, date.calendarId);
|
||||
assertEq(isoYear, isoDate.year);
|
||||
assertEq(isoMonth, isoDate.month);
|
||||
assertEq(isoDay, isoDate.day);
|
||||
assert.sameValue(calendar, date.calendarId);
|
||||
assert.sameValue(isoYear, isoDate.year);
|
||||
assert.sameValue(isoMonth, isoDate.month);
|
||||
assert.sameValue(isoDay, isoDate.day);
|
||||
|
||||
return {
|
||||
isoYear,
|
||||
@ -34,15 +34,15 @@ function assertSameISOFields(actual, expected) {
|
||||
let actualFields = ISOFields(actual);
|
||||
let expectedFields = ISOFields(expected);
|
||||
|
||||
assertEq(typeof actualFields.isoYear, "number");
|
||||
assertEq(typeof actualFields.isoMonth, "number");
|
||||
assertEq(typeof actualFields.isoDay, "number");
|
||||
assert.sameValue(typeof actualFields.isoYear, "number");
|
||||
assert.sameValue(typeof actualFields.isoMonth, "number");
|
||||
assert.sameValue(typeof actualFields.isoDay, "number");
|
||||
|
||||
assertEq(actualFields.isoMonth > 0, true);
|
||||
assertEq(actualFields.isoDay > 0, true);
|
||||
assert.sameValue(actualFields.isoMonth > 0, true);
|
||||
assert.sameValue(actualFields.isoDay > 0, true);
|
||||
|
||||
assertEq(actualFields.isoYear, expectedFields.isoYear);
|
||||
assertEq(actualFields.isoMonth, expectedFields.isoMonth);
|
||||
assertEq(actualFields.isoDay, expectedFields.isoDay);
|
||||
assertEq(actualFields.calendar, expectedFields.calendar);
|
||||
assert.sameValue(actualFields.isoYear, expectedFields.isoYear);
|
||||
assert.sameValue(actualFields.isoMonth, expectedFields.isoMonth);
|
||||
assert.sameValue(actualFields.isoDay, expectedFields.isoDay);
|
||||
assert.sameValue(actualFields.calendar, expectedFields.calendar);
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ allow_unused: True
|
||||
|
||||
const {
|
||||
Float16Array, Float32Array, Float64Array, Object, Reflect, SharedArrayBuffer, WeakMap,
|
||||
assertEq
|
||||
} = global;
|
||||
const {
|
||||
apply: Reflect_apply,
|
||||
@ -37,7 +36,7 @@ allow_unused: True
|
||||
new.target);
|
||||
for (var i = 0; i < length; i++)
|
||||
sharedArray[i] = array[i];
|
||||
assertEq(sharedArray.buffer, sharedBuffer);
|
||||
assert.sameValue(sharedArray.buffer, sharedBuffer);
|
||||
return sharedArray;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user