summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-09-20 20:25:30 +0200
committerStanislaw Halik <sthalik@misaki.pl>2023-09-20 20:25:52 +0200
commit627dc90720e083b2e458ab7efb4dcca739b7a19a (patch)
tree0dcc9d909c7b804cebb9b524708af24c565f10ff /test
parent02f712a439ef3f59569c4e942024b496eeb24370 (diff)
a
Diffstat (limited to 'test')
-rw-r--r--test/path-search.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/test/path-search.cpp b/test/path-search.cpp
index eb4ff4a5..3b1c4e93 100644
--- a/test/path-search.cpp
+++ b/test/path-search.cpp
@@ -11,15 +11,15 @@ namespace {
void test_bbox()
{
- constexpr auto is_passable_1 = [](chunk& c, path_search::bbox bb) {
+ static constexpr auto is_passable_1 = [](chunk& c, path_search::bbox bb) {
return path_search::is_passable_1(c, bb.min, bb.max, (object_id)-1);
};
- constexpr auto is_passable = [](world& w, chunk_coords_ ch, path_search::bbox bb) {
+ static constexpr auto is_passable = [](world& w, chunk_coords_ ch, path_search::bbox bb) {
return path_search::is_passable(w, ch, bb.min, bb.max, (object_id)-1);
};
- constexpr auto bbox = [](Vector2i coord, rotation r) {
+ static constexpr auto bbox = [](Vector2i coord, rotation r) {
return path_search::make_neighbor_tile_bbox(coord, {}, r);
};
@@ -81,15 +81,17 @@ void test_bbox()
auto w = world();
auto& c = test_app::make_test_chunk(w, ch);
- fm_assert( !is_passable_1(c, bbox({8, 8}, N)) );
- fm_assert( !is_passable_1(c, bbox({8, 8}, E)) );
- fm_assert( !is_passable_1(c, bbox({8, 8}, S)) );
- fm_assert( !is_passable_1(c, bbox({8, 8}, W)) );
-
- fm_assert( !is_passable_1(c, bbox({8, 9}, N)) );
- fm_assert( is_passable_1(c, bbox({8, 9}, E)) );
- fm_assert( is_passable_1(c, bbox({8, 9}, S)) );
- fm_assert( is_passable_1(c, bbox({8, 9}, W)) );
+ constexpr auto is_passable_NESW = [](chunk& c, Vector2i coord, std::array<bool, 4> dirs) {
+ fm_assert(is_passable_1(c, bbox(coord, N)) == dirs[0]);
+ fm_assert(is_passable_1(c, bbox(coord, E)) == dirs[1]);
+ fm_assert(is_passable_1(c, bbox(coord, S)) == dirs[2]);
+ fm_assert(is_passable_1(c, bbox(coord, W)) == dirs[3]);
+ };
+
+ is_passable_NESW(c, {8, 8}, { false, false, false, false });
+ is_passable_NESW(c, {8, 9}, { false, true, true, true });
+ is_passable_NESW(c, {2, 4}, { true, false, true, true });
+ is_passable_NESW(c, {4, 4}, { true, true, true, false });
}
}