From 4d98593553713c5e1f11917c3dda096a95711cca Mon Sep 17 00:00:00 2001 From: Miki Rozloznik Date: Tue, 3 Sep 2024 22:59:03 +0800 Subject: [PATCH] Fix test --- runtime/src/zserio/Variant.h | 8 ++++---- runtime/test/zserio/VariantTest.cpp | 7 ++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/runtime/src/zserio/Variant.h b/runtime/src/zserio/Variant.h index 9ced0f5..669d677 100644 --- a/runtime/src/zserio/Variant.h +++ b/runtime/src/zserio/Variant.h @@ -339,7 +339,7 @@ class BasicVariant : public AllocatorHolder using R = decltype(fun(std::declval::type>())); if constexpr (std::is_same_v) { - nullptr_t dummy; + std::nullptr_t dummy; visitSeq(std::forward(fun), dummy, std::make_index_sequence()); } else @@ -363,7 +363,7 @@ class BasicVariant : public AllocatorHolder using R = decltype(fun(std::declval::type>())); if constexpr (std::is_same_v) { - nullptr_t dummy; + std::nullptr_t dummy; visitSeq(std::forward(fun), dummy, std::make_index_sequence()); } else @@ -444,7 +444,7 @@ class BasicVariant : public AllocatorHolder { if (I != m_data.index()) return; - if constexpr (std::is_same_v) + if constexpr (std::is_same_v) { std::forward(fun)(get()); } @@ -459,7 +459,7 @@ class BasicVariant : public AllocatorHolder { if (I != m_data.index()) return; - if constexpr (std::is_same_v) + if constexpr (std::is_same_v) { std::forward(fun)(get()); } diff --git a/runtime/test/zserio/VariantTest.cpp b/runtime/test/zserio/VariantTest.cpp index d67346b..bd329eb 100644 --- a/runtime/test/zserio/VariantTest.cpp +++ b/runtime/test/zserio/VariantTest.cpp @@ -44,7 +44,7 @@ struct BigObj } bool operator==(const BigObj& o) const { - return std::equal(std::begin(data), std::end(data), std::begin(o.data)); + return data[0] == o.data[0]; } bool operator!=(const BigObj& o) const { @@ -52,10 +52,7 @@ struct BigObj } bool operator<(const BigObj& o) const { - auto it = std::mismatch(std::begin(data), std::end(data), std::begin(o.data)); - if (it.first == std::end(data)) - return false; - return *it.first < *it.second; + return data[0] < o.data[0]; } char data[30]; };