Test de texture : une assertion par classe au lieu de trois par octet
245 760 appels à expect() (10 classes × 8 192 octets × 3) dépassaient le délai de 5 s par défaut sur le runner Gitea (1,4 s ici) ; le test tombe à 11 ms. Même vérification, même résultat. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -115,11 +115,12 @@ describe('renderPlanetTexture', () => {
|
|||||||
it('produces no NaN or out-of-range bytes for any class', () => {
|
it('produces no NaN or out-of-range bytes for any class', () => {
|
||||||
for (const planetClass of ALL_CLASSES) {
|
for (const planetClass of ALL_CLASSES) {
|
||||||
const pixels = renderPlanetTexture(appearanceOf(planetClass, { polarCapExtentDeg: 30 }), SIZE);
|
const pixels = renderPlanetTexture(appearanceOf(planetClass, { polarCapExtentDeg: 30 }), SIZE);
|
||||||
for (const value of pixels) {
|
// One assertion per class, not three per byte: 245 760 expect() calls ran past the
|
||||||
expect(Number.isInteger(value)).toBe(true);
|
// default 5 s timeout on a slower CI machine.
|
||||||
expect(value).toBeGreaterThanOrEqual(0);
|
const firstBad = pixels.findIndex(
|
||||||
expect(value).toBeLessThanOrEqual(255);
|
(value) => !Number.isInteger(value) || value < 0 || value > 255,
|
||||||
}
|
);
|
||||||
|
expect(firstBad, planetClass).toBe(-1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user