add edge case find_tile test [#117]

This commit is contained in:
Brandon Liu
2023-01-30 03:41:13 +08:00
parent 701db2dabc
commit 61a5076dc5
2 changed files with 14 additions and 0 deletions

View File

@@ -107,6 +107,15 @@ test("tile search for first entry == id", () => {
assert.strictEqual(findTile(entries, 101), null);
});
test("tile search with runlength", () => {
const entries: Entry[] = [
{ tileId: 3, offset: 3, length: 1, runLength: 2 },
{ tileId: 5, offset: 5, length: 1, runLength: 2 },
];
const entry = findTile(entries, 4)!;
assert.strictEqual(entry.offset, 3);
});
test("tile search with multiple tile entries", () => {
let entries: Entry[] = [{ tileId: 100, offset: 1, length: 1, runLength: 2 }];
let entry = findTile(entries, 101)!;