Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ksergey committed Oct 14, 2024
1 parent 4729e5f commit f6eaa22
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion app/generation/cppng/templates/typing.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <cstdint>
#include <numeric>
#include <span>
#include <stdexcept>
#include <string_view>

#include "mp.h"
Expand Down Expand Up @@ -140,7 +141,7 @@ struct Encoding<T> {
auto const ptr = std::bit_cast<element_type const*>(buffer);
if constexpr (T::length > 1) {
if constexpr (std::is_same_v<value_type, std::string_view>) {
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);
Expand Down
4 changes: 2 additions & 2 deletions example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
3 changes: 2 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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})
Expand Down
4 changes: 2 additions & 2 deletions tests/basic-group-schema_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<TestMessage1::Fields>(), 2);
REQUIRE_EQ(TestMessage1::Entries::sbeBlockLength(), 28);
REQUIRE_EQ(TestMessage1::Entries::fieldsCount(), 2);
REQUIRE_EQ(MP_Size<TestMessage1::Entries::Fields>(), 2);
}

0 comments on commit f6eaa22

Please sign in to comment.