diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/app.cpp | 1 | ||||
| -rw-r--r-- | test/app.hpp | 1 | ||||
| -rw-r--r-- | test/util.cpp | 40 |
3 files changed, 42 insertions, 0 deletions
diff --git a/test/app.cpp b/test/app.cpp index 6ace3ca5..c3ffa8fd 100644 --- a/test/app.cpp +++ b/test/app.cpp @@ -58,6 +58,7 @@ int App::exec() FM_TEST(test_local), // fast FM_TEST(test_magnum_math), + FM_TEST(test_util), FM_TEST(test_math), FM_TEST(test_astar_pool), FM_TEST(test_coords), diff --git a/test/app.hpp b/test/app.hpp index b1995e77..0e4d7a3a 100644 --- a/test/app.hpp +++ b/test/app.hpp @@ -41,6 +41,7 @@ void test_rtree(); void test_save(); void test_saves(); void test_script(); +void test_util(); void test_wall_atlas(); void test_wall_atlas2(); diff --git a/test/util.cpp b/test/util.cpp new file mode 100644 index 00000000..48332621 --- /dev/null +++ b/test/util.cpp @@ -0,0 +1,40 @@ +#include "app.hpp" +#include "compat/array-size.hpp" + +namespace floormat::Test { + +namespace { + +struct Foo +{ + static constexpr std::array<int, 11> Array_1 = {}; + static constexpr const void* Array_2[22] = {}; + + std::array<int, 33> array_3; +}; + +constexpr bool test_array_size() +{ + fm_assert(static_array_size<decltype(Foo::Array_1)> == 11); + fm_assert(array_size(Foo::Array_1) == 11); + + fm_assert(static_array_size<decltype(Foo::Array_2)> == 22); + fm_assert(array_size(&Foo::Array_2) == 22); + + fm_assert(static_array_size<decltype(Foo{}.array_3)> == 33); + fm_assert(array_size(Foo{}.array_3) == 33); + fm_assert(array_size(&Foo::array_3) == 33); + + fm_assert(static_array_size<const int(&)[44]> == 44); + + return true; +} + +} // namespace + +void test_util() +{ + static_assert(test_array_size()); +} + +} // namespace floormat::Test |
