X-Git-Url: https://git.ladys.computer/Pisces/blobdiff_plain/4895d39790c88da109d29959ca026c666669e6f3..2e6fac40384b2e17dd3a6b8700abc787b0b57479:/numeric.test.js diff --git a/numeric.test.js b/numeric.test.js index 9d0dbd1..b6dbf0d 100644 --- a/numeric.test.js +++ b/numeric.test.js @@ -1,11 +1,14 @@ -// ♓🌟 Piscēs ∷ numeric.test.js -// ==================================================================== -// -// Copyright © 2022–2023 Lady [@ Lady’s Computer]. -// -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at . +// SPDX-FileCopyrightText: 2022, 2023, 2025 Lady +// SPDX-License-Identifier: MPL-2.0 +/** + * ⁌ ♓🧩 Piscēs ∷ numeric.test.js + * + * Copyright © 2022–2023, 2025 Lady [@ Ladys Computer]. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at . + */ import { assert, @@ -37,32 +40,17 @@ import { isNan, isSafeIntegralNumber, ln, - LN10, ln1p, - LN2, log10, - LOG10ℇ, log2, - LOG2ℇ, max, - MAXIMUM_NUMBER, - MAXIMUM_SAFE_INTEGRAL_NUMBER, min, - MINIMUM_NUMBER, - MINIMUM_SAFE_INTEGRAL_NUMBER, - NAN, - NEGATIVE_INFINITY, - NEGATIVE_ZERO, - POSITIVE_INFINITY, - POSITIVE_ZERO, rand, - RECIPROCAL_SQRT2, round, sgn, sin, sinh, sqrt, - SQRT2, tan, tanh, toBigInt, @@ -76,125 +64,8 @@ import { toSignedIntegralNumeric, toUnsignedIntegralNumeric, trunc, - Ε, - Π, - ℇ, } from "./numeric.js"; -describe("LN10", () => { - it("[[Get]] is ln(10)", () => { - assertStrictEquals(LN10, Math.LN10); - }); -}); - -describe("LN2", () => { - it("[[Get]] is ln(2)", () => { - assertStrictEquals(LN2, Math.LN2); - }); -}); - -describe("LOG10ℇ", () => { - it("[[Get]] is log10(ℇ)", () => { - assertStrictEquals(LOG10ℇ, Math.LOG10E); - }); -}); - -describe("LOG2ℇ", () => { - it("[[Get]] is log2(ℇ)", () => { - assertStrictEquals(LOG2ℇ, Math.LOG2E); - }); -}); - -describe("MAXIMUM_NUMBER", () => { - it("[[Get]] is the maximum number", () => { - assertStrictEquals(MAXIMUM_NUMBER, Number.MAX_VALUE); - }); -}); - -describe("MAXIMUM_SAFE_INTEGRAL_NUMBER", () => { - it("[[Get]] is the maximum safe integral number", () => { - assertStrictEquals( - MAXIMUM_SAFE_INTEGRAL_NUMBER, - Number.MAX_SAFE_INTEGER, - ); - }); -}); - -describe("MINIMUM_NUMBER", () => { - it("[[Get]] is the minimum number", () => { - assertStrictEquals(MINIMUM_NUMBER, Number.MIN_VALUE); - }); -}); - -describe("MINIMUM_SAFE_INTEGRAL_NUMBER", () => { - it("[[Get]] is the minimum safe integral number", () => { - assertStrictEquals( - MINIMUM_SAFE_INTEGRAL_NUMBER, - Number.MIN_SAFE_INTEGER, - ); - }); -}); - -describe("NAN", () => { - it("[[Get]] is nan", () => { - assertStrictEquals(NAN, NaN); - }); -}); - -describe("NEGATIVE_INFINITY", () => { - it("[[Get]] is negative infinity", () => { - assertStrictEquals(NEGATIVE_INFINITY, -Infinity); - }); -}); - -describe("NEGATIVE_ZERO", () => { - it("[[Get]] is negative zero", () => { - assertStrictEquals(NEGATIVE_ZERO, -0); - }); -}); - -describe("POSITIVE_INFINITY", () => { - it("[[Get]] is negative infinity", () => { - assertStrictEquals(POSITIVE_INFINITY, Infinity); - }); -}); - -describe("POSITIVE_ZERO", () => { - it("[[Get]] is positive zero", () => { - assertStrictEquals(POSITIVE_ZERO, 0); - }); -}); - -describe("RECIPROCAL_SQRT2", () => { - it("[[Get]] is sqrt(½)", () => { - assertStrictEquals(RECIPROCAL_SQRT2, Math.SQRT1_2); - }); -}); - -describe("SQRT2", () => { - it("[[Get]] is sqrt(2)", () => { - assertStrictEquals(SQRT2, Math.SQRT2); - }); -}); - -describe("Ε", () => { - it("[[Get]] is ε", () => { - assertStrictEquals(Ε, Number.EPSILON); - }); -}); - -describe("Π", () => { - it("[[Get]] is π", () => { - assertStrictEquals(Π, Math.PI); - }); -}); - -describe("ℇ", () => { - it("[[Get]] is ℇ", () => { - assertStrictEquals(ℇ, Math.E); - }); -}); - describe("abs", () => { it("[[Call]] returns the absolute value", () => { assertStrictEquals(abs(-1), 1); @@ -1483,6 +1354,22 @@ describe("toNumber", () => { it("[[Call]] converts to a number", () => { assertStrictEquals(toNumber(2n), 2); }); + + it("[[Construct]] throws an error", () => { + assertThrows(() => new toNumber(1)); + }); + + describe(".length", () => { + it("[[Get]] returns the correct length", () => { + assertStrictEquals(toNumber.length, 1); + }); + }); + + describe(".name", () => { + it("[[Get]] returns the correct name", () => { + assertStrictEquals(toNumber.name, "toNumber"); + }); + }); }); describe("toNumeric", () => {