-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba532a2
commit a52a066
Showing
19 changed files
with
110 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Maths } from "../../src/index.js"; | ||
const { average } = Maths; | ||
|
||
describe("Maths/average.js", () => { | ||
it("should return the average", () => { | ||
expect(average()).toBe(0); | ||
expect(average(...[0, 0, 0, 0])).toBe(0); | ||
expect(average(1)).toBe(1); | ||
expect(average(1, 2)).toBe(1.5); | ||
expect(average(5, 4, 3, 6, 7, 3, 1, 8)).toBe(4.625); | ||
expect(average(1, 2, -5, 2.4, -6.5, 0.5)).toBe(-0.9333333333333332); | ||
expect(average(1, 2, 3, 4, 5, 6, 7, 8, 9)).toBe(5); | ||
expect(average(-1, 2, 3, 4, 5, 6, 7, 8, -9)).toBe(2.7777777777777777); | ||
expect(average(...[1, 2, 3, 4, 5, 6])).toBe(3.5); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Maths } from "../../src/index.js"; | ||
const { clamp } = Maths; | ||
|
||
describe("Maths/clamp.js", () => { | ||
it("should return the value between the limits", () => { | ||
expect(clamp(-10, 0, 100)).toBe(0); | ||
expect(clamp(0, 0, 100)).toBe(0); | ||
expect(clamp(50, 0, 100)).toBe(50); | ||
expect(clamp(100, 0, 100)).toBe(100); | ||
expect(clamp(200, 0, 100)).toBe(100); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Maths } from "../../src/index.js"; | ||
const { degreesToRadians } = Maths; | ||
|
||
describe("Maths/degreesToRadians.js", () => { | ||
it("should return the value in radians", () => { | ||
expect(degreesToRadians(0)).toBe(0); | ||
expect(degreesToRadians(90)).toBe(1.5707963267948966); | ||
expect(degreesToRadians(500)).toBe(8.726646259971648); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Maths } from "../../src/index.js"; | ||
const { divideEvenly, divideEvenlyWithSpread, } = Maths; | ||
|
||
describe("Maths/divideEvenly.js", () => { | ||
describe("divideEvenly", () => { | ||
it("should return the a array with a values with the same space between all", () => { | ||
expect(divideEvenly()).toEqual([0, 2.5, 5, 7.5, 10]); | ||
expect(divideEvenly(0, 10, 2)).toEqual([0, 10]); | ||
expect(divideEvenly(-45, 45, 3)).toEqual([-45, 0, 45]); | ||
}); | ||
}); | ||
|
||
describe("divideEvenlyWithSpread", () => { | ||
it("---", () => { | ||
expect(divideEvenlyWithSpread(10, 5)).toEqual([-5, -3.888888888888889, -2.7777777777777777, -1.6666666666666665, -0.5555555555555554, 0.5555555555555554, 1.666666666666667, 2.7777777777777777, 3.8888888888888893, 5]); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Maths } from "../../src/index.js"; | ||
const { division } = Maths; | ||
|
||
describe("Maths/division.js", () => { | ||
it("should return the division of all given numbers", () => { | ||
expect(division()).toBe(0); | ||
expect(division(1)).toBe(1); | ||
expect(division(1, 2)).toBe(0.5); | ||
expect(division(1000, 10)).toBe(100); | ||
expect(division(20, 10, 5)).toBe(0.4); | ||
expect(division(...[1, 2, -5, 2.4, -6.5, 0.5])).toBe(0.012820512820512822); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Maths } from "../../src/index.js"; | ||
const { factorial } = Maths; | ||
|
||
describe("Maths/factorial.js", () => { | ||
it("should return the factorial", () => { | ||
expect(factorial(0)).toBe(0); | ||
expect(factorial(1)).toBe(1); | ||
expect(factorial(1.2)).toBe(0.23999999999999994); | ||
expect(factorial(4)).toBe(24); | ||
expect(factorial(6)).toBe(720); | ||
expect(factorial(10)).toBe(3628800); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Maths } from "../../src/index.js"; | ||
const { getPositionWithAngleDistance } = Maths; | ||
|
||
describe("Maths/getPositionWithAngleDistance.js", () => { | ||
it("should return a position based in the given angle, distance, and origin", () => { | ||
expect(getPositionWithAngleDistance(10, 100)).toEqual({ x: -83.90715290764524, y: -54.40211108893698 }); | ||
}); | ||
}); |