From 772ac64e3b701507f99d53cc34a985cf8f16c347 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Mon, 7 Mar 2022 17:02:59 +0100 Subject: [PATCH] config: add ENTT_VERSION --- src/entt/config/version.h | 6 ++++++ test/CMakeLists.txt | 4 ++++ test/entt/config/version.cpp | 8 ++++++++ 3 files changed, 18 insertions(+) create mode 100644 test/entt/config/version.cpp diff --git a/src/entt/config/version.h b/src/entt/config/version.h index 229a42bdf..dfdcfedf2 100644 --- a/src/entt/config/version.h +++ b/src/entt/config/version.h @@ -1,8 +1,14 @@ #ifndef ENTT_CONFIG_VERSION_H #define ENTT_CONFIG_VERSION_H +#include "macro.h" + #define ENTT_VERSION_MAJOR 3 #define ENTT_VERSION_MINOR 10 #define ENTT_VERSION_PATCH 0 +#define ENTT_VERSION \ + ENTT_XSTR(ENTT_VERSION_MAJOR) \ + "." ENTT_XSTR(ENTT_VERSION_MINOR) "." ENTT_XSTR(ENTT_VERSION_PATCH) + #endif diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d70892954..deb881c7e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -174,6 +174,10 @@ if(ENTT_BUILD_SNAPSHOT) target_include_directories(cereal PRIVATE ${cereal_INCLUDE_DIR}) endif() +# Test config + +SETUP_BASIC_TEST(version entt/config/version.cpp) + # Test container SETUP_BASIC_TEST(dense_map entt/container/dense_map.cpp) diff --git a/test/entt/config/version.cpp b/test/entt/config/version.cpp new file mode 100644 index 000000000..865605979 --- /dev/null +++ b/test/entt/config/version.cpp @@ -0,0 +1,8 @@ +#include +#include +#include + +TEST(Version, All) { + ASSERT_STREQ(ENTT_VERSION, ENTT_XSTR(ENTT_VERSION_MAJOR) "." ENTT_XSTR(ENTT_VERSION_MINOR) "." ENTT_XSTR(ENTT_VERSION_PATCH)); + ASSERT_TRUE(std::regex_match(ENTT_VERSION, std::regex{"^[0-9]+\\.[0-9]+\\.[0-9]+$"})); +}