rg-stats
Version:
A library for calculating various rhythm game stats.
85 lines (76 loc) • 2.15 kB
text/typescript
import t from "tap";
import { TestCase } from "../test-utils/test-case";
import { calculate, inverse } from "./curator-skill";
const testCases = [
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
];
t.test("MUSECA Curator Skill Tests", (t) => {
function MakeTestCase(score: number, level: number, skill: number): TestCase {
return (t) =>
t.equal(
// note: score doesn't actually matter, it's just there to check
// that your score isn't < 700k.
calculate(score, level),
skill,
`A score of ${score} on a level ${level} chart should be worth ${skill} skill.`
);
}
for (const testCase of testCases) {
MakeTestCase(testCase[0], testCase[1], testCase[2])(t);
}
t.end();
});
t.test("MUSECA Inverse Curator Skill Tests", (t) => {
function MakeTestCase(score: number, level: number, skill: number): TestCase {
return (t) =>
t.equal(
// note: score doesn't actually matter, it's just there to check
// that your score isn't < 700k.
inverse(skill, level),
score,
`A skill of ${skill} on a level ${level} chart should need ${score} score.`
);
}
// due to skill being floored, we can't just invert our test cases
// because technically, those curator skill values can be achieved with less
// score in most scenarios.
const inverseTestCases = [
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
];
for (const testCase of inverseTestCases) {
MakeTestCase(testCase[0], testCase[1], testCase[2])(t);
}
t.end();
});