mirror of
https://github.com/protomaps/PMTiles.git
synced 2026-02-04 02:41:09 +00:00
add edge case find_tile test [#117]
This commit is contained in:
@@ -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)!;
|
||||
|
||||
@@ -86,6 +86,11 @@ class TestFindTile(unittest.TestCase):
|
||||
self.assertEqual(result.offset, 1)
|
||||
self.assertEqual(result.length, 1)
|
||||
|
||||
def test_find_tile_runlength(self):
|
||||
entries = [Entry(3, 3, 1, 2),Entry(5, 5, 1, 2)]
|
||||
result = find_tile(entries, 4)
|
||||
self.assertEqual(result.offset, 3)
|
||||
|
||||
def test_find_tile_multiple(self):
|
||||
entries = [Entry(100, 1, 1, 2)]
|
||||
result = find_tile(entries, 101)
|
||||
|
||||
Reference in New Issue
Block a user