summaryrefslogtreecommitdiffhomepage
path: root/test/tile-iter.cpp
blob: 5248f7ce8f48a57ba9888f4d8d5269835dc6820e (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 "chunk.hpp"
#include "world.hpp"
#include "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