summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-11-01 16:35:03 +0100
committerStanislaw Halik <sthalik@misaki.pl>2022-11-01 16:35:03 +0100
commit704e9bd3ac58484a5209e186798076f1cbd432ef (patch)
tree511479ebd088d5c9524803c6f3fe4641009b58bc /test
parent7ff1f0911e0b0c314d6e639887b705d6fc0d78aa (diff)
wip
Diffstat (limited to 'test')
-rw-r--r--test/json.cpp12
-rw-r--r--test/serializer.cpp12
-rw-r--r--test/tile-iter.cpp10
3 files changed, 15 insertions, 19 deletions
diff --git a/test/json.cpp b/test/json.cpp
index 927e7355..0cb65278 100644
--- a/test/json.cpp
+++ b/test/json.cpp
@@ -19,14 +19,14 @@ static chunk make_test_chunk()
tiles = loader.tile_atlas("tiles", {8, 5});
constexpr auto N = TILE_MAX_DIM;
chunk c;
- for (auto& [x, k, pt] : c) {
- x.ground = { tiles, decltype(tile_image::variant)(k % tiles->num_tiles()) };
+ for (auto [x, k, pt] : c) {
+ x.ground() = { tiles, variant_t(k % tiles->num_tiles()) };
}
constexpr auto K = N/2;
- c[{K, K }].wall_north = { metal1, 0 };
- c[{K, K }].wall_west = { metal2, 0 };
- c[{K, K+1}].wall_north = { metal1, 0 };
- c[{K+1, K }].wall_west = { metal2, 0 };
+ c[{K, K }].wall_north() = { metal1, 0 };
+ c[{K, K }].wall_west() = { metal2, 0 };
+ c[{K, K+1}].wall_north() = { metal1, 0 };
+ c[{K+1, K }].wall_west() = { metal2, 0 };
return c;
}
diff --git a/test/serializer.cpp b/test/serializer.cpp
index db08a9f8..c1ab5fef 100644
--- a/test/serializer.cpp
+++ b/test/serializer.cpp
@@ -15,14 +15,14 @@ static chunk make_test_chunk()
tiles = loader.tile_atlas("tiles", {8, 5});
constexpr auto N = TILE_MAX_DIM;
chunk c;
- for (auto& [x, k, pt] : c) {
- x.ground = { tiles, decltype(tile_image::variant)(k % tiles->num_tiles()) };
+ for (auto [x, k, pt] : c) {
+ x.ground() = { tiles, variant_t(k % tiles->num_tiles()) };
}
constexpr auto K = N/2;
- c[{K, K }].wall_north = { metal1, 0 };
- c[{K, K }].wall_west = { metal2, 0 };
- c[{K, K+1}].wall_north = { metal1, 0 };
- c[{K+1, K }].wall_west = { metal2, 0 };
+ c[{K, K }].wall_north() = { metal1, 0 };
+ c[{K, K }].wall_west() = { metal2, 0 };
+ c[{K, K+1}].wall_north() = { metal1, 0 };
+ c[{K+1, K }].wall_west() = { metal2, 0 };
return c;
}
diff --git a/test/tile-iter.cpp b/test/tile-iter.cpp
index 9303a764..6bfd1a0b 100644
--- a/test/tile-iter.cpp
+++ b/test/tile-iter.cpp
@@ -10,6 +10,7 @@ static inline bool always_false()
bool floormat::test_tile_iter() // NOLINT(readability-function-size)
{
+#if 0
if (always_false())
{
const chunk c;
@@ -22,23 +23,18 @@ bool floormat::test_tile_iter() // NOLINT(readability-function-size)
for (auto&& [x, k, pt] : c)
static_assert(std::is_same_v<decltype(x), const tile&>);
}
+#endif
if (always_false())
{
chunk c;
- for (auto& [x, k, pt] : c)
- static_assert(std::is_same_v<decltype(x), tile&>);
- for (const auto& [x, k, pt] : c)
- static_assert(std::is_same_v<decltype(x), const tile&>);
for (auto [x, k, pt] : c)
- static_assert(std::is_same_v<decltype(x), tile&>);
+ static_assert(std::is_same_v<decltype(x), tile_ref>);
#if 0
// warns
for (const auto [x, k, pt] : c)
static_assert(std::is_same_v<decltype(x), const tile&>);
-#endif
for (auto&& [x, k, pt] : c)
static_assert(std::is_same_v<decltype(x), tile&>);
-#if 0
// fails to compile
for (const auto&& [x, k, pt] : c)
static_assert(std::is_same_v<decltype(x), const tile&>);