]> Lady’s Gitweb - Pisces/blobdiff - numeric.test.js
Minor refactors to numeric.js
[Pisces] / numeric.test.js
index 9d0dbd1f93ecf4c530640686a57461442190b960..b6dbf0dddcb09c1b85c7a346b0e63013951a34ac 100644 (file)
@@ -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 <https://mozilla.org/MPL/2.0/>.
+// SPDX-FileCopyrightText: 2022, 2023, 2025 Lady <https://www.ladys.computer/about/#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 <https://mozilla.org/MPL/2.0/>.
+ */
 
 import {
   assert,
 
 import {
   assert,
@@ -37,32 +40,17 @@ import {
   isNan,
   isSafeIntegralNumber,
   ln,
   isNan,
   isSafeIntegralNumber,
   ln,
-  LN10,
   ln1p,
   ln1p,
-  LN2,
   log10,
   log10,
-  LOG10ℇ,
   log2,
   log2,
-  LOG2ℇ,
   max,
   max,
-  MAXIMUM_NUMBER,
-  MAXIMUM_SAFE_INTEGRAL_NUMBER,
   min,
   min,
-  MINIMUM_NUMBER,
-  MINIMUM_SAFE_INTEGRAL_NUMBER,
-  NAN,
-  NEGATIVE_INFINITY,
-  NEGATIVE_ZERO,
-  POSITIVE_INFINITY,
-  POSITIVE_ZERO,
   rand,
   rand,
-  RECIPROCAL_SQRT2,
   round,
   sgn,
   sin,
   sinh,
   sqrt,
   round,
   sgn,
   sin,
   sinh,
   sqrt,
-  SQRT2,
   tan,
   tanh,
   toBigInt,
   tan,
   tanh,
   toBigInt,
@@ -76,125 +64,8 @@ import {
   toSignedIntegralNumeric,
   toUnsignedIntegralNumeric,
   trunc,
   toSignedIntegralNumeric,
   toUnsignedIntegralNumeric,
   trunc,
-  Ε,
-  Π,
-  ℇ,
 } from "./numeric.js";
 
 } 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);
 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("[[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", () => {
 });
 
 describe("toNumeric", () => {
This page took 0.363124 seconds and 4 git commands to generate.