diff --git a/app/generation/cppng/templates/typing.h b/app/generation/cppng/templates/typing.h index 1cb641c..cd47785 100644 --- a/app/generation/cppng/templates/typing.h +++ b/app/generation/cppng/templates/typing.h @@ -8,6 +8,7 @@ #include #include #include +#include #include #include "mp.h" @@ -140,7 +141,7 @@ struct Encoding { auto const ptr = std::bit_cast(buffer); if constexpr (T::length > 1) { if constexpr (std::is_same_v) { - std::string str(ptr, T::length); + std::string_view str(ptr, T::length); return str.substr(0, str.find('\0')); } else { return value_type(ptr, T::length); diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 24854fa..a2b28d0 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -1,13 +1,13 @@ include(FetchContent) FetchContent_Declare(fmt - URL https://github.com/fmtlib/fmt/archive/refs/tags/9.1.0.tar.gz + URL https://github.com/fmtlib/fmt/archive/refs/tags/11.0.2.tar.gz DOWNLOAD_EXTRACT_TIMESTAMP ON ) FetchContent_MakeAvailable(fmt) FetchContent_Declare(nlohmann_json - URL https://github.com/nlohmann/json/archive/refs/tags/v3.11.2.tar.gz + URL https://github.com/nlohmann/json/archive/refs/tags/v3.11.3.tar.gz DOWNLOAD_EXTRACT_TIMESTAMP ON ) FetchContent_MakeAvailable(nlohmann_json) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 4a27c0b..b916998 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,7 +1,7 @@ include(FetchContent) FetchContent_Declare(doctest - URL https://github.com/onqtam/doctest/archive/refs/tags/2.4.6.tar.gz + URL https://github.com/doctest/doctest/archive/refs/tags/v2.4.11.tar.gz DOWNLOAD_EXTRACT_TIMESTAMP ON ) FetchContent_MakeAvailable(doctest) @@ -14,6 +14,7 @@ function(AddTest NAME) cmake_parse_arguments(PARSED "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) add_executable(${NAME} ${PARSED_SOURCE}) + target_compile_features(${NAME} PUBLIC cxx_std_20) target_compile_options(${NAME} PRIVATE -Wall -Wextra) target_link_libraries(${NAME} PRIVATE ${PARSED_LIBS}) add_test(${NAME} ${NAME}) diff --git a/tests/basic-group-schema_test.cpp b/tests/basic-group-schema_test.cpp index 6f292df..32597a6 100644 --- a/tests/basic-group-schema_test.cpp +++ b/tests/basic-group-schema_test.cpp @@ -12,7 +12,7 @@ TEST_CASE("basic-group-schema-test") { REQUIRE_EQ(TestMessage1::name(), "TestMessage1"); REQUIRE_EQ(TestMessage1::id(), 1); REQUIRE_EQ(TestMessage1::sbeBlockLength(), 16); - REQUIRE_EQ(TestMessage1::fieldsCount(), 2); + REQUIRE_EQ(MP_Size(), 2); REQUIRE_EQ(TestMessage1::Entries::sbeBlockLength(), 28); - REQUIRE_EQ(TestMessage1::Entries::fieldsCount(), 2); + REQUIRE_EQ(MP_Size(), 2); }