test: make tests work and remove unused util

This commit is contained in:
zkldi
2022-12-18 23:12:11 +00:00
parent 7e757448cd
commit 695d028a8a
3 changed files with 6 additions and 44 deletions
@@ -1,9 +1,4 @@
import {
GenericCalculatePercent,
GetGradeFromPercent,
JubeatGetMusicRate,
ValidatePercent,
} from "./score-utils";
import { GenericCalculatePercent, GetGradeFromPercent, ValidatePercent } from "./score-utils";
import t from "tap";
import { isApproximately } from "test-utils/asserts";
import { Testing511SPA } from "test-utils/test-data";
@@ -149,20 +144,3 @@ t.test("#ValidatePercent", (t) => {
t.end();
});
t.test("#JubeatGetMusicRate", (t) => {
t.equal(
JubeatGetMusicRate(423, 136, 41, 14, 5, 619, false),
73.0,
"Should correctly calculate jubeat music rate."
);
t.equal(JubeatGetMusicRate(418, 158, 90, 54, 92, 818, false), 73.0);
t.equal(
JubeatGetMusicRate(423, 136, 41, 14, 5, 619, true),
73.0 * 1.2,
"Should correctly calculate hard mode jubeat music rate."
);
t.end();
});
@@ -186,22 +186,6 @@ export function JubeatGetGrade(score: number): Grades["jubeat:Single"] {
return "E";
}
export function JubeatGetMusicRate(
perfect: integer,
great: integer,
good: integer,
poor: integer,
miss: integer,
chartMaxCombo: integer,
hardMode: boolean
) {
const multiplier = hardMode ? 120 : 100;
const rawMusicRate = ((perfect + 0.2 * great + 0.05 * good) / chartMaxCombo) * multiplier;
return FloorToNDP(rawMusicRate, 1);
}
/**
* Calculates the ESD for a given game + percent combo. This function returns
* null if the game does not support support ESD.
@@ -81,19 +81,19 @@ t.test("#ConverterAPICGSDVX", (t) => {
});
t.test("Lamps", async (t) => {
t.hasStrict(await convert({ clearType: 0 }), {
t.hasStrict(await convert({ clearType: 1 }), {
dryScore: mkOutput({ scoreData: { lamp: "FAILED" } }),
});
t.hasStrict(await convert({ clearType: 1 }), {
t.hasStrict(await convert({ clearType: 2 }), {
dryScore: mkOutput({ scoreData: { lamp: "CLEAR" } }),
});
t.hasStrict(await convert({ clearType: 2 }), {
t.hasStrict(await convert({ clearType: 3 }), {
dryScore: mkOutput({ scoreData: { lamp: "EXCESSIVE CLEAR" } }),
});
t.hasStrict(await convert({ clearType: 3 }), {
t.hasStrict(await convert({ clearType: 4 }), {
dryScore: mkOutput({ scoreData: { lamp: "ULTIMATE CHAIN" } }),
});
t.hasStrict(await convert({ clearType: 4 }), {
t.hasStrict(await convert({ clearType: 5 }), {
dryScore: mkOutput({ scoreData: { lamp: "PERFECT ULTIMATE CHAIN" } }),
});