summaryrefslogtreecommitdiffhomepage
path: root/test/tile-iter.cpp
blob: 086fd3cee031dc1eda98cf525381278f5a3bec8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "app.hpp"
#include "src/chunk.hpp"
#include "src/world.hpp"
#include "src/tile-iterator.hpp"
namespace floormat {

static inline bool always_false()
{
    volatile bool ret = false;
    return ret;
}

void test_app::test_tile_iter() // NOLINT(readability-function-size)
{
    if (always_false())
    {
        world w;
        const chunk c{w, {}};
        for ([[maybe_unused]] const auto& [x, k, pt] : c)
            static_assert(std::is_same_v<decltype(x), const tile_proto>);
        for ([[maybe_unused]] const auto [x, k, pt] : c)
            static_assert(std::is_same_v<decltype(x), const tile_proto>);
        for ([[maybe_unused]] auto [x, k, pt] : c)
            static_assert(std::is_same_v<decltype(x), tile_proto>);
    }
    if (always_false())
    {
        world w;
        chunk c{w, {}};
        for ([[maybe_unused]] auto [x, k, pt] : c)
            static_assert(std::is_same_v<decltype(x), tile_ref>);
        for ([[maybe_unused]] const auto [x, k, pt] : c)
            static_assert(std::is_same_v<decltype(x), const tile_ref>);
    }
}

} // namespace floormat