sendou.ink/app/utils/numbers.test.ts
Kalle c014ba5e18
Sub damage table in Build Analyzer (#1333)
* Sub weapon damage table initial

* Remove duplicate stats

* Tiny sub weapon icons

* Border-collapse collapse

* Move func location

* Varying sub damage support

* Calculates damages of various bombs

* Burst bomb direct damage

* Fizzy dmg

* Curling bomb explosion values

* Don't show comparison column if no SRU

* Torpedo

* Add note about Splash Wall and Sprinkler

* Fix comment
2023-04-10 11:46:04 +03:00

35 lines
907 B
TypeScript

import { suite } from "uvu";
import * as assert from "uvu/assert";
import { cutToNDecimalPlaces } from "./number";
const CutToNDecimalPlaces = suite("cutToNDecimalPlaces()");
CutToNDecimalPlaces("cutOff truncates decimal places correctly", () => {
const result = cutToNDecimalPlaces(3.9999, 2);
assert.is(result, 3.99);
});
CutToNDecimalPlaces("cutOff can change amount of decimals returned", () => {
const result = cutToNDecimalPlaces(3.12, 1);
assert.is(result, 3.1);
});
CutToNDecimalPlaces(
"cutOff preserves decimal values with the desired number of decimal places correctly",
() => {
const result = cutToNDecimalPlaces(100, 2);
assert.is(result, 100);
}
);
CutToNDecimalPlaces(
"cutOff cuts off decimal places and removes trailing zeros correctly",
() => {
const result = cutToNDecimalPlaces(3.0001, 2);
assert.is(result, 3);
}
);
CutToNDecimalPlaces.run();