Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
poor-circle committed Nov 22, 2023
1 parent 86c1619 commit 88285e2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 90 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/s390x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ jobs:
-DBUILD_CORO_HTTP=OFF -DBUILD_CORO_IO=OFF -DBUILD_CORO_RPC=OFF -DBUILD_EASYLOG=OFF -DBUILD_STRUCT_JSON=OFF -DBUILD_STRUCT_XML=OFF -DBUILD_STRUCT_YAML=OFF -DBUILD_UTIL=OFF -DBUILD_STRUCT_PB=OFF -DBUILD_EXAMPLES=OFF -DBUILD_BENCHMARK=OFF
cmake --build ${{github.workspace}}/build -j
cd ${{github.workspace}}/build/output/tests
./struct_pack_test
./struct_pack_test
./struct_pack_test_with_optimize
6 changes: 3 additions & 3 deletions include/ylt/struct_pack.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ template <typename T, size_t I, uint64_t conf = sp_config::DEFAULT,
[[nodiscard]] STRUCT_PACK_INLINE auto get_field(const View &v) {
using T_Field = std::tuple_element_t<I, decltype(detail::get_types<T>())>;
expected<T_Field, struct_pack::errc> ret;
auto ec = get_field_to<T, I>(ret.value(), v);
auto ec = get_field_to<T, I, conf>(ret.value(), v);
if SP_UNLIKELY (ec != struct_pack::errc{}) {
ret = unexpected<struct_pack::errc>{ec};
}
Expand All @@ -627,7 +627,7 @@ template <typename T, size_t I, uint64_t conf = sp_config::DEFAULT>
[[nodiscard]] STRUCT_PACK_INLINE auto get_field(const char *data, size_t size) {
using T_Field = std::tuple_element_t<I, decltype(detail::get_types<T>())>;
expected<T_Field, struct_pack::errc> ret;
auto ec = get_field_to<T, I>(ret.value(), data, size);
auto ec = get_field_to<T, I, conf>(ret.value(), data, size);
if SP_UNLIKELY (ec != struct_pack::errc{}) {
ret = unexpected<struct_pack::errc>{ec};
}
Expand All @@ -644,7 +644,7 @@ template <typename T, size_t I, uint64_t conf = sp_config::DEFAULT,
[[nodiscard]] STRUCT_PACK_INLINE auto get_field(Reader &reader) {
using T_Field = std::tuple_element_t<I, decltype(detail::get_types<T>())>;
expected<T_Field, struct_pack::errc> ret;
auto ec = get_field_to<T, I>(ret.value(), reader);
auto ec = get_field_to<T, I, conf>(ret.value(), reader);
if SP_UNLIKELY (ec != struct_pack::errc{}) {
ret = unexpected<struct_pack::errc>{ec};
}
Expand Down
30 changes: 8 additions & 22 deletions src/struct_pack/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,31 +1,17 @@
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output/tests)
add_executable(struct_pack_test
test_serialize.cpp
test_compile_time_calculate.cpp
test_data_struct.cpp
test_data_struct2.cpp
test_tuplet.cpp
test_alignas.cpp
test_pragma_pack.cpp
test_pragma_pack_and_alignas_mix.cpp
test_varint.cpp
test_fast_varint.cpp
test_stream.cpp
test_compatible.cpp
test_non_aggregated_type.cpp
test_derived.cpp
test_cross_platform.cpp
test_disable_meta_info.cpp
test_optimize.cpp
main.cpp
)
file(GLOB SRCS_PATHS ./*.cpp)
add_executable(struct_pack_test ${SRCS_PATHS})
add_executable(struct_pack_test_with_optimize ${SRCS_PATHS})
add_test(NAME struct_pack_test COMMAND struct_pack_test)
add_test(NAME struct_pack_test_with_optimize COMMAND struct_pack_test_with_optimize)
include (TestBigEndian)
TEST_BIG_ENDIAN(IS_BIG_ENDIAN)
if(NOT IS_BIG_ENDIAN)
target_compile_definitions(struct_pack_test PRIVATE STRUCT_PACK_ENABLE_UNPORTABLE_TYPE TEST_IN_LITTLE_ENDIAN)
target_compile_definitions(struct_pack_test_with_optimize PRIVATE STRUCT_PACK_ENABLE_UNPORTABLE_TYPE STRUCT_PACK_OPTIMIZE TEST_IN_LITTLE_ENDIAN )
else()
target_compile_definitions(struct_pack_test PRIVATE STRUCT_PACK_ENABLE_UNPORTABLE_TYPE)
target_compile_definitions(struct_pack_test PRIVATE STRUCT_PACK_ENABLE_UNPORTABLE_TYPE )
target_compile_definitions(struct_pack_test_with_optimize PRIVATE STRUCT_PACK_ENABLE_UNPORTABLE_TYPE STRUCT_PACK_OPTIMIZE)
endif()
add_custom_command(
TARGET struct_pack_test PRE_BUILD
Expand All @@ -36,4 +22,4 @@ add_custom_command(
TARGET struct_pack_test PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_SOURCE_DIR}/binary_data
${CMAKE_BINARY_DIR}/src/struct_pack/tests/binary_data)
${CMAKE_BINARY_DIR}/src/struct_pack/tests/binary_data)
64 changes: 0 additions & 64 deletions src/struct_pack/tests/test_optimize.cpp

This file was deleted.

0 comments on commit 88285e2

Please sign in to comment.