fix(coords): Chunk-Namen korrekt für Float-Indizes und Newlines

- chunk_name: Reject float/bool indices like JavaScript (Number.isInteger)
- parse_chunk_name: Use fullmatch instead of match($) to reject strings with trailing newlines
- Add invalidIndices fixture cases to catch these edge cases in both languages

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
knsoandClaude Haiku 4.5 committed 2026-09-13 09:49:53 +02:00
1 parent 2f63779363
commit f0f7692f14
4 files changed
+20 -4

No files matched your search

+6
View File
@@ -49,6 +49,12 @@ describe("Chunk-Namen", () => {
expect(chunkName(1.5, 3)).toBeNull();
});
it("lehnt ungültige Indextypen ab", () => {
for (const [i, j] of NAMES.invalidIndices) {
expect(chunkName(i, j)).toBeNull();
}
});
it("kommt für alle 144 Chunks hin und zurück", () => {
for (let i = 0; i < 12; i++) {
for (let j = 0; j < 12; j++) expect(parseChunkName(chunkName(i, j))).toEqual({ i, j });