Skip to content

Commit

Permalink
🐛 reorganize tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfram77 committed Nov 23, 2022
1 parent 8cb9720 commit 1b00e64
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "extra-bigint",
"version": "1.1.1",
"version": "1.1.2",
"description": "A collection of functions for working with BigInts.",
"sideEffects": false,
"main": "index.js",
Expand Down
63 changes: 63 additions & 0 deletions tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ test("example1", () => {



// ABOUT
// -----

test("is", () => {
var a = is(314n);
expect(a).toBe(true);
Expand All @@ -102,6 +105,11 @@ test("is", () => {
});




// COMPARE
// -------

test("compare", () => {
var a = compare(10n, 12n);
expect(a).toBeLessThan(0);
Expand All @@ -112,6 +120,11 @@ test("compare", () => {
});




// SIGN
// ----

test("abs", () => {
var a = abs(-2n);
expect(a).toBe(2n);
Expand All @@ -132,6 +145,11 @@ test("sign", () => {
});




// ROUNDED DIVISION
// ----------------

test("floorDiv", () => {
var a = floorDiv(15n, 4n);
expect(a).toBe(3n);
Expand Down Expand Up @@ -165,6 +183,11 @@ test("roundDiv", () => {
// - https://www.learndatasci.com/solutions/python-double-slash-operator-floor-division/




// MODULO
// ------

test("rem", () => {
var a = rem(1n, 10n);
expect(a).toBe(1n);
Expand Down Expand Up @@ -195,6 +218,11 @@ test("modp", () => {
});




// RANGE CONTROL
// -------------

test("constrain", () => {
var a = constrain(20n, 0n, 50n);
expect(a).toBe(20n);
Expand Down Expand Up @@ -226,6 +254,11 @@ test("lerp", () => {
// - https://processing.org/reference/lerp_.html




// POWER / LOGARITHM
// -----------------

test("isPow2", () => {
var a = isPow2(32n);
expect(a).toBe(true);
Expand Down Expand Up @@ -290,6 +323,11 @@ test("log10", () => {
});




// ROOT
// ----

test("sqrt", () => {
var a = sqrt(81n);
expect(a).toBe(9n);
Expand Down Expand Up @@ -319,6 +357,11 @@ test("root", () => {
// - https://en.wikipedia.org/wiki/Nth_root




// DIVISORS
// --------

test("properDivisors", () => {
var a = properDivisors(6n);
expect(a).toStrictEqual([1n, 2n, 3n]);
Expand Down Expand Up @@ -437,6 +480,11 @@ test("lcm", () => {
});




// ARRANGEMENTS
// ------------

test("factorial", () => {
var a = factorial(5n);
expect(a).toBe(120n);
Expand Down Expand Up @@ -474,6 +522,11 @@ test("multinomial", () => {
});




// GEOMETRY
// --------

test("hypot", () => {
var a = hypot(3n, 4n);
expect(a).toBe(5n);
Expand All @@ -484,6 +537,11 @@ test("hypot", () => {
});




// STATISTICS
// ----------

test("sum", () => {
var a = sum(1n, 2n);
expect(a).toBe(3n);
Expand Down Expand Up @@ -564,6 +622,11 @@ test("variance", () => {
});




// MEAN (STATISTICS)
// -----------------

test("arithmeticMean", () => {
var a = arithmeticMean(1n, 2n);
expect(a).toBe(BigInt(Math.floor(1.5)));
Expand Down

0 comments on commit 1b00e64

Please sign in to comment.