mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-06 22:07:58 +03:00
test: make tests work and remove unused util
This commit is contained in:
@@ -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" } }),
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user