update miletruth page and remove unwanted files

This commit is contained in:
2026-06-03 13:42:12 +05:30
parent 3bad62851c
commit 6eea5636fb
153 changed files with 6089 additions and 36024 deletions

View File

@@ -0,0 +1,67 @@
import { STAGES, N, Z_SPACING, X_OFFSET, stagePosition, samplePath } from "./theme";
describe("strategy/theme — stage data", () => {
it("exposes five stages and a matching N", () => {
expect(STAGES).toHaveLength(5);
expect(N).toBe(5);
});
it("has unique, well-formed stage descriptors", () => {
const keys = STAGES.map((s) => s.key);
expect(new Set(keys).size).toBe(keys.length);
for (const s of STAGES) {
expect(s.n).toMatch(/^\d{2}$/);
expect(s.theme).toMatch(/^#[0-9A-Fa-f]{6}$/);
expect(s.kicker.length).toBeGreaterThan(0);
}
});
});
describe("strategy/theme — stagePosition()", () => {
it("alternates x sign by parity and steps z by -Z_SPACING", () => {
expect(stagePosition(0)).toEqual([-X_OFFSET, -0.45, -0]);
expect(stagePosition(1)).toEqual([X_OFFSET, 0.55, -Z_SPACING]);
expect(stagePosition(2)).toEqual([-X_OFFSET, -0.45, -2 * Z_SPACING]);
expect(stagePosition(3)).toEqual([X_OFFSET, 0.55, -3 * Z_SPACING]);
});
it("places even stages left and odd stages right", () => {
for (let i = 0; i < N; i++) {
const [x] = stagePosition(i);
if (i % 2 === 0) expect(x).toBeLessThan(0);
else expect(x).toBeGreaterThan(0);
}
});
});
describe("strategy/theme — samplePath()", () => {
it("equals stagePosition() at integer indices", () => {
for (let i = 0; i < N; i++) {
const sampled = samplePath(i);
const exact = stagePosition(i);
sampled.forEach((v, k) => expect(v).toBeCloseTo(exact[k], 10));
}
});
it("linearly interpolates between adjacent stages", () => {
const [x, y, z] = samplePath(0.5);
expect(x).toBeCloseTo(0, 10); // midpoint of -2.5 and +2.5
expect(y).toBeCloseTo(0.05, 10); // midpoint of -0.45 and 0.55
expect(z).toBeCloseTo(-Z_SPACING / 2, 10);
});
it("clamps indices below 0 to the first stage", () => {
expect(samplePath(-3)).toEqual(stagePosition(0));
});
it("clamps indices above N-1 to the last stage", () => {
expect(samplePath(99)).toEqual(stagePosition(N - 1));
});
it("never produces NaN across a fine sweep", () => {
for (let p = 0; p <= 1.0001; p += 0.05) {
const idx = p * (N - 1);
for (const v of samplePath(idx)) expect(Number.isNaN(v)).toBe(false);
}
});
});