sgn,
toBigInt,
toFloat32,
+ toIntegerOrInfinity,
toIntN,
toNumber,
toNumeric,
});
});
+describe("toIntegerOrInfinity", () => {
+ it("[[Call]] converts nan to zero", () => {
+ assertStrictEquals(toIntegerOrInfinity(NaN), 0);
+ });
+
+ it("[[Call]] converts negative zero to positive zero", () => {
+ assertStrictEquals(toIntegerOrInfinity(-0), 0);
+ });
+
+ it("[[Call]] drops the fractional part of negative numbers", () => {
+ assertStrictEquals(toIntegerOrInfinity(-1.79), -1);
+ });
+
+ it("[[Call]] returns infinity for infinity", () => {
+ assertStrictEquals(toIntegerOrInfinity(Infinity), Infinity);
+ });
+
+ it("[[Call]] returns negative infinity for negative infinity", () => {
+ assertStrictEquals(toIntegerOrInfinity(Infinity), Infinity);
+ });
+});
+
describe("toNumber", () => {
it("[[Call]] converts to a number", () => {
assertStrictEquals(toNumber(2n), 2);