diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2023-09-11 18:02:50 +0200 |
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-09-11 18:02:50 +0200 |
| commit | f3f153ad0fb35aae25cdd7f7071d3bbd892db9f6 (patch) | |
| tree | 318505efd1b3ba0ec20a75edaba62f518e8bfd2a /test | |
| parent | eb3f2bbd5b62063397d3ed4b4c6da2016e6efe8c (diff) | |
add failing test
Diffstat (limited to 'test')
| -rw-r--r-- | test/path-search.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/test/path-search.cpp b/test/path-search.cpp index 15d1e359..f968e0c5 100644 --- a/test/path-search.cpp +++ b/test/path-search.cpp @@ -16,6 +16,10 @@ void test_bbox() return search::sample_rtree_1(c, bb.min, bb.max, (object_id)-1); }; + constexpr auto sample2 = [](world& w, chunk_coords_ ch, search::bbox bb) { + return search::sample_rtree(w, ch, bb.min, bb.max, (object_id)-1); + }; + constexpr auto bbox = [](Vector2i coord, rotation r) { return search::make_neighbor_tile_bbox(coord, {}, r); }; @@ -24,17 +28,21 @@ void test_bbox() const auto table = loader.scenery("table1"); { + using enum rotation; auto w = world(); auto& c12 = w[chunk_coords_{1, 2, 0}]; [[maybe_unused]] auto& c11 = w[chunk_coords_{1, 1, 0}]; c12[{0, 0}].wall_north() = {metal2, 0}; - using enum rotation; - fm_assert( !sample(c12, bbox({0, 0}, N)) ); fm_assert( sample(c12, bbox({0, 0}, E)) ); fm_assert( sample(c12, bbox({0, 0}, S)) ); fm_assert( sample(c12, bbox({0, 0}, W)) ); + + fm_assert( sample2(w, chunk_coords_{1, 1, 0}, bbox({0, TILE_MAX_DIM-1}, W)) ); + fm_assert( sample2(w, chunk_coords_{1, 1, 0}, bbox({0, TILE_MAX_DIM-1}, E)) ); + fm_assert( sample2(w, chunk_coords_{1, 1, 0}, bbox({0, TILE_MAX_DIM-1}, N)) ); + fm_assert( !sample2(w, chunk_coords_{1, 1, 0}, bbox({0, TILE_MAX_DIM-1}, S)) ); } // todo use test chunk } |
