import { describe, expect, it } from "vitest"; import { CHUNK_SIZE, chunkForWorld, threeToWorld, tileForWorld, worldToThree } from "../src/world/coords.js"; describe("coords", () => { it("dreht Y zur three-z-Achse", () => { expect(worldToThree(1699, 743)).toEqual({ x: 1699, z: -743 }); expect(threeToWorld(1699, -743)).toEqual({ X: 1699, Y: 743 }); }); it("findet die Kachel von Vice Beach", () => { expect(tileForWorld(1409.4, 2803.2)).toEqual({ row: 53, col: 69 }); }); it("deckt den Ausschnitt mit Spalten 60..71 und Zeilen 54..65 ab", () => { expect(tileForWorld(-1000, 2500)).toEqual({ row: 54, col: 60 }); expect(tileForWorld(1999, -499)).toEqual({ row: 65, col: 71 }); }); it("teilt den Ausschnitt in 250-m-Chunks", () => { expect(CHUNK_SIZE).toBe(250); expect(chunkForWorld(-1000, 2500)).toEqual({ i: 0, j: 0 }); expect(chunkForWorld(1999, -499)).toEqual({ i: 11, j: 11 }); }); });