summaryrefslogtreecommitdiff
path: root/test/test-static-util.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2026-04-03 12:04:14 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2026-04-03 12:04:14 +0100
commit4d04572e48950493ce85255d181be43967f362fd (patch)
treef74d055f151472cda3fa3fc0f760eb6219dd9fad /test/test-static-util.cpp
parentUse std::chrono for worldTime (diff)
parentFix direction of difference vector calculating railVehicle new position (diff)
downloadilt-4d04572e48950493ce85255d181be43967f362fd.tar.bz2
ilt-4d04572e48950493ce85255d181be43967f362fd.tar.xz
ilt-4d04572e48950493ce85255d181be43967f362fd.zip
Merge branch 'shared-locations'
Diffstat (limited to 'test/test-static-util.cpp')
-rw-r--r--test/test-static-util.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/test-static-util.cpp b/test/test-static-util.cpp
new file mode 100644
index 0000000..2a8aa81
--- /dev/null
+++ b/test/test-static-util.cpp
@@ -0,0 +1,29 @@
+#include "util.h"
+
+namespace {
+ struct Base1 {
+ int a;
+ float b;
+ };
+
+ struct Base2 {
+ int x;
+ float y;
+ };
+
+ struct Sub : Base1, Base2 {
+ double value;
+ };
+
+ static_assert(std::is_same_v<MemberValueType<&Base1::a>, int>);
+ static_assert(std::is_same_v<MemberValueType<&Base2::y>, float>);
+ static_assert(std::is_same_v<MemberValueType<&Sub::a>, int>);
+ static_assert(std::is_same_v<MemberValueType<&Sub::y>, float>);
+ static_assert(std::is_same_v<MemberValueType<&Sub::value>, double>);
+
+ static_assert(std::is_same_v<ContainerType<&Base1::a>, Base1>);
+ static_assert(std::is_same_v<ContainerType<&Base2::y>, Base2>);
+ static_assert(std::is_same_v<ContainerType<&Sub::a>, Base1>);
+ static_assert(std::is_same_v<ContainerType<&Sub::y>, Base2>);
+ static_assert(std::is_same_v<ContainerType<&Sub::value>, Sub>);
+}