mirror of
https://github.com/fraillt/bitsery.git
synced 2026-06-08 08:13:56 +00:00
release v5.1.0
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(bitsery_tests CXX)
|
||||
|
||||
find_package(GTest 1.8 REQUIRED)
|
||||
find_package(GTest 1.10 REQUIRED)
|
||||
|
||||
if (NOT TARGET Bitsery::bitsery)
|
||||
message(FATAL_ERROR "Bitsery::bitsery alias not set. Please generate CMake from bitsery root directory.")
|
||||
|
||||
@@ -286,7 +286,7 @@ template <typename TConfig>
|
||||
class InputAll: public AdapterConfig<TConfig> {
|
||||
};
|
||||
|
||||
TYPED_TEST_CASE(InputAll, AdapterInputTypes);
|
||||
TYPED_TEST_SUITE(InputAll, AdapterInputTypes,);
|
||||
|
||||
|
||||
TYPED_TEST(InputAll, SettingMultipleErrorsAlwaysReturnsFirstError) {
|
||||
@@ -455,7 +455,7 @@ template <typename TConfig>
|
||||
class OutputAll: public AdapterConfig<TConfig> {
|
||||
};
|
||||
|
||||
TYPED_TEST_CASE(OutputAll, AdapterOutputTypes);
|
||||
TYPED_TEST_SUITE(OutputAll, AdapterOutputTypes,);
|
||||
|
||||
TYPED_TEST(OutputAll, CanBeMoveConstructedAndMoveAssigned) {
|
||||
auto w = this->config.createWriter();
|
||||
@@ -500,7 +500,7 @@ using BufferedAdapterInternalBufferTypes = ::testing::Types<
|
||||
std::string
|
||||
>;
|
||||
|
||||
TYPED_TEST_CASE(OutputStreamBuffered, BufferedAdapterInternalBufferTypes);
|
||||
TYPED_TEST_SUITE(OutputStreamBuffered, BufferedAdapterInternalBufferTypes,);
|
||||
|
||||
TYPED_TEST(OutputStreamBuffered, WhenInternalBufferIsFullThenWriteBufferToStream) {
|
||||
uint8_t x{};
|
||||
|
||||
@@ -156,12 +156,11 @@ T procBriefSyntax(const T& testData) {
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T&& procBriefSyntaxRvalue(const T& testData) {
|
||||
T&& procBriefSyntaxRvalue(T&& init_value, const T& testData) {
|
||||
SerializationContext ctx;
|
||||
ctx.createSerializer()(testData);
|
||||
T res{};
|
||||
ctx.createDeserializer()(res);
|
||||
return std::move(res);
|
||||
ctx.createDeserializer()(init_value);
|
||||
return std::move(init_value);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
@@ -426,17 +425,17 @@ TEST(BriefSyntax, StdTimePoint) {
|
||||
|
||||
TEST(BriefSyntax, StdAtomic) {
|
||||
std::atomic<int32_t> atm0{54654};
|
||||
EXPECT_TRUE(procBriefSyntaxRvalue(atm0) == atm0);
|
||||
EXPECT_TRUE(procBriefSyntaxRvalue(std::atomic<int32_t>{}, atm0) == atm0);
|
||||
|
||||
std::atomic<bool> atm1{false};
|
||||
EXPECT_TRUE(procBriefSyntaxRvalue(atm1) == atm1);
|
||||
EXPECT_TRUE(procBriefSyntaxRvalue(std::atomic<bool>{}, atm1) == atm1);
|
||||
|
||||
std::atomic<bool> atm2{true};
|
||||
EXPECT_TRUE(procBriefSyntaxRvalue(atm2) == atm2);
|
||||
EXPECT_TRUE(procBriefSyntaxRvalue(std::atomic<bool>{}, atm2) == atm2);
|
||||
|
||||
std::atomic<uint16_t> atm3;
|
||||
atm3.store(0x1337);
|
||||
EXPECT_TRUE(procBriefSyntaxRvalue(atm3).load() == 0x1337);
|
||||
EXPECT_TRUE(procBriefSyntaxRvalue(std::atomic<uint16_t>{}, atm3).load() == 0x1337);
|
||||
}
|
||||
|
||||
#if __cplusplus > 201402L
|
||||
|
||||
@@ -42,7 +42,7 @@ using FixedContainer = std::array<uint8_t, 100>;
|
||||
|
||||
using ContainerTypes = ::testing::Types<FixedContainer,NonFixedContainer>;
|
||||
|
||||
TYPED_TEST_CASE(DataWriting, ContainerTypes);
|
||||
TYPED_TEST_SUITE(DataWriting, ContainerTypes,);
|
||||
|
||||
static constexpr size_t DATA_SIZE = 14u;
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ using SequenceContainersWithArthmeticTypes = ::testing::Types<
|
||||
std::forward_list<int>,
|
||||
std::deque<unsigned short>>;
|
||||
|
||||
TYPED_TEST_CASE(SerializeContainerDynamicSizeArthmeticTypes, SequenceContainersWithArthmeticTypes);
|
||||
TYPED_TEST_SUITE(SerializeContainerDynamicSizeArthmeticTypes, SequenceContainersWithArthmeticTypes,);
|
||||
|
||||
TYPED_TEST(SerializeContainerDynamicSizeArthmeticTypes, Values) {
|
||||
SerializationContext ctx{};
|
||||
@@ -151,7 +151,7 @@ using SerializeContainerDynamicSizeWithCompositeTypes = ::testing::Types<
|
||||
std::vector<MyStruct1>,
|
||||
std::list<MyStruct2>>;
|
||||
|
||||
TYPED_TEST_CASE(SerializeContainerDynamicSizeCompositeTypes, SerializeContainerDynamicSizeWithCompositeTypes);
|
||||
TYPED_TEST_SUITE(SerializeContainerDynamicSizeCompositeTypes, SerializeContainerDynamicSizeWithCompositeTypes,);
|
||||
|
||||
TYPED_TEST(SerializeContainerDynamicSizeCompositeTypes, DefaultSerializeFunction) {
|
||||
SerializationContext ctx{};
|
||||
@@ -189,7 +189,7 @@ using StaticContainersWithIntegralTypes = ::testing::Types<
|
||||
std::array<int16_t, 4>,
|
||||
int16_t[4]>;
|
||||
|
||||
TYPED_TEST_CASE(SerializeContainerFixedSizeArithmeticTypes, StaticContainersWithIntegralTypes);
|
||||
TYPED_TEST_SUITE(SerializeContainerFixedSizeArithmeticTypes, StaticContainersWithIntegralTypes,);
|
||||
|
||||
TYPED_TEST(SerializeContainerFixedSizeArithmeticTypes, ArithmeticValues) {
|
||||
using Container = typename TestFixture::TContainer;
|
||||
@@ -214,7 +214,7 @@ class SerializeContainerFixedSizeCompositeTypes : public SerializeContainerFixed
|
||||
using StaticContainersWithCompositeTypes = ::testing::Types<
|
||||
std::array<MyStruct1, 4>, MyStruct1[4]>;
|
||||
|
||||
TYPED_TEST_CASE(SerializeContainerFixedSizeCompositeTypes, StaticContainersWithCompositeTypes);
|
||||
TYPED_TEST_SUITE(SerializeContainerFixedSizeCompositeTypes, StaticContainersWithCompositeTypes,);
|
||||
|
||||
TYPED_TEST(SerializeContainerFixedSizeCompositeTypes, DefaultSerializationFunction) {
|
||||
using Container = typename TestFixture::TContainer;
|
||||
@@ -269,6 +269,5 @@ TEST_P(SerializeContainer, SizeHasVariableLength) {
|
||||
EXPECT_THAT(ctx.getBufferSize(), Eq(ctx.containerSizeSerializedBytesCount(src.size())));
|
||||
}
|
||||
|
||||
//last comma is to suppress error that otherwise can be suppressed by clang/gcc with -Wgnu-zero-variadic-macro-arguments
|
||||
INSTANTIATE_TEST_CASE_P(LargeContainerSize, SerializeContainer, ::testing::Values(0x01, 0x80, 0x4000),);
|
||||
INSTANTIATE_TEST_SUITE_P(LargeContainerSize, SerializeContainer, ::testing::Values(0x01, 0x80, 0x4000));
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ using bitsery::EndiannessType;
|
||||
// helper function, that gets value filled with specified number of bits
|
||||
template <typename TValue>
|
||||
TValue getValue(bool isPositive, size_t significantBits) {
|
||||
TValue v = isPositive ? 0 : -1;
|
||||
TValue v = isPositive ? 0 : static_cast<TValue>(-1);
|
||||
if (significantBits == 0)
|
||||
return v;
|
||||
|
||||
@@ -47,7 +47,7 @@ TValue getValue(bool isPositive, size_t significantBits) {
|
||||
auto shiftBy = bitsery::details::BitsSize<TValue>::value - significantBits;
|
||||
mask = static_cast<TUnsigned>(mask >> shiftBy);
|
||||
//cast to unsigned when applying mask
|
||||
return static_cast<TValue>(v ^ mask);
|
||||
return v ^ static_cast<TValue>(mask);
|
||||
}
|
||||
|
||||
// helper function, that serialize and return deserialized value
|
||||
@@ -118,7 +118,7 @@ using AllValueSizesTestCases = ::testing::Types<
|
||||
TC<int64_t, false, BigEndianConfig>
|
||||
>;
|
||||
|
||||
TYPED_TEST_CASE(SerializeExtensionCompactValueCorrectness, AllValueSizesTestCases);
|
||||
TYPED_TEST_SUITE(SerializeExtensionCompactValueCorrectness, AllValueSizesTestCases,);
|
||||
|
||||
TYPED_TEST(SerializeExtensionCompactValueCorrectness, TestDifferentSizeValues) {
|
||||
using TCase = typename TestFixture::TestCase;
|
||||
@@ -202,7 +202,7 @@ using RequiredBytesTestCases = ::testing::Types<
|
||||
SizeTC<int64_t, false, 63,10>
|
||||
>;
|
||||
|
||||
TYPED_TEST_CASE(SerializeExtensionCompactValueRequiredBytes, RequiredBytesTestCases);
|
||||
TYPED_TEST_SUITE(SerializeExtensionCompactValueRequiredBytes, RequiredBytesTestCases,);
|
||||
|
||||
TYPED_TEST(SerializeExtensionCompactValueRequiredBytes, Test) {
|
||||
using TCase = typename TestFixture::TestCase;
|
||||
|
||||
@@ -176,7 +176,7 @@ TEST(SerializeExtensionEntropy, CustomFunctionNotEntropyEncodedWithAlignBeforeDa
|
||||
});
|
||||
|
||||
EXPECT_THAT(res, Eq(v));
|
||||
auto bitsForIndex = 8; //because aligned
|
||||
auto bitsForIndex = 8u; //because aligned
|
||||
EXPECT_THAT(ctx.getBufferSize(), Eq((bitsForIndex + rangeForValue.getRequiredBits() * 2 - 1) / 8 + 1 ));
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ struct MultipleVirtualInheritance : Derived1, Derived2 {
|
||||
|
||||
MultipleVirtualInheritance() = default;
|
||||
|
||||
MultipleVirtualInheritance(uint8_t x_, uint8_t y1_, uint8_t y2_, uint8_t z_) {
|
||||
MultipleVirtualInheritance(uint8_t x_, uint8_t y1_, uint8_t y2_, int8_t z_) {
|
||||
x = x_;
|
||||
y1 = y1_;
|
||||
y2 = y2_;
|
||||
|
||||
@@ -89,7 +89,7 @@ using SerializeExtensionStdMapTypes = ::testing::Types<
|
||||
std::multimap<int32_t ,int64_t>
|
||||
>;
|
||||
|
||||
TYPED_TEST_CASE(SerializeExtensionStdMap, SerializeExtensionStdMapTypes);
|
||||
TYPED_TEST_SUITE(SerializeExtensionStdMap, SerializeExtensionStdMapTypes,);
|
||||
|
||||
namespace bitsery {
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ using SerializeExtensionStdSetTypes = ::testing::Types<
|
||||
std::set<int32_t>,
|
||||
std::multiset<int32_t>>;
|
||||
|
||||
TYPED_TEST_CASE(SerializeExtensionStdSet, SerializeExtensionStdSetTypes);
|
||||
TYPED_TEST_SUITE(SerializeExtensionStdSet, SerializeExtensionStdSetTypes,);
|
||||
|
||||
TYPED_TEST(SerializeExtensionStdSet, ValuesSyntaxDifferentSetTypes) {
|
||||
SerializationContext ctx1;
|
||||
|
||||
@@ -197,13 +197,13 @@ using TestingWithNonPolymorphicTypes = ::testing::Types<
|
||||
UniquePtrTest,
|
||||
SharedPtrTest>;
|
||||
|
||||
TYPED_TEST_CASE(SerializeExtensionStdSmartPtrNonPolymorphicType, TestingWithNonPolymorphicTypes);
|
||||
TYPED_TEST_SUITE(SerializeExtensionStdSmartPtrNonPolymorphicType, TestingWithNonPolymorphicTypes,);
|
||||
|
||||
using TestingWithPolymorphicTypes = ::testing::Types<
|
||||
UniquePtrTest,
|
||||
SharedPtrTest>;
|
||||
|
||||
TYPED_TEST_CASE(SerializeExtensionStdSmartPtrPolymorphicType, TestingWithPolymorphicTypes);
|
||||
TYPED_TEST_SUITE(SerializeExtensionStdSmartPtrPolymorphicType, TestingWithPolymorphicTypes,);
|
||||
|
||||
TYPED_TEST(SerializeExtensionStdSmartPtrNonPolymorphicType, Data0Result0) {
|
||||
using Ptr = typename TestFixture::template TPtr<MyStruct1>;
|
||||
|
||||
Reference in New Issue
Block a user