diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-09-10 17:54:35 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-09-10 23:11:29 +0200 |
commit | 4e2b7d27041dd98fab836c5a3c2c45322ed898e2 (patch) | |
tree | 1ea8417e882a15d607922410c40be6a1d5c03ffe /src | |
parent | 8d9827ba7ac7c16540f5c40666db00ef899c2c64 (diff) |
add asserts important for path-search
Diffstat (limited to 'src')
-rw-r--r-- | src/global-coords.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/global-coords.cpp b/src/global-coords.cpp index e01c980a..17b8d7fd 100644 --- a/src/global-coords.cpp +++ b/src/global-coords.cpp @@ -2,6 +2,8 @@ namespace floormat { +namespace { + static_assert(sizeof(decltype(local_coords::x))*8 == 8); static_assert(sizeof(decltype(chunk_coords::x))*8 == 16); static_assert(std::is_same_v<decltype(local_coords::x), decltype(local_coords::y)>); @@ -24,4 +26,13 @@ static_assert(chunk_coords_{(char)11, (char)22, (char)33} - Vector3i(1, 2, 3) == static_assert(chunk_coords_{(short)10, (short)20, (char)30} + Vector2i(1, 2) == chunk_coords_{(short)11, (short)22, (char)30}); static_assert(chunk_coords_{(short)11, (short)22, (char)30} - Vector2i(1, 2) == chunk_coords_{(short)10, (short)20, (char)30}); +constexpr auto g1 = global_coords{{1, 2, 0}, {3, 0}}; +constexpr auto g2 = global_coords{{1, 1, 0}, {3, TILE_MAX_DIM-1}}; + +static_assert(g1 - g2 == Vector2i(0, 1)); +static_assert((g1 + Vector2i(0, -1)).chunk() == g2.chunk()); +static_assert(g1 + Vector2i(0, -1) == g2); + +} // namespace + } // namespace floormat |