From 0fd569ea417aa88ab196ccf9b251e2154c18369b Mon Sep 17 00:00:00 2001 From: Miki Rozloznik Date: Mon, 8 Jan 2024 14:21:09 +0100 Subject: [PATCH] Add clang-format to the C++ test project --- test/CMakeLists.txt | 22 +- .../cpp/ImplicitArrayBit8Test.cpp | 4 +- .../cpp/ImplicitArrayFloat16Test.cpp | 4 +- .../cpp/ImplicitArrayInt24Test.cpp | 6 +- .../cpp/ImplicitArrayUInt64Test.cpp | 4 +- .../cpp/ImplicitArrayUInt8Test.cpp | 4 +- .../cpp/LengthOfWithImplicitArrayTest.cpp | 4 +- .../cpp/TableWithImplicitArrayTest.cpp | 6 +- .../cpp/ComplexAllocationTest.cpp | 139 ++++---- .../cpp/PubsubAllocationTest.cpp | 20 +- .../cpp/ServiceAllocationTest.cpp | 7 +- .../cpp/SqlAllocationTest.cpp | 36 +- .../cpp/SetTopLevelPackageTest.cpp | 3 +- .../cpp/Bit4RangeCheckTest.cpp | 4 +- .../cpp/ChoiceBit4RangeCheckTest.cpp | 8 +- .../cpp/DynamicBitRangeCheckTest.cpp | 4 +- .../cpp/DynamicIntRangeCheckTest.cpp | 4 +- .../cpp/Int4RangeCheckTest.cpp | 4 +- .../cpp/Int7ArrayRangeCheckTest.cpp | 11 +- .../cpp/Int8RangeCheckTest.cpp | 4 +- .../cpp/OptionalBit31RangeCheckTest.cpp | 7 +- .../cpp/UInt8RangeCheckTest.cpp | 4 +- .../cpp/UnionInt4RangeCheckTest.cpp | 12 +- .../cpp/VarInt16RangeCheckTest.cpp | 4 +- .../cpp/VarInt32RangeCheckTest.cpp | 10 +- .../cpp/VarInt64RangeCheckTest.cpp | 10 +- .../cpp/VarSizeRangeCheckTest.cpp | 7 +- .../cpp/VarUInt16RangeCheckTest.cpp | 4 +- .../cpp/VarUInt32RangeCheckTest.cpp | 7 +- .../cpp/VarUInt64RangeCheckTest.cpp | 7 +- .../cpp/WithReflectionCodeTest.cpp | 170 ++++----- .../cpp/DefaultPackageAmalgamationTest.cpp | 8 +- .../cpp/WithSourcesAmalgamationTest.cpp | 57 ++- .../cpp/DebugStringTest.cpp | 330 +++++++++--------- .../cpp/WithTypeInfoCodeCreator.cpp | 17 +- .../cpp/WithTypeInfoCodeTest.cpp | 15 +- .../cpp/BlobTableValidationTest.cpp | 16 +- .../cpp/ColumnTypeValidationTest.cpp | 42 ++- .../cpp/ConstraintTableValidationTest.cpp | 12 +- .../cpp/ControlValidationTest.cpp | 47 +-- .../cpp/DependTableValidationTest.cpp | 6 +- .../cpp/FullRangeTableValidationTest.cpp | 8 +- .../cpp/HiddenColumnTableValidationTest.cpp | 4 +- .../cpp/SimpleTableValidationTest.cpp | 47 +-- .../cpp/VirtualTableValidationTest.cpp | 11 +- .../cpp/WithoutCrossExtensionCheckTest.cpp | 1 - .../cpp/WithoutPubsubCodeTest.cpp | 24 +- .../cpp/WithoutServiceCodeTest.cpp | 24 +- .../cpp/WithoutWriterCodeTest.cpp | 193 +++++----- .../cpp/CompatibilityErrorTest.cpp | 46 +-- .../cpp/CppGeneratorErrorTest.cpp | 8 +- .../cpp/AutoOptionalMemberAlignmentTest.cpp | 18 +- .../alignment/cpp/BitAlignmentTest.cpp | 6 +- .../cpp/OptionalMemberAlignmentTest.cpp | 10 +- .../array_types/cpp/ArraysMappingTest.cpp | 4 +- .../cpp/AutoArrayBitfieldParamTest.cpp | 10 +- .../cpp/AutoArrayStructRecursionTest.cpp | 4 +- .../cpp/AutoArraySubtypedUInt8Test.cpp | 8 +- .../array_types/cpp/AutoArrayUInt8Test.cpp | 4 +- .../array_types/cpp/FixedArrayUInt8Test.cpp | 4 +- .../cpp/PackedArraysMappingTest.cpp | 4 +- .../cpp/PackedAutoArrayBitfieldParamTest.cpp | 6 +- .../cpp/PackedAutoArrayEmptyCompoundsTest.cpp | 15 +- .../PackedAutoArrayRemovedEnumItemTest.cpp | 4 +- .../PackedAutoArrayStructRecursionTest.cpp | 8 +- .../PackedAutoArrayStructWithBytesTest.cpp | 6 +- .../PackedAutoArrayStructWithExternTest.cpp | 6 +- ...edAutoArrayStructWithUnpackedFieldTest.cpp | 4 +- .../cpp/PackedAutoArrayUInt8Test.cpp | 4 +- .../cpp/PackedFixedArrayUInt8Test.cpp | 4 +- ...PackedVariableArrayStructRecursionTest.cpp | 7 +- .../cpp/PackedVariableArrayStructTest.cpp | 15 +- .../cpp/PackedVariableArrayUInt8Test.cpp | 4 +- .../cpp/PackingInterfaceOptimizationTest.cpp | 71 ++-- .../cpp/VariableArrayStructCastInt8Test.cpp | 4 +- .../VariableArrayStructCastVarUIntTest.cpp | 4 +- .../cpp/VariableArraySubtypedStructTest.cpp | 24 +- .../cpp/VariableArrayTernaryOperatorTest.cpp | 8 +- .../bitmask_types/cpp/BitfieldBitmaskTest.cpp | 6 +- .../cpp/BitfieldConstBitmaskTest.cpp | 8 +- .../cpp/BitmaskDefinedByConstantTest.cpp | 8 +- .../cpp/BitmaskUsedByBitmaskTest.cpp | 8 +- .../cpp/BitmaskWithoutNoneTest.cpp | 6 +- .../bitmask_types/cpp/UInt64BitmaskTest.cpp | 13 +- .../bitmask_types/cpp/UInt8BitmaskTest.cpp | 6 +- .../bitmask_types/cpp/VarUIntBitmaskTest.cpp | 6 +- .../builtin_types/cpp/AllBuiltInTypesTest.cpp | 6 +- .../cpp/BitFieldFunctionLengthTest.cpp | 13 +- .../cpp/BitFieldUInt64LengthTest.cpp | 4 +- .../cpp/BitmaskParamChoiceTest.cpp | 12 +- .../choice_types/cpp/BoolParamChoiceTest.cpp | 10 +- .../cpp/ChoiceCompatibilityCheckTest.cpp | 62 ++-- .../choice_types/cpp/ChoiceWithArrayTest.cpp | 14 +- .../cpp/DefaultEmptyChoiceTest.cpp | 12 +- .../choice_types/cpp/EmptyChoiceTest.cpp | 6 +- .../cpp/EmptyChoiceWithCaseTest.cpp | 10 +- .../cpp/EmptyChoiceWithDefaultTest.cpp | 10 +- .../choice_types/cpp/EnumParamChoiceTest.cpp | 12 +- .../EnumWithRemovedItemParamChoiceTest.cpp | 4 +- .../cpp/ExpressionSelectorChoiceTest.cpp | 3 +- .../cpp/FullBitmaskParamChoiceTest.cpp | 16 +- .../cpp/FullEnumParamChoiceTest.cpp | 12 +- ...tionReturningLiteralSelectorChoiceTest.cpp | 3 +- .../cpp/FunctionSelectorChoiceTest.cpp | 3 +- .../cpp/UInt16ParamChoiceTest.cpp | 12 +- .../cpp/UInt32ParamChoiceTest.cpp | 10 +- .../cpp/UInt64ParamChoiceTest.cpp | 11 +- test/language/constants/cpp/ConstantsTest.cpp | 11 +- .../cpp/ArrayLengthofConstraintTest.cpp | 6 +- .../constraints/cpp/ChoiceConstraintsTest.cpp | 10 +- .../constraints/cpp/LiteralConstraintTest.cpp | 6 +- .../cpp/StructureBitmaskConstraintsTest.cpp | 12 +- .../cpp/StructureConstraintsTest.cpp | 10 +- .../constraints/cpp/UnionConstraintsTest.cpp | 7 +- .../cpp/StructureDefaultValuesTest.cpp | 8 +- .../cpp/BitfieldConstEnumTest.cpp | 6 +- .../cpp/BitfieldEnumTest.cpp | 6 +- .../cpp/DeprecatedEnumItemTest.cpp | 12 +- .../cpp/EnumDefinedByConstantTest.cpp | 6 +- .../cpp/EnumUsedByEnumTest.cpp | 25 +- .../cpp/MultipleRemovedEnumItemsTest.cpp | 7 +- .../cpp/RemovedEnumItemTest.cpp | 31 +- .../enumeration_types/cpp/UInt64EnumTest.cpp | 10 +- .../enumeration_types/cpp/UInt8EnumTest.cpp | 6 +- .../enumeration_types/cpp/VarUIntEnumTest.cpp | 10 +- .../cpp/ExplicitBitmaskParamTest.cpp | 14 +- .../cpp/ExplicitBlobParamTest.cpp | 10 +- .../cpp/ExplicitEnumParamTest.cpp | 10 +- .../cpp/ExplicitSameAsFieldTest.cpp | 10 +- .../cpp/ExplicitSimpleParamTest.cpp | 10 +- .../cpp/MultipleExplicitParamsTest.cpp | 10 +- .../cpp/MultipleWithSameNameTest.cpp | 16 +- .../expressions/cpp/ArrayTypeTest.cpp | 4 +- .../expressions/cpp/BitmaskTypeTest.cpp | 3 +- .../expressions/cpp/CastUInt64ToUInt8Test.cpp | 3 +- .../expressions/cpp/CastUInt8ToUInt64Test.cpp | 3 +- .../expressions/cpp/ConstTypeTest.cpp | 3 +- .../expressions/cpp/EnumerationTypeTest.cpp | 3 +- .../expressions/cpp/FieldTypeTest.cpp | 3 +- .../cpp/FieldTypeWithClashTest.cpp | 3 +- .../expressions/cpp/FloatTypeTest.cpp | 3 +- .../expressions/cpp/FullConstTypeTest.cpp | 3 +- .../cpp/FullEnumerationTypeTest.cpp | 3 +- .../expressions/cpp/FunctionTypeTest.cpp | 3 +- .../expressions/cpp/IndexOperatorTest.cpp | 13 +- .../expressions/cpp/IsSetOperatorTest.cpp | 3 +- .../expressions/cpp/LengthOfOperatorTest.cpp | 4 +- .../expressions/cpp/ModuloOperatorTest.cpp | 3 +- .../expressions/cpp/NegationOperatorTest.cpp | 3 +- .../expressions/cpp/NumBitsOperatorTest.cpp | 31 +- .../expressions/cpp/ParameterTypeTest.cpp | 3 +- .../cpp/ParameterizedArrayTypeTest.cpp | 12 +- .../expressions/cpp/ParenthesisTest.cpp | 3 +- .../expressions/cpp/QuestionMarkTest.cpp | 3 +- .../expressions/cpp/StringTypeTest.cpp | 22 +- .../expressions/cpp/UInt64TypeTest.cpp | 3 +- .../expressions/cpp/UsedBeforeTypeTest.cpp | 3 +- .../expressions/cpp/ValueOfOperatorTest.cpp | 3 +- .../cpp/ExtendedChoiceFieldTest.cpp | 14 +- .../cpp/ExtendedCompoundFieldTest.cpp | 14 +- .../cpp/ExtendedEmptyStructureTest.cpp | 9 +- .../cpp/ExtendedFieldInTemplateTest.cpp | 8 +- .../cpp/ExtendedIndexedOffsetsTest.cpp | 14 +- ...ExtendedOptionalParameterizedFieldTest.cpp | 8 +- .../cpp/ExtendedSimpleFieldTest.cpp | 6 +- .../cpp/ExtendedUnalignedFieldTest.cpp | 7 +- .../cpp/MultipleExtendedFieldsTest.cpp | 15 +- ...MultipleExtendedFieldsVariousTypesTest.cpp | 24 +- .../functions/cpp/ChoiceArrayTest.cpp | 10 +- .../functions/cpp/StructureArrayParamTest.cpp | 20 +- .../functions/cpp/StructureArrayTest.cpp | 15 +- .../functions/cpp/StructureBytesTest.cpp | 4 +- .../functions/cpp/StructureExternTest.cpp | 7 +- .../functions/cpp/StructureOptionalTest.cpp | 22 +- .../functions/cpp/StructureParamTest.cpp | 10 +- .../cpp/StructureParentChildValueTest.cpp | 8 +- .../functions/cpp/StructureStringTest.cpp | 5 +- .../functions/cpp/StructureValueTest.cpp | 14 +- .../language/functions/cpp/UnionArrayTest.cpp | 15 +- .../cpp/BitmaskNameClashingWithJavaTest.cpp | 6 +- .../cpp/StructureNameClashingWithJavaTest.cpp | 22 +- .../cpp/AutoIndexedOffsetArrayTest.cpp | 26 +- .../cpp/Bit5IndexedOffsetArrayTest.cpp | 24 +- .../cpp/BoolIndexedOffsetArrayTest.cpp | 24 +- .../cpp/CompoundIndexedOffsetArrayTest.cpp | 31 +- .../cpp/EmptyIndexedOffsetArrayTest.cpp | 14 +- .../cpp/Int14IndexedOffsetArrayTest.cpp | 24 +- .../cpp/OptionalIndexedOffsetArrayTest.cpp | 26 +- .../OptionalNestedIndexedOffsetArrayTest.cpp | 26 +- .../cpp/PackedAutoIndexedOffsetArrayTest.cpp | 31 +- .../PackedIndexedOffsetArrayHolderTest.cpp | 7 +- .../cpp/VarInt32IndexedOffsetArrayTest.cpp | 21 +- test/language/literals/cpp/LiteralsTest.cpp | 1 - .../cpp/AccessWithinTypeTest.cpp | 11 +- .../offsets/cpp/AutoArrayOffsetTest.cpp | 26 +- test/language/offsets/cpp/BitOffsetTest.cpp | 36 +- .../language/offsets/cpp/NestedOffsetTest.cpp | 24 +- .../offsets/cpp/OptionalMemberOffsetTest.cpp | 14 +- .../offsets/cpp/PackedAutoArrayOffsetTest.cpp | 6 +- .../offsets/cpp/ParameterOffsetTest.cpp | 20 +- .../offsets/cpp/TernaryOperatorOffsetTest.cpp | 14 +- .../language/offsets/cpp/UInt64OffsetTest.cpp | 15 +- .../optional_members/cpp/AutoOptionalTest.cpp | 14 +- .../cpp/OptionalArrayRecursionTest.cpp | 20 +- .../cpp/OptionalArrayTest.cpp | 2 - .../cpp/OptionalExpressionTest.cpp | 24 +- ...ionalExpressionWithRemovedEnumItemTest.cpp | 4 +- .../cpp/OptionalRecursionTest.cpp | 6 +- test/language/packages/cpp/IndexTest.cpp | 8 +- .../packages/cpp/PackageNameConflictTest.cpp | 3 +- test/language/packages/cpp/ReaderTest.cpp | 4 +- .../cpp/ArrayElementParamTest.cpp | 9 +- .../cpp/ArrayElementParamWithOptionalTest.cpp | 5 +- .../cpp/BytesParamTest.cpp | 4 +- .../cpp/DynamicBitfieldParamTest.cpp | 10 +- .../cpp/ExternParamTest.cpp | 4 +- .../cpp/FixedAndVariableParamTest.cpp | 44 ++- .../cpp/GrandChildParamTest.cpp | 19 +- .../cpp/NestedParameterizedFieldTest.cpp | 2 - .../cpp/PackedArrayElementParamTest.cpp | 7 +- .../cpp/ParamWithOptionalTest.cpp | 2 - .../ParameterizedInnerClassesClashingTest.cpp | 12 +- .../cpp/ParameterizedParamTest.cpp | 10 +- .../cpp/SimpleParamTest.cpp | 10 +- .../cpp/SubtypedBitfieldParamTest.cpp | 10 +- .../pubsub_types/cpp/SimplePubsubTest.cpp | 24 +- .../cpp/ComplexTypesServiceTest.cpp | 59 ++-- .../service_types/cpp/SimpleServiceTest.cpp | 34 +- .../cpp/FieldConstraintsTest.cpp | 7 +- .../cpp/TableConstraintsTest.cpp | 7 +- .../cpp/DbWithRelocationTest.cpp | 16 +- .../sql_databases/cpp/SimpleDbTest.cpp | 26 +- ...eldWithChildrenInitializationTableTest.cpp | 2 - .../cpp/BlobOffsetsParamTableTest.cpp | 20 +- .../sql_tables/cpp/BlobParamTableTest.cpp | 17 +- .../sql_tables/cpp/ColumnParamTableTest.cpp | 14 +- .../sql_tables/cpp/ComplexTableTest.cpp | 18 +- .../sql_tables/cpp/ConstParamTableTest.cpp | 16 +- .../cpp/DynamicBitFieldEnumFieldTableTest.cpp | 14 +- .../sql_tables/cpp/MultiplePkTableTest.cpp | 16 +- .../cpp/SubtypedBitmaskFieldTableTest.cpp | 12 +- .../cpp/SubtypedBoolFieldTableTest.cpp | 4 +- .../cpp/SubtypedEnumFieldTableTest.cpp | 10 +- .../sql_tables/cpp/SubtypedTableTest.cpp | 8 +- .../sql_tables/cpp/WithoutPkTableTest.cpp | 16 +- test/language/sql_types/cpp/SqlTypesTest.cpp | 5 +- .../cpp/HiddenVirtualColumnsTest.cpp | 21 +- .../cpp/SimpleVirtualColumnsTest.cpp | 24 +- .../cpp/Fts3VirtualTableTest.cpp | 21 +- .../cpp/Fts5VirtualTableTest.cpp | 22 +- .../cpp/RowIdAndWithoutRowIdTablesTest.cpp | 8 +- .../cpp/SimpleWithoutRowIdTableTest.cpp | 8 +- .../cpp/EmptyStructureTest.cpp | 10 +- .../cpp/EmptyStructureWithParameterTest.cpp | 6 +- .../cpp/FieldConstructorClashingTest.cpp | 6 +- .../cpp/OneStringStructureTest.cpp | 10 +- .../cpp/SimpleStructureTest.cpp | 14 +- .../cpp/StructureInnerClassesClashingTest.cpp | 6 +- .../StructureWithRemovedEnumItemFieldTest.cpp | 10 +- .../subtypes/cpp/BitmaskSubtypeTest.cpp | 5 +- .../language/subtypes/cpp/EnumSubtypeTest.cpp | 5 +- .../cpp/ParamStructureSubtypeTest.cpp | 62 ++-- .../subtypes/cpp/StructureSubtypeTest.cpp | 6 +- .../subtypes/cpp/SubtypeImportedTest.cpp | 1 - .../subtypes/cpp/UInt16SubtypeTest.cpp | 3 +- .../cpp/ChoiceTemplatedEnumSelectorTest.cpp | 2 - .../cpp/ChoiceTemplatedFieldTest.cpp | 1 - .../cpp/ChoiceTemplatedSelectorTest.cpp | 2 - .../ExpressionBitmaskTemplateArgumentTest.cpp | 1 - ...essionEnumTemplateArgumentConflictTest.cpp | 1 - .../ExpressionEnumTemplateArgumentTest.cpp | 1 - .../ExpressionFullTemplateArgumentTest.cpp | 1 - .../cpp/FunctionTemplatedReturnTypeTest.cpp | 6 +- .../cpp/InstantiateClashOtherTemplateTest.cpp | 1 - .../templates/cpp/InstantiateImportedTest.cpp | 1 - .../cpp/InstantiateNestedTemplateTest.cpp | 1 - .../cpp/InstantiateNotImportedTest.cpp | 1 - .../cpp/InstantiateOnlyNestedTest.cpp | 1 - .../templates/cpp/InstantiateSimpleTest.cpp | 1 - .../templates/cpp/InstantiateSqlTableTest.cpp | 7 +- .../cpp/InstantiateTemplateArgumentTest.cpp | 1 - .../cpp/InstantiateTypeAsChoiceFieldTest.cpp | 1 - .../cpp/InstantiateTypeAsParameterTest.cpp | 5 +- .../InstantiateTypeAsSqlDatabaseFieldTest.cpp | 2 - .../InstantiateTypeAsSqlTableFieldTest.cpp | 7 +- .../InstantiateTypeAsStructArrayFieldTest.cpp | 1 - .../cpp/InstantiateTypeAsStructFieldTest.cpp | 1 - .../InstantiateTypeAsTemplateArgumentTest.cpp | 5 +- ...stantiateTypeImportedAsStructFieldTest.cpp | 1 - ...antiateTypeOnParameterizedTemplateTest.cpp | 5 +- .../templates/cpp/InstantiateUnusedTest.cpp | 1 - .../cpp/InstantiateViaImportTest.cpp | 1 - .../cpp/InstantiateViaSingleImportTest.cpp | 1 - .../cpp/InstantiateVsDefaultTest.cpp | 1 - ...ateWithInstantiateTemplateArgumentTest.cpp | 1 - .../cpp/SqlTableTemplatedFieldTest.cpp | 2 - ...StructFullAndShortTemplateArgumentTest.cpp | 1 - .../StructFullNameTemplateArgumentTest.cpp | 2 - .../StructLongTemplateArgumentClashTest.cpp | 7 +- .../cpp/StructLongTemplateArgumentTest.cpp | 4 +- .../cpp/StructRecursiveTemplateTest.cpp | 2 - .../StructTemplateClashAcrossPackagesTest.cpp | 5 +- .../StructTemplateClashOtherTemplateTest.cpp | 1 - .../cpp/StructTemplateClashOtherTypeTest.cpp | 1 - .../templates/cpp/StructTemplateClashTest.cpp | 5 +- .../cpp/StructTemplateInTemplateTest.cpp | 2 - .../cpp/StructTemplatedFieldTest.cpp | 2 - .../StructTemplatedTemplateArgumentTest.cpp | 1 - .../cpp/StructTemplatedTypeArgumentTest.cpp | 2 - .../cpp/SubtypeTemplateArgumentTest.cpp | 5 +- .../cpp/SubtypeTemplateWithBuiltinTest.cpp | 1 - .../cpp/SubtypeTemplateWithCompoundTest.cpp | 1 - .../cpp/TemplatedStructRecursionTest.cpp | 19 +- .../templates/cpp/UnionTemplatedFieldTest.cpp | 1 - .../union_types/cpp/EmptyUnionTest.cpp | 6 +- .../cpp/EmptyUnionWithParameterTest.cpp | 34 +- .../union_types/cpp/SimpleUnionTest.cpp | 8 +- .../cpp/UnionCompatibilityCheckTest.cpp | 25 +- .../union_types/cpp/UnionWithArrayTest.cpp | 12 +- .../cpp/UnionWithParameterTest.cpp | 7 +- .../cpp/UnionWithParameterizedFieldTest.cpp | 6 +- test/others/gif/cpp/GifTest.cpp | 4 +- test/utils/cpp/test_utils/Assertions.h | 43 ++- test/utils/cpp/test_utils/CMakeLists.txt | 33 ++ .../utils/cpp/test_utils/LocalServiceClient.h | 12 +- test/utils/cpp/test_utils/MemoryResources.h | 17 +- test/utils/cpp/test_utils/TestPubsub.h | 13 +- .../cpp/test_utils/ValidationObservers.h | 35 +- test/utils/cpp/test_utils/ZserioErrorOutput.h | 6 +- .../cpp/ArrayTypesWarningTest.cpp | 53 +-- ...ackedArrayChoiceHasNoPackableFieldTest.cpp | 18 +- ...ackedArrayStructHasNoPackableFieldTest.cpp | 33 +- ...kedArrayTemplateHasNoPackableFieldTest.cpp | 20 +- ...PackedArrayUnionHasNoPackableFieldTest.cpp | 20 +- .../PackedArrayUnpackableBoolElementTest.cpp | 17 +- .../PackedArrayUnpackableBytesElementTest.cpp | 8 +- ...PackedArrayUnpackableExternElementTest.cpp | 16 +- .../PackedArrayUnpackableFloatElementTest.cpp | 9 +- ...PackedArrayUnpackableStringElementTest.cpp | 9 +- .../cpp/ChoiceTypesWarningTest.cpp | 8 +- .../cpp/CommentsWarningTest.cpp | 71 ++-- .../cpp/DocCommentMissingWarningTest.cpp | 101 ++++-- .../cpp/CompatibilityWarningTest.cpp | 12 +- .../cpp/FileEncodingWarningTest.cpp | 5 +- .../cpp/FunctionsWarningTest.cpp | 11 +- .../cpp/NotHandledWarningTest.cpp | 11 +- .../cpp/OptionalMembersWarningTest.cpp | 26 +- .../cpp/PackagesWarningTest.cpp | 17 +- .../cpp/SqlTablesWarningTest.cpp | 26 +- .../cpp/SqlWithoutRowIdTablesWarningTest.cpp | 8 +- .../cpp/TemplatesWarningTest.cpp | 26 +- .../cpp/UnusedTypeWarningTest.cpp | 23 +- 352 files changed, 2115 insertions(+), 2787 deletions(-) create mode 100644 test/utils/cpp/test_utils/CMakeLists.txt diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index cccfa37e8..b83e35406 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -14,6 +14,7 @@ enable_testing() set(CPPCHECK_HOME "" CACHE PATH "Home directory of cppcheck tool. If empty, cppcheck tool is not called.") set(SANITIZERS_ENABLED OFF CACHE BOOL "Whether the compiler sanitizers are enabled.") set(CLANG_TIDY_BIN "" CACHE STRING "Name of clang-tidy binary. If empty, clang-tidy tool is not called.") +set(CLANG_FORMAT_BIN "" CACHE STRING "Name of clang-format binary. If empty, clang-format tool is not called.") set(ZSERIO_PROJECT_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/..") set(ZSERIO_RELEASE_ROOT "${ZSERIO_PROJECT_ROOT}/distr" CACHE PATH "Root directory of Zserio release binaries.") @@ -25,6 +26,7 @@ set(CMAKE_MODULE_PATH ${ZSERIO_PROJECT_ROOT}/cmake) # cmake helpers include(cmake_utils) include(clang_tidy_utils) +include(clang_format_utils) include(cppcheck_utils) # setup compiler @@ -36,6 +38,10 @@ compiler_set_static_clibs() if (SANITIZERS_ENABLED) compiler_set_address_sanitizer() endif () + +# add test utility library +add_subdirectory(utils/cpp/test_utils test_utils) + # add gtest library include(gtest_utils) gtest_add_library(${ZSERIO_PROJECT_ROOT}/3rdparty/cpp/googletest) @@ -93,6 +99,18 @@ function(add_custom_test TEST_NAME) HEADER_FILTER "${CMAKE_CURRENT_SOURCE_DIR}/.*|${CMAKE_CURRENT_BINARY_DIR}/.*") + if (DEFINED TEST_ARG_SOURCES) + clang_format_add_custom_target(${TEST_NAME}-clang-format + DEPENDS + ${TEST_NAME} + SOURCES + "${TEST_ARG_SOURCES}" + CONFIG_FILE + "${ZSERIO_PROJECT_ROOT}/.clang-format" + WERROR + ON) + endif () + get_generated_dirs("${TEST_ARG_GENERATED_SOURCES}" GENERATED_DIRS) cppcheck_add_custom_command(TARGET ${TEST_NAME} SOURCE_DIR @@ -137,8 +155,8 @@ endif () # add_executable requieres at least a single source file add_executable(${PROJECT_NAME} ${TEST_SOURCES_LIST}) -target_link_libraries(${PROJECT_NAME} ${TEST_DEPENDENCIES_LIST} gtest_main ZserioCppRuntime ${SQLITE_LIBRARY}) -target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/utils/cpp) +target_link_libraries(${PROJECT_NAME} ${TEST_DEPENDENCIES_LIST} gtest_main ZserioCppTestUtils ZserioCppRuntime + ${SQLITE_LIBRARY}) target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${SQLITE_INCDIR}) # add tests - test are labeled by file names (i.e. grouped) diff --git a/test/arguments/allow_implicit_arrays/cpp/ImplicitArrayBit8Test.cpp b/test/arguments/allow_implicit_arrays/cpp/ImplicitArrayBit8Test.cpp index ad4aad818..766c5fe15 100644 --- a/test/arguments/allow_implicit_arrays/cpp/ImplicitArrayBit8Test.cpp +++ b/test/arguments/allow_implicit_arrays/cpp/ImplicitArrayBit8Test.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "allow_implicit_arrays/implicit_array_bit8/ImplicitArray.h" - +#include "gtest/gtest.h" #include "zserio/RebindAlloc.h" #include "zserio/SerializeUtil.h" diff --git a/test/arguments/allow_implicit_arrays/cpp/ImplicitArrayFloat16Test.cpp b/test/arguments/allow_implicit_arrays/cpp/ImplicitArrayFloat16Test.cpp index a621c8715..cea0964f8 100644 --- a/test/arguments/allow_implicit_arrays/cpp/ImplicitArrayFloat16Test.cpp +++ b/test/arguments/allow_implicit_arrays/cpp/ImplicitArrayFloat16Test.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "allow_implicit_arrays/implicit_array_float16/ImplicitArray.h" - +#include "gtest/gtest.h" #include "zserio/RebindAlloc.h" #include "zserio/SerializeUtil.h" diff --git a/test/arguments/allow_implicit_arrays/cpp/ImplicitArrayInt24Test.cpp b/test/arguments/allow_implicit_arrays/cpp/ImplicitArrayInt24Test.cpp index 73bb77991..a52d8ae07 100644 --- a/test/arguments/allow_implicit_arrays/cpp/ImplicitArrayInt24Test.cpp +++ b/test/arguments/allow_implicit_arrays/cpp/ImplicitArrayInt24Test.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "allow_implicit_arrays/implicit_array_int24/ImplicitArray.h" - +#include "gtest/gtest.h" #include "zserio/RebindAlloc.h" #include "zserio/SerializeUtil.h" @@ -113,5 +111,5 @@ TEST_F(ImplicitArrayInt24Test, writeReadFile) ASSERT_EQ(static_cast(i), readArray[i]); } -} // namespace implicit_array_bit8 +} // namespace implicit_array_int24 } // namespace allow_implicit_arrays diff --git a/test/arguments/allow_implicit_arrays/cpp/ImplicitArrayUInt64Test.cpp b/test/arguments/allow_implicit_arrays/cpp/ImplicitArrayUInt64Test.cpp index c99715add..56b0bb724 100644 --- a/test/arguments/allow_implicit_arrays/cpp/ImplicitArrayUInt64Test.cpp +++ b/test/arguments/allow_implicit_arrays/cpp/ImplicitArrayUInt64Test.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "allow_implicit_arrays/implicit_array_uint64/ImplicitArray.h" - +#include "gtest/gtest.h" #include "zserio/RebindAlloc.h" #include "zserio/SerializeUtil.h" diff --git a/test/arguments/allow_implicit_arrays/cpp/ImplicitArrayUInt8Test.cpp b/test/arguments/allow_implicit_arrays/cpp/ImplicitArrayUInt8Test.cpp index 3f49a6d7a..fc0220909 100644 --- a/test/arguments/allow_implicit_arrays/cpp/ImplicitArrayUInt8Test.cpp +++ b/test/arguments/allow_implicit_arrays/cpp/ImplicitArrayUInt8Test.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "allow_implicit_arrays/implicit_array_uint8/ImplicitArray.h" - +#include "gtest/gtest.h" #include "zserio/RebindAlloc.h" #include "zserio/SerializeUtil.h" diff --git a/test/arguments/allow_implicit_arrays/cpp/LengthOfWithImplicitArrayTest.cpp b/test/arguments/allow_implicit_arrays/cpp/LengthOfWithImplicitArrayTest.cpp index 2663804a2..5a3f6a569 100644 --- a/test/arguments/allow_implicit_arrays/cpp/LengthOfWithImplicitArrayTest.cpp +++ b/test/arguments/allow_implicit_arrays/cpp/LengthOfWithImplicitArrayTest.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "allow_implicit_arrays/lengthof_with_implicit_array/LengthOfWithImplicitArray.h" - +#include "gtest/gtest.h" #include "zserio/RebindAlloc.h" namespace allow_implicit_arrays diff --git a/test/arguments/allow_implicit_arrays/cpp/TableWithImplicitArrayTest.cpp b/test/arguments/allow_implicit_arrays/cpp/TableWithImplicitArrayTest.cpp index a7da359ec..ae7ef005e 100644 --- a/test/arguments/allow_implicit_arrays/cpp/TableWithImplicitArrayTest.cpp +++ b/test/arguments/allow_implicit_arrays/cpp/TableWithImplicitArrayTest.cpp @@ -1,11 +1,9 @@ #include -#include #include - -#include "gtest/gtest.h" +#include #include "allow_implicit_arrays/table_with_implicit_array/DbWithImplicitArray.h" - +#include "gtest/gtest.h" #include "zserio/RebindAlloc.h" #include "zserio/StringConvertUtil.h" diff --git a/test/arguments/set_cpp_allocator/cpp/ComplexAllocationTest.cpp b/test/arguments/set_cpp_allocator/cpp/ComplexAllocationTest.cpp index dda8636cb..0f3087e59 100644 --- a/test/arguments/set_cpp_allocator/cpp/ComplexAllocationTest.cpp +++ b/test/arguments/set_cpp_allocator/cpp/ComplexAllocationTest.cpp @@ -1,15 +1,12 @@ -#include -#include #include - -#include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" -#include "zserio/BitStreamReader.h" +#include +#include #include "complex_allocation/MainStructure.h" - +#include "gtest/gtest.h" #include "test_utils/MemoryResources.h" +#include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" using namespace zserio::literals; using namespace test_utils; @@ -98,23 +95,23 @@ class ComplexAllocationTest : public ::testing::Test writer.writeBits(STRUCT_PACKED_ELEMENT_ARRAY_MAX_BIT_NUMBER, 6); writer.writeBits(STRUCT_PACKED_ELEMENT_ARRAY_ELEMENT0_Z, 32); // x1 - writer.writeSignedBits(STRUCT_PACKED_ELEMENT_ARRAY_DELTA, - STRUCT_PACKED_ELEMENT_ARRAY_MAX_BIT_NUMBER + 1); + writer.writeSignedBits( + STRUCT_PACKED_ELEMENT_ARRAY_DELTA, STRUCT_PACKED_ELEMENT_ARRAY_MAX_BIT_NUMBER + 1); // y1 - writer.writeSignedBits(STRUCT_PACKED_ELEMENT_ARRAY_DELTA, - STRUCT_PACKED_ELEMENT_ARRAY_MAX_BIT_NUMBER + 1); + writer.writeSignedBits( + STRUCT_PACKED_ELEMENT_ARRAY_DELTA, STRUCT_PACKED_ELEMENT_ARRAY_MAX_BIT_NUMBER + 1); // z1 - writer.writeSignedBits(STRUCT_PACKED_ELEMENT_ARRAY_DELTA, - STRUCT_PACKED_ELEMENT_ARRAY_MAX_BIT_NUMBER + 1); + writer.writeSignedBits( + STRUCT_PACKED_ELEMENT_ARRAY_DELTA, STRUCT_PACKED_ELEMENT_ARRAY_MAX_BIT_NUMBER + 1); // x2 - writer.writeSignedBits(STRUCT_PACKED_ELEMENT_ARRAY_DELTA, - STRUCT_PACKED_ELEMENT_ARRAY_MAX_BIT_NUMBER + 1); + writer.writeSignedBits( + STRUCT_PACKED_ELEMENT_ARRAY_DELTA, STRUCT_PACKED_ELEMENT_ARRAY_MAX_BIT_NUMBER + 1); // y2 - writer.writeSignedBits(STRUCT_PACKED_ELEMENT_ARRAY_DELTA, - STRUCT_PACKED_ELEMENT_ARRAY_MAX_BIT_NUMBER + 1); + writer.writeSignedBits( + STRUCT_PACKED_ELEMENT_ARRAY_DELTA, STRUCT_PACKED_ELEMENT_ARRAY_MAX_BIT_NUMBER + 1); // z2 - writer.writeSignedBits(STRUCT_PACKED_ELEMENT_ARRAY_DELTA, - STRUCT_PACKED_ELEMENT_ARRAY_MAX_BIT_NUMBER + 1); + writer.writeSignedBits( + STRUCT_PACKED_ELEMENT_ARRAY_DELTA, STRUCT_PACKED_ELEMENT_ARRAY_MAX_BIT_NUMBER + 1); // structOptionalField writer.writeBool(true); @@ -161,8 +158,8 @@ class ComplexAllocationTest : public ::testing::Test stringArray.emplace_back(STRING_ARRAY_ELEMENT2, allocator); } - void fillChoiceField(allocation_choice::AllocationChoice& choiceField, const allocator_type& allocator, - bool hasArray) + void fillChoiceField( + allocation_choice::AllocationChoice& choiceField, const allocator_type& allocator, bool hasArray) { choiceField.initialize(hasArray); if (hasArray) @@ -175,13 +172,13 @@ class ComplexAllocationTest : public ::testing::Test } else { - choiceField.setCompound(allocation_choice::ChoiceCompound(CHOICE_COMPOUND_ELEMENT0_VALUE16, - CHOICE_COMPOUND_ELEMENT0_IS_VALID, allocator)); + choiceField.setCompound(allocation_choice::ChoiceCompound( + CHOICE_COMPOUND_ELEMENT0_VALUE16, CHOICE_COMPOUND_ELEMENT0_IS_VALID, allocator)); } } - void fillUnionField(allocation_union::AllocationUnion& unionField, const allocator_type& allocator, - bool hasArray) + void fillUnionField( + allocation_union::AllocationUnion& unionField, const allocator_type& allocator, bool hasArray) { if (hasArray) { @@ -192,8 +189,8 @@ class ComplexAllocationTest : public ::testing::Test } else { - unionField.setCompound(allocation_union::UnionCompound(UNION_COMPOUND_ELEMENT0_VALUE16, - UNION_COMPOUND_ELEMENT0_IS_VALID, allocator)); + unionField.setCompound(allocation_union::UnionCompound( + UNION_COMPOUND_ELEMENT0_VALUE16, UNION_COMPOUND_ELEMENT0_IS_VALID, allocator)); } } @@ -213,19 +210,15 @@ class ComplexAllocationTest : public ::testing::Test packedUInt16Array.push_back(STRUCT_PACKED_UINT16_ARRAY_ELEMENT2); auto& packedElementArray = structField.getPackedElementArray(); packedElementArray.reserve(STRUCT_PACKED_ELEMENT_ARRAY_SIZE); - packedElementArray.emplace_back( - STRUCT_PACKED_ELEMENT_ARRAY_ELEMENT0_X, - STRUCT_PACKED_ELEMENT_ARRAY_ELEMENT0_Y, - STRUCT_PACKED_ELEMENT_ARRAY_ELEMENT0_Z); - packedElementArray.emplace_back( - STRUCT_PACKED_ELEMENT_ARRAY_ELEMENT0_X + + packedElementArray.emplace_back(STRUCT_PACKED_ELEMENT_ARRAY_ELEMENT0_X, + STRUCT_PACKED_ELEMENT_ARRAY_ELEMENT0_Y, STRUCT_PACKED_ELEMENT_ARRAY_ELEMENT0_Z); + packedElementArray.emplace_back(STRUCT_PACKED_ELEMENT_ARRAY_ELEMENT0_X + static_cast(STRUCT_PACKED_ELEMENT_ARRAY_DELTA), STRUCT_PACKED_ELEMENT_ARRAY_ELEMENT0_Y + static_cast(STRUCT_PACKED_ELEMENT_ARRAY_DELTA), STRUCT_PACKED_ELEMENT_ARRAY_ELEMENT0_Z + static_cast(STRUCT_PACKED_ELEMENT_ARRAY_DELTA)); - packedElementArray.emplace_back( - STRUCT_PACKED_ELEMENT_ARRAY_ELEMENT0_X + + packedElementArray.emplace_back(STRUCT_PACKED_ELEMENT_ARRAY_ELEMENT0_X + static_cast(STRUCT_PACKED_ELEMENT_ARRAY_DELTA) * 2, STRUCT_PACKED_ELEMENT_ARRAY_ELEMENT0_Y + static_cast(STRUCT_PACKED_ELEMENT_ARRAY_DELTA) * 2, @@ -254,8 +247,8 @@ class ComplexAllocationTest : public ::testing::Test BitBuffer createExternalField(const allocator_type& allocator) { - const std::array externalFieldData = {static_cast(EXTERNAL_FIELD_DATA >> 8U), - static_cast(EXTERNAL_FIELD_DATA)}; + const std::array externalFieldData = { + static_cast(EXTERNAL_FIELD_DATA >> 8U), static_cast(EXTERNAL_FIELD_DATA)}; return BitBuffer(externalFieldData.data(), EXTERNAL_FIELD_VAR_SIZE, allocator); } @@ -272,8 +265,9 @@ class ComplexAllocationTest : public ::testing::Test vector_type createBytesField(const allocator_type& allocator) { - return vector_type({static_cast(BYTES_FIELD_DATA >> 8U), - static_cast(BYTES_FIELD_DATA)}, allocator); + return vector_type( + {static_cast(BYTES_FIELD_DATA >> 8U), static_cast(BYTES_FIELD_DATA)}, + allocator); } void fillBytesArray(vector_type>& bytesArray, const allocator_type& allocator) @@ -392,19 +386,25 @@ class ComplexAllocationTest : public ::testing::Test ASSERT_EQ(STRUCT_PACKED_ELEMENT_ARRAY_SIZE, packedElementArray.size()); ASSERT_EQ(STRUCT_PACKED_ELEMENT_ARRAY_ELEMENT0_X, packedElementArray[0].getX()); ASSERT_EQ(STRUCT_PACKED_ELEMENT_ARRAY_ELEMENT0_X + - static_cast(STRUCT_PACKED_ELEMENT_ARRAY_DELTA), packedElementArray[1].getX()); + static_cast(STRUCT_PACKED_ELEMENT_ARRAY_DELTA), + packedElementArray[1].getX()); ASSERT_EQ(STRUCT_PACKED_ELEMENT_ARRAY_ELEMENT0_X + - static_cast(STRUCT_PACKED_ELEMENT_ARRAY_DELTA) * 2, packedElementArray[2].getX()); + static_cast(STRUCT_PACKED_ELEMENT_ARRAY_DELTA) * 2, + packedElementArray[2].getX()); ASSERT_EQ(STRUCT_PACKED_ELEMENT_ARRAY_ELEMENT0_Y, packedElementArray[0].getY()); ASSERT_EQ(STRUCT_PACKED_ELEMENT_ARRAY_ELEMENT0_Y + - static_cast(STRUCT_PACKED_ELEMENT_ARRAY_DELTA), packedElementArray[1].getY()); + static_cast(STRUCT_PACKED_ELEMENT_ARRAY_DELTA), + packedElementArray[1].getY()); ASSERT_EQ(STRUCT_PACKED_ELEMENT_ARRAY_ELEMENT0_Y + - static_cast(STRUCT_PACKED_ELEMENT_ARRAY_DELTA) * 2, packedElementArray[2].getY()); + static_cast(STRUCT_PACKED_ELEMENT_ARRAY_DELTA) * 2, + packedElementArray[2].getY()); ASSERT_EQ(STRUCT_PACKED_ELEMENT_ARRAY_ELEMENT0_Z, packedElementArray[0].getZ()); ASSERT_EQ(STRUCT_PACKED_ELEMENT_ARRAY_ELEMENT0_Z + - static_cast(STRUCT_PACKED_ELEMENT_ARRAY_DELTA), packedElementArray[1].getZ()); + static_cast(STRUCT_PACKED_ELEMENT_ARRAY_DELTA), + packedElementArray[1].getZ()); ASSERT_EQ(STRUCT_PACKED_ELEMENT_ARRAY_ELEMENT0_Z + - static_cast(STRUCT_PACKED_ELEMENT_ARRAY_DELTA) * 2, packedElementArray[2].getZ()); + static_cast(STRUCT_PACKED_ELEMENT_ARRAY_DELTA) * 2, + packedElementArray[2].getZ()); // structOptionalField const auto& optionalField0 = mainStructure.getStructOptionalField(); @@ -423,8 +423,8 @@ class ComplexAllocationTest : public ::testing::Test const auto& externalField = mainStructure.getExternalField(); ASSERT_EQ(EXTERNAL_FIELD_VAR_SIZE, externalField.getBitSize()); const uint8_t* externalFieldBuffer = externalField.getBuffer(); - const uint16_t externalFieldData = (static_cast(externalFieldBuffer[0] << 8U)) | - (externalFieldBuffer[1]); + const uint16_t externalFieldData = + (static_cast(externalFieldBuffer[0] << 8U)) | (externalFieldBuffer[1]); ASSERT_EQ(EXTERNAL_FIELD_DATA, externalFieldData); // externalArray @@ -437,8 +437,8 @@ class ComplexAllocationTest : public ::testing::Test const auto& externalArrayElement1 = externalArray[1]; ASSERT_EQ(EXTERNAL_ARRAY_ELEMENT1_VAR_SIZE, externalArrayElement1.getBitSize()); const uint8_t* externalBufferElement1 = externalArrayElement1.getBuffer(); - const uint16_t externalDataElement1 = (static_cast(externalBufferElement1[0] << 8U)) | - (externalBufferElement1[1]); + const uint16_t externalDataElement1 = + (static_cast(externalBufferElement1[0] << 8U)) | (externalBufferElement1[1]); ASSERT_EQ(EXTERNAL_ARRAY_ELEMENT1_DATA, externalDataElement1); // bytesField @@ -452,8 +452,8 @@ class ComplexAllocationTest : public ::testing::Test ASSERT_EQ(BYTES_ARRAY_SIZE, bytesArray.size()); const auto& bytesArrayElement0 = bytesArray[0]; ASSERT_EQ(BYTES_ARRAY_ELEMENT0_VAR_SIZE, bytesArrayElement0.size()); - const uint16_t bytesDataElement0 = (static_cast(bytesArrayElement0[0] << 8U)) | - (bytesArrayElement0[1]); + const uint16_t bytesDataElement0 = + (static_cast(bytesArrayElement0[0] << 8U)) | (bytesArrayElement0[1]); ASSERT_EQ(BYTES_ARRAY_ELEMENT0_DATA, bytesDataElement0); const auto& bytesArrayElement1 = bytesArray[1]; ASSERT_EQ(BYTES_ARRAY_ELEMENT1_VAR_SIZE, bytesArrayElement1.size()); @@ -490,9 +490,9 @@ class ComplexAllocationTest : public ::testing::Test const bool hasPropagatingAllocator = hasCopyPropagatingAllocator(); HeapMemoryResource heapMemoryResource; InvalidMemoryResource invalidMemoryResource; - MemoryResourceScopedSetter memoryResourceScopedSetter(hasPropagatingAllocator ? - static_cast(invalidMemoryResource) : - static_cast(heapMemoryResource)); + MemoryResourceScopedSetter memoryResourceScopedSetter(hasPropagatingAllocator + ? static_cast(invalidMemoryResource) + : static_cast(heapMemoryResource)); zserio::BitStreamWriter writer(bitBuffer); writeMainStructure(writer, hasArray); @@ -576,9 +576,9 @@ class ComplexAllocationTest : public ::testing::Test InvalidMemoryResource invalidMemoryResource; HeapMemoryResource heapMemoryResource; - MemoryResourceScopedSetter memoryResourceScopedSetter(hasPropagatingAllocator ? - static_cast(invalidMemoryResource) : - static_cast(heapMemoryResource)); + MemoryResourceScopedSetter memoryResourceScopedSetter(hasPropagatingAllocator + ? static_cast(invalidMemoryResource) + : static_cast(heapMemoryResource)); zserio::BitStreamWriter writer(bitBuffer); writeMainStructure(writer, hasArray); @@ -694,8 +694,8 @@ class ComplexAllocationTest : public ::testing::Test ASSERT_EQ(allocatedSize1, memoryResource1.getAllocatedSize()); ASSERT_EQ(numAllocations2, memoryResource2.getNumAllocations()); ASSERT_EQ(allocatedSize2, memoryResource2.getAllocatedSize()); - ASSERT_EQ(numAllocations1 - numDeallocations1 + numAllocations2, - memoryResource3.getNumAllocations()); + ASSERT_EQ( + numAllocations1 - numDeallocations1 + numAllocations2, memoryResource3.getNumAllocations()); ASSERT_EQ(allocatedSize1 + allocatedSize2, memoryResource3.getAllocatedSize()); // check memory fragmentation in used memory resources @@ -784,14 +784,13 @@ class ComplexAllocationTest : public ::testing::Test MainStructure mainStructure(STRING_FIELD, std::move(stringArray), hasArray, std::move(choiceField), std::move(unionField), std::move(structField), std::move(structOptionalField), createExternalField(allocator), - std::move(externalArray), createBytesField(allocator), - std::move(bytesArray), allocator); + std::move(externalArray), createBytesField(allocator), std::move(bytesArray), + allocator); checkMainStructure(mainStructure, hasArray); // check memory fragmentation in used memory resource ASSERT_EQ(0, memoryResource.getNumDeallocations()); } - } // check memory leaks in used memory resource @@ -894,8 +893,8 @@ class ComplexAllocationTest : public ::testing::Test // check that no further memory allocation will take place const size_t numAllocations = memoryResource.getNumAllocations(); const size_t allocatedSize = memoryResource.getAllocatedSize(); - const size_t expectedBitSize = (hasArray) ? MAIN_STRUCTURE_WITH_ARRAYS_BIT_SIZE : - MAIN_STRUCTURE_WITHOUT_ARRAYS_BIT_SIZE; + const size_t expectedBitSize = + (hasArray) ? MAIN_STRUCTURE_WITH_ARRAYS_BIT_SIZE : MAIN_STRUCTURE_WITHOUT_ARRAYS_BIT_SIZE; ASSERT_EQ(expectedBitSize, mainStructure.bitSizeOf(0)); ASSERT_EQ(numAllocations, memoryResource.getNumAllocations()); ASSERT_EQ(allocatedSize, memoryResource.getAllocatedSize()); @@ -927,8 +926,8 @@ class ComplexAllocationTest : public ::testing::Test const size_t numAllocations = memoryResource.getNumAllocations(); const size_t allocatedSize = memoryResource.getAllocatedSize(); const size_t bitPosition = 1; - const size_t expectedBitSize = (hasArray) ? MAIN_STRUCTURE_WITH_ARRAYS_BIT_SIZE : - MAIN_STRUCTURE_WITHOUT_ARRAYS_BIT_SIZE; + const size_t expectedBitSize = + (hasArray) ? MAIN_STRUCTURE_WITH_ARRAYS_BIT_SIZE : MAIN_STRUCTURE_WITHOUT_ARRAYS_BIT_SIZE; ASSERT_EQ(bitPosition + expectedBitSize, mainStructure.initializeOffsets(bitPosition)); ASSERT_EQ(numAllocations, memoryResource.getNumAllocations()); ASSERT_EQ(allocatedSize, memoryResource.getAllocatedSize()); @@ -1030,8 +1029,8 @@ class ComplexAllocationTest : public ::testing::Test fillMainStructure(mainStructure, allocator, hasArray); // call bitSizeOf to allocate possible packing context for packed arrays - const size_t expectedBitSize = (hasArray) ? MAIN_STRUCTURE_WITH_ARRAYS_BIT_SIZE : - MAIN_STRUCTURE_WITHOUT_ARRAYS_BIT_SIZE; + const size_t expectedBitSize = + (hasArray) ? MAIN_STRUCTURE_WITH_ARRAYS_BIT_SIZE : MAIN_STRUCTURE_WITHOUT_ARRAYS_BIT_SIZE; ASSERT_EQ(expectedBitSize, mainStructure.bitSizeOf(0)); // check that no further memory allocation will take place @@ -1152,7 +1151,7 @@ class ComplexAllocationTest : public ::testing::Test static const uint8_t STRUCT_PACKED_UINT16_ARRAY_MAX_BIT_NUMBER; static const uint32_t STRUCT_PACKED_ELEMENT_ARRAY_SIZE; static const uint32_t STRUCT_PACKED_ELEMENT_ARRAY_ELEMENT0_X; - static const uint32_t STRUCT_PACKED_ELEMENT_ARRAY_ELEMENT0_Y ; + static const uint32_t STRUCT_PACKED_ELEMENT_ARRAY_ELEMENT0_Y; static const uint32_t STRUCT_PACKED_ELEMENT_ARRAY_ELEMENT0_Z; static const int8_t STRUCT_PACKED_ELEMENT_ARRAY_DELTA; static const uint8_t STRUCT_PACKED_ELEMENT_ARRAY_MAX_BIT_NUMBER; diff --git a/test/arguments/set_cpp_allocator/cpp/PubsubAllocationTest.cpp b/test/arguments/set_cpp_allocator/cpp/PubsubAllocationTest.cpp index 70353b0e2..fa53c4fb2 100644 --- a/test/arguments/set_cpp_allocator/cpp/PubsubAllocationTest.cpp +++ b/test/arguments/set_cpp_allocator/cpp/PubsubAllocationTest.cpp @@ -1,12 +1,9 @@ #include #include "gtest/gtest.h" - #include "pubsub_allocation/GreetingPubsub.h" - #include "test_utils/MemoryResources.h" #include "test_utils/TestPubsub.h" - #include "zserio/StringView.h" using namespace zserio::literals; @@ -83,7 +80,8 @@ class PubsubAllocationTest : public ::testing::Test { public: explicit NameCallback(GreetingPubsub& pubsub, const allocator_type& allocator) : - m_greetingPubsub(pubsub), m_allocator(allocator) + m_greetingPubsub(pubsub), + m_allocator(allocator) {} void operator()(zserio::StringView topic, const Name& name) override @@ -109,7 +107,8 @@ class PubsubAllocationTest : public ::testing::Test struct GreetingCallback : public GreetingPubsub::GreetingPubsubCallback { - explicit GreetingCallback(const allocator_type& allocator) : greeting(allocator) + explicit GreetingCallback(const allocator_type& allocator) : + greeting(allocator) {} void operator()(zserio::StringView topic, const Greeting& providedGreeting) override @@ -124,7 +123,7 @@ class PubsubAllocationTest : public ::testing::Test private: InvalidMemoryResource m_invalidMemoryResource; MemoryResourceScopedSetter m_invalidMemoryResourceSetter; - TestMemoryResource<4*1024> m_memoryResource; + TestMemoryResource<4 * 1024> m_memoryResource; allocator_type m_allocator; std::unique_ptr m_testPubsub; @@ -134,8 +133,8 @@ class PubsubAllocationTest : public ::testing::Test TEST_F(PubsubAllocationTest, sendGreetingPubsub) { - auto idName = greetingPubsub.subscribeName(std::allocate_shared( - getAllocator(), greetingPubsub, getAllocator())); + auto idName = greetingPubsub.subscribeName( + std::allocate_shared(getAllocator(), greetingPubsub, getAllocator())); std::shared_ptr greetingCallback = std::allocate_shared(getAllocator(), getAllocator()); @@ -154,8 +153,9 @@ TEST_F(PubsubAllocationTest, sendGreetingPubsubWithContext) { CountingContext countingContext; - auto idName = greetingPubsub.subscribeName(std::allocate_shared( - getAllocator(), greetingPubsub, getAllocator()), &countingContext); + auto idName = greetingPubsub.subscribeName( + std::allocate_shared(getAllocator(), greetingPubsub, getAllocator()), + &countingContext); ASSERT_EQ(1, countingContext.subscribeCount); std::shared_ptr greetingCallback = diff --git a/test/arguments/set_cpp_allocator/cpp/ServiceAllocationTest.cpp b/test/arguments/set_cpp_allocator/cpp/ServiceAllocationTest.cpp index 17d573d4b..7f13683ae 100644 --- a/test/arguments/set_cpp_allocator/cpp/ServiceAllocationTest.cpp +++ b/test/arguments/set_cpp_allocator/cpp/ServiceAllocationTest.cpp @@ -1,9 +1,7 @@ #include "gtest/gtest.h" - #include "service_allocation/GreetingService.h" - -#include "test_utils/MemoryResources.h" #include "test_utils/LocalServiceClient.h" +#include "test_utils/MemoryResources.h" using namespace zserio::literals; using namespace test_utils; @@ -53,7 +51,8 @@ class ServiceAllocationTest : public ::testing::Test class GreetingServiceImpl : public GreetingService::Service { public: - explicit GreetingServiceImpl(const allocator_type& allocator) : GreetingService::Service(allocator) + explicit GreetingServiceImpl(const allocator_type& allocator) : + GreetingService::Service(allocator) {} Greeting sendGreetingImpl(const Name& name, void* context) override diff --git a/test/arguments/set_cpp_allocator/cpp/SqlAllocationTest.cpp b/test/arguments/set_cpp_allocator/cpp/SqlAllocationTest.cpp index 20e80be0e..260e6578a 100644 --- a/test/arguments/set_cpp_allocator/cpp/SqlAllocationTest.cpp +++ b/test/arguments/set_cpp_allocator/cpp/SqlAllocationTest.cpp @@ -1,7 +1,5 @@ #include "gtest/gtest.h" - #include "sql_allocation/SqlAllocationDb.h" - #include "test_utils/MemoryResources.h" #include "test_utils/ValidationObservers.h" @@ -86,8 +84,8 @@ class SqlAllocationTest : public ::testing::Test const allocator_type& allocator, uint32_t id, uint32_t len = 0) { row.setIdWithVeryLongNameAndYetLongerName(id); - row.setTextWithVeryLongNameAndYetLongerName(string_type( - "This is constant string longer than 32 bytes (", allocator) + + row.setTextWithVeryLongNameAndYetLongerName( + string_type("This is constant string longer than 32 bytes (", allocator) + zserio::toString(id, allocator) + ")"); row.setDataBlobWithVeryLongNameAndYetLongerName(DataBlob{len == 0 ? id + 1 : len, MAGIC}); row.setParameterizedBlobWithVeryLongNameAndYetLongerName( @@ -109,10 +107,9 @@ class SqlAllocationTest : public ::testing::Test static void checkTableRow(const SqlAllocationTable::Row& row1, const SqlAllocationTable::Row& row2) { - ASSERT_EQ(row1.getIdWithVeryLongNameAndYetLongerName(), - row2.getIdWithVeryLongNameAndYetLongerName()); - ASSERT_EQ(row1.getTextWithVeryLongNameAndYetLongerName(), - row2.getTextWithVeryLongNameAndYetLongerName()); + ASSERT_EQ(row1.getIdWithVeryLongNameAndYetLongerName(), row2.getIdWithVeryLongNameAndYetLongerName()); + ASSERT_EQ( + row1.getTextWithVeryLongNameAndYetLongerName(), row2.getTextWithVeryLongNameAndYetLongerName()); ASSERT_EQ(row1.getDataBlobWithVeryLongNameAndYetLongerName(), row2.getDataBlobWithVeryLongNameAndYetLongerName()); ASSERT_EQ(row1.getParameterizedBlobWithVeryLongNameAndYetLongerName(), @@ -121,8 +118,8 @@ class SqlAllocationTest : public ::testing::Test row2.getParameterizedBlobExplicitWithVeryLongNameAndYetLongerName()); ASSERT_EQ(row1.getColorWithVeryLongNameAndYetLongerName(), row2.getColorWithVeryLongNameAndYetLongerName()); - ASSERT_EQ(row1.getRoleWithVeryLongNameAndYetLongerName(), - row2.getRoleWithVeryLongNameAndYetLongerName()); + ASSERT_EQ( + row1.getRoleWithVeryLongNameAndYetLongerName(), row2.getRoleWithVeryLongNameAndYetLongerName()); } static void checkTableRows(const vector_type& rows1, @@ -136,7 +133,7 @@ class SqlAllocationTest : public ::testing::Test private: InvalidMemoryResource m_invalidMemoryResource; MemoryResourceScopedSetter m_invalidMemoryResourceSetter; - TestMemoryResource<10*1024> m_memoryResource; + TestMemoryResource<10 * 1024> m_memoryResource; allocator_type m_allocator; protected: @@ -154,8 +151,7 @@ constexpr uint32_t SqlAllocationTest::NUM_ROWS; constexpr uint32_t SqlAllocationTest::RED_ROW_ID; constexpr uint32_t SqlAllocationTest::MAGIC; constexpr uint32_t SqlAllocationTest::WRONG_MAGIC; -const string_type SqlAllocationTest::DB_FILE_NAME = - "arguments/set_cpp_allocator/sql_allocation_test.sqlite"; +const string_type SqlAllocationTest::DB_FILE_NAME = "arguments/set_cpp_allocator/sql_allocation_test.sqlite"; TEST_F(SqlAllocationTest, readWithoutCondition) { @@ -206,8 +202,7 @@ TEST_F(SqlAllocationTest, update) const uint32_t updateRowId = 2; SqlAllocationTable::Row updateRow; fillTableRow(updateRow, parameterProvider, getAllocator(), updateRowId, 4); - const string_type updateCondition = - string_type("idWithVeryLongNameAndYetLongerName=", getAllocator()) + + const string_type updateCondition = string_type("idWithVeryLongNameAndYetLongerName=", getAllocator()) + zserio::toString(updateRowId, getAllocator()); sqlAllocationTable.update(parameterProvider, updateRow, updateCondition); @@ -242,7 +237,8 @@ TEST_F(SqlAllocationTest, validateInvalidSchema) const bool wasTransactionStarted = connection.startTransaction(); connection.executeUpdate("DROP TABLE allocationTable"); - connection.executeUpdate("CREATE TABLE allocationTable(" + connection.executeUpdate( + "CREATE TABLE allocationTable(" "idWithVeryLongNameAndYetLongerName INTEGER NOT NULL, " // shall be PK "textWithVeryLongNameAndYetLongerName TEXT, " // shall be NOT NULL "dataBlobWithVeryLongNameAndYetLongerName TEXT NOT NULL, " // wrong type, shall be BLOB @@ -273,9 +269,11 @@ TEST_F(SqlAllocationTest, validateInvalidField) zserio::SqliteConnection& connection = m_database->connection(); const bool wasTransactionStarted = connection.startTransaction(); - connection.executeUpdate("UPDATE allocationTable SET colorWithVeryLongNameAndYetLongerName = 13 " + connection.executeUpdate( + "UPDATE allocationTable SET colorWithVeryLongNameAndYetLongerName = 13 " "WHERE idWithVeryLongNameAndYetLongerName = 0"); - connection.executeUpdate("UPDATE allocationTable SET roleWithVeryLongNameAndYetLongerName = 100000 " + connection.executeUpdate( + "UPDATE allocationTable SET roleWithVeryLongNameAndYetLongerName = 100000 " "WHERE idWithVeryLongNameAndYetLongerName = 1"); { std::unique_ptr statement(connection.prepareStatement( @@ -283,7 +281,7 @@ TEST_F(SqlAllocationTest, validateInvalidField) "WHERE idWithVeryLongNameAndYetLongerName = 2")); BitBuffer bitBuffer{64, getAllocator()}; // for data blob 2 * uint32 zserio::BitStreamWriter writer(bitBuffer); - writer.writeBits(2+1, 32); // len = id + 1 + writer.writeBits(2 + 1, 32); // len = id + 1 writer.writeBits(WRONG_MAGIC, 32); // magic sqlite3_bind_blob(statement.get(), 1, bitBuffer.getBuffer(), static_cast(bitBuffer.getByteSize()), SQLITE_TRANSIENT); diff --git a/test/arguments/set_top_level_package/cpp/SetTopLevelPackageTest.cpp b/test/arguments/set_top_level_package/cpp/SetTopLevelPackageTest.cpp index 050f25e8c..8abc57a3b 100644 --- a/test/arguments/set_top_level_package/cpp/SetTopLevelPackageTest.cpp +++ b/test/arguments/set_top_level_package/cpp/SetTopLevelPackageTest.cpp @@ -1,6 +1,5 @@ -#include "gtest/gtest.h" - #include "company/appl/SimpleStructure.h" +#include "gtest/gtest.h" namespace company { diff --git a/test/arguments/with_range_check_code/cpp/Bit4RangeCheckTest.cpp b/test/arguments/with_range_check_code/cpp/Bit4RangeCheckTest.cpp index c707062cc..b93821403 100644 --- a/test/arguments/with_range_check_code/cpp/Bit4RangeCheckTest.cpp +++ b/test/arguments/with_range_check_code/cpp/Bit4RangeCheckTest.cpp @@ -1,8 +1,6 @@ #include "gtest/gtest.h" - -#include "zserio/CppRuntimeException.h" - #include "with_range_check_code/bit4_range_check/Bit4RangeCheckCompound.h" +#include "zserio/CppRuntimeException.h" namespace with_range_check_code { diff --git a/test/arguments/with_range_check_code/cpp/ChoiceBit4RangeCheckTest.cpp b/test/arguments/with_range_check_code/cpp/ChoiceBit4RangeCheckTest.cpp index dab59fc8d..914f414ef 100644 --- a/test/arguments/with_range_check_code/cpp/ChoiceBit4RangeCheckTest.cpp +++ b/test/arguments/with_range_check_code/cpp/ChoiceBit4RangeCheckTest.cpp @@ -1,8 +1,6 @@ #include "gtest/gtest.h" - -#include "zserio/CppRuntimeException.h" - #include "with_range_check_code/choice_bit4_range_check/ChoiceBit4RangeCheckCompound.h" +#include "zserio/CppRuntimeException.h" namespace with_range_check_code { @@ -54,8 +52,8 @@ TEST_F(ChoiceBit4RangeCheckTest, choiceBit4AboveUpperBound) } catch (const zserio::CppRuntimeException& excpt) { - ASSERT_STREQ("Value 16 of ChoiceBit4RangeCheckCompound.value exceeds the range of <0..15>!", - excpt.what()); + ASSERT_STREQ( + "Value 16 of ChoiceBit4RangeCheckCompound.value exceeds the range of <0..15>!", excpt.what()); } } diff --git a/test/arguments/with_range_check_code/cpp/DynamicBitRangeCheckTest.cpp b/test/arguments/with_range_check_code/cpp/DynamicBitRangeCheckTest.cpp index 3f32e780a..5468d993b 100644 --- a/test/arguments/with_range_check_code/cpp/DynamicBitRangeCheckTest.cpp +++ b/test/arguments/with_range_check_code/cpp/DynamicBitRangeCheckTest.cpp @@ -1,8 +1,6 @@ #include "gtest/gtest.h" - -#include "zserio/CppRuntimeException.h" - #include "with_range_check_code/dynamic_bit_range_check/DynamicBitRangeCheckCompound.h" +#include "zserio/CppRuntimeException.h" namespace with_range_check_code { diff --git a/test/arguments/with_range_check_code/cpp/DynamicIntRangeCheckTest.cpp b/test/arguments/with_range_check_code/cpp/DynamicIntRangeCheckTest.cpp index f72b3fffe..ce7a57447 100644 --- a/test/arguments/with_range_check_code/cpp/DynamicIntRangeCheckTest.cpp +++ b/test/arguments/with_range_check_code/cpp/DynamicIntRangeCheckTest.cpp @@ -1,8 +1,6 @@ #include "gtest/gtest.h" - -#include "zserio/CppRuntimeException.h" - #include "with_range_check_code/dynamic_int_range_check/DynamicIntRangeCheckCompound.h" +#include "zserio/CppRuntimeException.h" namespace with_range_check_code { diff --git a/test/arguments/with_range_check_code/cpp/Int4RangeCheckTest.cpp b/test/arguments/with_range_check_code/cpp/Int4RangeCheckTest.cpp index 96fdda0c3..5e5185bd2 100644 --- a/test/arguments/with_range_check_code/cpp/Int4RangeCheckTest.cpp +++ b/test/arguments/with_range_check_code/cpp/Int4RangeCheckTest.cpp @@ -1,8 +1,6 @@ #include "gtest/gtest.h" - -#include "zserio/CppRuntimeException.h" - #include "with_range_check_code/int4_range_check/Int4RangeCheckCompound.h" +#include "zserio/CppRuntimeException.h" namespace with_range_check_code { diff --git a/test/arguments/with_range_check_code/cpp/Int7ArrayRangeCheckTest.cpp b/test/arguments/with_range_check_code/cpp/Int7ArrayRangeCheckTest.cpp index 9ef526452..78871a924 100644 --- a/test/arguments/with_range_check_code/cpp/Int7ArrayRangeCheckTest.cpp +++ b/test/arguments/with_range_check_code/cpp/Int7ArrayRangeCheckTest.cpp @@ -1,7 +1,6 @@ #include "gtest/gtest.h" - -#include "zserio/CppRuntimeException.h" #include "with_range_check_code/int7_array_range_check/Int7ArrayRangeCheckCompound.h" +#include "zserio/CppRuntimeException.h" namespace with_range_check_code { @@ -55,8 +54,8 @@ TEST_F(Int7ArrayRangeCheckTest, int7ArrayBelowLowerBound) } catch (const zserio::CppRuntimeException& excpt) { - ASSERT_STREQ("Value -65 of Int7ArrayRangeCheckCompound.array exceeds the range of <-64..63>!", - excpt.what()); + ASSERT_STREQ( + "Value -65 of Int7ArrayRangeCheckCompound.array exceeds the range of <-64..63>!", excpt.what()); } } @@ -69,8 +68,8 @@ TEST_F(Int7ArrayRangeCheckTest, int7ArrayAboveUpperBound) } catch (const zserio::CppRuntimeException& excpt) { - ASSERT_STREQ("Value 64 of Int7ArrayRangeCheckCompound.array exceeds the range of <-64..63>!", - excpt.what()); + ASSERT_STREQ( + "Value 64 of Int7ArrayRangeCheckCompound.array exceeds the range of <-64..63>!", excpt.what()); } } diff --git a/test/arguments/with_range_check_code/cpp/Int8RangeCheckTest.cpp b/test/arguments/with_range_check_code/cpp/Int8RangeCheckTest.cpp index 7a018dfc4..f585f7e22 100644 --- a/test/arguments/with_range_check_code/cpp/Int8RangeCheckTest.cpp +++ b/test/arguments/with_range_check_code/cpp/Int8RangeCheckTest.cpp @@ -1,8 +1,6 @@ #include "gtest/gtest.h" - -#include "zserio/CppRuntimeException.h" - #include "with_range_check_code/int8_range_check/Int8RangeCheckCompound.h" +#include "zserio/CppRuntimeException.h" namespace with_range_check_code { diff --git a/test/arguments/with_range_check_code/cpp/OptionalBit31RangeCheckTest.cpp b/test/arguments/with_range_check_code/cpp/OptionalBit31RangeCheckTest.cpp index 88a95a74a..747a81609 100644 --- a/test/arguments/with_range_check_code/cpp/OptionalBit31RangeCheckTest.cpp +++ b/test/arguments/with_range_check_code/cpp/OptionalBit31RangeCheckTest.cpp @@ -1,8 +1,6 @@ #include "gtest/gtest.h" - -#include "zserio/CppRuntimeException.h" - #include "with_range_check_code/optional_bit31_range_check/OptionalBit31RangeCheckCompound.h" +#include "zserio/CppRuntimeException.h" namespace with_range_check_code { @@ -54,7 +52,8 @@ TEST_F(OptionalBit31RangeCheckTest, optionalBit31AboveUpperBound) catch (const zserio::CppRuntimeException& excpt) { ASSERT_STREQ("Value 2147483648 of OptionalBit31RangeCheckCompound.value exceeds the range of " - "<0..2147483647>!", excpt.what()); + "<0..2147483647>!", + excpt.what()); } } diff --git a/test/arguments/with_range_check_code/cpp/UInt8RangeCheckTest.cpp b/test/arguments/with_range_check_code/cpp/UInt8RangeCheckTest.cpp index beeb03c78..bdac1d6b4 100644 --- a/test/arguments/with_range_check_code/cpp/UInt8RangeCheckTest.cpp +++ b/test/arguments/with_range_check_code/cpp/UInt8RangeCheckTest.cpp @@ -1,8 +1,6 @@ #include "gtest/gtest.h" - -#include "zserio/CppRuntimeException.h" - #include "with_range_check_code/uint8_range_check/UInt8RangeCheckCompound.h" +#include "zserio/CppRuntimeException.h" namespace with_range_check_code { diff --git a/test/arguments/with_range_check_code/cpp/UnionInt4RangeCheckTest.cpp b/test/arguments/with_range_check_code/cpp/UnionInt4RangeCheckTest.cpp index 07f645dac..eb3283bb7 100644 --- a/test/arguments/with_range_check_code/cpp/UnionInt4RangeCheckTest.cpp +++ b/test/arguments/with_range_check_code/cpp/UnionInt4RangeCheckTest.cpp @@ -1,8 +1,6 @@ #include "gtest/gtest.h" - -#include "zserio/CppRuntimeException.h" - #include "with_range_check_code/union_int4_range_check/UnionInt4RangeCheckCompound.h" +#include "zserio/CppRuntimeException.h" namespace with_range_check_code { @@ -52,8 +50,8 @@ TEST_F(UnionInt4RangeCheckTest, unionInt4BelowLowerBound) } catch (const zserio::CppRuntimeException& excpt) { - ASSERT_STREQ("Value -9 of UnionInt4RangeCheckCompound.value exceeds the range of <-8..7>!", - excpt.what()); + ASSERT_STREQ( + "Value -9 of UnionInt4RangeCheckCompound.value exceeds the range of <-8..7>!", excpt.what()); } } @@ -66,8 +64,8 @@ TEST_F(UnionInt4RangeCheckTest, unionInt4AboveUpperBound) } catch (const zserio::CppRuntimeException& excpt) { - ASSERT_STREQ("Value 8 of UnionInt4RangeCheckCompound.value exceeds the range of <-8..7>!", - excpt.what()); + ASSERT_STREQ( + "Value 8 of UnionInt4RangeCheckCompound.value exceeds the range of <-8..7>!", excpt.what()); } } diff --git a/test/arguments/with_range_check_code/cpp/VarInt16RangeCheckTest.cpp b/test/arguments/with_range_check_code/cpp/VarInt16RangeCheckTest.cpp index 64adc59f0..818582572 100644 --- a/test/arguments/with_range_check_code/cpp/VarInt16RangeCheckTest.cpp +++ b/test/arguments/with_range_check_code/cpp/VarInt16RangeCheckTest.cpp @@ -1,8 +1,6 @@ #include "gtest/gtest.h" - -#include "zserio/CppRuntimeException.h" - #include "with_range_check_code/varint16_range_check/VarInt16RangeCheckCompound.h" +#include "zserio/CppRuntimeException.h" namespace with_range_check_code { diff --git a/test/arguments/with_range_check_code/cpp/VarInt32RangeCheckTest.cpp b/test/arguments/with_range_check_code/cpp/VarInt32RangeCheckTest.cpp index d1c488e0c..2782327be 100644 --- a/test/arguments/with_range_check_code/cpp/VarInt32RangeCheckTest.cpp +++ b/test/arguments/with_range_check_code/cpp/VarInt32RangeCheckTest.cpp @@ -1,8 +1,6 @@ #include "gtest/gtest.h" - -#include "zserio/CppRuntimeException.h" - #include "with_range_check_code/varint32_range_check/VarInt32RangeCheckCompound.h" +#include "zserio/CppRuntimeException.h" namespace with_range_check_code { @@ -53,7 +51,8 @@ TEST_F(VarInt32RangeCheckTest, varInt32BelowLowerBound) catch (const zserio::CppRuntimeException& excpt) { ASSERT_STREQ("Value -268435456 of VarInt32RangeCheckCompound.value exceeds the range of " - "<-268435455..268435455>!", excpt.what()); + "<-268435455..268435455>!", + excpt.what()); } } @@ -67,7 +66,8 @@ TEST_F(VarInt32RangeCheckTest, varInt32AboveUpperBound) catch (const zserio::CppRuntimeException& excpt) { ASSERT_STREQ("Value 268435456 of VarInt32RangeCheckCompound.value exceeds the range of " - "<-268435455..268435455>!", excpt.what()); + "<-268435455..268435455>!", + excpt.what()); } } diff --git a/test/arguments/with_range_check_code/cpp/VarInt64RangeCheckTest.cpp b/test/arguments/with_range_check_code/cpp/VarInt64RangeCheckTest.cpp index 1b1d5c20d..5ebed7cf3 100644 --- a/test/arguments/with_range_check_code/cpp/VarInt64RangeCheckTest.cpp +++ b/test/arguments/with_range_check_code/cpp/VarInt64RangeCheckTest.cpp @@ -1,8 +1,6 @@ #include "gtest/gtest.h" - -#include "zserio/CppRuntimeException.h" - #include "with_range_check_code/varint64_range_check/VarInt64RangeCheckCompound.h" +#include "zserio/CppRuntimeException.h" namespace with_range_check_code { @@ -53,7 +51,8 @@ TEST_F(VarInt64RangeCheckTest, varInt64BelowLowerBound) catch (const zserio::CppRuntimeException& excpt) { ASSERT_STREQ("Value -72057594037927936 of VarInt64RangeCheckCompound.value exceeds the range of " - "<-72057594037927935..72057594037927935>!", excpt.what()); + "<-72057594037927935..72057594037927935>!", + excpt.what()); } } @@ -67,7 +66,8 @@ TEST_F(VarInt64RangeCheckTest, varInt64AboveUpperBound) catch (const zserio::CppRuntimeException& excpt) { ASSERT_STREQ("Value 72057594037927936 of VarInt64RangeCheckCompound.value exceeds the range of " - "<-72057594037927935..72057594037927935>!", excpt.what()); + "<-72057594037927935..72057594037927935>!", + excpt.what()); } } diff --git a/test/arguments/with_range_check_code/cpp/VarSizeRangeCheckTest.cpp b/test/arguments/with_range_check_code/cpp/VarSizeRangeCheckTest.cpp index 663a97714..7322db892 100644 --- a/test/arguments/with_range_check_code/cpp/VarSizeRangeCheckTest.cpp +++ b/test/arguments/with_range_check_code/cpp/VarSizeRangeCheckTest.cpp @@ -1,8 +1,6 @@ #include "gtest/gtest.h" - -#include "zserio/CppRuntimeException.h" - #include "with_range_check_code/varsize_range_check/VarSizeRangeCheckCompound.h" +#include "zserio/CppRuntimeException.h" namespace with_range_check_code { @@ -53,7 +51,8 @@ TEST_F(VarSizeRangeCheckTest, varSizeAboveUpperBound) catch (const zserio::CppRuntimeException& excpt) { ASSERT_STREQ("Value 2147483648 of VarSizeRangeCheckCompound.value exceeds the range of " - "<0..2147483647>!", excpt.what()); + "<0..2147483647>!", + excpt.what()); } } diff --git a/test/arguments/with_range_check_code/cpp/VarUInt16RangeCheckTest.cpp b/test/arguments/with_range_check_code/cpp/VarUInt16RangeCheckTest.cpp index a5ce6e0ec..d8b4152e9 100644 --- a/test/arguments/with_range_check_code/cpp/VarUInt16RangeCheckTest.cpp +++ b/test/arguments/with_range_check_code/cpp/VarUInt16RangeCheckTest.cpp @@ -1,8 +1,6 @@ #include "gtest/gtest.h" - -#include "zserio/CppRuntimeException.h" - #include "with_range_check_code/varuint16_range_check/VarUInt16RangeCheckCompound.h" +#include "zserio/CppRuntimeException.h" namespace with_range_check_code { diff --git a/test/arguments/with_range_check_code/cpp/VarUInt32RangeCheckTest.cpp b/test/arguments/with_range_check_code/cpp/VarUInt32RangeCheckTest.cpp index 21b41284f..d386af0af 100644 --- a/test/arguments/with_range_check_code/cpp/VarUInt32RangeCheckTest.cpp +++ b/test/arguments/with_range_check_code/cpp/VarUInt32RangeCheckTest.cpp @@ -1,8 +1,6 @@ #include "gtest/gtest.h" - -#include "zserio/CppRuntimeException.h" - #include "with_range_check_code/varuint32_range_check/VarUInt32RangeCheckCompound.h" +#include "zserio/CppRuntimeException.h" namespace with_range_check_code { @@ -53,7 +51,8 @@ TEST_F(VarUInt32RangeCheckTest, varUInt32AboveUpperBound) catch (const zserio::CppRuntimeException& excpt) { ASSERT_STREQ("Value 536870912 of VarUInt32RangeCheckCompound.value exceeds the range of " - "<0..536870911>!", excpt.what()); + "<0..536870911>!", + excpt.what()); } } diff --git a/test/arguments/with_range_check_code/cpp/VarUInt64RangeCheckTest.cpp b/test/arguments/with_range_check_code/cpp/VarUInt64RangeCheckTest.cpp index 32b897666..f4929ef3d 100644 --- a/test/arguments/with_range_check_code/cpp/VarUInt64RangeCheckTest.cpp +++ b/test/arguments/with_range_check_code/cpp/VarUInt64RangeCheckTest.cpp @@ -1,8 +1,6 @@ #include "gtest/gtest.h" - -#include "zserio/CppRuntimeException.h" - #include "with_range_check_code/varuint64_range_check/VarUInt64RangeCheckCompound.h" +#include "zserio/CppRuntimeException.h" namespace with_range_check_code { @@ -53,7 +51,8 @@ TEST_F(VarUInt64RangeCheckTest, varUInt64AboveUpperBound) catch (const zserio::CppRuntimeException& excpt) { ASSERT_STREQ("Value 144115188075855872 of VarUInt64RangeCheckCompound.value exceeds the range of " - "<0..144115188075855871>!", excpt.what()); + "<0..144115188075855871>!", + excpt.what()); } } diff --git a/test/arguments/with_reflection_code/cpp/WithReflectionCodeTest.cpp b/test/arguments/with_reflection_code/cpp/WithReflectionCodeTest.cpp index 75cba8fc2..3e85e943a 100644 --- a/test/arguments/with_reflection_code/cpp/WithReflectionCodeTest.cpp +++ b/test/arguments/with_reflection_code/cpp/WithReflectionCodeTest.cpp @@ -1,9 +1,7 @@ #include "gtest/gtest.h" - #include "with_reflection_code/Choice.h" -#include "with_reflection_code/Original.h" #include "with_reflection_code/Extended.h" - +#include "with_reflection_code/Original.h" #include "zserio/SerializeUtil.h" #include "zserio/StringView.h" #include "zserio/TypeInfoUtil.h" @@ -37,45 +35,35 @@ class WithReflectionCodeTest : public ::testing::Test static Struct createStruct() { - return Struct{ - Empty{}, - zserio::NullOpt, // child (auto optional) - vector_type{{ - {0, "zero", false, zserio::NullOpt}, - {1, "one", true, vector_type{{{"best"}, {"first"}}}}, - {2, "two", false, zserio::NullOpt} - }}, - 5, // param - createParameterized(5), - 4, // len - vector_type(4), // offsets - vector_type{{ - createParameterized(5), + return Struct{Empty{}, + zserio::NullOpt, // child (auto optional) + vector_type{{{0, "zero", false, zserio::NullOpt}, + {1, "one", true, vector_type{{{"best"}, {"first"}}}}, + {2, "two", false, zserio::NullOpt}}}, + 5, // param createParameterized(5), - createParameterized(5), - createParameterized(5) - }}, - Bitmask::Values::FLAG1 | Bitmask::Values::FLAG2, - vector_type{{Bitmask::Values::FLAG1, Bitmask::Values::FLAG2 | Bitmask::Values::FLAG3}}, - Selector::STRUCT, - vector_type{{Selector::STRUCT, SelectorEnum::UNION, Selector::BITMASK}}, - static_cast(31), // dynamicBitField (bit) - vector_type{{10, 20, 30}}, - ::zserio::NullOpt, // dynamicIntField (param > 4) - vector_type{{-3, -1, 1, 3}}, - vector_type{{true, false, true}}, - BitBuffer{{0xAB, 0xCD}, 16}, - vector_type{BitBuffer{{0x02}, 2}, BitBuffer{{0x01}, 1}}, - vector_type{{0xAB, 0xCD}}, - vector_type>{{ {{ 0xDE, 0xAD }}, {{ 0xCA, 0xFE }} }} - }; + 4, // len + vector_type(4), // offsets + vector_type{{createParameterized(5), createParameterized(5), + createParameterized(5), createParameterized(5)}}, + Bitmask::Values::FLAG1 | Bitmask::Values::FLAG2, + vector_type{{Bitmask::Values::FLAG1, Bitmask::Values::FLAG2 | Bitmask::Values::FLAG3}}, + Selector::STRUCT, + vector_type{{Selector::STRUCT, SelectorEnum::UNION, Selector::BITMASK}}, + static_cast(31), // dynamicBitField (bit) + vector_type{{10, 20, 30}}, + ::zserio::NullOpt, // dynamicIntField (param > 4) + vector_type{{-3, -1, 1, 3}}, vector_type{{true, false, true}}, + BitBuffer{{0xAB, 0xCD}, 16}, vector_type{BitBuffer{{0x02}, 2}, BitBuffer{{0x01}, 1}}, + vector_type{{0xAB, 0xCD}}, + vector_type>{{{{0xDE, 0xAD}}, {{0xCA, 0xFE}}}}}; } static void createReflectableParameterized(ZserioTreeCreator& creator, uint8_t param) { creator.beginArray("array"); for (uint8_t i = 0; i < param; ++i) - creator.addValueElement(i+1); + creator.addValueElement(i + 1); creator.endArray(); } @@ -185,7 +173,7 @@ class WithReflectionCodeTest : public ::testing::Test ASSERT_EQ(bitSizeOf, reader.getBitPosition()); } - template + template void checkWriteRead(IReflectable& reflectable, const T& originalObject, ARGS... args) { zserio::BitBuffer bitBuffer(1024 * 8); @@ -219,8 +207,8 @@ class WithReflectionCodeTest : public ::testing::Test ASSERT_EQ("with_reflection_code.Struct"_sv, reflectable.getTypeInfo().getSchemaName()); // Empty empty; - ASSERT_EQ("with_reflection_code.Empty"_sv, - reflectable.getField("empty")->getTypeInfo().getSchemaName()); + ASSERT_EQ( + "with_reflection_code.Empty"_sv, reflectable.getField("empty")->getTypeInfo().getSchemaName()); // optional Child child; ASSERT_EQ(nullptr, reflectable.getField("child")); // non-present optional @@ -240,15 +228,13 @@ class WithReflectionCodeTest : public ::testing::Test checkWriteReadBuiltin(*(reflectable["childArray"]->at(1)->getField("name")), [&structure](zserio::BitStreamReader& reader) { ASSERT_EQ(structure.getChildArray()[1].getName(), reader.readString()); - } - ); + }); checkWriteThrows(*(reflectable["childArray"]->at(1)->getField("nicknames"))); checkWriteReadBuiltin(*(reflectable["childArray"]->at(1)->getField("nicknames")->at(1)), [&structure](zserio::BitStreamReader& reader) { ASSERT_EQ(structure.getChildArray()[1].getNicknames()[1], reader.readString()); - } - ); + }); // uint8 param; ASSERT_EQ(5, reflectable.getField("param")->getUInt8()); @@ -256,11 +242,9 @@ class WithReflectionCodeTest : public ::testing::Test ASSERT_EQ("5", reflectable.getField("param")->toString()); ASSERT_THROW(reflectable.getField("param")->toInt(), zserio::CppRuntimeException); ASSERT_THROW(reflectable.getField("param")->getInt8(), zserio::CppRuntimeException); - checkWriteReadBuiltin(*(reflectable.getField("param")), - [&structure](zserio::BitStreamReader& reader) { - ASSERT_EQ(structure.getParam(), reader.readBits(8)); - } - ); + checkWriteReadBuiltin(*(reflectable.getField("param")), [&structure](zserio::BitStreamReader& reader) { + ASSERT_EQ(structure.getParam(), reader.readBits(8)); + }); // Parameterized(param) parameterized; ASSERT_EQ(5, reflectable["parameterized.param"]->getUInt8()); @@ -281,11 +265,9 @@ class WithReflectionCodeTest : public ::testing::Test ASSERT_EQ(4, reflectable.find("len")->toUInt()); ASSERT_EQ(4.0, reflectable.find("len")->toDouble()); ASSERT_THROW(reflectable.find("len")->toInt(), zserio::CppRuntimeException); - checkWriteReadBuiltin(*(reflectable.find("len")), - [&structure](zserio::BitStreamReader& reader) { - ASSERT_EQ(structure.getLen(), reader.readVarSize()); - } - ); + checkWriteReadBuiltin(*(reflectable.find("len")), [&structure](zserio::BitStreamReader& reader) { + ASSERT_EQ(structure.getLen(), reader.readVarSize()); + }); // uint32 offsets[len]; ASSERT_TRUE(reflectable.getField("offsets")->isArray()); @@ -293,19 +275,18 @@ class WithReflectionCodeTest : public ::testing::Test ASSERT_NE(0, reflectable.getField("offsets")->at(0)->getUInt32()); // offset shall be initialized ASSERT_NE(0, reflectable.getField("offsets")->at(0)->toDouble()); checkWriteThrows(*(reflectable.getField("offsets"))); - checkWriteReadBuiltin(*(reflectable.getField("offsets")->at(0)), - [&structure](zserio::BitStreamReader& reader) { + checkWriteReadBuiltin( + *(reflectable.getField("offsets")->at(0)), [&structure](zserio::BitStreamReader& reader) { ASSERT_EQ(structure.getOffsets()[0], reader.readBits(32)); - } - ); + }); // Parameterized(param) parameterizedArray[len]; ASSERT_TRUE(reflectable.getField("parameterizedArray")->isArray()); ASSERT_EQ(4, reflectable.getField("parameterizedArray")->size()); ASSERT_EQ("3", reflectable["parameterizedArray"]->at(2)->find("array")->at(2)->toString()); checkWriteThrows(*(reflectable["parameterizedArray"])); - checkWriteRead(*(reflectable["parameterizedArray"]->at(2)), - structure.getParameterizedArray()[2], structure.getParam()); + checkWriteRead(*(reflectable["parameterizedArray"]->at(2)), structure.getParameterizedArray()[2], + structure.getParam()); // Bitmask bitmaskField; ASSERT_EQ(Bitmask(Bitmask::Values::FLAG1 | Bitmask::Values::FLAG2).getValue(), @@ -349,11 +330,9 @@ class WithReflectionCodeTest : public ::testing::Test ASSERT_EQ(31, reflectable["dynamicBitField"]->toUInt()); ASSERT_EQ(31, reflectable["dynamicBitField"]->getUInt64()); ASSERT_THROW(reflectable["dynamicBitField"]->getUInt8(), zserio::CppRuntimeException); - checkWriteReadBuiltin(*(reflectable["dynamicBitField"]), - [&structure](zserio::BitStreamReader& reader) { - ASSERT_EQ(structure.getDynamicBitField(), reader.readBits64(structure.getParam())); - } - ); + checkWriteReadBuiltin(*(reflectable["dynamicBitField"]), [&structure](zserio::BitStreamReader& reader) { + ASSERT_EQ(structure.getDynamicBitField(), reader.readBits64(structure.getParam())); + }); // bit dynamicBitFieldArray[]; ASSERT_TRUE(reflectable.getField("dynamicBitFieldArray")->isArray()); @@ -363,11 +342,10 @@ class WithReflectionCodeTest : public ::testing::Test ASSERT_EQ(20.0, reflectable["dynamicBitFieldArray"]->at(1)->toDouble()); ASSERT_EQ("30", reflectable["dynamicBitFieldArray"]->at(2)->toString()); checkWriteThrows(*(reflectable["dynamicBitFieldArray"])); - checkWriteReadBuiltin(*(reflectable["dynamicBitFieldArray"]->at(2)), - [&structure](zserio::BitStreamReader& reader) { + checkWriteReadBuiltin( + *(reflectable["dynamicBitFieldArray"]->at(2)), [&structure](zserio::BitStreamReader& reader) { ASSERT_EQ(structure.getDynamicBitFieldArray()[2], reader.readBits64(structure.getParam())); - } - ); + }); // int dynamicIntField if param < 4; ASSERT_EQ(nullptr, reflectable.getField("dynamicIntField")); @@ -383,11 +361,10 @@ class WithReflectionCodeTest : public ::testing::Test ASSERT_EQ("-1", reflectable["dynamicIntFieldArray"]->at(1)->toString()); ASSERT_EQ(1, reflectable["dynamicIntFieldArray"]->at(2)->getInt8()); checkWriteThrows(*(reflectable["dynamicIntFieldArray"])); - checkWriteReadBuiltin(*(reflectable["dynamicIntFieldArray"]->at(0)), - [&structure](zserio::BitStreamReader& reader) { + checkWriteReadBuiltin( + *(reflectable["dynamicIntFieldArray"]->at(0)), [&structure](zserio::BitStreamReader& reader) { ASSERT_EQ(structure.getDynamicIntFieldArray()[0], reader.readSignedBits(4)); - } - ); + }); // bool boolArray[]; ASSERT_TRUE(reflectable["boolArray"]->isArray()); @@ -396,21 +373,19 @@ class WithReflectionCodeTest : public ::testing::Test ASSERT_EQ(0.0, reflectable["boolArray"]->at(1)->toDouble()); ASSERT_EQ("false", reflectable["boolArray"]->at(1)->toString()); checkWriteThrows(*(reflectable["boolArray"])); - checkWriteReadBuiltin(*(reflectable["boolArray"]->at(0)), - [&structure](zserio::BitStreamReader& reader) { + checkWriteReadBuiltin( + *(reflectable["boolArray"]->at(0)), [&structure](zserio::BitStreamReader& reader) { ASSERT_EQ(structure.getBoolArray()[0], reader.readBool()); - } - ); + }); // extern externField; ASSERT_EQ(16, reflectable.getField("externField")->getBitBuffer().getBitSize()); ASSERT_EQ(0xAB, reflectable.getField("externField")->getBitBuffer().getBuffer()[0]); ASSERT_EQ(0xCD, reflectable.getField("externField")->getBitBuffer().getBuffer()[1]); - checkWriteReadBuiltin(*(reflectable.getField("externField")), - [&structure](zserio::BitStreamReader& reader) { + checkWriteReadBuiltin( + *(reflectable.getField("externField")), [&structure](zserio::BitStreamReader& reader) { ASSERT_EQ(structure.getExternField(), reader.readBitBuffer()); - } - ); + }); // extern externArray[]; ASSERT_TRUE(reflectable["externArray"]->isArray()); @@ -420,21 +395,19 @@ class WithReflectionCodeTest : public ::testing::Test ASSERT_EQ(1, reflectable["externArray"]->at(1)->getBitBuffer().getBitSize()); ASSERT_EQ(0x01, reflectable["externArray"]->at(1)->getBitBuffer().getBuffer()[0]); checkWriteThrows(*(reflectable["externArray"])); - checkWriteReadBuiltin(*(reflectable.getField("externArray")->at(0)), - [&structure](zserio::BitStreamReader& reader) { + checkWriteReadBuiltin( + *(reflectable.getField("externArray")->at(0)), [&structure](zserio::BitStreamReader& reader) { ASSERT_EQ(structure.getExternArray()[0], reader.readBitBuffer()); - } - ); + }); // bytes bytesField; ASSERT_EQ(2, reflectable.getField("bytesField")->getBytes().size()); ASSERT_EQ(0xAB, reflectable.getField("bytesField")->getBytes().data()[0]); ASSERT_EQ(0xCD, reflectable.getField("bytesField")->getBytes().data()[1]); - checkWriteReadBuiltin(*(reflectable.getField("bytesField")), - [&structure](zserio::BitStreamReader& reader) { + checkWriteReadBuiltin( + *(reflectable.getField("bytesField")), [&structure](zserio::BitStreamReader& reader) { ASSERT_EQ(structure.getBytesField(), reader.readBytes()); - } - ); + }); // bytes bytesArray[]; ASSERT_TRUE(reflectable["bytesArray"]->isArray()); @@ -446,11 +419,10 @@ class WithReflectionCodeTest : public ::testing::Test ASSERT_EQ(0xCA, reflectable["bytesArray"]->at(1)->getBytes()[0]); ASSERT_EQ(0xFE, reflectable["bytesArray"]->at(1)->getBytes()[1]); checkWriteThrows(*(reflectable["bytesArray"])); - checkWriteReadBuiltin(*(reflectable.getField("bytesArray")->at(0)), - [&structure](zserio::BitStreamReader& reader) { + checkWriteReadBuiltin( + *(reflectable.getField("bytesArray")->at(0)), [&structure](zserio::BitStreamReader& reader) { ASSERT_EQ(structure.getBytesArray()[0], reader.readBytes()); - } - ); + }); // function Selector getEnumField() ASSERT_EQ(zserio::enumToString(SelectorEnum::STRUCT), @@ -461,11 +433,10 @@ class WithReflectionCodeTest : public ::testing::Test reflectable.setField("enumField", AnyHolder(Selector::UNION)); ASSERT_EQ(zserio::enumToString(Selector::UNION), reflectable["enumField"]->toString()); // - wrong type in any holder - ASSERT_THROW(reflectable.setField("bitmaskField", AnyHolder(Selector::UNION)), - zserio::CppRuntimeException); + ASSERT_THROW( + reflectable.setField("bitmaskField", AnyHolder(Selector::UNION)), zserio::CppRuntimeException); // - field does not exist - ASSERT_THROW(reflectable.setField("nonexistent", AnyHolder(0)), - zserio::CppRuntimeException); + ASSERT_THROW(reflectable.setField("nonexistent", AnyHolder(0)), zserio::CppRuntimeException); // - optional child reflectable.setField("child", AnyHolder(Child{13, "thirteen", false, zserio::NullOpt})); ASSERT_TRUE(reflectable.getField("child")); @@ -497,17 +468,14 @@ TEST_F(WithReflectionCodeTest, checkChoiceWithStructure) auto structReflectable = reflectable->getField(reflectable->getChoice()); ASSERT_TRUE(structReflectable); - ASSERT_EQ("with_reflection_code.Struct"_sv, - structReflectable->getTypeInfo().getSchemaName()); + ASSERT_EQ("with_reflection_code.Struct"_sv, structReflectable->getTypeInfo().getSchemaName()); // existing array element somewhere within the structField ASSERT_EQ(1, (*reflectable)["structField.parameterized.array"]->at(0)->toUInt()); - ASSERT_EQ(3, - reflectable->find("structField.parameterizedArray")->at(1)->find("array")->at(2)->getUInt8()); + ASSERT_EQ(3, reflectable->find("structField.parameterizedArray")->at(1)->find("array")->at(2)->getUInt8()); // function on structField - ASSERT_EQ(zserio::enumToValue(Selector::STRUCT), - reflectable->find("structField.getEnumField")->getInt8()); + ASSERT_EQ(zserio::enumToValue(Selector::STRUCT), reflectable->find("structField.getEnumField")->getInt8()); ASSERT_EQ("zero"_sv, reflectable->callFunction("getFirstChildName")->getStringView()); ASSERT_EQ("zero", reflectable->find("getFirstChildName")->toString()); diff --git a/test/arguments/with_sources_amalgamation/cpp/DefaultPackageAmalgamationTest.cpp b/test/arguments/with_sources_amalgamation/cpp/DefaultPackageAmalgamationTest.cpp index 333d2d402..bd976df40 100644 --- a/test/arguments/with_sources_amalgamation/cpp/DefaultPackageAmalgamationTest.cpp +++ b/test/arguments/with_sources_amalgamation/cpp/DefaultPackageAmalgamationTest.cpp @@ -27,11 +27,11 @@ TEST_F(DefaultPackageAmalgamationTest, checkDefaultPackage) { ASSERT_TRUE(isFilePresent( "arguments/with_sources_amalgamation/gen_default_package/DefaultPackageAmalgamation.cpp")); - ASSERT_TRUE(isFilePresent( - "arguments/with_sources_amalgamation/gen_default_package/AmalgamationStructure.h")); + ASSERT_TRUE( + isFilePresent("arguments/with_sources_amalgamation/gen_default_package/AmalgamationStructure.h")); - ASSERT_FALSE(isFilePresent( - "arguments/with_sources_amalgamation/gen_default_package/AmalgamationStructure.cpp")); + ASSERT_FALSE( + isFilePresent("arguments/with_sources_amalgamation/gen_default_package/AmalgamationStructure.cpp")); } TEST_F(DefaultPackageAmalgamationTest, readWrite) diff --git a/test/arguments/with_sources_amalgamation/cpp/WithSourcesAmalgamationTest.cpp b/test/arguments/with_sources_amalgamation/cpp/WithSourcesAmalgamationTest.cpp index 3ae1235a7..5ecf078da 100644 --- a/test/arguments/with_sources_amalgamation/cpp/WithSourcesAmalgamationTest.cpp +++ b/test/arguments/with_sources_amalgamation/cpp/WithSourcesAmalgamationTest.cpp @@ -2,7 +2,6 @@ #include #include "gtest/gtest.h" - #include "with_sources_amalgamation/WorldDb.h" namespace with_sources_amalgamation @@ -29,47 +28,37 @@ TEST_F(WithSourcesAmalgamation, checkWithSourcesAmalgamationPackage) { ASSERT_TRUE(isFilePresent( "arguments/with_sources_amalgamation/gen/with_sources_amalgamation/WithSourcesAmalgamation.cpp")); - ASSERT_TRUE(isFilePresent( - "arguments/with_sources_amalgamation/gen/with_sources_amalgamation/Color.h")); - ASSERT_TRUE(isFilePresent( - "arguments/with_sources_amalgamation/gen/with_sources_amalgamation/Direction.h")); - ASSERT_TRUE(isFilePresent( - "arguments/with_sources_amalgamation/gen/with_sources_amalgamation/GeoMapTable.h")); - ASSERT_TRUE(isFilePresent( - "arguments/with_sources_amalgamation/gen/with_sources_amalgamation/Group.h")); - ASSERT_TRUE(isFilePresent( - "arguments/with_sources_amalgamation/gen/with_sources_amalgamation/Permission.h")); - ASSERT_TRUE(isFilePresent( - "arguments/with_sources_amalgamation/gen/with_sources_amalgamation/WorldDb.h")); - - ASSERT_FALSE(isFilePresent( - "arguments/with_sources_amalgamation/gen/with_sources_amalgamation/Color.cpp")); - ASSERT_FALSE(isFilePresent( - "arguments/with_sources_amalgamation/gen/with_sources_amalgamation/Direction.cpp")); - ASSERT_FALSE(isFilePresent( - "arguments/with_sources_amalgamation/gen/with_sources_amalgamation/GeoMapTable.cpp")); - ASSERT_FALSE(isFilePresent( - "arguments/with_sources_amalgamation/gen/with_sources_amalgamation/Group.cpp")); - ASSERT_FALSE(isFilePresent( - "arguments/with_sources_amalgamation/gen/with_sources_amalgamation/Permission.cpp")); - ASSERT_FALSE(isFilePresent( - "arguments/with_sources_amalgamation/gen/with_sources_amalgamation/WorldDb.cpp")); + ASSERT_TRUE(isFilePresent("arguments/with_sources_amalgamation/gen/with_sources_amalgamation/Color.h")); + ASSERT_TRUE(isFilePresent("arguments/with_sources_amalgamation/gen/with_sources_amalgamation/Direction.h")); + ASSERT_TRUE( + isFilePresent("arguments/with_sources_amalgamation/gen/with_sources_amalgamation/GeoMapTable.h")); + ASSERT_TRUE(isFilePresent("arguments/with_sources_amalgamation/gen/with_sources_amalgamation/Group.h")); + ASSERT_TRUE( + isFilePresent("arguments/with_sources_amalgamation/gen/with_sources_amalgamation/Permission.h")); + ASSERT_TRUE(isFilePresent("arguments/with_sources_amalgamation/gen/with_sources_amalgamation/WorldDb.h")); + + ASSERT_FALSE(isFilePresent("arguments/with_sources_amalgamation/gen/with_sources_amalgamation/Color.cpp")); + ASSERT_FALSE( + isFilePresent("arguments/with_sources_amalgamation/gen/with_sources_amalgamation/Direction.cpp")); + ASSERT_FALSE( + isFilePresent("arguments/with_sources_amalgamation/gen/with_sources_amalgamation/GeoMapTable.cpp")); + ASSERT_FALSE(isFilePresent("arguments/with_sources_amalgamation/gen/with_sources_amalgamation/Group.cpp")); + ASSERT_FALSE( + isFilePresent("arguments/with_sources_amalgamation/gen/with_sources_amalgamation/Permission.cpp")); + ASSERT_FALSE( + isFilePresent("arguments/with_sources_amalgamation/gen/with_sources_amalgamation/WorldDb.cpp")); } TEST_F(WithSourcesAmalgamation, checkImportedTilePackage) { - ASSERT_TRUE(isFilePresent( - "arguments/with_sources_amalgamation/gen/_imported_tile_/ImportedTile.cpp")); - ASSERT_FALSE(isFilePresent( - "arguments/with_sources_amalgamation/gen/_imported_tile_/Tile.cpp")); + ASSERT_TRUE(isFilePresent("arguments/with_sources_amalgamation/gen/_imported_tile_/ImportedTile.cpp")); + ASSERT_FALSE(isFilePresent("arguments/with_sources_amalgamation/gen/_imported_tile_/Tile.cpp")); } TEST_F(WithSourcesAmalgamation, check___Package) { - ASSERT_TRUE(isFilePresent( - "arguments/with_sources_amalgamation/gen/___/Amalgamation.cpp")); - ASSERT_FALSE(isFilePresent( - "arguments/with_sources_amalgamation/gen/__/Empty.cpp")); + ASSERT_TRUE(isFilePresent("arguments/with_sources_amalgamation/gen/___/Amalgamation.cpp")); + ASSERT_FALSE(isFilePresent("arguments/with_sources_amalgamation/gen/__/Empty.cpp")); } TEST_F(WithSourcesAmalgamation, readWriteWorldDb) diff --git a/test/arguments/with_type_info_code/cpp/DebugStringTest.cpp b/test/arguments/with_type_info_code/cpp/DebugStringTest.cpp index bcf9a3108..a2e5eced1 100644 --- a/test/arguments/with_type_info_code/cpp/DebugStringTest.cpp +++ b/test/arguments/with_type_info_code/cpp/DebugStringTest.cpp @@ -1,7 +1,6 @@ #include #include "gtest/gtest.h" - #include "zserio/DebugStringUtil.h" #include "zserio/JsonWriter.h" #include "zserio/RebindAlloc.h" @@ -165,8 +164,8 @@ TEST_F(DebugStringTest, jsonWriterWithOptionals) { zserio::toJsonFile(withTypeInfoCode, JSON_NAME_WITH_OPTIONALS); - auto reflectable = zserio::fromJsonFile(WithTypeInfoCode::typeInfo(), JSON_NAME_WITH_OPTIONALS, - allocator_type()); + auto reflectable = + zserio::fromJsonFile(WithTypeInfoCode::typeInfo(), JSON_NAME_WITH_OPTIONALS, allocator_type()); ASSERT_TRUE(reflectable); reflectable->initializeChildren(); checkReflectable(withTypeInfoCode, reflectable); @@ -205,8 +204,8 @@ TEST_F(DebugStringTest, jsonWriterWithoutOptionals) const WithTypeInfoCode& withTypeInfoCodeConst = withTypeInfoCode; zserio::toJsonFile(withTypeInfoCodeConst, JSON_NAME_WITHOUT_OPTIONALS); - auto reflectable = zserio::fromJsonFile(WithTypeInfoCode::typeInfo(), JSON_NAME_WITHOUT_OPTIONALS, - allocator_type()); + auto reflectable = zserio::fromJsonFile( + WithTypeInfoCode::typeInfo(), JSON_NAME_WITHOUT_OPTIONALS, allocator_type()); ASSERT_TRUE(reflectable); reflectable->initializeChildren(); checkReflectable(withTypeInfoCode, reflectable); @@ -223,42 +222,40 @@ TEST_F(DebugStringTest, jsonWriterWithArrayLengthFilter) { const string_type jsonFileName = getJsonNameWithArrayLengthFilter(i); - { - { - std::ofstream jsonFile(jsonFileName.c_str(), std::ios::out | std::ios::trunc); - JsonWriter jsonWriter(jsonFile, JSON_INDENT); - ArrayLengthWalkFilter walkFilter(i); - Walker walker(jsonWriter, walkFilter); - walker.walk(withTypeInfoCode.reflectable()); - } - { - std::ifstream jsonFile(jsonFileName.c_str()); - JsonReader jsonReader(jsonFile); - auto reflectable = jsonReader.read(WithTypeInfoCode::typeInfo()); - ASSERT_TRUE(reflectable); - checkWithTypeInfoCodeArrayLength(reflectable, i); - } - } - { - { - // constant reflectable - const WithTypeInfoCode& withTypeInfoCodeConst = withTypeInfoCode; - std::ofstream jsonFile(jsonFileName.c_str(), std::ios::out | std::ios::trunc); - JsonWriter jsonWriter(jsonFile, JSON_INDENT); - ArrayLengthWalkFilter walkFilter(i); - Walker walker(jsonWriter, walkFilter); - walker.walk(withTypeInfoCodeConst.reflectable()); - } - { - std::ifstream jsonFile(jsonFileName.c_str()); - JsonReader jsonReader(jsonFile); - auto reflectable = jsonReader.read(WithTypeInfoCode::typeInfo()); - ASSERT_TRUE(reflectable); - checkWithTypeInfoCodeArrayLength(reflectable, i); - } - } + {{std::ofstream jsonFile(jsonFileName.c_str(), std::ios::out | std::ios::trunc); + JsonWriter jsonWriter(jsonFile, JSON_INDENT); + ArrayLengthWalkFilter walkFilter(i); + Walker walker(jsonWriter, walkFilter); + walker.walk(withTypeInfoCode.reflectable()); + } + { + std::ifstream jsonFile(jsonFileName.c_str()); + JsonReader jsonReader(jsonFile); + auto reflectable = jsonReader.read(WithTypeInfoCode::typeInfo()); + ASSERT_TRUE(reflectable); + checkWithTypeInfoCodeArrayLength(reflectable, i); } } +{ + { + // constant reflectable + const WithTypeInfoCode& withTypeInfoCodeConst = withTypeInfoCode; + std::ofstream jsonFile(jsonFileName.c_str(), std::ios::out | std::ios::trunc); + JsonWriter jsonWriter(jsonFile, JSON_INDENT); + ArrayLengthWalkFilter walkFilter(i); + Walker walker(jsonWriter, walkFilter); + walker.walk(withTypeInfoCodeConst.reflectable()); + } + { + std::ifstream jsonFile(jsonFileName.c_str()); + JsonReader jsonReader(jsonFile); + auto reflectable = jsonReader.read(WithTypeInfoCode::typeInfo()); + ASSERT_TRUE(reflectable); + checkWithTypeInfoCodeArrayLength(reflectable, i); + } +} +} // namespace with_type_info_code +} TEST_F(DebugStringTest, jsonWriterWithDepth0Filter) { @@ -266,41 +263,39 @@ TEST_F(DebugStringTest, jsonWriterWithDepth0Filter) fillWithTypeInfoCode(withTypeInfoCode); withTypeInfoCode.initializeOffsets(0); + {{std::ofstream jsonFile(JSON_NAME_WITH_DEPTH0_FILTER.c_str(), std::ios::out | std::ios::trunc); + JsonWriter jsonWriter(jsonFile, JSON_INDENT); + DepthWalkFilter walkFilter(0); + Walker walker(jsonWriter, walkFilter); + walker.walk(withTypeInfoCode.reflectable()); +} +{ + std::ifstream jsonFile(JSON_NAME_WITH_DEPTH0_FILTER.c_str()); + JsonReader jsonReader(jsonFile); + auto reflectable = jsonReader.read(WithTypeInfoCode::typeInfo()); + ASSERT_TRUE(reflectable); + checkWithTypeInfoCodeDepth0(reflectable); +} +} +{ + // constant reflectable { - { - std::ofstream jsonFile(JSON_NAME_WITH_DEPTH0_FILTER.c_str(), std::ios::out | std::ios::trunc); - JsonWriter jsonWriter(jsonFile, JSON_INDENT); - DepthWalkFilter walkFilter(0); - Walker walker(jsonWriter, walkFilter); - walker.walk(withTypeInfoCode.reflectable()); - } - { - std::ifstream jsonFile(JSON_NAME_WITH_DEPTH0_FILTER.c_str()); - JsonReader jsonReader(jsonFile); - auto reflectable = jsonReader.read(WithTypeInfoCode::typeInfo()); - ASSERT_TRUE(reflectable); - checkWithTypeInfoCodeDepth0(reflectable); - } + const WithTypeInfoCode& withTypeInfoCodeConst = withTypeInfoCode; + std::ofstream jsonFile(JSON_NAME_WITH_DEPTH0_FILTER.c_str(), std::ios::out | std::ios::trunc); + JsonWriter jsonWriter(jsonFile, JSON_INDENT); + DepthWalkFilter walkFilter(0); + Walker walker(jsonWriter, walkFilter); + walker.walk(withTypeInfoCodeConst.reflectable()); } { - // constant reflectable - { - const WithTypeInfoCode& withTypeInfoCodeConst = withTypeInfoCode; - std::ofstream jsonFile(JSON_NAME_WITH_DEPTH0_FILTER.c_str(), std::ios::out | std::ios::trunc); - JsonWriter jsonWriter(jsonFile, JSON_INDENT); - DepthWalkFilter walkFilter(0); - Walker walker(jsonWriter, walkFilter); - walker.walk(withTypeInfoCodeConst.reflectable()); - } - { - std::ifstream jsonFile(JSON_NAME_WITH_DEPTH0_FILTER.c_str()); - JsonReader jsonReader(jsonFile); - auto reflectable = jsonReader.read(WithTypeInfoCode::typeInfo()); - ASSERT_TRUE(reflectable); - checkWithTypeInfoCodeDepth0(reflectable); - } + std::ifstream jsonFile(JSON_NAME_WITH_DEPTH0_FILTER.c_str()); + JsonReader jsonReader(jsonFile); + auto reflectable = jsonReader.read(WithTypeInfoCode::typeInfo()); + ASSERT_TRUE(reflectable); + checkWithTypeInfoCodeDepth0(reflectable); } } +} TEST_F(DebugStringTest, jsonWriterWithDepth1ArrayLength0Filter) { @@ -308,53 +303,46 @@ TEST_F(DebugStringTest, jsonWriterWithDepth1ArrayLength0Filter) fillWithTypeInfoCode(withTypeInfoCode); withTypeInfoCode.initializeOffsets(0); + {{std::ofstream jsonFile( + JSON_NAME_WITH_DEPTH1_ARRAY_LENGTH0_FILTER.c_str(), std::ios::out | std::ios::trunc); + JsonWriter jsonWriter(jsonFile, JSON_INDENT); + DepthWalkFilter depthFilter(1); + ArrayLengthWalkFilter arrayLengthFilter(0); + AndWalkFilter walkFilter({std::ref(depthFilter), std::ref(arrayLengthFilter)}); + Walker walker(jsonWriter, walkFilter); + walker.walk(withTypeInfoCode.reflectable()); +} +{ + std::ifstream jsonFile(JSON_NAME_WITH_DEPTH1_ARRAY_LENGTH0_FILTER.c_str()); + JsonReader jsonReader(jsonFile); + auto reflectable = jsonReader.read(WithTypeInfoCode::typeInfo()); + ASSERT_TRUE(reflectable); + checkWithTypeInfoCodeDepth1ArrayLength0(reflectable); +} +} +{ { - { - std::ofstream jsonFile(JSON_NAME_WITH_DEPTH1_ARRAY_LENGTH0_FILTER.c_str(), - std::ios::out | std::ios::trunc); - JsonWriter jsonWriter(jsonFile, JSON_INDENT); - DepthWalkFilter depthFilter(1); - ArrayLengthWalkFilter arrayLengthFilter(0); - AndWalkFilter walkFilter({ - std::ref(depthFilter), - std::ref(arrayLengthFilter) - }); - Walker walker(jsonWriter, walkFilter); - walker.walk(withTypeInfoCode.reflectable()); - } - { - std::ifstream jsonFile(JSON_NAME_WITH_DEPTH1_ARRAY_LENGTH0_FILTER.c_str()); - JsonReader jsonReader(jsonFile); - auto reflectable = jsonReader.read(WithTypeInfoCode::typeInfo()); - ASSERT_TRUE(reflectable); - checkWithTypeInfoCodeDepth1ArrayLength0(reflectable); - } + // constant reflectable + const WithTypeInfoCode& withTypeInfoCodeConst = withTypeInfoCode; + std::ofstream jsonFile( + JSON_NAME_WITH_DEPTH1_ARRAY_LENGTH0_FILTER.c_str(), std::ios::out | std::ios::trunc); + JsonWriter jsonWriter(jsonFile, JSON_INDENT); + DepthWalkFilter depthFilter(1); + ArrayLengthWalkFilter arrayLengthFilter(0); + AndWalkFilter walkFilter( + {std::ref(depthFilter), std::ref(arrayLengthFilter)}); + Walker walker(jsonWriter, walkFilter); + walker.walk(withTypeInfoCodeConst.reflectable()); } { - { - // constant reflectable - const WithTypeInfoCode& withTypeInfoCodeConst = withTypeInfoCode; - std::ofstream jsonFile(JSON_NAME_WITH_DEPTH1_ARRAY_LENGTH0_FILTER.c_str(), - std::ios::out | std::ios::trunc); - JsonWriter jsonWriter(jsonFile, JSON_INDENT); - DepthWalkFilter depthFilter(1); - ArrayLengthWalkFilter arrayLengthFilter(0); - AndWalkFilter walkFilter({ - std::ref(depthFilter), - std::ref(arrayLengthFilter) - }); - Walker walker(jsonWriter, walkFilter); - walker.walk(withTypeInfoCodeConst.reflectable()); - } - { - std::ifstream jsonFile(JSON_NAME_WITH_DEPTH1_ARRAY_LENGTH0_FILTER.c_str()); - JsonReader jsonReader(jsonFile); - auto reflectable = jsonReader.read(WithTypeInfoCode::typeInfo()); - ASSERT_TRUE(reflectable); - checkWithTypeInfoCodeDepth1ArrayLength0(reflectable); - } + std::ifstream jsonFile(JSON_NAME_WITH_DEPTH1_ARRAY_LENGTH0_FILTER.c_str()); + JsonReader jsonReader(jsonFile); + auto reflectable = jsonReader.read(WithTypeInfoCode::typeInfo()); + ASSERT_TRUE(reflectable); + checkWithTypeInfoCodeDepth1ArrayLength0(reflectable); } } +} TEST_F(DebugStringTest, jsonWriterWithDepth5Filter) { @@ -362,43 +350,41 @@ TEST_F(DebugStringTest, jsonWriterWithDepth5Filter) fillWithTypeInfoCode(withTypeInfoCode); withTypeInfoCode.initializeOffsets(0); + {{std::ofstream jsonFile(JSON_NAME_WITH_DEPTH5_FILTER.c_str(), std::ios::out | std::ios::trunc); + JsonWriter jsonWriter(jsonFile, JSON_INDENT); + DepthWalkFilter walkFilter(5); + Walker walker(jsonWriter, walkFilter); + walker.walk(withTypeInfoCode.reflectable()); +} +{ + std::ifstream jsonFile(JSON_NAME_WITH_DEPTH5_FILTER.c_str()); + JsonReader jsonReader(jsonFile); + auto reflectable = jsonReader.read(WithTypeInfoCode::typeInfo()); + ASSERT_TRUE(reflectable); + reflectable->initializeChildren(); + checkReflectable(withTypeInfoCode, reflectable); +} +} +{ { - { - std::ofstream jsonFile(JSON_NAME_WITH_DEPTH5_FILTER.c_str(), std::ios::out | std::ios::trunc); - JsonWriter jsonWriter(jsonFile, JSON_INDENT); - DepthWalkFilter walkFilter(5); - Walker walker(jsonWriter, walkFilter); - walker.walk(withTypeInfoCode.reflectable()); - } - { - std::ifstream jsonFile(JSON_NAME_WITH_DEPTH5_FILTER.c_str()); - JsonReader jsonReader(jsonFile); - auto reflectable = jsonReader.read(WithTypeInfoCode::typeInfo()); - ASSERT_TRUE(reflectable); - reflectable->initializeChildren(); - checkReflectable(withTypeInfoCode, reflectable); - } + // constant reflectable + const WithTypeInfoCode& withTypeInfoCodeConst = withTypeInfoCode; + std::ofstream jsonFile(JSON_NAME_WITH_DEPTH5_FILTER.c_str(), std::ios::out | std::ios::trunc); + JsonWriter jsonWriter(jsonFile, JSON_INDENT); + DepthWalkFilter walkFilter(5); + Walker walker(jsonWriter, walkFilter); + walker.walk(withTypeInfoCodeConst.reflectable()); } { - { - // constant reflectable - const WithTypeInfoCode& withTypeInfoCodeConst = withTypeInfoCode; - std::ofstream jsonFile(JSON_NAME_WITH_DEPTH5_FILTER.c_str(), std::ios::out | std::ios::trunc); - JsonWriter jsonWriter(jsonFile, JSON_INDENT); - DepthWalkFilter walkFilter(5); - Walker walker(jsonWriter, walkFilter); - walker.walk(withTypeInfoCodeConst.reflectable()); - } - { - std::ifstream jsonFile(JSON_NAME_WITH_DEPTH5_FILTER.c_str()); - JsonReader jsonReader(jsonFile); - auto reflectable = jsonReader.read(WithTypeInfoCode::typeInfo()); - ASSERT_TRUE(reflectable); - reflectable->initializeChildren(); - checkReflectable(withTypeInfoCode, reflectable); - } + std::ifstream jsonFile(JSON_NAME_WITH_DEPTH5_FILTER.c_str()); + JsonReader jsonReader(jsonFile); + auto reflectable = jsonReader.read(WithTypeInfoCode::typeInfo()); + ASSERT_TRUE(reflectable); + reflectable->initializeChildren(); + checkReflectable(withTypeInfoCode, reflectable); } } +} TEST_F(DebugStringTest, jsonWriterWithRegexFilter) { @@ -407,40 +393,38 @@ TEST_F(DebugStringTest, jsonWriterWithRegexFilter) fillWithTypeInfoCode(withTypeInfoCode, createOptionals); withTypeInfoCode.initializeOffsets(0); + {{std::ofstream jsonFile(JSON_NAME_WITH_REGEX_FILTER.c_str(), std::ios::out | std::ios::trunc); + JsonWriter jsonWriter(jsonFile, JSON_INDENT); + RegexWalkFilter walkFilter(".*fieldOffset"); + Walker walker(jsonWriter, walkFilter); + walker.walk(withTypeInfoCode.reflectable()); +} +{ + std::ifstream jsonFile(JSON_NAME_WITH_REGEX_FILTER.c_str()); + JsonReader jsonReader(jsonFile); + auto reflectable = jsonReader.read(WithTypeInfoCode::typeInfo()); + ASSERT_TRUE(reflectable); + checkWithTypeInfoCodeRegex(reflectable); +} +} +{ { - { - std::ofstream jsonFile(JSON_NAME_WITH_REGEX_FILTER.c_str(), std::ios::out | std::ios::trunc); - JsonWriter jsonWriter(jsonFile, JSON_INDENT); - RegexWalkFilter walkFilter(".*fieldOffset"); - Walker walker(jsonWriter, walkFilter); - walker.walk(withTypeInfoCode.reflectable()); - } - { - std::ifstream jsonFile(JSON_NAME_WITH_REGEX_FILTER.c_str()); - JsonReader jsonReader(jsonFile); - auto reflectable = jsonReader.read(WithTypeInfoCode::typeInfo()); - ASSERT_TRUE(reflectable); - checkWithTypeInfoCodeRegex(reflectable); - } + // constant reflectable + const WithTypeInfoCode& withTypeInfoCodeConst = withTypeInfoCode; + std::ofstream jsonFile(JSON_NAME_WITH_REGEX_FILTER.c_str(), std::ios::out | std::ios::trunc); + JsonWriter jsonWriter(jsonFile, JSON_INDENT); + RegexWalkFilter walkFilter(".*fieldOffset"); + Walker walker(jsonWriter, walkFilter); + walker.walk(withTypeInfoCodeConst.reflectable()); } { - { - // constant reflectable - const WithTypeInfoCode& withTypeInfoCodeConst = withTypeInfoCode; - std::ofstream jsonFile(JSON_NAME_WITH_REGEX_FILTER.c_str(), std::ios::out | std::ios::trunc); - JsonWriter jsonWriter(jsonFile, JSON_INDENT); - RegexWalkFilter walkFilter(".*fieldOffset"); - Walker walker(jsonWriter, walkFilter); - walker.walk(withTypeInfoCodeConst.reflectable()); - } - { - std::ifstream jsonFile(JSON_NAME_WITH_REGEX_FILTER.c_str()); - JsonReader jsonReader(jsonFile); - auto reflectable = jsonReader.read(WithTypeInfoCode::typeInfo()); - ASSERT_TRUE(reflectable); - checkWithTypeInfoCodeRegex(reflectable); - } + std::ifstream jsonFile(JSON_NAME_WITH_REGEX_FILTER.c_str()); + JsonReader jsonReader(jsonFile); + auto reflectable = jsonReader.read(WithTypeInfoCode::typeInfo()); + ASSERT_TRUE(reflectable); + checkWithTypeInfoCodeRegex(reflectable); } } +} } // namespace with_type_info_code diff --git a/test/arguments/with_type_info_code/cpp/WithTypeInfoCodeCreator.cpp b/test/arguments/with_type_info_code/cpp/WithTypeInfoCodeCreator.cpp index 1d1291ba3..d8b108891 100644 --- a/test/arguments/with_type_info_code/cpp/WithTypeInfoCodeCreator.cpp +++ b/test/arguments/with_type_info_code/cpp/WithTypeInfoCodeCreator.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "zserio/RebindAlloc.h" #include "WithTypeInfoCodeCreator.h" @@ -68,8 +67,8 @@ static void fillComplexStruct(ComplexStruct& complexStruct, bool createOptionals if (createOptionals) { complexStruct.setOptionalEnum(TestEnum::ItemThree); - complexStruct.setOptionalBitmask(TestBitmask::Values::RED | TestBitmask::Values::_Green | - TestBitmask::Values::ColorBlue); + complexStruct.setOptionalBitmask( + TestBitmask::Values::RED | TestBitmask::Values::_Green | TestBitmask::Values::ColorBlue); const vector_type buffer = {0xCB, 0xF0}; complexStruct.setOptionalExtern(BitBuffer(buffer, 12)); complexStruct.setOptionalBytes(vector_type{{0xAB, 0xCD}}); @@ -89,8 +88,8 @@ static void fillComplexStruct(ComplexStruct& complexStruct, bool createOptionals static void fillRecursiveStruct(RecursiveStruct& recursiveStruct) { recursiveStruct.setFieldU32(0xDEAD1); - recursiveStruct.setFieldRecursion(RecursiveStruct(0xDEAD2, zserio::NullOpt, - vector_type())); + recursiveStruct.setFieldRecursion( + RecursiveStruct(0xDEAD2, zserio::NullOpt, vector_type())); const vector_type arrayRecursion = { RecursiveStruct(0xDEAD3, zserio::NullOpt, vector_type()), RecursiveStruct(0xDEAD4, zserio::NullOpt, vector_type())}; @@ -164,16 +163,16 @@ void fillWithTypeInfoCode(WithTypeInfoCode& withTypeInfoCode, bool createOptiona withTypeInfoCode.setSelector(TestEnum::_TWO); fillSimpleChoice(withTypeInfoCode.getSimpleChoice(), withTypeInfoCode.getSelector()); fillTS32(withTypeInfoCode.getTemplatedStruct()); - fillTemplatedParameterizedStruct_TS32(withTypeInfoCode.getTemplatedParameterizedStruct(), - withTypeInfoCode.getTemplatedStruct()); + fillTemplatedParameterizedStruct_TS32( + withTypeInfoCode.getTemplatedParameterizedStruct(), withTypeInfoCode.getTemplatedStruct()); const BitBuffer externData({0xCA, 0xFE}, 15); withTypeInfoCode.setExternData(externData); const vector_type externArray = {externData, externData}; withTypeInfoCode.setExternArray(externArray); withTypeInfoCode.setBytesData(vector_type{{0xAB, 0xCD}}); withTypeInfoCode.setBytesArray(vector_type>{{ - vector_type{{0xAB, 0xCD}}, - vector_type{{0xAB, 0xCD}}, + vector_type{{0xAB, 0xCD}}, + vector_type{{0xAB, 0xCD}}, }}); const vector_type implicitArray = {1, 4, 6, 4, 6, 1}; withTypeInfoCode.setImplicitArray(implicitArray); diff --git a/test/arguments/with_type_info_code/cpp/WithTypeInfoCodeTest.cpp b/test/arguments/with_type_info_code/cpp/WithTypeInfoCodeTest.cpp index a46ac9c52..01f4a21f8 100644 --- a/test/arguments/with_type_info_code/cpp/WithTypeInfoCodeTest.cpp +++ b/test/arguments/with_type_info_code/cpp/WithTypeInfoCodeTest.cpp @@ -1,13 +1,11 @@ #include #include "gtest/gtest.h" - -#include "zserio/RebindAlloc.h" -#include "zserio/SerializeUtil.h" - -#include "with_type_info_code/SqlDatabase.h" #include "with_type_info_code/SimplePubsub.h" #include "with_type_info_code/SimpleService.h" +#include "with_type_info_code/SqlDatabase.h" +#include "zserio/RebindAlloc.h" +#include "zserio/SerializeUtil.h" #include "WithTypeInfoCodeCreator.h" @@ -825,8 +823,7 @@ class WithTypeInfoCodeTest : public ::testing::Test ASSERT_EQ(zserio::CppType::UINT64, dynamicBitFieldArrayField.typeInfo.getCppType()); ASSERT_EQ(1, dynamicBitFieldArrayField.typeArguments.size()); - ASSERT_EQ("getDynamicBitField() * 2"_sv, - dynamicBitFieldArrayField.typeArguments[0]); + ASSERT_EQ("getDynamicBitField() * 2"_sv, dynamicBitFieldArrayField.typeArguments[0]); ASSERT_EQ(false, dynamicBitFieldArrayField.isExtended); ASSERT_EQ(""_sv, dynamicBitFieldArrayField.alignment); ASSERT_EQ(""_sv, dynamicBitFieldArrayField.offset); @@ -1249,7 +1246,6 @@ class WithTypeInfoCodeTest : public ::testing::Test ASSERT_EQ(6, ItemThreeItem.value); ASSERT_FALSE(ItemThreeItem.isDeprecated); ASSERT_FALSE(ItemThreeItem.isRemoved); - } void checkSimpleChoice(const ITypeInfo& typeInfo) @@ -1488,8 +1484,7 @@ class WithTypeInfoCodeTest : public ::testing::Test void checkTemplatedParameterizedStruct_TS32(const ITypeInfo& typeInfo) { - ASSERT_EQ("with_type_info_code.TemplatedParameterizedStruct_TS32"_sv, - typeInfo.getSchemaName()); + ASSERT_EQ("with_type_info_code.TemplatedParameterizedStruct_TS32"_sv, typeInfo.getSchemaName()); ASSERT_EQ(zserio::SchemaType::STRUCT, typeInfo.getSchemaType()); ASSERT_EQ(zserio::CppType::STRUCT, typeInfo.getCppType()); diff --git a/test/arguments/with_validation_code/cpp/BlobTableValidationTest.cpp b/test/arguments/with_validation_code/cpp/BlobTableValidationTest.cpp index 6027570c0..bdc21388e 100644 --- a/test/arguments/with_validation_code/cpp/BlobTableValidationTest.cpp +++ b/test/arguments/with_validation_code/cpp/BlobTableValidationTest.cpp @@ -1,13 +1,11 @@ #include #include "gtest/gtest.h" - +#include "test_utils/ValidationObservers.h" +#include "with_validation_code/blob_table_validation/BlobTableValidationDb.h" #include "zserio/FloatUtil.h" #include "zserio/SqliteFinalizer.h" -#include "with_validation_code/blob_table_validation/BlobTableValidationDb.h" -#include "test_utils/ValidationObservers.h" - using namespace test_utils; namespace with_validation_code @@ -32,8 +30,8 @@ class BlobTableValidationTest : public ::testing::Test { const bool wasTransactionStarted = connection.startTransaction(); - std::unique_ptr statement(connection.prepareStatement( - "INSERT INTO blobTable(id, blob, nullableBlob) VALUES (?, ?, ?)")); + std::unique_ptr statement( + connection.prepareStatement("INSERT INTO blobTable(id, blob, nullableBlob) VALUES (?, ?, ?)")); int argIdx = 1; sqlite3_bind_int(statement.get(), argIdx++, ROW_ID); @@ -71,9 +69,9 @@ const char* const BlobTableValidationTest::DB_FILE_NAME = constexpr uint32_t BlobTableValidationTest::ROW_ID; constexpr bool BlobTableValidationTest::HAS_NAN; -constexpr uint32_t BlobTableValidationTest::NONE_STANDARD_NAN_VALUE; -constexpr uint8_t BlobTableValidationTest::ALIGNED_7_BITS; -constexpr int8_t BlobTableValidationTest::END_VALUE; +constexpr uint32_t BlobTableValidationTest::NONE_STANDARD_NAN_VALUE; +constexpr uint8_t BlobTableValidationTest::ALIGNED_7_BITS; +constexpr int8_t BlobTableValidationTest::END_VALUE; TEST_F(BlobTableValidationTest, validate) { diff --git a/test/arguments/with_validation_code/cpp/ColumnTypeValidationTest.cpp b/test/arguments/with_validation_code/cpp/ColumnTypeValidationTest.cpp index cb421f04a..5456c1415 100644 --- a/test/arguments/with_validation_code/cpp/ColumnTypeValidationTest.cpp +++ b/test/arguments/with_validation_code/cpp/ColumnTypeValidationTest.cpp @@ -1,12 +1,10 @@ #include #include "gtest/gtest.h" - -#include "with_validation_code/column_type_validation/ColumnTypeDb.h" #include "test_utils/ValidationObservers.h" - -#include "zserio/SqliteFinalizer.h" +#include "with_validation_code/column_type_validation/ColumnTypeDb.h" #include "zserio/SerializeUtil.h" +#include "zserio/SqliteFinalizer.h" using namespace test_utils; @@ -203,12 +201,12 @@ TEST_F(ColumnTypeValidationTest, validateBlobWhileIntegerExpected) { populateDb(); - std::unique_ptr stmt( - m_database->connection().prepareStatement("UPDATE columnTypeTable SET int64Value = ? WHERE id = 2")); + std::unique_ptr stmt(m_database->connection().prepareStatement( + "UPDATE columnTypeTable SET int64Value = ? WHERE id = 2")); Blob blob(13); auto bitBuffer = zserio::serialize(blob); - sqlite3_bind_blob(stmt.get(), 1, bitBuffer.getBuffer(), static_cast(bitBuffer.getByteSize()), - SQLITE_TRANSIENT); + sqlite3_bind_blob( + stmt.get(), 1, bitBuffer.getBuffer(), static_cast(bitBuffer.getByteSize()), SQLITE_TRANSIENT); ASSERT_EQ(SQLITE_DONE, sqlite3_step(stmt.get())); ValidationObserver validationObserver; @@ -318,12 +316,12 @@ TEST_F(ColumnTypeValidationTest, validateBlobWhileFloatExpected) { populateDb(); - std::unique_ptr stmt( - m_database->connection().prepareStatement("UPDATE columnTypeTable SET float16Value = ? WHERE id = 2")); + std::unique_ptr stmt(m_database->connection().prepareStatement( + "UPDATE columnTypeTable SET float16Value = ? WHERE id = 2")); Blob blob(13); auto bitBuffer = zserio::serialize(blob); - sqlite3_bind_blob(stmt.get(), 1, bitBuffer.getBuffer(), static_cast(bitBuffer.getByteSize()), - SQLITE_TRANSIENT); + sqlite3_bind_blob( + stmt.get(), 1, bitBuffer.getBuffer(), static_cast(bitBuffer.getByteSize()), SQLITE_TRANSIENT); ASSERT_EQ(SQLITE_DONE, sqlite3_step(stmt.get())); ValidationObserver validationObserver; @@ -387,12 +385,12 @@ TEST_F(ColumnTypeValidationTest, validateBlobWhileStringExpected) { populateDb(); - std::unique_ptr stmt( - m_database->connection().prepareStatement("UPDATE columnTypeTable SET stringValue = ? WHERE id = 2")); + std::unique_ptr stmt(m_database->connection().prepareStatement( + "UPDATE columnTypeTable SET stringValue = ? WHERE id = 2")); Blob blob(13); auto bitBuffer = zserio::serialize(blob); - sqlite3_bind_blob(stmt.get(), 1, bitBuffer.getBuffer(), static_cast(bitBuffer.getByteSize()), - SQLITE_TRANSIENT); + sqlite3_bind_blob( + stmt.get(), 1, bitBuffer.getBuffer(), static_cast(bitBuffer.getByteSize()), SQLITE_TRANSIENT); ASSERT_EQ(SQLITE_DONE, sqlite3_step(stmt.get())); ValidationObserver validationObserver; @@ -454,8 +452,8 @@ TEST_F(ColumnTypeValidationTest, validateFloatWhileBlobExpected) ASSERT_EQ(1, validationObserver.getErrors().size()); const auto& error = validationObserver.getErrors()[0]; ASSERT_EQ(std::vector{"1"}, error.primaryKeyValues); - ASSERT_EQ("Column ColumnTypeTable.blobValue type check failed (REAL doesn't match to BLOB)!", - error.message); + ASSERT_EQ( + "Column ColumnTypeTable.blobValue type check failed (REAL doesn't match to BLOB)!", error.message); } TEST_F(ColumnTypeValidationTest, validateStringWhileBlobExpected) @@ -477,8 +475,8 @@ TEST_F(ColumnTypeValidationTest, validateStringWhileBlobExpected) ASSERT_EQ(1, validationObserver.getErrors().size()); const auto& error = validationObserver.getErrors()[0]; ASSERT_EQ(std::vector{"1"}, error.primaryKeyValues); - ASSERT_EQ("Column ColumnTypeTable.blobValue type check failed (TEXT doesn't match to BLOB)!", - error.message); + ASSERT_EQ( + "Column ColumnTypeTable.blobValue type check failed (TEXT doesn't match to BLOB)!", error.message); } TEST_F(ColumnTypeValidationTest, validateEmptyStringWhileBlobExpected) @@ -500,8 +498,8 @@ TEST_F(ColumnTypeValidationTest, validateEmptyStringWhileBlobExpected) ASSERT_EQ(1, validationObserver.getErrors().size()); const auto& error = validationObserver.getErrors()[0]; ASSERT_EQ(std::vector{"1"}, error.primaryKeyValues); - ASSERT_EQ("Column ColumnTypeTable.blobValue type check failed (TEXT doesn't match to BLOB)!", - error.message); + ASSERT_EQ( + "Column ColumnTypeTable.blobValue type check failed (TEXT doesn't match to BLOB)!", error.message); } } // namespace column_type_validation diff --git a/test/arguments/with_validation_code/cpp/ConstraintTableValidationTest.cpp b/test/arguments/with_validation_code/cpp/ConstraintTableValidationTest.cpp index abb844a6a..c3dc7c805 100644 --- a/test/arguments/with_validation_code/cpp/ConstraintTableValidationTest.cpp +++ b/test/arguments/with_validation_code/cpp/ConstraintTableValidationTest.cpp @@ -1,13 +1,11 @@ #include #include "gtest/gtest.h" - +#include "test_utils/ValidationObservers.h" +#include "with_validation_code/constraint_table_validation/ConstraintTableValidationDb.h" #include "zserio/FloatUtil.h" #include "zserio/SqliteFinalizer.h" -#include "with_validation_code/constraint_table_validation/ConstraintTableValidationDb.h" -#include "test_utils/ValidationObservers.h" - using namespace test_utils; namespace with_validation_code @@ -32,8 +30,8 @@ class ConstraintTableValidationTest : public ::testing::Test { const bool wasTransactionStarted = connection.startTransaction(); - std::unique_ptr statement(connection.prepareStatement( - "INSERT INTO constraintTable(id, blob) VALUES (?, ?)")); + std::unique_ptr statement( + connection.prepareStatement("INSERT INTO constraintTable(id, blob) VALUES (?, ?)")); int argIdx = 1; sqlite3_bind_int(statement.get(), argIdx++, ROW_ID); @@ -62,7 +60,7 @@ const char* const ConstraintTableValidationTest::DB_FILE_NAME = "arguments/with_validation_code/constraint_table_validation_test.sqlite"; constexpr uint32_t ConstraintTableValidationTest::ROW_ID; -constexpr uint8_t ConstraintTableValidationTest::VALUE; +constexpr uint8_t ConstraintTableValidationTest::VALUE; TEST_F(ConstraintTableValidationTest, validate) { diff --git a/test/arguments/with_validation_code/cpp/ControlValidationTest.cpp b/test/arguments/with_validation_code/cpp/ControlValidationTest.cpp index 53168fcb9..1e77a8dcb 100644 --- a/test/arguments/with_validation_code/cpp/ControlValidationTest.cpp +++ b/test/arguments/with_validation_code/cpp/ControlValidationTest.cpp @@ -1,15 +1,13 @@ -#include #include +#include #include "gtest/gtest.h" - +#include "test_utils/ValidationObservers.h" +#include "with_validation_code/control_validation/ControlValidationDb.h" #include "zserio/FloatUtil.h" #include "zserio/SqliteFinalizer.h" #include "zserio/StringConvertUtil.h" -#include "with_validation_code/control_validation/ControlValidationDb.h" -#include "test_utils/ValidationObservers.h" - using namespace test_utils; namespace with_validation_code @@ -35,20 +33,20 @@ class ControlValidationTest : public ::testing::Test const bool wasTransactionStarted = connection.startTransaction(); { - std::unique_ptr statement(connection.prepareStatement( - "INSERT INTO table1(id, field) VALUES (?, ?)")); + std::unique_ptr statement( + connection.prepareStatement("INSERT INTO table1(id, field) VALUES (?, ?)")); insertRows(statement.get(), TABLE1_NUM_ROWS); } { - std::unique_ptr statement(connection.prepareStatement( - "INSERT INTO table2(id, blob) VALUES (?, ?)")); + std::unique_ptr statement( + connection.prepareStatement("INSERT INTO table2(id, blob) VALUES (?, ?)")); insertRowsWithBlob(statement.get(), TABLE2_NUM_ROWS); } { - std::unique_ptr statement(connection.prepareStatement( - "INSERT INTO table3(id, field) VALUES (?, ?)")); + std::unique_ptr statement( + connection.prepareStatement("INSERT INTO table3(id, field) VALUES (?, ?)")); insertRows(statement.get(), TABLE3_NUM_ROWS); } @@ -91,8 +89,8 @@ class ControlValidationTest : public ::testing::Test void writeInvalidBlobToTable2(zserio::SqliteConnection& connection, uint32_t id) { - std::unique_ptr statement(connection.prepareStatement( - "UPDATE table2 SET blob = ? where id = ?")); + std::unique_ptr statement( + connection.prepareStatement("UPDATE table2 SET blob = ? where id = ?")); zserio::BitBuffer bitBuffer(8); zserio::BitStreamWriter writer(bitBuffer); @@ -116,7 +114,8 @@ class ControlValidationTest : public ::testing::Test explicit SkipTableObserver(const std::set& tablesToSkip, const std::string& tableToStopAfter = std::string(), size_t numberOfErrorsInRowsToSkipRestOfTheTable = SIZE_MAX) : - m_tablesToSkip(tablesToSkip), m_tableToStopAfter(tableToStopAfter), + m_tablesToSkip(tablesToSkip), + m_tableToStopAfter(tableToStopAfter), m_numberOfErrorsInRowsToSkipRestOfTheTable(numberOfErrorsInRowsToSkipRestOfTheTable) {} @@ -133,8 +132,8 @@ class ControlValidationTest : public ::testing::Test } bool reportError(zserio::StringView tableName, zserio::StringView fieldName, - zserio::Span primaryKeyValues, ErrorType errorType, - zserio::StringView message) override + zserio::Span primaryKeyValues, ErrorType errorType, + zserio::StringView message) override { ValidationObserver::reportError(tableName, fieldName, primaryKeyValues, errorType, message); if (errorType >= zserio::IValidationObserver::VALUE_OUT_OF_RANGE) @@ -379,17 +378,18 @@ TEST_F(ControlValidationTest, validateSkipTableAfter2ErrorsInRows) ASSERT_EQ(std::vector{"0"}, errors.at(3).primaryKeyValues); ASSERT_EQ(zserio::IValidationObserver::VALUE_OUT_OF_RANGE, errors.at(3).errorType); ASSERT_EQ("Value -72057594037927936 of Table3.field exceeds the range of " - "-72057594037927935..72057594037927935", errors.at(3).message); + "-72057594037927935..72057594037927935", + errors.at(3).message); ASSERT_EQ("table3", errors.at(4).tableName); ASSERT_EQ("field", errors.at(4).fieldName); ASSERT_EQ(std::vector{"1"}, errors.at(4).primaryKeyValues); ASSERT_EQ(zserio::IValidationObserver::VALUE_OUT_OF_RANGE, errors.at(4).errorType); ASSERT_EQ("Value -72057594037927936 of Table3.field exceeds the range of " - "-72057594037927935..72057594037927935", errors.at(4).message); + "-72057594037927935..72057594037927935", + errors.at(4).message); } - TEST_F(ControlValidationTest, validateSkipTableAndTerminateValidationAfterFirstSchemaError) { zserio::SqliteConnection& connection = m_database->connection(); @@ -402,7 +402,8 @@ TEST_F(ControlValidationTest, validateSkipTableAndTerminateValidationAfterFirstS connection.executeUpdate("UPDATE table1 SET field = (16383 + 1) where id = 0"); connection.executeUpdate("UPDATE table1 SET field = (-16383 - 1) where id = 3"); - connection.executeUpdate("CREATE TABLE table2Temp (id INTEGER PRIMARY KEY NOT NULL, " + connection.executeUpdate( + "CREATE TABLE table2Temp (id INTEGER PRIMARY KEY NOT NULL, " "blob BLOB, superfluousField INTEGER NOT NULL)"); // field shall be NOT NULL connection.executeUpdate("INSERT INTO table2Temp SELECT id, blob, 0 FROM table2"); connection.executeUpdate("DROP TABLE table2"); @@ -420,8 +421,8 @@ TEST_F(ControlValidationTest, validateSkipTableAndTerminateValidationAfterFirstS } bool reportError(zserio::StringView tableName, zserio::StringView fieldName, - zserio::Span primaryKeyValues, ErrorType errorType, - zserio::StringView message) override + zserio::Span primaryKeyValues, ErrorType errorType, + zserio::StringView message) override { ValidationObserver::reportError(tableName, fieldName, primaryKeyValues, errorType, message); if (errorType < zserio::IValidationObserver::VALUE_OUT_OF_RANGE) @@ -477,5 +478,5 @@ TEST_F(ControlValidationTest, validateSkipTableAndTerminateValidationAfterFirstS errors.at(2).message); } -} // namespace control_table +} // namespace control_validation } // namespace with_validation_code diff --git a/test/arguments/with_validation_code/cpp/DependTableValidationTest.cpp b/test/arguments/with_validation_code/cpp/DependTableValidationTest.cpp index 1aa5fc6b0..ff46a752e 100644 --- a/test/arguments/with_validation_code/cpp/DependTableValidationTest.cpp +++ b/test/arguments/with_validation_code/cpp/DependTableValidationTest.cpp @@ -1,13 +1,11 @@ #include #include "gtest/gtest.h" - +#include "test_utils/ValidationObservers.h" +#include "with_validation_code/depend_table_validation/DependTableValidationDb.h" #include "zserio/FloatUtil.h" #include "zserio/SqliteFinalizer.h" -#include "with_validation_code/depend_table_validation/DependTableValidationDb.h" -#include "test_utils/ValidationObservers.h" - using namespace test_utils; namespace with_validation_code diff --git a/test/arguments/with_validation_code/cpp/FullRangeTableValidationTest.cpp b/test/arguments/with_validation_code/cpp/FullRangeTableValidationTest.cpp index 49047609c..ef3cd9506 100644 --- a/test/arguments/with_validation_code/cpp/FullRangeTableValidationTest.cpp +++ b/test/arguments/with_validation_code/cpp/FullRangeTableValidationTest.cpp @@ -1,10 +1,8 @@ #include #include "gtest/gtest.h" - -#include "with_validation_code/full_range_table_validation/FullRangeTableValidationDb.h" #include "test_utils/ValidationObservers.h" - +#include "with_validation_code/full_range_table_validation/FullRangeTableValidationDb.h" #include "zserio/SqliteFinalizer.h" using namespace test_utils; @@ -57,8 +55,8 @@ class FullRangeTableValidationTest : public ::testing::Test sqlite3_bind_int64(statement.get(), argIdx++, static_cast(fullUnsigned)); sqlite3_bind_int64(statement.get(), argIdx++, fullVarSigned); sqlite3_bind_int64(statement.get(), argIdx++, static_cast(fullVarUnsigned)); - sqlite3_bind_text(statement.get(), argIdx++, message.c_str(), static_cast(message.size()), - SQLITE_TRANSIENT); + sqlite3_bind_text( + statement.get(), argIdx++, message.c_str(), static_cast(message.size()), SQLITE_TRANSIENT); ASSERT_EQ(SQLITE_DONE, sqlite3_step(statement.get())); } diff --git a/test/arguments/with_validation_code/cpp/HiddenColumnTableValidationTest.cpp b/test/arguments/with_validation_code/cpp/HiddenColumnTableValidationTest.cpp index a6877933f..aa3f263cd 100644 --- a/test/arguments/with_validation_code/cpp/HiddenColumnTableValidationTest.cpp +++ b/test/arguments/with_validation_code/cpp/HiddenColumnTableValidationTest.cpp @@ -1,10 +1,8 @@ #include #include "gtest/gtest.h" - -#include "with_validation_code/hidden_column_table_validation/HiddenColumnTableValidationDb.h" #include "test_utils/ValidationObservers.h" - +#include "with_validation_code/hidden_column_table_validation/HiddenColumnTableValidationDb.h" #include "zserio/SqliteFinalizer.h" using namespace test_utils; diff --git a/test/arguments/with_validation_code/cpp/SimpleTableValidationTest.cpp b/test/arguments/with_validation_code/cpp/SimpleTableValidationTest.cpp index ec0a28cc7..ece552816 100644 --- a/test/arguments/with_validation_code/cpp/SimpleTableValidationTest.cpp +++ b/test/arguments/with_validation_code/cpp/SimpleTableValidationTest.cpp @@ -1,11 +1,9 @@ -#include #include +#include #include "gtest/gtest.h" - -#include "with_validation_code/simple_table_validation/SimpleTableValidationDb.h" #include "test_utils/ValidationObservers.h" - +#include "with_validation_code/simple_table_validation/SimpleTableValidationDb.h" #include "zserio/SqliteFinalizer.h" using namespace test_utils; @@ -124,7 +122,7 @@ class SimpleTableValidationTest : public ::testing::Test { std::unique_ptr statement(connection.prepareStatement( "INSERT INTO simpleTable (rowid, fieldBool, fieldBit5, fieldDynamicBit, fieldVarInt16, " - "fieldString, fieldBlob, fieldEnum, fieldBitmask) " + "fieldString, fieldBlob, fieldEnum, fieldBitmask) " "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)")); int argIdx = 1; @@ -142,8 +140,8 @@ class SimpleTableValidationTest : public ::testing::Test uint8_t* buffer = bitBuffer.getBuffer(); if (wrongOffset) corruptOffsetInFieldBlob(buffer); - sqlite3_bind_blob(statement.get(), argIdx++, buffer, static_cast(bitBuffer.getByteSize()), - SQLITE_TRANSIENT); + sqlite3_bind_blob( + statement.get(), argIdx++, buffer, static_cast(bitBuffer.getByteSize()), SQLITE_TRANSIENT); if (id == FIELD_ENUM_NULL_ROW_ID) sqlite3_bind_null(statement.get(), argIdx++); @@ -227,8 +225,8 @@ TEST_F(SimpleTableValidationTest, validateSingleTable) TestParameterProvider parameterProvider; ValidationObserver validationObserver; bool continueValidation = false; - const bool isValidated = simpleTable.validate(validationObserver, - parameterProvider.getSimpleTableParameterProvider(), continueValidation); + const bool isValidated = simpleTable.validate( + validationObserver, parameterProvider.getSimpleTableParameterProvider(), continueValidation); ASSERT_TRUE(isValidated); ASSERT_TRUE(continueValidation); @@ -275,11 +273,13 @@ TEST_F(SimpleTableValidationTest, validateMissingColumn) const bool wasTransactionStarted = connection.startTransaction(); populateDb(connection, false); - connection.executeUpdate("CREATE TABLE simpleTableTemp (rowid INTEGER PRIMARY KEY NOT NULL, " + connection.executeUpdate( + "CREATE TABLE simpleTableTemp (rowid INTEGER PRIMARY KEY NOT NULL, " "fieldBool INTEGER NOT NULL, fieldDynamicBit INTEGER NOT NULL, fieldVarInt16 INTEGER NOT NULL," "fieldString TEXT NOT NULL, fieldBlob BLOB NOT NULL, fieldEnum INTEGER, " "fieldBitmask INTEGER NOT NULL)"); - connection.executeUpdate("INSERT INTO simpleTableTemp SELECT rowid, fieldBool, fieldDynamicBit, " + connection.executeUpdate( + "INSERT INTO simpleTableTemp SELECT rowid, fieldBool, fieldDynamicBit, " "fieldVarInt16, fieldString, fieldBlob, fieldEnum, fieldBitmask FROM simpleTable"); connection.executeUpdate("DROP TABLE simpleTable"); connection.executeUpdate("ALTER TABLE simpleTableTemp RENAME TO simpleTable"); @@ -313,11 +313,13 @@ TEST_F(SimpleTableValidationTest, validateWrongColumnType) const bool wasTransactionStarted = connection.startTransaction(); populateDb(connection, false); - connection.executeUpdate("CREATE TABLE simpleTableTemp (rowid INTEGER PRIMARY KEY NOT NULL, " + connection.executeUpdate( + "CREATE TABLE simpleTableTemp (rowid INTEGER PRIMARY KEY NOT NULL, " "fieldBool INTEGER NOT NULL, fieldBit5 TEXT, fieldDynamicBit INTEGER NOT NULL, " "fieldVarInt16 INTEGER NOT NULL, fieldString TEXT NOT NULL, fieldBlob BLOB NOT NULL, " "fieldEnum INTEGER, fieldBitmask INTEGER NOT NULL)"); - connection.executeUpdate("INSERT INTO simpleTableTemp SELECT rowid, fieldBool, fieldBit5, fieldDynamicBit, " + connection.executeUpdate( + "INSERT INTO simpleTableTemp SELECT rowid, fieldBool, fieldBit5, fieldDynamicBit, " "fieldVarInt16, fieldString, fieldBlob, fieldEnum, fieldBitmask FROM simpleTable"); connection.executeUpdate("DROP TABLE simpleTable"); connection.executeUpdate("ALTER TABLE simpleTableTemp RENAME TO simpleTable"); @@ -351,11 +353,13 @@ TEST_F(SimpleTableValidationTest, validateWrongColumnNotNullConstraint) const bool wasTransactionStarted = connection.startTransaction(); populateDb(connection, false); - connection.executeUpdate("CREATE TABLE simpleTableTemp (rowid INTEGER PRIMARY KEY NOT NULL, " + connection.executeUpdate( + "CREATE TABLE simpleTableTemp (rowid INTEGER PRIMARY KEY NOT NULL, " "fieldBool INTEGER NOT NULL, fieldBit5 INTEGER NOT NULL, fieldDynamicBit INTEGER NOT NULL, " "fieldVarInt16 INTEGER NOT NULL, fieldString TEXT NOT NULL, fieldBlob BLOB, " "fieldEnum INTEGER, fieldBitmask INTEGER NOT NULL)"); - connection.executeUpdate("INSERT INTO simpleTableTemp SELECT rowid, fieldBool, fieldBit5, fieldDynamicBit, " + connection.executeUpdate( + "INSERT INTO simpleTableTemp SELECT rowid, fieldBool, fieldBit5, fieldDynamicBit, " "fieldVarInt16, fieldString, fieldBlob, fieldEnum, fieldBitmask FROM simpleTable"); connection.executeUpdate("DROP TABLE simpleTable"); connection.executeUpdate("ALTER TABLE simpleTableTemp RENAME TO simpleTable"); @@ -398,11 +402,13 @@ TEST_F(SimpleTableValidationTest, validateWrongColumnPrimaryKeyConstraint) const bool wasTransactionStarted = connection.startTransaction(); populateDb(connection, false); - connection.executeUpdate("CREATE TABLE simpleTableTemp (rowid INTEGER NOT NULL, " + connection.executeUpdate( + "CREATE TABLE simpleTableTemp (rowid INTEGER NOT NULL, " "fieldBool INTEGER NOT NULL, fieldBit5 INTEGER, fieldDynamicBit INTEGER NOT NULL, " "fieldVarInt16 INTEGER NOT NULL, fieldString TEXT NOT NULL, fieldBlob BLOB NOT NULL, " "fieldEnum INTEGER, fieldBitmask INTEGER NOT NULL)"); - connection.executeUpdate("INSERT INTO simpleTableTemp SELECT rowid, fieldBool, fieldBit5, fieldDynamicBit, " + connection.executeUpdate( + "INSERT INTO simpleTableTemp SELECT rowid, fieldBool, fieldBit5, fieldDynamicBit, " "fieldVarInt16, fieldString, fieldBlob, fieldEnum, fieldBitmask from simpleTable"); connection.executeUpdate("DROP TABLE simpleTable"); connection.executeUpdate("ALTER TABLE simpleTableTemp RENAME TO simpleTable"); @@ -464,8 +470,8 @@ TEST_F(SimpleTableValidationTest, validateOutOfRange) const auto& error1 = errors.at(0); ASSERT_EQ("simpleTable", error1.tableName); ASSERT_EQ("fieldBit5", error1.fieldName); - ASSERT_EQ(std::vector{std::to_string(FIELD_BIT5_OUT_OF_RANGE_ROW_ID)}, - error1.primaryKeyValues); + ASSERT_EQ( + std::vector{std::to_string(FIELD_BIT5_OUT_OF_RANGE_ROW_ID)}, error1.primaryKeyValues); ASSERT_EQ(zserio::IValidationObserver::VALUE_OUT_OF_RANGE, error1.errorType); ASSERT_EQ("Value 32 of SimpleTable.fieldBit5 exceeds the range of 0..31", error1.message); @@ -523,8 +529,7 @@ TEST_F(SimpleTableValidationTest, validateInvalidEnumValue) const auto& error = errors.at(0); ASSERT_EQ("simpleTable", error.tableName); ASSERT_EQ("fieldEnum", error.fieldName); - ASSERT_EQ(std::vector{std::to_string(FIELD_ENUM_RED_ROW_ID)}, - error.primaryKeyValues); + ASSERT_EQ(std::vector{std::to_string(FIELD_ENUM_RED_ROW_ID)}, error.primaryKeyValues); ASSERT_EQ(zserio::IValidationObserver::INVALID_VALUE, error.errorType); ASSERT_EQ("Enumeration value 0 of SimpleTable.fieldEnum is not valid!", error.message); } diff --git a/test/arguments/with_validation_code/cpp/VirtualTableValidationTest.cpp b/test/arguments/with_validation_code/cpp/VirtualTableValidationTest.cpp index fea350579..174218854 100644 --- a/test/arguments/with_validation_code/cpp/VirtualTableValidationTest.cpp +++ b/test/arguments/with_validation_code/cpp/VirtualTableValidationTest.cpp @@ -1,9 +1,8 @@ #include #include "gtest/gtest.h" - -#include "with_validation_code/virtual_table_validation/VirtualTableValidationDb.h" #include "test_utils/ValidationObservers.h" +#include "with_validation_code/virtual_table_validation/VirtualTableValidationDb.h" using namespace test_utils; @@ -42,14 +41,14 @@ class VirtualTableValidationTest : public ::testing::Test private: void insertTestTableRow(zserio::SqliteConnection& connection, int16_t id) { - std::unique_ptr statement(connection.prepareStatement( - "INSERT INTO TestTable (docId, text, anotherId) VALUES (?, ?, ?)")); + std::unique_ptr statement( + connection.prepareStatement("INSERT INTO TestTable (docId, text, anotherId) VALUES (?, ?, ?)")); int argIdx = 1; sqlite3_bind_int(statement.get(), argIdx++, static_cast(id)); const std::string text("Test " + std::to_string(id)); - sqlite3_bind_text(statement.get(), argIdx++, text.c_str(), static_cast(text.size()), - SQLITE_TRANSIENT); + sqlite3_bind_text( + statement.get(), argIdx++, text.c_str(), static_cast(text.size()), SQLITE_TRANSIENT); if (id % 2 == 0) sqlite3_bind_int(statement.get(), argIdx++, id / 2); else diff --git a/test/arguments/without_cross_extension_check/cpp/WithoutCrossExtensionCheckTest.cpp b/test/arguments/without_cross_extension_check/cpp/WithoutCrossExtensionCheckTest.cpp index 0d20078a6..bd22f7a36 100644 --- a/test/arguments/without_cross_extension_check/cpp/WithoutCrossExtensionCheckTest.cpp +++ b/test/arguments/without_cross_extension_check/cpp/WithoutCrossExtensionCheckTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "invalid_in_java/Test.h" #include "invalid_in_python/Test.h" diff --git a/test/arguments/without_pubsub_code/cpp/WithoutPubsubCodeTest.cpp b/test/arguments/without_pubsub_code/cpp/WithoutPubsubCodeTest.cpp index d4d81177b..e82459361 100644 --- a/test/arguments/without_pubsub_code/cpp/WithoutPubsubCodeTest.cpp +++ b/test/arguments/without_pubsub_code/cpp/WithoutPubsubCodeTest.cpp @@ -18,34 +18,26 @@ class WithoutPubsubCode : public ::testing::Test TEST_F(WithoutPubsubCode, checkService) { - ASSERT_TRUE(isFilePresent( - "arguments/without_pubsub_code/gen/without_pubsub_code/Service.cpp")); - ASSERT_TRUE(isFilePresent( - "arguments/without_pubsub_code/gen/without_pubsub_code/Service.h")); + ASSERT_TRUE(isFilePresent("arguments/without_pubsub_code/gen/without_pubsub_code/Service.cpp")); + ASSERT_TRUE(isFilePresent("arguments/without_pubsub_code/gen/without_pubsub_code/Service.h")); } TEST_F(WithoutPubsubCode, checkResponse) { - ASSERT_TRUE(isFilePresent( - "arguments/without_pubsub_code/gen/without_pubsub_code/Response.cpp")); - ASSERT_TRUE(isFilePresent( - "arguments/without_pubsub_code/gen/without_pubsub_code/Response.h")); + ASSERT_TRUE(isFilePresent("arguments/without_pubsub_code/gen/without_pubsub_code/Response.cpp")); + ASSERT_TRUE(isFilePresent("arguments/without_pubsub_code/gen/without_pubsub_code/Response.h")); } TEST_F(WithoutPubsubCode, checkRequest) { - ASSERT_TRUE(isFilePresent( - "arguments/without_pubsub_code/gen/without_pubsub_code/Request.cpp")); - ASSERT_TRUE(isFilePresent( - "arguments/without_pubsub_code/gen/without_pubsub_code/Request.h")); + ASSERT_TRUE(isFilePresent("arguments/without_pubsub_code/gen/without_pubsub_code/Request.cpp")); + ASSERT_TRUE(isFilePresent("arguments/without_pubsub_code/gen/without_pubsub_code/Request.h")); } TEST_F(WithoutPubsubCode, checkPubsub) { - ASSERT_FALSE(isFilePresent( - "arguments/without_pubsub_code/gen/without_pubsub_code/Pubsub.cpp")); - ASSERT_FALSE(isFilePresent( - "arguments/without_pubsub_code/gen/without_pubsub_code/Pubsub.h")); + ASSERT_FALSE(isFilePresent("arguments/without_pubsub_code/gen/without_pubsub_code/Pubsub.cpp")); + ASSERT_FALSE(isFilePresent("arguments/without_pubsub_code/gen/without_pubsub_code/Pubsub.h")); } } // namespace without_pubsub_code diff --git a/test/arguments/without_service_code/cpp/WithoutServiceCodeTest.cpp b/test/arguments/without_service_code/cpp/WithoutServiceCodeTest.cpp index a13bd67e7..406cef47a 100644 --- a/test/arguments/without_service_code/cpp/WithoutServiceCodeTest.cpp +++ b/test/arguments/without_service_code/cpp/WithoutServiceCodeTest.cpp @@ -18,34 +18,26 @@ class WithoutServiceCode : public ::testing::Test TEST_F(WithoutServiceCode, checkService) { - ASSERT_FALSE(isFilePresent( - "arguments/without_service_code/gen/without_service_code/Service.cpp")); - ASSERT_FALSE(isFilePresent( - "arguments/without_service_code/gen/without_service_code/Service.h")); + ASSERT_FALSE(isFilePresent("arguments/without_service_code/gen/without_service_code/Service.cpp")); + ASSERT_FALSE(isFilePresent("arguments/without_service_code/gen/without_service_code/Service.h")); } TEST_F(WithoutServiceCode, checkResponse) { - ASSERT_TRUE(isFilePresent( - "arguments/without_service_code/gen/without_service_code/Response.cpp")); - ASSERT_TRUE(isFilePresent( - "arguments/without_service_code/gen/without_service_code/Response.h")); + ASSERT_TRUE(isFilePresent("arguments/without_service_code/gen/without_service_code/Response.cpp")); + ASSERT_TRUE(isFilePresent("arguments/without_service_code/gen/without_service_code/Response.h")); } TEST_F(WithoutServiceCode, checkRequest) { - ASSERT_TRUE(isFilePresent( - "arguments/without_service_code/gen/without_service_code/Request.cpp")); - ASSERT_TRUE(isFilePresent( - "arguments/without_service_code/gen/without_service_code/Request.h")); + ASSERT_TRUE(isFilePresent("arguments/without_service_code/gen/without_service_code/Request.cpp")); + ASSERT_TRUE(isFilePresent("arguments/without_service_code/gen/without_service_code/Request.h")); } TEST_F(WithoutServiceCode, checkPubsub) { - ASSERT_TRUE(isFilePresent( - "arguments/without_service_code/gen/without_service_code/Pubsub.cpp")); - ASSERT_TRUE(isFilePresent( - "arguments/without_service_code/gen/without_service_code/Pubsub.h")); + ASSERT_TRUE(isFilePresent("arguments/without_service_code/gen/without_service_code/Pubsub.cpp")); + ASSERT_TRUE(isFilePresent("arguments/without_service_code/gen/without_service_code/Pubsub.h")); } } // namespace without_service_code diff --git a/test/arguments/without_writer_code/cpp/WithoutWriterCodeTest.cpp b/test/arguments/without_writer_code/cpp/WithoutWriterCodeTest.cpp index c6e471136..f9f7aa380 100644 --- a/test/arguments/without_writer_code/cpp/WithoutWriterCodeTest.cpp +++ b/test/arguments/without_writer_code/cpp/WithoutWriterCodeTest.cpp @@ -1,17 +1,14 @@ #include #include "gtest/gtest.h" - +#include "test_utils/Assertions.h" #include "without_writer_code/Tile.h" #include "without_writer_code/WorldDb.h" - +#include "zserio/RebindAlloc.h" #include "zserio/SerializeUtil.h" #include "zserio/StringView.h" -#include "zserio/RebindAlloc.h" #include "zserio/pmr/PolymorphicAllocator.h" -#include "test_utils/Assertions.h" - namespace without_writer_code { @@ -23,24 +20,20 @@ struct BasicMethodNames // TODO[Mi-L@]: Since we don't know allocator name provided by user, we use just the fixed substring here // all compounds - static constexpr const char* TYPE_INFO_DECLARATION = - "typeInfo();"; + static constexpr const char* TYPE_INFO_DECLARATION = "typeInfo();"; static constexpr const char* REFLECTABLE_CONST_DECLARATION = "reflectable(const allocator_type& allocator = allocator_type()) const;"; static constexpr const char* REFLECTABLE_DECLARATION = "reflectable(const allocator_type& allocator = allocator_type());"; // ItemType - static constexpr const char* ITEM_TYPE_TYPE_INFO = - "enumTypeInfo<::without_writer_code::ItemType"; + static constexpr const char* ITEM_TYPE_TYPE_INFO = "enumTypeInfo<::without_writer_code::ItemType"; static constexpr const char* ITEM_TYPE_REFLECTABLE = "enumReflectable(::without_writer_code::ItemType value,"; // VersionAvailability - static constexpr const char* VERSION_AVAILABILITY_TYPE_INFO_DEFINITION = - "VersionAvailability::typeInfo()"; - static constexpr const char* VERSION_AVAILABILITY_REFLECTABLE_DECLARATION = - "reflectable(const "; + static constexpr const char* VERSION_AVAILABILITY_TYPE_INFO_DEFINITION = "VersionAvailability::typeInfo()"; + static constexpr const char* VERSION_AVAILABILITY_REFLECTABLE_DECLARATION = "reflectable(const "; static constexpr const char* VERSION_AVAILABILITY_REFLECTABLE_DEFINITION = "VersionAvailability::reflectable(const "; static constexpr const char* TO_STRING_DECLARATION = @@ -49,40 +42,35 @@ struct BasicMethodNames "VersionAvailability::toString(const zserio::string<"; // ...>::allocator_type... // ExtraParamUnion - static constexpr const char* EXTRA_PARAM_UNION_TYPE_INFO_DEFINITION = - "ExtraParamUnion::typeInfo()"; + static constexpr const char* EXTRA_PARAM_UNION_TYPE_INFO_DEFINITION = "ExtraParamUnion::typeInfo()"; static constexpr const char* EXTRA_PARAM_UNION_REFLECTABLE_CONST_DEFINITION = "ExtraParamUnion::reflectable(const allocator_type& allocator) const"; static constexpr const char* EXTRA_PARAM_UNION_REFLECTABLE_DEFINITION = "::zserio::IBasicReflectablePtr<"; // return type only to prevent clash with const version // Item - static constexpr const char* ITEM_TYPE_INFO_DEFINITION = - "Item::typeInfo()"; + static constexpr const char* ITEM_TYPE_INFO_DEFINITION = "Item::typeInfo()"; static constexpr const char* ITEM_REFLECTABLE_CONST_DEFINITION = "Item::reflectable(const allocator_type& allocator) const"; static constexpr const char* ITEM_REFLECTABLE_DEFINITION = "::zserio::IBasicReflectablePtr<"; // return type only to prevent clash with const version // ItemChoice - static constexpr const char* ITEM_CHOICE_TYPE_INFO_DEFINITION = - "ItemChoice::typeInfo()"; + static constexpr const char* ITEM_CHOICE_TYPE_INFO_DEFINITION = "ItemChoice::typeInfo()"; static constexpr const char* ITEM_CHOICE_REFLECTABLE_CONST_DEFINITION = "ItemChoice::reflectable(const allocator_type& allocator) const"; static constexpr const char* ITEM_CHOICE_REFLECTABLE_DEFINITION = "::zserio::IBasicReflectablePtr<"; // return type only to prevent clash with const version // ItemChoiceHolder - static constexpr const char* ITEM_CHOICE_HOLDER_TYPE_INFO_DEFINITION = - "ItemChoiceHolder::typeInfo()"; + static constexpr const char* ITEM_CHOICE_HOLDER_TYPE_INFO_DEFINITION = "ItemChoiceHolder::typeInfo()"; static constexpr const char* ITEM_CHOICE_HOLDER_REFLECTABLE_CONST_DEFINITION = "ItemChoiceHolder::reflectable(const allocator_type& allocator) const"; static constexpr const char* ITEM_CHOICE_HOLDER_REFLECTABLE_DEFINITION = "::zserio::IBasicReflectablePtr<"; // return type only to prevent clash with const version // Tile - static constexpr const char* TILE_TYPE_INFO_DEFINITION = - "Tile::typeInfo()"; + static constexpr const char* TILE_TYPE_INFO_DEFINITION = "Tile::typeInfo()"; static constexpr const char* TILE_REFLECTABLE_CONST_DEFINITION = "Tile::reflectable(const allocator_type& allocator) const"; static constexpr const char* TILE_REFLECTABLE_DEFINITION = @@ -91,12 +79,10 @@ struct BasicMethodNames static constexpr const char* GET_VERSION_STRING_DEFINITION = "& Tile::getVersionString("; // GeoMapTable - static constexpr const char* GEO_MAP_TABLE_TYPE_INFO_DEFINITION = - "GeoMapTable::typeInfo()"; + static constexpr const char* GEO_MAP_TABLE_TYPE_INFO_DEFINITION = "GeoMapTable::typeInfo()"; // WorldDb - static constexpr const char* WORLD_DB_TYPE_INFO_DEFINITION = - "WorldDb::typeInfo()"; + static constexpr const char* WORLD_DB_TYPE_INFO_DEFINITION = "WorldDb::typeInfo()"; static constexpr const char* WORLD_DB_CTOR_DECLARATION = "WorldDb(const ::zserio::string<"; static constexpr const char* WORLD_DB_CTOR_DEFINITION = "WorldDb::WorldDb(const ::zserio::string<"; }; @@ -105,12 +91,10 @@ template <> struct BasicMethodNames> { // all compounds - static constexpr const char* TYPE_INFO_DECLARATION = - "static const ::zserio::pmr::ITypeInfo& typeInfo();"; + static constexpr const char* TYPE_INFO_DECLARATION = "static const ::zserio::pmr::ITypeInfo& typeInfo();"; static constexpr const char* REFLECTABLE_CONST_DECLARATION = "::zserio::pmr::IReflectableConstPtr reflectable("; - static constexpr const char* REFLECTABLE_DECLARATION = - "::zserio::pmr::IReflectablePtr reflectable("; + static constexpr const char* REFLECTABLE_DECLARATION = "::zserio::pmr::IReflectablePtr reflectable("; // ItemType static constexpr const char* ITEM_TYPE_TYPE_INFO = @@ -129,7 +113,7 @@ struct BasicMethodNames> "::zserio::pmr::string toString(const ::zserio::pmr::string::allocator_type& allocator ="; static constexpr const char* TO_STRING_DEFINITION = "::zserio::pmr::string VersionAvailability::toString(" - "const ::zserio::pmr::string::allocator_type& allocator) const"; + "const ::zserio::pmr::string::allocator_type& allocator) const"; // ExtraParamUnion static constexpr const char* EXTRA_PARAM_UNION_TYPE_INFO_DEFINITION = @@ -140,8 +124,7 @@ struct BasicMethodNames> "::zserio::pmr::IReflectablePtr ExtraParamUnion::reflectable("; // Item - static constexpr const char* ITEM_TYPE_INFO_DEFINITION = - "const ::zserio::pmr::ITypeInfo& Item::typeInfo()"; + static constexpr const char* ITEM_TYPE_INFO_DEFINITION = "const ::zserio::pmr::ITypeInfo& Item::typeInfo()"; static constexpr const char* ITEM_REFLECTABLE_CONST_DEFINITION = "::zserio::pmr::IReflectableConstPtr Item::reflectable("; static constexpr const char* ITEM_REFLECTABLE_DEFINITION = @@ -164,8 +147,7 @@ struct BasicMethodNames> "::zserio::pmr::IReflectablePtr ItemChoiceHolder::reflectable("; // Tile - static constexpr const char* TILE_TYPE_INFO_DEFINITION = - "const ::zserio::pmr::ITypeInfo& Tile::typeInfo()"; + static constexpr const char* TILE_TYPE_INFO_DEFINITION = "const ::zserio::pmr::ITypeInfo& Tile::typeInfo()"; static constexpr const char* TILE_REFLECTABLE_CONST_DEFINITION = "::zserio::pmr::IReflectableConstPtr Tile::reflectable("; static constexpr const char* TILE_REFLECTABLE_DEFINITION = @@ -190,12 +172,9 @@ template <> struct BasicMethodNames> { // all compounds - static constexpr const char* TYPE_INFO_DECLARATION = - "static const ::zserio::ITypeInfo& typeInfo();"; - static constexpr const char* REFLECTABLE_CONST_DECLARATION = - "::zserio::IReflectableConstPtr reflectable("; - static constexpr const char* REFLECTABLE_DECLARATION = - "::zserio::IReflectablePtr reflectable("; + static constexpr const char* TYPE_INFO_DECLARATION = "static const ::zserio::ITypeInfo& typeInfo();"; + static constexpr const char* REFLECTABLE_CONST_DECLARATION = "::zserio::IReflectableConstPtr reflectable("; + static constexpr const char* REFLECTABLE_DECLARATION = "::zserio::IReflectablePtr reflectable("; // ItemType static constexpr const char* ITEM_TYPE_TYPE_INFO = @@ -214,7 +193,7 @@ struct BasicMethodNames> "::zserio::string<> toString(const ::zserio::string<>::allocator_type& allocator ="; static constexpr const char* TO_STRING_DEFINITION = "::zserio::string<> VersionAvailability::toString(" - "const ::zserio::string<>::allocator_type& allocator) const"; + "const ::zserio::string<>::allocator_type& allocator) const"; // ExtraParamUnion static constexpr const char* EXTRA_PARAM_UNION_TYPE_INFO_DEFINITION = @@ -225,12 +204,10 @@ struct BasicMethodNames> "::zserio::IReflectablePtr ExtraParamUnion::reflectable("; // Item - static constexpr const char* ITEM_TYPE_INFO_DEFINITION = - "const ::zserio::ITypeInfo& Item::typeInfo()"; + static constexpr const char* ITEM_TYPE_INFO_DEFINITION = "const ::zserio::ITypeInfo& Item::typeInfo()"; static constexpr const char* ITEM_REFLECTABLE_CONST_DEFINITION = "::zserio::IReflectableConstPtr Item::reflectable("; - static constexpr const char* ITEM_REFLECTABLE_DEFINITION = - "::zserio::IReflectablePtr Item::reflectable("; + static constexpr const char* ITEM_REFLECTABLE_DEFINITION = "::zserio::IReflectablePtr Item::reflectable("; // ItemChoice static constexpr const char* ITEM_CHOICE_TYPE_INFO_DEFINITION = @@ -249,14 +226,11 @@ struct BasicMethodNames> "::zserio::IReflectablePtr ItemChoiceHolder::reflectable("; // Tile - static constexpr const char* TILE_TYPE_INFO_DEFINITION = - "const ::zserio::ITypeInfo& Tile::typeInfo()"; + static constexpr const char* TILE_TYPE_INFO_DEFINITION = "const ::zserio::ITypeInfo& Tile::typeInfo()"; static constexpr const char* TILE_REFLECTABLE_CONST_DEFINITION = "::zserio::IReflectableConstPtr Tile::reflectable("; - static constexpr const char* TILE_REFLECTABLE_DEFINITION = - "::zserio::IReflectablePtr Tile::reflectable("; - static constexpr const char* GET_VERSION_STRING_DECLARATION = - "const ::zserio::string<>& getVersionString("; + static constexpr const char* TILE_REFLECTABLE_DEFINITION = "::zserio::IReflectablePtr Tile::reflectable("; + static constexpr const char* GET_VERSION_STRING_DECLARATION = "const ::zserio::string<>& getVersionString("; static constexpr const char* GET_VERSION_STRING_DEFINITION = "const ::zserio::string<>& Tile::getVersionString("; @@ -279,8 +253,8 @@ class WithoutWriterCode : public ::testing::Test void createWorldDb(zserio::SqliteConnection& db) { sqlite3* connection = nullptr; - const int result = sqlite3_open_v2(":memory:", &connection, SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE, - nullptr); + const int result = + sqlite3_open_v2(":memory:", &connection, SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE, nullptr); db.reset(connection); ASSERT_EQ(SQLITE_OK, result); @@ -354,9 +328,9 @@ class WithoutWriterCode : public ::testing::Test checkTile(static_cast(tile)); // const version must be called since non-const version is not available - static_assert(std::is_same< - zserio::IBasicReflectableConstPtr, - decltype(tile.reflectable())>::value, "Const version shall be called!"); + static_assert(std::is_same, + decltype(tile.reflectable())>::value, + "Const version shall be called!"); } void checkTile(const Tile& tile) @@ -430,7 +404,7 @@ TEST_F(WithoutWriterCode, checkItemTypeMethods) ASSERT_METHOD_PRESENT(PATH, type, "size_t enumToOrdinal<", "size_t enumToOrdinal("); ASSERT_METHOD_PRESENT(PATH, type, "ItemType valueToEnum<", "ItemType valueToEnum("); - ASSERT_METHOD_PRESENT(PATH, type, "size_t bitSizeOf<::without_writer_code::ItemType>" , + ASSERT_METHOD_PRESENT(PATH, type, "size_t bitSizeOf<::without_writer_code::ItemType>", "size_t bitSizeOf(::without_writer_code::ItemType"); ASSERT_METHOD_PRESENT(PATH, type, "ItemType read<::without_writer_code::ItemType", "ItemType read(::zserio::BitStreamReader&"); @@ -440,8 +414,8 @@ TEST_F(WithoutWriterCode, checkVersionAvailabilityMethods) { const char* type = "VersionAvailability"; - ASSERT_METHOD_NOT_PRESENT(PATH, type, - "size_t initializeOffsets(", "size_t VersionAvailability::initializeOffsets("); + ASSERT_METHOD_NOT_PRESENT( + PATH, type, "size_t initializeOffsets(", "size_t VersionAvailability::initializeOffsets("); ASSERT_METHOD_NOT_PRESENT(PATH, type, "void write(", "void VersionAvailability::write("); ASSERT_METHOD_PRESENT(PATH, type, "constexpr VersionAvailability() noexcept", nullptr); @@ -452,11 +426,11 @@ TEST_F(WithoutWriterCode, checkVersionAvailabilityMethods) "VersionAvailability::VersionAvailability(underlying_type value)"); ASSERT_METHOD_PRESENT(PATH, type, "~VersionAvailability() = default;", nullptr); ASSERT_METHOD_PRESENT(PATH, type, "VersionAvailability(const VersionAvailability&) = default;", nullptr); - ASSERT_METHOD_PRESENT(PATH, type, "VersionAvailability& operator=(const VersionAvailability&) = default;", - nullptr); + ASSERT_METHOD_PRESENT( + PATH, type, "VersionAvailability& operator=(const VersionAvailability&) = default;", nullptr); ASSERT_METHOD_PRESENT(PATH, type, "VersionAvailability(VersionAvailability&&) = default;", nullptr); - ASSERT_METHOD_PRESENT(PATH, type, "VersionAvailability& operator=(VersionAvailability&&) = default;", - nullptr); + ASSERT_METHOD_PRESENT( + PATH, type, "VersionAvailability& operator=(VersionAvailability&&) = default;", nullptr); ASSERT_METHOD_PRESENT(PATH, type, MethodNames::TYPE_INFO_DECLARATION, MethodNames::VERSION_AVAILABILITY_TYPE_INFO_DEFINITION); @@ -467,10 +441,9 @@ TEST_F(WithoutWriterCode, checkVersionAvailabilityMethods) ASSERT_METHOD_PRESENT(PATH, type, "constexpr underlying_type getValue() const", nullptr); ASSERT_METHOD_PRESENT(PATH, type, "size_t bitSizeOf(size_t bitPosition = 0) const", "size_t VersionAvailability::bitSizeOf(size_t) const"); - ASSERT_METHOD_PRESENT(PATH, type, - "uint32_t hashCode() const", "uint32_t VersionAvailability::hashCode() const"); - ASSERT_METHOD_PRESENT(PATH, type, MethodNames::TO_STRING_DECLARATION, - MethodNames::TO_STRING_DEFINITION); + ASSERT_METHOD_PRESENT( + PATH, type, "uint32_t hashCode() const", "uint32_t VersionAvailability::hashCode() const"); + ASSERT_METHOD_PRESENT(PATH, type, MethodNames::TO_STRING_DECLARATION, MethodNames::TO_STRING_DEFINITION); } TEST_F(WithoutWriterCode, checkExtraParamUnionMethods) @@ -478,8 +451,8 @@ TEST_F(WithoutWriterCode, checkExtraParamUnionMethods) const char* type = "ExtraParamUnion"; ASSERT_METHOD_NOT_PRESENT(PATH, type, " ExtraParamUnion()", "ExtraParamUnion::ExtraParamUnion()"); - ASSERT_METHOD_NOT_PRESENT(PATH, type, - "size_t initializeOffsets(", "size_t ExtraParamUnion::initializeOffsets("); + ASSERT_METHOD_NOT_PRESENT( + PATH, type, "size_t initializeOffsets(", "size_t ExtraParamUnion::initializeOffsets("); ASSERT_METHOD_NOT_PRESENT(PATH, type, "void write(", "void ExtraParamUnion::write("); ASSERT_METHOD_NOT_PRESENT(PATH, type, MethodNames::REFLECTABLE_DECLARATION, MethodNames::EXTRA_PARAM_UNION_REFLECTABLE_DEFINITION); @@ -518,21 +491,21 @@ TEST_F(WithoutWriterCode, checkItemMethods) ASSERT_METHOD_NOT_PRESENT(PATH, type, "void setParam(", "void Item::setParam("); ASSERT_METHOD_NOT_PRESENT(PATH, type, "size_t initializeOffsets(", "size_t Item::initializeOffsets("); ASSERT_METHOD_NOT_PRESENT(PATH, type, "void write(", "void Item::write("); - ASSERT_METHOD_NOT_PRESENT(PATH, type, MethodNames::REFLECTABLE_DECLARATION, - MethodNames::ITEM_REFLECTABLE_DEFINITION); + ASSERT_METHOD_NOT_PRESENT( + PATH, type, MethodNames::REFLECTABLE_DECLARATION, MethodNames::ITEM_REFLECTABLE_DEFINITION); - ASSERT_METHOD_PRESENT(PATH, type, - "Item(::zserio::BitStreamReader&", "Item::Item(::zserio::BitStreamReader&"); + ASSERT_METHOD_PRESENT( + PATH, type, "Item(::zserio::BitStreamReader&", "Item::Item(::zserio::BitStreamReader&"); ASSERT_METHOD_PRESENT(PATH, type, "~Item() = default;", nullptr); ASSERT_METHOD_PRESENT(PATH, type, "Item(const Item&", "Item::Item(const Item&"); ASSERT_METHOD_PRESENT(PATH, type, "Item& operator=(const Item&", "Item& Item::operator=(const Item&"); ASSERT_METHOD_PRESENT(PATH, type, "Item(Item&&", "Item::Item(Item&&"); ASSERT_METHOD_PRESENT(PATH, type, "Item& operator=(Item&&", "Item& Item::operator=(Item&&"); - ASSERT_METHOD_PRESENT(PATH, type, "Item(::zserio::PropagateAllocatorT,", - "Item::Item(::zserio::PropagateAllocatorT,"); + ASSERT_METHOD_PRESENT( + PATH, type, "Item(::zserio::PropagateAllocatorT,", "Item::Item(::zserio::PropagateAllocatorT,"); - ASSERT_METHOD_PRESENT(PATH, type, MethodNames::TYPE_INFO_DECLARATION, - MethodNames::ITEM_TYPE_INFO_DEFINITION); + ASSERT_METHOD_PRESENT( + PATH, type, MethodNames::TYPE_INFO_DECLARATION, MethodNames::ITEM_TYPE_INFO_DEFINITION); ASSERT_METHOD_PRESENT(PATH, type, MethodNames::REFLECTABLE_CONST_DECLARATION, MethodNames::ITEM_REFLECTABLE_CONST_DEFINITION); @@ -554,24 +527,24 @@ TEST_F(WithoutWriterCode, checkItemChoiceMethods) ASSERT_METHOD_NOT_PRESENT(PATH, type, " ItemChoice()", "ItemChoice::ItemChoice()"); ASSERT_METHOD_NOT_PRESENT(PATH, type, "size_t initializeOffsets(", "size_t ItemChoice::initializeOffsets("); ASSERT_METHOD_NOT_PRESENT(PATH, type, "void write(", "void ItemChoice::write("); - ASSERT_METHOD_NOT_PRESENT(PATH, type, MethodNames::REFLECTABLE_DECLARATION, - MethodNames::ITEM_CHOICE_REFLECTABLE_DEFINITION); + ASSERT_METHOD_NOT_PRESENT( + PATH, type, MethodNames::REFLECTABLE_DECLARATION, MethodNames::ITEM_CHOICE_REFLECTABLE_DEFINITION); ASSERT_METHOD_PRESENT(PATH, type, "ItemChoice(::zserio::BitStreamReader&", "ItemChoice::ItemChoice(::zserio::BitStreamReader&"); ASSERT_METHOD_PRESENT(PATH, type, "~ItemChoice() = default;", nullptr); - ASSERT_METHOD_PRESENT(PATH, type, - "ItemChoice(const ItemChoice&", "ItemChoice::ItemChoice(const ItemChoice&"); + ASSERT_METHOD_PRESENT( + PATH, type, "ItemChoice(const ItemChoice&", "ItemChoice::ItemChoice(const ItemChoice&"); ASSERT_METHOD_PRESENT(PATH, type, "ItemChoice& operator=(const ItemChoice&", "ItemChoice& ItemChoice::operator=(const ItemChoice&"); ASSERT_METHOD_PRESENT(PATH, type, "ItemChoice(ItemChoice&&", "ItemChoice::ItemChoice(ItemChoice&&"); - ASSERT_METHOD_PRESENT(PATH, type, "ItemChoice& operator=(ItemChoice&&", - "ItemChoice& ItemChoice::operator=(ItemChoice&&"); + ASSERT_METHOD_PRESENT( + PATH, type, "ItemChoice& operator=(ItemChoice&&", "ItemChoice& ItemChoice::operator=(ItemChoice&&"); ASSERT_METHOD_PRESENT(PATH, type, "ItemChoice(::zserio::PropagateAllocatorT,", "ItemChoice::ItemChoice(::zserio::PropagateAllocatorT,"); - ASSERT_METHOD_PRESENT(PATH, type, MethodNames::TYPE_INFO_DECLARATION, - MethodNames::ITEM_CHOICE_TYPE_INFO_DEFINITION); + ASSERT_METHOD_PRESENT( + PATH, type, MethodNames::TYPE_INFO_DECLARATION, MethodNames::ITEM_CHOICE_TYPE_INFO_DEFINITION); ASSERT_METHOD_PRESENT(PATH, type, MethodNames::REFLECTABLE_CONST_DECLARATION, MethodNames::ITEM_CHOICE_REFLECTABLE_CONST_DEFINITION); @@ -591,8 +564,8 @@ TEST_F(WithoutWriterCode, checkItemChoiceHolderMethods) const char* type = "ItemChoiceHolder"; ASSERT_METHOD_NOT_PRESENT(PATH, type, " ItemChoiceHolder()", "ItemChoiceHolder::ItemChoiceHolder()"); - ASSERT_METHOD_NOT_PRESENT(PATH, type, - "size_t initializeOffsets(", "size_t ItemChoiceHolder::initializeOffsets("); + ASSERT_METHOD_NOT_PRESENT( + PATH, type, "size_t initializeOffsets(", "size_t ItemChoiceHolder::initializeOffsets("); ASSERT_METHOD_NOT_PRESENT(PATH, type, "void write(", "void ItemChoiceHolder::write("); ASSERT_METHOD_NOT_PRESENT(PATH, type, MethodNames::REFLECTABLE_DECLARATION, MethodNames::ITEM_CHOICE_HOLDER_REFLECTABLE_DEFINITION); @@ -618,8 +591,8 @@ TEST_F(WithoutWriterCode, checkItemChoiceHolderMethods) ASSERT_METHOD_PRESENT(PATH, type, "void initializeChildren(", "void ItemChoiceHolder::initializeChildren("); ASSERT_METHOD_PRESENT(PATH, type, "bool getHasItem(", "bool ItemChoiceHolder::getHasItem("); - ASSERT_METHOD_PRESENT(PATH, type, - "ItemChoice& getItemChoice(", "ItemChoice& ItemChoiceHolder::getItemChoice("); + ASSERT_METHOD_PRESENT( + PATH, type, "ItemChoice& getItemChoice(", "ItemChoice& ItemChoiceHolder::getItemChoice("); ASSERT_METHOD_PRESENT(PATH, type, "size_t bitSizeOf(", "size_t ItemChoiceHolder::bitSizeOf("); ASSERT_METHOD_PRESENT(PATH, type, "bool operator==(", "bool ItemChoiceHolder::operator==("); ASSERT_METHOD_PRESENT(PATH, type, "uint32_t hashCode(", "uint32_t ItemChoiceHolder::hashCode("); @@ -641,21 +614,21 @@ TEST_F(WithoutWriterCode, checkTileMethods) ASSERT_METHOD_NOT_PRESENT(PATH, type, "void setData(", "void Tile::setData("); ASSERT_METHOD_NOT_PRESENT(PATH, type, "size_t initializeOffsets(", "size_t Tile::initializeOffsets("); ASSERT_METHOD_NOT_PRESENT(PATH, type, "void write(", "void Tile::write("); - ASSERT_METHOD_NOT_PRESENT(PATH, type, MethodNames::REFLECTABLE_DECLARATION, - MethodNames::TILE_REFLECTABLE_DEFINITION); + ASSERT_METHOD_NOT_PRESENT( + PATH, type, MethodNames::REFLECTABLE_DECLARATION, MethodNames::TILE_REFLECTABLE_DEFINITION); - ASSERT_METHOD_PRESENT(PATH, type, - "Tile(::zserio::BitStreamReader&", "Tile::Tile(::zserio::BitStreamReader&"); + ASSERT_METHOD_PRESENT( + PATH, type, "Tile(::zserio::BitStreamReader&", "Tile::Tile(::zserio::BitStreamReader&"); ASSERT_METHOD_PRESENT(PATH, type, "~Tile() = default;", nullptr); ASSERT_METHOD_PRESENT(PATH, type, "Tile(const Tile&) = default;", nullptr); ASSERT_METHOD_PRESENT(PATH, type, "Tile& operator=(const Tile&) = default;", nullptr); ASSERT_METHOD_PRESENT(PATH, type, "Tile(Tile&&) = default;", nullptr); ASSERT_METHOD_PRESENT(PATH, type, "Tile& operator=(Tile&&) = default;", nullptr); - ASSERT_METHOD_PRESENT(PATH, type, "Tile(::zserio::PropagateAllocatorT,", - "Tile::Tile(::zserio::PropagateAllocatorT,"); + ASSERT_METHOD_PRESENT( + PATH, type, "Tile(::zserio::PropagateAllocatorT,", "Tile::Tile(::zserio::PropagateAllocatorT,"); - ASSERT_METHOD_PRESENT(PATH, type, MethodNames::TYPE_INFO_DECLARATION, - MethodNames::TILE_TYPE_INFO_DEFINITION); + ASSERT_METHOD_PRESENT( + PATH, type, MethodNames::TYPE_INFO_DECLARATION, MethodNames::TILE_TYPE_INFO_DEFINITION); ASSERT_METHOD_PRESENT(PATH, type, MethodNames::REFLECTABLE_CONST_DECLARATION, MethodNames::TILE_REFLECTABLE_CONST_DEFINITION); @@ -687,14 +660,14 @@ TEST_F(WithoutWriterCode, checkGeoMapTableMethods) const char* type = "GeoMapTable"; ASSERT_METHOD_NOT_PRESENT(PATH, type, "void createTable(", "void GeoMapTable::createTable("); - ASSERT_METHOD_NOT_PRESENT(PATH, type, "void createOrdinaryRowIdTable(", - "void GeoMapTable::createOrdinaryRowIdTable("); + ASSERT_METHOD_NOT_PRESENT( + PATH, type, "void createOrdinaryRowIdTable(", "void GeoMapTable::createOrdinaryRowIdTable("); ASSERT_METHOD_NOT_PRESENT(PATH, type, "void deleteTable(", "void GeoMapTable::deleteTable("); ASSERT_METHOD_NOT_PRESENT(PATH, type, "void write(", "void GeoMapTable::write("); ASSERT_METHOD_NOT_PRESENT(PATH, type, "void update(", "void GeoMapTable::update("); ASSERT_METHOD_NOT_PRESENT(PATH, type, "void writeRow(", "void GeoMapTable::writeRow("); - ASSERT_METHOD_NOT_PRESENT(PATH, type, "void appendCreateTableToQuery(", - "void GeoMapTable::appendCreateTableToQuery("); + ASSERT_METHOD_NOT_PRESENT( + PATH, type, "void appendCreateTableToQuery(", "void GeoMapTable::appendCreateTableToQuery("); ASSERT_METHOD_PRESENT(PATH, type, "GeoMapTable(::zserio::SqliteConnection&", "GeoMapTable::GeoMapTable(::zserio::SqliteConnection&"); @@ -704,8 +677,8 @@ TEST_F(WithoutWriterCode, checkGeoMapTableMethods) ASSERT_METHOD_PRESENT(PATH, type, "GeoMapTable(GeoMapTable&&) = delete;", nullptr); ASSERT_METHOD_PRESENT(PATH, type, "GeoMapTable& operator=(GeoMapTable&&) = delete;", nullptr); - ASSERT_METHOD_PRESENT(PATH, type, MethodNames::TYPE_INFO_DECLARATION, - MethodNames::GEO_MAP_TABLE_TYPE_INFO_DEFINITION); + ASSERT_METHOD_PRESENT( + PATH, type, MethodNames::TYPE_INFO_DECLARATION, MethodNames::GEO_MAP_TABLE_TYPE_INFO_DEFINITION); ASSERT_METHOD_PRESENT(PATH, type, "Reader createReader(", "Reader GeoMapTable::createReader("); } @@ -714,11 +687,11 @@ TEST_F(WithoutWriterCode, checkWorldDbMethods) { const char* type = "WorldDb"; - ASSERT_METHOD_NOT_PRESENT(PATH, type,"void createSchema(", "void WorldDb::createSchema("); + ASSERT_METHOD_NOT_PRESENT(PATH, type, "void createSchema(", "void WorldDb::createSchema("); ASSERT_METHOD_NOT_PRESENT(PATH, type, "void deleteSchema(", "void WorldDb::deleteSchema("); - ASSERT_METHOD_PRESENT(PATH, type, MethodNames::WORLD_DB_CTOR_DECLARATION, - MethodNames::WORLD_DB_CTOR_DEFINITION); + ASSERT_METHOD_PRESENT( + PATH, type, MethodNames::WORLD_DB_CTOR_DECLARATION, MethodNames::WORLD_DB_CTOR_DEFINITION); ASSERT_METHOD_PRESENT(PATH, type, "WorldDb(sqlite3*", "WorldDb::WorldDb(sqlite3*"); ASSERT_METHOD_PRESENT(PATH, type, "~WorldDb()", "WorldDb::~WorldDb("); ASSERT_METHOD_PRESENT(PATH, type, "WorldDb(const WorldDb&) = delete;", nullptr); @@ -726,8 +699,8 @@ TEST_F(WithoutWriterCode, checkWorldDbMethods) ASSERT_METHOD_PRESENT(PATH, type, "WorldDb(WorldDb&&) = delete;", nullptr); ASSERT_METHOD_PRESENT(PATH, type, "WorldDb& operator=(WorldDb&&) = delete;", nullptr); - ASSERT_METHOD_PRESENT(PATH, type, MethodNames::TYPE_INFO_DECLARATION, - MethodNames::WORLD_DB_TYPE_INFO_DEFINITION); + ASSERT_METHOD_PRESENT( + PATH, type, MethodNames::TYPE_INFO_DECLARATION, MethodNames::WORLD_DB_TYPE_INFO_DEFINITION); ASSERT_METHOD_PRESENT(PATH, type, "::zserio::SqliteConnection& connection(", "::zserio::SqliteConnection& WorldDb::connection("); diff --git a/test/errors/compatibility_error/cpp/CompatibilityErrorTest.cpp b/test/errors/compatibility_error/cpp/CompatibilityErrorTest.cpp index 6d4d19683..596b64a0b 100644 --- a/test/errors/compatibility_error/cpp/CompatibilityErrorTest.cpp +++ b/test/errors/compatibility_error/cpp/CompatibilityErrorTest.cpp @@ -1,13 +1,11 @@ #include "gtest/gtest.h" - #include "test_utils/ZserioErrorOutput.h" class CompatibilityErrorTest : public ::testing::Test { protected: - - CompatibilityErrorTest() - : zserioErrors("errors/compatibility_error") + CompatibilityErrorTest() : + zserioErrors("errors/compatibility_error") {} const test_utils::ZserioErrorOutput zserioErrors; @@ -15,39 +13,33 @@ class CompatibilityErrorTest : public ::testing::Test TEST_F(CompatibilityErrorTest, packedArrayInTemplate240) { - const std::vector errors{{ - "packed_array_in_template_240_error.zs:1:30: " - "Root package requires compatibility with version '2.4.0'!", + const std::vector errors{{"packed_array_in_template_240_error.zs:1:30: " + "Root package requires compatibility with version '2.4.0'!", "packed_array_in_template_240_error.zs:7:14: " - "Packed arrays binary encoding has been changed in version '2.5.0'!", - "C++11 Generator: Compatibility check failed!" - }}; + "Packed arrays binary encoding has been changed in version '2.5.0'!", + "C++11 Generator: Compatibility check failed!"}}; ASSERT_TRUE(zserioErrors.isPresent(errors)); } TEST_F(CompatibilityErrorTest, packedCompoundArray242) { - const std::vector errors{{ - "packed_compound_array_242_error.zs:1:30: " - "Root package requires compatibility with version '2.4.2'!", - "packed_compound_array_242_error.zs:16:25: " - "Packed arrays binary encoding has been changed in version '2.5.0'!", - "C++11 Generator: Compatibility check failed!" - }}; + const std::vector errors{{"packed_compound_array_242_error.zs:1:30: " + "Root package requires compatibility with version '2.4.2'!", + "packed_compound_array_242_error.zs:16:25: " + "Packed arrays binary encoding has been changed in version '2.5.0'!", + "C++11 Generator: Compatibility check failed!"}}; ASSERT_TRUE(zserioErrors.isPresent(errors)); } TEST_F(CompatibilityErrorTest, packedUInt32Array241) { - const std::vector errors{{ - "packed_uint32_array_241_error.zs:1:30: " - "Root package requires compatibility with version '2.4.1'!", - "packed_uint32_array_241_error.zs:7:19: " - "Packed arrays binary encoding has been changed in version '2.5.0'!", - "C++11 Generator: Compatibility check failed!" - }}; + const std::vector errors{{"packed_uint32_array_241_error.zs:1:30: " + "Root package requires compatibility with version '2.4.1'!", + "packed_uint32_array_241_error.zs:7:19: " + "Packed arrays binary encoding has been changed in version '2.5.0'!", + "C++11 Generator: Compatibility check failed!"}}; ASSERT_TRUE(zserioErrors.isPresent(errors)); } @@ -56,13 +48,13 @@ TEST_F(CompatibilityErrorTest, versionLessThanMinSupported) { ASSERT_TRUE(zserioErrors.isPresent( "version_less_than_min_supported_error.zs:1:30: " - "Package specifies unsupported compatibility version '2.3.2', " - "minimum supported version is '2.4.0'!")); + "Package specifies unsupported compatibility version '2.3.2', " + "minimum supported version is '2.4.0'!")); } TEST_F(CompatibilityErrorTest, wrongCompatibilityVersionFormat) { ASSERT_TRUE(zserioErrors.isPresent( "wrong_compatibility_version_format_error.zs:2:30: " - "Failed to parse version string: '2.5.0-rc1' as a version!")); + "Failed to parse version string: '2.5.0-rc1' as a version!")); } diff --git a/test/errors/cpp_generator_error/cpp/CppGeneratorErrorTest.cpp b/test/errors/cpp_generator_error/cpp/CppGeneratorErrorTest.cpp index f58ee8596..da58692ec 100644 --- a/test/errors/cpp_generator_error/cpp/CppGeneratorErrorTest.cpp +++ b/test/errors/cpp_generator_error/cpp/CppGeneratorErrorTest.cpp @@ -1,13 +1,11 @@ #include "gtest/gtest.h" - #include "test_utils/ZserioErrorOutput.h" class CppGeneratorErrorTest : public ::testing::Test { protected: - - CppGeneratorErrorTest() - : zserioErrors("errors/cpp_generator_error") + CppGeneratorErrorTest() : + zserioErrors("errors/cpp_generator_error") {} const test_utils::ZserioErrorOutput zserioErrors; @@ -16,7 +14,7 @@ class CppGeneratorErrorTest : public ::testing::Test TEST_F(CppGeneratorErrorTest, wrongSetCppAllocator) { ASSERT_TRUE(zserioErrors.isPresent( - "[ERROR] C++11 Generator: The specified option 'setCppAllocator' has unknown allocator 'wrong'!")); + "[ERROR] C++11 Generator: The specified option 'setCppAllocator' has unknown allocator 'wrong'!")); } TEST_F(CppGeneratorErrorTest, bitmaskValuesClassClash) diff --git a/test/language/alignment/cpp/AutoOptionalMemberAlignmentTest.cpp b/test/language/alignment/cpp/AutoOptionalMemberAlignmentTest.cpp index f7755c732..cc4d4fb59 100644 --- a/test/language/alignment/cpp/AutoOptionalMemberAlignmentTest.cpp +++ b/test/language/alignment/cpp/AutoOptionalMemberAlignmentTest.cpp @@ -1,9 +1,7 @@ +#include "alignment/auto_optional_member_alignment/AutoOptionalMemberAlignment.h" #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" - -#include "alignment/auto_optional_member_alignment/AutoOptionalMemberAlignment.h" +#include "zserio/BitStreamWriter.h" namespace alignment { @@ -13,8 +11,8 @@ namespace auto_optional_member_alignment class AutoOptionalMemberAlignmentTest : public ::testing::Test { protected: - void writeAutoOptionalMemberAlignmentToByteArray(zserio::BitStreamWriter& writer, bool hasAutoOptional, - int32_t autoOptionalField, int32_t field) + void writeAutoOptionalMemberAlignmentToByteArray( + zserio::BitStreamWriter& writer, bool hasAutoOptional, int32_t autoOptionalField, int32_t field) { writer.writeBool(hasAutoOptional); @@ -138,8 +136,8 @@ TEST_F(AutoOptionalMemberAlignmentTest, writeWithOptional) zserio::BitStreamReader reader(writer.getWriteBuffer(), writer.getBitPosition(), zserio::BitsTag()); AutoOptionalMemberAlignment readAutoOptionalMemberAlignment(reader); - checkAutoOptionalMemberAlignment(readAutoOptionalMemberAlignment, hasAutoOptional, autoOptionalField, - field); + checkAutoOptionalMemberAlignment( + readAutoOptionalMemberAlignment, hasAutoOptional, autoOptionalField, field); ASSERT_TRUE(autoOptionalMemberAlignment == readAutoOptionalMemberAlignment); } @@ -156,8 +154,8 @@ TEST_F(AutoOptionalMemberAlignmentTest, writeWithoutOptional) zserio::BitStreamReader reader(writer.getWriteBuffer(), writer.getBitPosition(), zserio::BitsTag()); AutoOptionalMemberAlignment readAutoOptionalMemberAlignment(reader); - checkAutoOptionalMemberAlignment(readAutoOptionalMemberAlignment, hasAutoOptional, autoOptionalField, - field); + checkAutoOptionalMemberAlignment( + readAutoOptionalMemberAlignment, hasAutoOptional, autoOptionalField, field); ASSERT_TRUE(autoOptionalMemberAlignment == readAutoOptionalMemberAlignment); } diff --git a/test/language/alignment/cpp/BitAlignmentTest.cpp b/test/language/alignment/cpp/BitAlignmentTest.cpp index 833cbae0c..28ed5d327 100644 --- a/test/language/alignment/cpp/BitAlignmentTest.cpp +++ b/test/language/alignment/cpp/BitAlignmentTest.cpp @@ -1,9 +1,7 @@ +#include "alignment/bit_alignment/BitAlignment.h" #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" - -#include "alignment/bit_alignment/BitAlignment.h" +#include "zserio/BitStreamWriter.h" namespace alignment { diff --git a/test/language/alignment/cpp/OptionalMemberAlignmentTest.cpp b/test/language/alignment/cpp/OptionalMemberAlignmentTest.cpp index 40e5b380f..9da698bb0 100644 --- a/test/language/alignment/cpp/OptionalMemberAlignmentTest.cpp +++ b/test/language/alignment/cpp/OptionalMemberAlignmentTest.cpp @@ -1,9 +1,7 @@ +#include "alignment/optional_member_alignment/OptionalMemberAlignment.h" #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" - -#include "alignment/optional_member_alignment/OptionalMemberAlignment.h" +#include "zserio/BitStreamWriter.h" namespace alignment { @@ -13,8 +11,8 @@ namespace optional_member_alignment class OptionalMemberAlignmentTest : public ::testing::Test { protected: - void writeOptionalMemberAlignmentToByteArray(zserio::BitStreamWriter& writer, bool hasOptional, - int32_t optionalField, int32_t field) + void writeOptionalMemberAlignmentToByteArray( + zserio::BitStreamWriter& writer, bool hasOptional, int32_t optionalField, int32_t field) { writer.writeBool(hasOptional); diff --git a/test/language/array_types/cpp/ArraysMappingTest.cpp b/test/language/array_types/cpp/ArraysMappingTest.cpp index c471db174..456e41c07 100644 --- a/test/language/array_types/cpp/ArraysMappingTest.cpp +++ b/test/language/array_types/cpp/ArraysMappingTest.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "array_types/arrays_mapping/ArraysMapping.h" - +#include "gtest/gtest.h" #include "zserio/RebindAlloc.h" namespace array_types diff --git a/test/language/array_types/cpp/AutoArrayBitfieldParamTest.cpp b/test/language/array_types/cpp/AutoArrayBitfieldParamTest.cpp index 04a37b353..1a1b5e97b 100644 --- a/test/language/array_types/cpp/AutoArrayBitfieldParamTest.cpp +++ b/test/language/array_types/cpp/AutoArrayBitfieldParamTest.cpp @@ -1,11 +1,9 @@ +#include "array_types/auto_array_bitfield_param/ParameterizedBitfieldLength.h" #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" #include "zserio/SerializeUtil.h" -#include "array_types/auto_array_bitfield_param/ParameterizedBitfieldLength.h" - namespace array_types { namespace auto_array_bitfield_param @@ -26,8 +24,8 @@ class AutoArrayBitfieldParamTest : public ::testing::Test dynamicBitfieldArray.push_back(i); } - void checkParameterizedBitfieldLengthInBitStream(zserio::BitStreamReader& reader, - const ParameterizedBitfieldLength& parameterizedBitfieldLength) + void checkParameterizedBitfieldLengthInBitStream( + zserio::BitStreamReader& reader, const ParameterizedBitfieldLength& parameterizedBitfieldLength) { ASSERT_EQ(NUM_BITS_PARAM, parameterizedBitfieldLength.getNumBits()); ASSERT_EQ(DYNAMIC_BITFIELD_ARRAY_SIZE, reader.readVarSize()); diff --git a/test/language/array_types/cpp/AutoArrayStructRecursionTest.cpp b/test/language/array_types/cpp/AutoArrayStructRecursionTest.cpp index 2fc599192..8b5d35c3f 100644 --- a/test/language/array_types/cpp/AutoArrayStructRecursionTest.cpp +++ b/test/language/array_types/cpp/AutoArrayStructRecursionTest.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "array_types/auto_array_struct_recursion/AutoArrayRecursion.h" - +#include "gtest/gtest.h" #include "zserio/SerializeUtil.h" namespace array_types diff --git a/test/language/array_types/cpp/AutoArraySubtypedUInt8Test.cpp b/test/language/array_types/cpp/AutoArraySubtypedUInt8Test.cpp index 209b71fcd..837f98def 100644 --- a/test/language/array_types/cpp/AutoArraySubtypedUInt8Test.cpp +++ b/test/language/array_types/cpp/AutoArraySubtypedUInt8Test.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "array_types/auto_array_subtyped_uint8/AutoArray.h" - +#include "gtest/gtest.h" #include "zserio/RebindAlloc.h" #include "zserio/SerializeUtil.h" @@ -35,8 +33,7 @@ class AutoArraySubtypedUInt8Test : public ::testing::Test const size_t bitPosition = 2; const size_t subtypedBuiltinAutoArrayBitSize = 8 + numElements * 8; - ASSERT_EQ(subtypedBuiltinAutoArrayBitSize, - autoArray.bitSizeOf(bitPosition)); + ASSERT_EQ(subtypedBuiltinAutoArrayBitSize, autoArray.bitSizeOf(bitPosition)); } void checkInitializeOffsets(size_t numElements) @@ -113,7 +110,6 @@ class AutoArraySubtypedUInt8Test : public ::testing::Test static const size_t AUTO_ARRAY_LENGTH1; static const size_t AUTO_ARRAY_LENGTH2; zserio::BitBuffer bitBuffer = zserio::BitBuffer(1024 * 8); - }; const std::string AutoArraySubtypedUInt8Test::BLOB_NAME_BASE = diff --git a/test/language/array_types/cpp/AutoArrayUInt8Test.cpp b/test/language/array_types/cpp/AutoArrayUInt8Test.cpp index f09d2e498..23da45a1d 100644 --- a/test/language/array_types/cpp/AutoArrayUInt8Test.cpp +++ b/test/language/array_types/cpp/AutoArrayUInt8Test.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "array_types/auto_array_uint8/AutoArray.h" - +#include "gtest/gtest.h" #include "zserio/RebindAlloc.h" #include "zserio/SerializeUtil.h" diff --git a/test/language/array_types/cpp/FixedArrayUInt8Test.cpp b/test/language/array_types/cpp/FixedArrayUInt8Test.cpp index 015165444..5a92355e4 100644 --- a/test/language/array_types/cpp/FixedArrayUInt8Test.cpp +++ b/test/language/array_types/cpp/FixedArrayUInt8Test.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "array_types/fixed_array_uint8/FixedArray.h" - +#include "gtest/gtest.h" #include "zserio/RebindAlloc.h" #include "zserio/SerializeUtil.h" diff --git a/test/language/array_types/cpp/PackedArraysMappingTest.cpp b/test/language/array_types/cpp/PackedArraysMappingTest.cpp index fda0b3914..a5ced26e6 100644 --- a/test/language/array_types/cpp/PackedArraysMappingTest.cpp +++ b/test/language/array_types/cpp/PackedArraysMappingTest.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "array_types/packed_arrays_mapping/PackedArraysMapping.h" - +#include "gtest/gtest.h" #include "zserio/RebindAlloc.h" namespace array_types diff --git a/test/language/array_types/cpp/PackedAutoArrayBitfieldParamTest.cpp b/test/language/array_types/cpp/PackedAutoArrayBitfieldParamTest.cpp index 2755990a3..94e17c87e 100644 --- a/test/language/array_types/cpp/PackedAutoArrayBitfieldParamTest.cpp +++ b/test/language/array_types/cpp/PackedAutoArrayBitfieldParamTest.cpp @@ -1,11 +1,9 @@ +#include "array_types/packed_auto_array_bitfield_param/ParameterizedBitfieldLength.h" #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" #include "zserio/SerializeUtil.h" -#include "array_types/packed_auto_array_bitfield_param/ParameterizedBitfieldLength.h" - namespace array_types { namespace packed_auto_array_bitfield_param diff --git a/test/language/array_types/cpp/PackedAutoArrayEmptyCompoundsTest.cpp b/test/language/array_types/cpp/PackedAutoArrayEmptyCompoundsTest.cpp index 6d387ebca..a0bd3a8f7 100644 --- a/test/language/array_types/cpp/PackedAutoArrayEmptyCompoundsTest.cpp +++ b/test/language/array_types/cpp/PackedAutoArrayEmptyCompoundsTest.cpp @@ -1,10 +1,8 @@ -#include #include - -#include "gtest/gtest.h" +#include #include "array_types/packed_auto_array_empty_compounds/PackedAutoArray.h" - +#include "gtest/gtest.h" #include "zserio/RebindAlloc.h" #include "zserio/SerializeUtil.h" @@ -28,12 +26,9 @@ const std::string PackedAutoArrayEmptyCompoundsTest::BLOB_NAME = TEST_F(PackedAutoArrayEmptyCompoundsTest, writeReadFile) { - auto packedAutoArray = PackedAutoArray( - {{EmptyStruct(), EmptyStruct(), EmptyStruct()}}, - {{EmptyUnion(), EmptyUnion(), EmptyUnion()}}, - {{EmptyChoice(), EmptyChoice(), EmptyChoice()}}, - {{Main(), Main(), Main()}} - ); + auto packedAutoArray = PackedAutoArray({{EmptyStruct(), EmptyStruct(), EmptyStruct()}}, + {{EmptyUnion(), EmptyUnion(), EmptyUnion()}}, {{EmptyChoice(), EmptyChoice(), EmptyChoice()}}, + {{Main(), Main(), Main()}}); packedAutoArray.getMainArray()[0].setParam(0); packedAutoArray.getMainArray()[1].setParam(1); packedAutoArray.getMainArray()[2].setParam(2); diff --git a/test/language/array_types/cpp/PackedAutoArrayRemovedEnumItemTest.cpp b/test/language/array_types/cpp/PackedAutoArrayRemovedEnumItemTest.cpp index f7b8d7883..0058e460e 100644 --- a/test/language/array_types/cpp/PackedAutoArrayRemovedEnumItemTest.cpp +++ b/test/language/array_types/cpp/PackedAutoArrayRemovedEnumItemTest.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "array_types/packed_auto_array_removed_enum_item/PackedAutoArrayRemovedEnumItem.h" - +#include "gtest/gtest.h" #include "zserio/SerializeUtil.h" namespace array_types diff --git a/test/language/array_types/cpp/PackedAutoArrayStructRecursionTest.cpp b/test/language/array_types/cpp/PackedAutoArrayStructRecursionTest.cpp index 5a79916c8..0a00db128 100644 --- a/test/language/array_types/cpp/PackedAutoArrayStructRecursionTest.cpp +++ b/test/language/array_types/cpp/PackedAutoArrayStructRecursionTest.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "array_types/packed_auto_array_struct_recursion/PackedAutoArrayRecursion.h" - +#include "gtest/gtest.h" #include "zserio/SerializeUtil.h" namespace array_types @@ -54,8 +52,8 @@ class PackedAutoArrayStructRecursionTest : public ::testing::Test } } - void checkPackedAutoArrayRecursion(const PackedAutoArrayRecursion& packedAutoArrayRecursion, - size_t numElements) + void checkPackedAutoArrayRecursion( + const PackedAutoArrayRecursion& packedAutoArrayRecursion, size_t numElements) { ASSERT_EQ(0, packedAutoArrayRecursion.getId()); const auto& autoArray = packedAutoArrayRecursion.getPackedAutoArrayRecursion(); diff --git a/test/language/array_types/cpp/PackedAutoArrayStructWithBytesTest.cpp b/test/language/array_types/cpp/PackedAutoArrayStructWithBytesTest.cpp index c2bf24ca1..917a93ece 100644 --- a/test/language/array_types/cpp/PackedAutoArrayStructWithBytesTest.cpp +++ b/test/language/array_types/cpp/PackedAutoArrayStructWithBytesTest.cpp @@ -1,10 +1,8 @@ -#include #include - -#include "gtest/gtest.h" +#include #include "array_types/packed_auto_array_struct_with_bytes/PackedAutoArray.h" - +#include "gtest/gtest.h" #include "zserio/RebindAlloc.h" #include "zserio/SerializeUtil.h" diff --git a/test/language/array_types/cpp/PackedAutoArrayStructWithExternTest.cpp b/test/language/array_types/cpp/PackedAutoArrayStructWithExternTest.cpp index 76aba38ae..ab1be2965 100644 --- a/test/language/array_types/cpp/PackedAutoArrayStructWithExternTest.cpp +++ b/test/language/array_types/cpp/PackedAutoArrayStructWithExternTest.cpp @@ -1,10 +1,8 @@ -#include #include - -#include "gtest/gtest.h" +#include #include "array_types/packed_auto_array_struct_with_extern/PackedAutoArray.h" - +#include "gtest/gtest.h" #include "zserio/RebindAlloc.h" #include "zserio/SerializeUtil.h" diff --git a/test/language/array_types/cpp/PackedAutoArrayStructWithUnpackedFieldTest.cpp b/test/language/array_types/cpp/PackedAutoArrayStructWithUnpackedFieldTest.cpp index e51058a1a..0ac22cfa5 100644 --- a/test/language/array_types/cpp/PackedAutoArrayStructWithUnpackedFieldTest.cpp +++ b/test/language/array_types/cpp/PackedAutoArrayStructWithUnpackedFieldTest.cpp @@ -1,9 +1,7 @@ #include -#include "gtest/gtest.h" - #include "array_types/packed_auto_array_struct_with_unpacked_field/PackedAutoArray.h" - +#include "gtest/gtest.h" #include "zserio/SerializeUtil.h" namespace array_types diff --git a/test/language/array_types/cpp/PackedAutoArrayUInt8Test.cpp b/test/language/array_types/cpp/PackedAutoArrayUInt8Test.cpp index 096a30105..7d6e837b2 100644 --- a/test/language/array_types/cpp/PackedAutoArrayUInt8Test.cpp +++ b/test/language/array_types/cpp/PackedAutoArrayUInt8Test.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "array_types/packed_auto_array_uint8/PackedAutoArray.h" - +#include "gtest/gtest.h" #include "zserio/RebindAlloc.h" #include "zserio/SerializeUtil.h" diff --git a/test/language/array_types/cpp/PackedFixedArrayUInt8Test.cpp b/test/language/array_types/cpp/PackedFixedArrayUInt8Test.cpp index 9a1b661f3..ad70d1259 100644 --- a/test/language/array_types/cpp/PackedFixedArrayUInt8Test.cpp +++ b/test/language/array_types/cpp/PackedFixedArrayUInt8Test.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "array_types/packed_fixed_array_uint8/PackedFixedArray.h" - +#include "gtest/gtest.h" #include "zserio/RebindAlloc.h" #include "zserio/SerializeUtil.h" diff --git a/test/language/array_types/cpp/PackedVariableArrayStructRecursionTest.cpp b/test/language/array_types/cpp/PackedVariableArrayStructRecursionTest.cpp index 38fe853e0..ee90dd7a6 100644 --- a/test/language/array_types/cpp/PackedVariableArrayStructRecursionTest.cpp +++ b/test/language/array_types/cpp/PackedVariableArrayStructRecursionTest.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "array_types/packed_variable_array_struct_recursion/PackedVariableArray.h" - +#include "gtest/gtest.h" #include "zserio/SerializeUtil.h" namespace array_types @@ -82,8 +80,7 @@ class PackedVariableArrayStructRecursionTest : public ::testing::Test ASSERT_GT(unpackedBitSize * minCompressionRatio, packedBitSize) << "Unpacked array has " << std::to_string(unpackedBitSize) << " bits, " << "packed array has " << std::to_string(packedBitSize) << " bits, " - << "compression ratio is " - << std::to_string(packedBitSize / unpackedBitSize * 100) << "%!"; + << "compression ratio is " << std::to_string(packedBitSize / unpackedBitSize * 100) << "%!"; } void checkWriteRead(size_t numElements) diff --git a/test/language/array_types/cpp/PackedVariableArrayStructTest.cpp b/test/language/array_types/cpp/PackedVariableArrayStructTest.cpp index 7494d574c..2844ef664 100644 --- a/test/language/array_types/cpp/PackedVariableArrayStructTest.cpp +++ b/test/language/array_types/cpp/PackedVariableArrayStructTest.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "array_types/packed_variable_array_struct/PackedVariableArray.h" - +#include "gtest/gtest.h" #include "zserio/SerializeUtil.h" namespace array_types @@ -85,7 +83,7 @@ class PackedVariableArrayStructTest : public ::testing::Test else if (index == 5) testUnion.setArray32(vector_type{index * 2, index * 2 + 1}); else - testUnion.setValue32(Value32{index * 2 }); + testUnion.setValue32(Value32{index * 2}); return testUnion; } @@ -95,15 +93,14 @@ class PackedVariableArrayStructTest : public ::testing::Test PackedVariableArray packedVariableArray; fillPackedVariableArray(packedVariableArray, numElements); - const double unpackedBitSize = static_cast( - packedVariableArray.getTestUnpackedArray().bitSizeOf()); + const double unpackedBitSize = + static_cast(packedVariableArray.getTestUnpackedArray().bitSizeOf()); const double packedBitSize = static_cast(packedVariableArray.getTestPackedArray().bitSizeOf()); const double minCompressionRatio = 0.622; ASSERT_GT(unpackedBitSize * minCompressionRatio, packedBitSize) << "Unpacked array has " << std::to_string(unpackedBitSize) << " bits, " << "packed array has " << std::to_string(packedBitSize) << " bits, " - << "compression ratio is " - << std::to_string(packedBitSize /unpackedBitSize * 100) << "%!"; + << "compression ratio is " << std::to_string(packedBitSize / unpackedBitSize * 100) << "%!"; } void checkWriteRead(uint32_t numElements) @@ -212,5 +209,5 @@ TEST_F(PackedVariableArrayStructTest, writeReadFileLength4) checkWriteReadFile(VARIABLE_ARRAY_LENGTH4); } -} // namespace packed_variable_array_struct_recursion +} // namespace packed_variable_array_struct } // namespace array_types diff --git a/test/language/array_types/cpp/PackedVariableArrayUInt8Test.cpp b/test/language/array_types/cpp/PackedVariableArrayUInt8Test.cpp index d6e324781..a96720512 100644 --- a/test/language/array_types/cpp/PackedVariableArrayUInt8Test.cpp +++ b/test/language/array_types/cpp/PackedVariableArrayUInt8Test.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "array_types/packed_variable_array_uint8/PackedVariableArray.h" - +#include "gtest/gtest.h" #include "zserio/RebindAlloc.h" #include "zserio/SerializeUtil.h" diff --git a/test/language/array_types/cpp/PackingInterfaceOptimizationTest.cpp b/test/language/array_types/cpp/PackingInterfaceOptimizationTest.cpp index 962c09864..e1837473b 100644 --- a/test/language/array_types/cpp/PackingInterfaceOptimizationTest.cpp +++ b/test/language/array_types/cpp/PackingInterfaceOptimizationTest.cpp @@ -1,12 +1,9 @@ -#include "gtest/gtest.h" - #include "array_types/packing_interface_optimization/PackingInterfaceOptimization.h" - +#include "gtest/gtest.h" +#include "test_utils/Assertions.h" #include "zserio/RebindAlloc.h" #include "zserio/SerializeUtil.h" -#include "test_utils/Assertions.h" - namespace array_types { namespace packing_interface_optimization @@ -79,16 +76,16 @@ class PackingInterfaceOptimizationTest : public ::testing::Test void assertPackingInterfaceMethodsPresent(const std::string& typeName) { const std::string ctorDeclaration = typeName + "(ZserioPackingContext"; - const std::string ctorDefinition = typeName + "::" + typeName + "(" + - typeName + "::ZserioPackingContext"; + const std::string ctorDefinition = + typeName + "::" + typeName + "(" + typeName + "::ZserioPackingContext"; ASSERT_METHOD_PRESENT(PATH, typeName, ctorDeclaration.c_str(), ctorDefinition.c_str()); ASSERT_METHOD_PRESENT(PATH, typeName, "initPackingContext(", "::initPackingContext("); const std::string bitSizeOfMethodDeclaration = "bitSizeOf(ZserioPackingContext"; const std::string bitSizeOfMethodDefinition = "bitSizeOf(" + typeName + "::ZserioPackingContext"; - ASSERT_METHOD_PRESENT(PATH, typeName, bitSizeOfMethodDeclaration.c_str(), - bitSizeOfMethodDefinition.c_str()); + ASSERT_METHOD_PRESENT( + PATH, typeName, bitSizeOfMethodDeclaration.c_str(), bitSizeOfMethodDefinition.c_str()); const std::string initializeOffsetsMethodDeclaration = "initializeOffsets(ZserioPackingContext"; const std::string initializeOffsetsMethodDefinition = @@ -104,16 +101,16 @@ class PackingInterfaceOptimizationTest : public ::testing::Test void assertPackingInterfaceMethodsNotPresent(const std::string& typeName) { const std::string ctorDeclaration = typeName + "(ZserioPackingContext"; - const std::string ctorDefinition = typeName + "::" + typeName + "(" + - typeName + "::ZserioPackingContext"; + const std::string ctorDefinition = + typeName + "::" + typeName + "(" + typeName + "::ZserioPackingContext"; ASSERT_METHOD_NOT_PRESENT(PATH, typeName, ctorDeclaration.c_str(), ctorDefinition.c_str()); ASSERT_METHOD_NOT_PRESENT(PATH, typeName, "initPackingContext(", "::initPackingContext("); const std::string bitSizeOfMethodDeclaration = "bitSizeOf(ZserioPackingContext"; const std::string bitSizeOfMethodDefinition = "bitSizeOf(" + typeName + "::ZserioPackingContext"; - ASSERT_METHOD_NOT_PRESENT(PATH, typeName, bitSizeOfMethodDeclaration.c_str(), - bitSizeOfMethodDefinition.c_str()); + ASSERT_METHOD_NOT_PRESENT( + PATH, typeName, bitSizeOfMethodDeclaration.c_str(), bitSizeOfMethodDefinition.c_str()); const std::string initializeOffsetsMethodDeclaration = "initializeOffsets(ZserioPackingContext"; const std::string initializeOffsetsMethodDefinition = @@ -123,7 +120,8 @@ class PackingInterfaceOptimizationTest : public ::testing::Test const std::string writeMethodDeclaration = "write(ZserioPackingContext"; const std::string writeMethodDefinition = "write(" + typeName + "::ZserioPackingContext"; - ASSERT_METHOD_NOT_PRESENT(PATH, typeName, writeMethodDeclaration.c_str(), writeMethodDefinition.c_str()); + ASSERT_METHOD_NOT_PRESENT( + PATH, typeName, writeMethodDeclaration.c_str(), writeMethodDefinition.c_str()); } static const std::string BLOB_NAME; @@ -142,16 +140,15 @@ TEST_F(PackingInterfaceOptimizationTest, writeReadFile) fillPackedColorsHolder(packingInterfaceOptimization.getPackedColorsHolder()); zserio::serializeToFile(packingInterfaceOptimization, BLOB_NAME); - const auto readPackingInterfaceOptimization = zserio::deserializeFromFile( - BLOB_NAME); + const auto readPackingInterfaceOptimization = + zserio::deserializeFromFile(BLOB_NAME); ASSERT_EQ(packingInterfaceOptimization, readPackingInterfaceOptimization); } TEST_F(PackingInterfaceOptimizationTest, packingInterfaceOptimizationMethods) { assertPackingInterfaceMethodsNotPresent("PackingInterfaceOptimization"); - ASSERT_STRING_IN_FILE_NOT_PRESENT(PATH + "PackingInterfaceOptimization.h", - "class ZserioPackingContext"); + ASSERT_STRING_IN_FILE_NOT_PRESENT(PATH + "PackingInterfaceOptimization.h", "class ZserioPackingContext"); } TEST_F(PackingInterfaceOptimizationTest, unpackedColorsHolderMethods) @@ -160,7 +157,8 @@ TEST_F(PackingInterfaceOptimizationTest, unpackedColorsHolderMethods) ASSERT_STRING_IN_FILE_NOT_PRESENT(PATH + "UnpackedColorsHolder.h", "class ZserioPackingContext"); ASSERT_STRING_IN_FILE_NOT_PRESENT(PATH + "UnpackedColorsHolder.h", - "::array_types::packing_interface_optimization::UnpackedColorStruct::ZserioPackingContext& context"); + "::array_types::packing_interface_optimization::UnpackedColorStruct::ZserioPackingContext& " + "context"); ASSERT_STRING_IN_FILE_PRESENT(PATH + "UnpackedColorsHolder.h", "::array_types::packing_interface_optimization::MixedColorStruct::ZserioPackingContext& context"); @@ -169,8 +167,7 @@ TEST_F(PackingInterfaceOptimizationTest, unpackedColorsHolderMethods) TEST_F(PackingInterfaceOptimizationTest, packedColorsHolderMethods) { assertPackingInterfaceMethodsNotPresent("PackedColorsHolder"); - ASSERT_STRING_IN_FILE_NOT_PRESENT(PATH + "PackedColorsHolder.h", - "class ZserioPackingContext"); + ASSERT_STRING_IN_FILE_NOT_PRESENT(PATH + "PackedColorsHolder.h", "class ZserioPackingContext"); ASSERT_STRING_IN_FILE_PRESENT(PATH + "PackedColorsHolder.h", "::array_types::packing_interface_optimization::MixedColorStruct::ZserioPackingContext& context"); @@ -208,8 +205,8 @@ TEST_F(PackingInterfaceOptimizationTest, unpackedColorEnumMethods) ASSERT_METHOD_NOT_PRESENT(PATH, "UnpackedColorEnum", "read<::array_types::packing_interface_optimization::UnpackedColorEnum, ::zserio::DeltaContext", "read(::zserio::DeltaContext&"); - ASSERT_METHOD_NOT_PRESENT(PATH, "UnpackedColorEnum", "write<::zserio::DeltaContext,", - "write(::zserio::DeltaContext&"); + ASSERT_METHOD_NOT_PRESENT( + PATH, "UnpackedColorEnum", "write<::zserio::DeltaContext,", "write(::zserio::DeltaContext&"); } TEST_F(PackingInterfaceOptimizationTest, unpackedColorBitmaskMethods) @@ -222,8 +219,8 @@ TEST_F(PackingInterfaceOptimizationTest, unpackedColorBitmaskMethods) "::bitSizeOf(::zserio::DeltaContext"); ASSERT_METHOD_NOT_PRESENT(PATH, "UnpackedColorBitmask", "initializeOffsets(::zserio::DeltaContext", "::initializeOffsets(::zserio::DeltaContext"); - ASSERT_METHOD_NOT_PRESENT(PATH, "UnpackedColorBitmask", "write(::zserio::DeltaContext", - "::write(::zserio::DeltaContext"); + ASSERT_METHOD_NOT_PRESENT( + PATH, "UnpackedColorBitmask", "write(::zserio::DeltaContext", "::write(::zserio::DeltaContext"); } TEST_F(PackingInterfaceOptimizationTest, mixedColorStructMethods) @@ -248,15 +245,15 @@ TEST_F(PackingInterfaceOptimizationTest, mixedColorEnumMethods) { ASSERT_METHOD_PRESENT(PATH, "MixedColorEnum", "initPackingContext<::zserio::DeltaContext,", "initPackingContext(::zserio::DeltaContext&"); - ASSERT_METHOD_PRESENT(PATH, "MixedColorEnum", "bitSizeOf<::zserio::DeltaContext,", - "bitSizeOf(::zserio::DeltaContext&"); + ASSERT_METHOD_PRESENT( + PATH, "MixedColorEnum", "bitSizeOf<::zserio::DeltaContext,", "bitSizeOf(::zserio::DeltaContext&"); ASSERT_METHOD_PRESENT(PATH, "MixedColorEnum", "initializeOffsets<::zserio::DeltaContext,", "initializeOffsets(::zserio::DeltaContext&"); ASSERT_METHOD_PRESENT(PATH, "MixedColorEnum", "read<::array_types::packing_interface_optimization::MixedColorEnum, ::zserio::DeltaContext", "read(::zserio::DeltaContext&"); - ASSERT_METHOD_PRESENT(PATH, "MixedColorEnum", "write<::zserio::DeltaContext,", - "write(::zserio::DeltaContext&"); + ASSERT_METHOD_PRESENT( + PATH, "MixedColorEnum", "write<::zserio::DeltaContext,", "write(::zserio::DeltaContext&"); } TEST_F(PackingInterfaceOptimizationTest, mixedColorBitmaskMethods) @@ -269,8 +266,8 @@ TEST_F(PackingInterfaceOptimizationTest, mixedColorBitmaskMethods) "::bitSizeOf(::zserio::DeltaContext"); ASSERT_METHOD_PRESENT(PATH, "MixedColorBitmask", "initializeOffsets(::zserio::DeltaContext", "::initializeOffsets(::zserio::DeltaContext"); - ASSERT_METHOD_PRESENT(PATH, "MixedColorBitmask", "write(::zserio::DeltaContext", - "::write(::zserio::DeltaContext"); + ASSERT_METHOD_PRESENT( + PATH, "MixedColorBitmask", "write(::zserio::DeltaContext", "::write(::zserio::DeltaContext"); } TEST_F(PackingInterfaceOptimizationTest, packedColorStructMethods) @@ -295,15 +292,15 @@ TEST_F(PackingInterfaceOptimizationTest, packedColorEnumMethods) { ASSERT_METHOD_PRESENT(PATH, "PackedColorEnum", "initPackingContext<::zserio::DeltaContext,", "initPackingContext(::zserio::DeltaContext&"); - ASSERT_METHOD_PRESENT(PATH, "PackedColorEnum", "bitSizeOf<::zserio::DeltaContext,", - "bitSizeOf(::zserio::DeltaContext&"); + ASSERT_METHOD_PRESENT( + PATH, "PackedColorEnum", "bitSizeOf<::zserio::DeltaContext,", "bitSizeOf(::zserio::DeltaContext&"); ASSERT_METHOD_PRESENT(PATH, "PackedColorEnum", "initializeOffsets<::zserio::DeltaContext,", "initializeOffsets(::zserio::DeltaContext&"); ASSERT_METHOD_PRESENT(PATH, "PackedColorEnum", "read<::array_types::packing_interface_optimization::PackedColorEnum, ::zserio::DeltaContext", "read(::zserio::DeltaContext&"); - ASSERT_METHOD_PRESENT(PATH, "PackedColorEnum", "write<::zserio::DeltaContext,", - "write(::zserio::DeltaContext&"); + ASSERT_METHOD_PRESENT( + PATH, "PackedColorEnum", "write<::zserio::DeltaContext,", "write(::zserio::DeltaContext&"); } TEST_F(PackingInterfaceOptimizationTest, packedColorBitmaskMethods) @@ -316,8 +313,8 @@ TEST_F(PackingInterfaceOptimizationTest, packedColorBitmaskMethods) "::bitSizeOf(::zserio::DeltaContext"); ASSERT_METHOD_PRESENT(PATH, "PackedColorBitmask", "initializeOffsets(::zserio::DeltaContext", "::initializeOffsets(::zserio::DeltaContext"); - ASSERT_METHOD_PRESENT(PATH, "PackedColorBitmask", "write(::zserio::DeltaContext", - "::write(::zserio::DeltaContext"); + ASSERT_METHOD_PRESENT( + PATH, "PackedColorBitmask", "write(::zserio::DeltaContext", "::write(::zserio::DeltaContext"); } } // namespace packing_interface_optimization diff --git a/test/language/array_types/cpp/VariableArrayStructCastInt8Test.cpp b/test/language/array_types/cpp/VariableArrayStructCastInt8Test.cpp index 2a6ea29fd..da4380a0c 100644 --- a/test/language/array_types/cpp/VariableArrayStructCastInt8Test.cpp +++ b/test/language/array_types/cpp/VariableArrayStructCastInt8Test.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "array_types/variable_array_struct_cast_int8/VariableArray.h" - +#include "gtest/gtest.h" #include "zserio/RebindAlloc.h" #include "zserio/SerializeUtil.h" #include "zserio/StringConvertUtil.h" diff --git a/test/language/array_types/cpp/VariableArrayStructCastVarUIntTest.cpp b/test/language/array_types/cpp/VariableArrayStructCastVarUIntTest.cpp index 70dd0af3b..aa5342dbc 100644 --- a/test/language/array_types/cpp/VariableArrayStructCastVarUIntTest.cpp +++ b/test/language/array_types/cpp/VariableArrayStructCastVarUIntTest.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "array_types/variable_array_struct_cast_varuint/VariableArray.h" - +#include "gtest/gtest.h" #include "zserio/RebindAlloc.h" #include "zserio/SerializeUtil.h" #include "zserio/StringConvertUtil.h" diff --git a/test/language/array_types/cpp/VariableArraySubtypedStructTest.cpp b/test/language/array_types/cpp/VariableArraySubtypedStructTest.cpp index 94b994b51..347ec8f7b 100644 --- a/test/language/array_types/cpp/VariableArraySubtypedStructTest.cpp +++ b/test/language/array_types/cpp/VariableArraySubtypedStructTest.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "array_types/variable_array_subtyped_struct/VariableArray.h" - +#include "gtest/gtest.h" #include "zserio/RebindAlloc.h" #include "zserio/SerializeUtil.h" #include "zserio/StringConvertUtil.h" @@ -43,8 +41,8 @@ TEST_F(VariableArraySubtypedStructTest, bitSizeOf) compoundArray.reserve(numElements); for (size_t i = 0; i < numElements; ++i) { - const ArrayElement arrayElement(static_cast(i), - string_type("Name") + zserio::toString(i)); + const ArrayElement arrayElement( + static_cast(i), string_type("Name") + zserio::toString(i)); compoundArray.push_back(arrayElement); } VariableArray variableArray; @@ -64,8 +62,8 @@ TEST_F(VariableArraySubtypedStructTest, initializeOffsets) compoundArray.reserve(numElements); for (size_t i = 0; i < numElements; ++i) { - const ArrayElement arrayElement(static_cast(i), - string_type("Name") + zserio::toString(i)); + const ArrayElement arrayElement( + static_cast(i), string_type("Name") + zserio::toString(i)); compoundArray.push_back(arrayElement); } VariableArray variableArray; @@ -103,8 +101,8 @@ TEST_F(VariableArraySubtypedStructTest, writeRead) compoundArray.reserve(numElements); for (size_t i = 0; i < numElements; ++i) { - const ArrayElement arrayElement(static_cast(i), - string_type("Name") + zserio::toString(i)); + const ArrayElement arrayElement( + static_cast(i), string_type("Name") + zserio::toString(i)); compoundArray.push_back(arrayElement); } VariableArray variableArray; @@ -135,8 +133,8 @@ TEST_F(VariableArraySubtypedStructTest, writeReadFile) compoundArray.reserve(numElements); for (size_t i = 0; i < numElements; ++i) { - const ArrayElement arrayElement(static_cast(i), - string_type("Name") + zserio::toString(i)); + const ArrayElement arrayElement( + static_cast(i), string_type("Name") + zserio::toString(i)); compoundArray.push_back(arrayElement); } VariableArray variableArray; @@ -162,8 +160,8 @@ TEST_F(VariableArraySubtypedStructTest, writeWrongArray) compoundArray.reserve(numElements); for (size_t i = 0; i < numElements; ++i) { - const ArrayElement arrayElement(static_cast(i), - string_type("Name") + zserio::toString(i)); + const ArrayElement arrayElement( + static_cast(i), string_type("Name") + zserio::toString(i)); compoundArray.push_back(arrayElement); } VariableArray variableArray; diff --git a/test/language/array_types/cpp/VariableArrayTernaryOperatorTest.cpp b/test/language/array_types/cpp/VariableArrayTernaryOperatorTest.cpp index f3222ff8c..939bf6b28 100644 --- a/test/language/array_types/cpp/VariableArrayTernaryOperatorTest.cpp +++ b/test/language/array_types/cpp/VariableArrayTernaryOperatorTest.cpp @@ -1,10 +1,8 @@ +#include "array_types/variable_array_ternary_operator/VariableArray.h" #include "gtest/gtest.h" - #include "zserio/RebindAlloc.h" #include "zserio/SerializeUtil.h" -#include "array_types/variable_array_ternary_operator/VariableArray.h" - namespace array_types { namespace variable_array_ternary_operator @@ -20,8 +18,8 @@ class VariableArrayTernaryOperator : public ::testing::Test void fillVariableArray(VariableArray& variableArray, bool isFirstSizeUsed) { variableArray.setIsFirstSizeUsed(isFirstSizeUsed); - const uint8_t currentSize = (isFirstSizeUsed) ? variableArray.getFirstSize() : - variableArray.getSecondSize(); + const uint8_t currentSize = + (isFirstSizeUsed) ? variableArray.getFirstSize() : variableArray.getSecondSize(); vector_type& array = variableArray.getArray(); array.clear(); const size_t arraySize = static_cast(currentSize) * static_cast(currentSize); diff --git a/test/language/bitmask_types/cpp/BitfieldBitmaskTest.cpp b/test/language/bitmask_types/cpp/BitfieldBitmaskTest.cpp index 4da0f3e95..0acad0c74 100644 --- a/test/language/bitmask_types/cpp/BitfieldBitmaskTest.cpp +++ b/test/language/bitmask_types/cpp/BitfieldBitmaskTest.cpp @@ -1,13 +1,11 @@ #include +#include "bitmask_types/bitfield_bitmask/Permission.h" #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" #include "zserio/CppRuntimeException.h" -#include "bitmask_types/bitfield_bitmask/Permission.h" - namespace bitmask_types { namespace bitfield_bitmask diff --git a/test/language/bitmask_types/cpp/BitfieldConstBitmaskTest.cpp b/test/language/bitmask_types/cpp/BitfieldConstBitmaskTest.cpp index 772de1c58..7d5985ed6 100644 --- a/test/language/bitmask_types/cpp/BitfieldConstBitmaskTest.cpp +++ b/test/language/bitmask_types/cpp/BitfieldConstBitmaskTest.cpp @@ -1,14 +1,12 @@ #include +#include "bitmask_types/bitfield_const_bitmask/NUM_BITS.h" +#include "bitmask_types/bitfield_const_bitmask/Permission.h" #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" #include "zserio/CppRuntimeException.h" -#include "bitmask_types/bitfield_const_bitmask/Permission.h" -#include "bitmask_types/bitfield_const_bitmask/NUM_BITS.h" - namespace bitmask_types { namespace bitfield_const_bitmask diff --git a/test/language/bitmask_types/cpp/BitmaskDefinedByConstantTest.cpp b/test/language/bitmask_types/cpp/BitmaskDefinedByConstantTest.cpp index 82b26fbfb..290a6efc4 100644 --- a/test/language/bitmask_types/cpp/BitmaskDefinedByConstantTest.cpp +++ b/test/language/bitmask_types/cpp/BitmaskDefinedByConstantTest.cpp @@ -1,14 +1,12 @@ #include +#include "bitmask_types/bitmask_defined_by_constant/Permission.h" +#include "bitmask_types/bitmask_defined_by_constant/READ_PERMISSION.h" #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" #include "zserio/CppRuntimeException.h" -#include "bitmask_types/bitmask_defined_by_constant/Permission.h" -#include "bitmask_types/bitmask_defined_by_constant/READ_PERMISSION.h" - namespace bitmask_types { namespace bitmask_defined_by_constant diff --git a/test/language/bitmask_types/cpp/BitmaskUsedByBitmaskTest.cpp b/test/language/bitmask_types/cpp/BitmaskUsedByBitmaskTest.cpp index d2093779c..4129fff85 100644 --- a/test/language/bitmask_types/cpp/BitmaskUsedByBitmaskTest.cpp +++ b/test/language/bitmask_types/cpp/BitmaskUsedByBitmaskTest.cpp @@ -1,14 +1,12 @@ #include +#include "bitmask_types/bitmask_used_by_bitmask/Permission.h" +#include "bitmask_types/bitmask_used_by_bitmask/SimplePermission.h" #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" #include "zserio/CppRuntimeException.h" -#include "bitmask_types/bitmask_used_by_bitmask/Permission.h" -#include "bitmask_types/bitmask_used_by_bitmask/SimplePermission.h" - namespace bitmask_types { namespace bitmask_used_by_bitmask diff --git a/test/language/bitmask_types/cpp/BitmaskWithoutNoneTest.cpp b/test/language/bitmask_types/cpp/BitmaskWithoutNoneTest.cpp index 7e4217194..5f8529eb1 100644 --- a/test/language/bitmask_types/cpp/BitmaskWithoutNoneTest.cpp +++ b/test/language/bitmask_types/cpp/BitmaskWithoutNoneTest.cpp @@ -1,13 +1,11 @@ #include +#include "bitmask_types/bitmask_without_none/Permission.h" #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" #include "zserio/CppRuntimeException.h" -#include "bitmask_types/bitmask_without_none/Permission.h" - namespace bitmask_types { namespace bitmask_without_none diff --git a/test/language/bitmask_types/cpp/UInt64BitmaskTest.cpp b/test/language/bitmask_types/cpp/UInt64BitmaskTest.cpp index 0b8473029..a473f8b87 100644 --- a/test/language/bitmask_types/cpp/UInt64BitmaskTest.cpp +++ b/test/language/bitmask_types/cpp/UInt64BitmaskTest.cpp @@ -1,13 +1,11 @@ #include +#include "bitmask_types/uint64_bitmask/Permission.h" #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" #include "zserio/CppRuntimeException.h" -#include "bitmask_types/uint64_bitmask/Permission.h" - namespace bitmask_types { namespace uint64_bitmask @@ -52,8 +50,7 @@ TEST_F(Uint64BitmaskTest, valuesConstroctor) TEST_F(Uint64BitmaskTest, underlyingTypeConstructor) { const Permission permission(READ_PERMISSION_VALUE); - ASSERT_TRUE((permission & Permission::Values::READ_PERMISSION) == - Permission::Values::READ_PERMISSION); + ASSERT_TRUE((permission & Permission::Values::READ_PERMISSION) == Permission::Values::READ_PERMISSION); } TEST_F(Uint64BitmaskTest, readConstructor) @@ -292,8 +289,8 @@ TEST_F(Uint64BitmaskTest, operatorBitwiseNot) ASSERT_EQ(Permission::Values::READ_PERMISSION, ~Permission::Values::nonePermission & Permission::Values::READ_PERMISSION); ASSERT_EQ(Permission::Values::READ_PERMISSION | Permission::Values::write_permission, - ~Permission::Values::nonePermission & (Permission::Values::READ_PERMISSION | - Permission::Values::write_permission)); + ~Permission::Values::nonePermission & + (Permission::Values::READ_PERMISSION | Permission::Values::write_permission)); } TEST_F(Uint64BitmaskTest, operatorBitwiseOrAssignment) diff --git a/test/language/bitmask_types/cpp/UInt8BitmaskTest.cpp b/test/language/bitmask_types/cpp/UInt8BitmaskTest.cpp index 5b32d4125..f61467eb1 100644 --- a/test/language/bitmask_types/cpp/UInt8BitmaskTest.cpp +++ b/test/language/bitmask_types/cpp/UInt8BitmaskTest.cpp @@ -1,13 +1,11 @@ #include +#include "bitmask_types/uint8_bitmask/Permission.h" #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" #include "zserio/CppRuntimeException.h" -#include "bitmask_types/uint8_bitmask/Permission.h" - namespace bitmask_types { namespace uint8_bitmask diff --git a/test/language/bitmask_types/cpp/VarUIntBitmaskTest.cpp b/test/language/bitmask_types/cpp/VarUIntBitmaskTest.cpp index b435d0c7a..ef5fe81dc 100644 --- a/test/language/bitmask_types/cpp/VarUIntBitmaskTest.cpp +++ b/test/language/bitmask_types/cpp/VarUIntBitmaskTest.cpp @@ -1,13 +1,11 @@ -#include #include +#include +#include "bitmask_types/varuint_bitmask/Permission.h" #include "gtest/gtest.h" - #include "zserio/CppRuntimeException.h" #include "zserio/SerializeUtil.h" -#include "bitmask_types/varuint_bitmask/Permission.h" - namespace bitmask_types { namespace varuint_bitmask diff --git a/test/language/builtin_types/cpp/AllBuiltInTypesTest.cpp b/test/language/builtin_types/cpp/AllBuiltInTypesTest.cpp index d41d0b9e3..67a04c25b 100644 --- a/test/language/builtin_types/cpp/AllBuiltInTypesTest.cpp +++ b/test/language/builtin_types/cpp/AllBuiltInTypesTest.cpp @@ -1,10 +1,8 @@ #include -#include "gtest/gtest.h" - #include "builtin_types/all_builtin_types/AllBuiltInTypes.h" #include "builtin_types/all_builtin_types/ExternalStructure.h" - +#include "gtest/gtest.h" #include "zserio/RebindAlloc.h" #include "zserio/SerializeUtil.h" @@ -33,7 +31,7 @@ class AllBuiltInTypesTest : public ::testing::Test return bitBuffer; } - AllBuiltInTypes m_allBuiltInTypes; + AllBuiltInTypes m_allBuiltInTypes; static const std::string BLOB_NAME; }; diff --git a/test/language/builtin_types/cpp/BitFieldFunctionLengthTest.cpp b/test/language/builtin_types/cpp/BitFieldFunctionLengthTest.cpp index 4ac8e3341..a27dfb36e 100644 --- a/test/language/builtin_types/cpp/BitFieldFunctionLengthTest.cpp +++ b/test/language/builtin_types/cpp/BitFieldFunctionLengthTest.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "builtin_types/bitfield_function_length/Container.h" - +#include "gtest/gtest.h" #include "zserio/SerializeUtil.h" #include "zserio/Vector.h" @@ -19,14 +17,13 @@ class BitFieldFunctionLengthTest : public ::testing::Test protected: Container createContainer() { - return Container( - 0xDEAD, // id - vector_type({0xDEAD1, 0xDEAD2, 0xDEAD3, 0xDEAD4, - 0xDEAD5, 0xDEAD6, 0xDEAD7}), // array[7] + return Container(0xDEAD, // id + vector_type( + {0xDEAD1, 0xDEAD2, 0xDEAD3, 0xDEAD4, 0xDEAD5, 0xDEAD6, 0xDEAD7}), // array[7] 0x3F, // bitField3 (7 bits) 0x1FFF, // bitField4 (0xDEAD & 0x0F = 0xD = 13 bits) 0x1FFF // bitField5 (0xDEAD % 32 = 13 bits) - ); + ); } static const std::string BLOB_NAME; diff --git a/test/language/builtin_types/cpp/BitFieldUInt64LengthTest.cpp b/test/language/builtin_types/cpp/BitFieldUInt64LengthTest.cpp index 84e7db27e..05712a3c2 100644 --- a/test/language/builtin_types/cpp/BitFieldUInt64LengthTest.cpp +++ b/test/language/builtin_types/cpp/BitFieldUInt64LengthTest.cpp @@ -1,9 +1,7 @@ #include -#include "gtest/gtest.h" - #include "builtin_types/bitfield_uint64_length/Container.h" - +#include "gtest/gtest.h" #include "zserio/SerializeUtil.h" namespace builtin_types diff --git a/test/language/choice_types/cpp/BitmaskParamChoiceTest.cpp b/test/language/choice_types/cpp/BitmaskParamChoiceTest.cpp index c18e992e6..d9f1feff1 100644 --- a/test/language/choice_types/cpp/BitmaskParamChoiceTest.cpp +++ b/test/language/choice_types/cpp/BitmaskParamChoiceTest.cpp @@ -1,10 +1,8 @@ -#include "gtest/gtest.h" - -#include "choice_types/bitmask_param_choice/Selector.h" #include "choice_types/bitmask_param_choice/BitmaskParamChoice.h" - -#include "zserio/BitStreamWriter.h" +#include "choice_types/bitmask_param_choice/Selector.h" +#include "gtest/gtest.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace choice_types { @@ -124,8 +122,8 @@ TEST_F(BitmaskParamChoiceTest, propagateAllocatorCopyConstructor) const uint8_t value = 99; bitmaskParamChoice.setBlack(value); - const BitmaskParamChoice bitmaskParamChoiceCopy(zserio::PropagateAllocator, bitmaskParamChoice, - BitmaskParamChoice::allocator_type()); + const BitmaskParamChoice bitmaskParamChoiceCopy( + zserio::PropagateAllocator, bitmaskParamChoice, BitmaskParamChoice::allocator_type()); ASSERT_EQ(selector, bitmaskParamChoiceCopy.getSelector()); ASSERT_EQ(value, bitmaskParamChoiceCopy.getBlack()); } diff --git a/test/language/choice_types/cpp/BoolParamChoiceTest.cpp b/test/language/choice_types/cpp/BoolParamChoiceTest.cpp index 5247809de..28bc40f5b 100644 --- a/test/language/choice_types/cpp/BoolParamChoiceTest.cpp +++ b/test/language/choice_types/cpp/BoolParamChoiceTest.cpp @@ -1,9 +1,7 @@ -#include "gtest/gtest.h" - #include "choice_types/bool_param_choice/BoolParamChoice.h" - -#include "zserio/BitStreamWriter.h" +#include "gtest/gtest.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace choice_types { @@ -113,8 +111,8 @@ TEST_F(BoolParamChoiceTest, propagateAllocatorCopyConstructor) const int8_t value = 99; boolParamChoice.setBlack(value); - BoolParamChoice boolParamChoiceCopy(zserio::PropagateAllocator, boolParamChoice, - BoolParamChoice::allocator_type()); + BoolParamChoice boolParamChoiceCopy( + zserio::PropagateAllocator, boolParamChoice, BoolParamChoice::allocator_type()); ASSERT_EQ(selector, boolParamChoiceCopy.getSelector()); ASSERT_EQ(value, boolParamChoiceCopy.getBlack()); } diff --git a/test/language/choice_types/cpp/ChoiceCompatibilityCheckTest.cpp b/test/language/choice_types/cpp/ChoiceCompatibilityCheckTest.cpp index 1d48cc01f..7c06191af 100644 --- a/test/language/choice_types/cpp/ChoiceCompatibilityCheckTest.cpp +++ b/test/language/choice_types/cpp/ChoiceCompatibilityCheckTest.cpp @@ -1,8 +1,6 @@ -#include "gtest/gtest.h" - #include "choice_types/choice_compatibility_check/ChoiceCompatibilityCheckVersion1.h" #include "choice_types/choice_compatibility_check/ChoiceCompatibilityCheckVersion2.h" - +#include "gtest/gtest.h" #include "zserio/SerializeUtil.h" namespace choice_types @@ -16,25 +14,25 @@ using vector_type = zserio::vector; namespace { - template - struct VersionTraits - {}; +template +struct VersionTraits +{}; - template <> - struct VersionTraits - { - using Holder = HolderVersion1; - using Choice = ChoiceVersion1; - using Enum = EnumVersion1; - }; +template <> +struct VersionTraits +{ + using Holder = HolderVersion1; + using Choice = ChoiceVersion1; + using Enum = EnumVersion1; +}; - template <> - struct VersionTraits - { - using Holder = HolderVersion2; - using Choice = ChoiceVersion2; - using Enum = EnumVersion2; - }; +template <> +struct VersionTraits +{ + using Holder = HolderVersion2; + using Choice = ChoiceVersion2; + using Enum = EnumVersion2; +}; } // namespace class ChoiceCompatibilityCheckTest : public ::testing::Test @@ -88,12 +86,8 @@ class ChoiceCompatibilityCheckTest : public ::testing::Test { using Enum = typename VersionTraits::Enum; - return vector_type{ - createHolder(Enum::COORD_XY, 0), - createHolder(Enum::TEXT, 1), - createHolder(Enum::COORD_XY, 2), - createHolder(Enum::TEXT, 3) - }; + return vector_type{createHolder(Enum::COORD_XY, 0), createHolder(Enum::TEXT, 1), + createHolder(Enum::COORD_XY, 2), createHolder(Enum::TEXT, 3)}; } HolderVersion2 createHolderCoordXYZ(uint32_t index) @@ -130,8 +124,8 @@ TEST_F(ChoiceCompatibilityCheckTest, writeVersion1ReadVersion1) ChoiceCompatibilityCheckVersion1 choiceCompatibilityCheckVersion1; fill(choiceCompatibilityCheckVersion1, createArrayVersion1()); - auto readChoiceCompatibilityCheckVersion1 = writeRead( - choiceCompatibilityCheckVersion1); + auto readChoiceCompatibilityCheckVersion1 = + writeRead(choiceCompatibilityCheckVersion1); ASSERT_EQ(choiceCompatibilityCheckVersion1, readChoiceCompatibilityCheckVersion1); } @@ -140,8 +134,8 @@ TEST_F(ChoiceCompatibilityCheckTest, writeVersion1ReadVersion2) ChoiceCompatibilityCheckVersion1 choiceCompatibilityCheckVersion1; fill(choiceCompatibilityCheckVersion1, createArrayVersion1()); - auto readChoiceCompatibilityCheckVersion2 = writeRead( - choiceCompatibilityCheckVersion1); + auto readChoiceCompatibilityCheckVersion2 = + writeRead(choiceCompatibilityCheckVersion1); const auto expectedArrayVersion2 = createArrayVersion1(); ASSERT_EQ(expectedArrayVersion2, readChoiceCompatibilityCheckVersion2.getArray()); ASSERT_EQ(expectedArrayVersion2, readChoiceCompatibilityCheckVersion2.getPackedArray()); @@ -152,8 +146,8 @@ TEST_F(ChoiceCompatibilityCheckTest, writeVersion2ReadVersion1) ChoiceCompatibilityCheckVersion2 choiceCompatibilityCheckVersion2; fill(choiceCompatibilityCheckVersion2, createArrayVersion1()); - auto readChoiceCompatibilityCheckVersion1 = writeRead( - choiceCompatibilityCheckVersion2); + auto readChoiceCompatibilityCheckVersion1 = + writeRead(choiceCompatibilityCheckVersion2); const auto expectedArrayVersion1 = createArrayVersion1(); ASSERT_EQ(expectedArrayVersion1, readChoiceCompatibilityCheckVersion1.getArray()); ASSERT_EQ(expectedArrayVersion1, readChoiceCompatibilityCheckVersion1.getPackedArray()); @@ -164,8 +158,8 @@ TEST_F(ChoiceCompatibilityCheckTest, writeVersion2ReadVersion2) ChoiceCompatibilityCheckVersion2 choiceCompatibilityCheckVersion2; fill(choiceCompatibilityCheckVersion2, createArrayVersion2()); - auto readChoiceCompatibilityCheckVersion2 = writeRead( - choiceCompatibilityCheckVersion2); + auto readChoiceCompatibilityCheckVersion2 = + writeRead(choiceCompatibilityCheckVersion2); ASSERT_EQ(choiceCompatibilityCheckVersion2, readChoiceCompatibilityCheckVersion2); } diff --git a/test/language/choice_types/cpp/ChoiceWithArrayTest.cpp b/test/language/choice_types/cpp/ChoiceWithArrayTest.cpp index c86031ad0..880890265 100644 --- a/test/language/choice_types/cpp/ChoiceWithArrayTest.cpp +++ b/test/language/choice_types/cpp/ChoiceWithArrayTest.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "choice_types/choice_with_array/TestChoice.h" - +#include "gtest/gtest.h" #include "zserio/RebindAlloc.h" #include "zserio/SerializeUtil.h" @@ -19,10 +17,10 @@ using vector_type = zserio::vector; TEST(ChoiceWithArrayTest, setters) { TestChoice choice8; - choice8.setArray8(vector_type{ Data8{1}, Data8{2} , Data8{3} }); + choice8.setArray8(vector_type{Data8{1}, Data8{2}, Data8{3}}); choice8.initialize(8); TestChoice choice16; - choice16.setArray16(vector_type{ -1, 1 }); + choice16.setArray16(vector_type{-1, 1}); choice16.initialize(16); ASSERT_EQ(3, choice8.getArray8().size()); @@ -30,7 +28,7 @@ TEST(ChoiceWithArrayTest, setters) ASSERT_THROW(choice8.getArray16(), zserio::CppRuntimeException); ASSERT_THROW(choice16.getArray8(), zserio::CppRuntimeException); - vector_type data8 = { Data8{1}, Data8{2}, Data8{3} }; + vector_type data8 = {Data8{1}, Data8{2}, Data8{3}}; const void* dataPtr = data8.data(); TestChoice choiceData8Copied; choiceData8Copied.setArray8(data8); @@ -45,7 +43,7 @@ TEST(ChoiceWithArrayTest, setters) TEST(ChoiceWithArrayTest, moveConstructor) { TestChoice choice8; - choice8.setArray8(vector_type{ Data8{1}, Data8{2} , Data8{3} }); + choice8.setArray8(vector_type{Data8{1}, Data8{2}, Data8{3}}); choice8.initialize(8); const void* dataPtr = choice8.getArray8().data(); TestChoice choice8Moved(std::move(choice8)); @@ -55,7 +53,7 @@ TEST(ChoiceWithArrayTest, moveConstructor) TEST(ChoiceWithArrayTest, moveAssignmentOperator) { TestChoice choice8; - choice8.setArray8(vector_type{ Data8{1}, Data8{2} , Data8{3} }); + choice8.setArray8(vector_type{Data8{1}, Data8{2}, Data8{3}}); choice8.initialize(8); const void* dataPtr = choice8.getArray8().data(); TestChoice choice8Moved; diff --git a/test/language/choice_types/cpp/DefaultEmptyChoiceTest.cpp b/test/language/choice_types/cpp/DefaultEmptyChoiceTest.cpp index e70ad149d..26ffb5d5a 100644 --- a/test/language/choice_types/cpp/DefaultEmptyChoiceTest.cpp +++ b/test/language/choice_types/cpp/DefaultEmptyChoiceTest.cpp @@ -1,9 +1,7 @@ +#include "choice_types/default_empty_choice/DefaultEmptyChoice.h" #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" - -#include "choice_types/default_empty_choice/DefaultEmptyChoice.h" +#include "zserio/BitStreamWriter.h" namespace choice_types { @@ -93,13 +91,13 @@ TEST_F(DefaultEmptyChoiceTest, write) DefaultEmptyChoice readDefaultEmptyChoiceB(readerB, tagB); ASSERT_EQ(valueB, readDefaultEmptyChoiceB.getB()); - const uint8_t tagDefault= DEFAULT_SELECTOR; + const uint8_t tagDefault = DEFAULT_SELECTOR; defaultEmptyChoice.initialize(tagDefault); zserio::BitStreamWriter writerDefault(bitBuffer); defaultEmptyChoice.write(writerDefault); - zserio::BitStreamReader readerDefault(writerDefault.getWriteBuffer(), - writerDefault.getBitPosition(), zserio::BitsTag()); + zserio::BitStreamReader readerDefault( + writerDefault.getWriteBuffer(), writerDefault.getBitPosition(), zserio::BitsTag()); DefaultEmptyChoice readDefaultEmptyChoiceDefault(readerDefault, tagDefault); ASSERT_EQ(tagDefault, readDefaultEmptyChoiceDefault.getTag()); } diff --git a/test/language/choice_types/cpp/EmptyChoiceTest.cpp b/test/language/choice_types/cpp/EmptyChoiceTest.cpp index f4cfc2edd..09965c543 100644 --- a/test/language/choice_types/cpp/EmptyChoiceTest.cpp +++ b/test/language/choice_types/cpp/EmptyChoiceTest.cpp @@ -1,9 +1,7 @@ +#include "choice_types/empty_choice/EmptyChoice.h" #include "gtest/gtest.h" - -#include "zserio/SerializeUtil.h" #include "zserio/CppRuntimeException.h" - -#include "choice_types/empty_choice/EmptyChoice.h" +#include "zserio/SerializeUtil.h" namespace choice_types { diff --git a/test/language/choice_types/cpp/EmptyChoiceWithCaseTest.cpp b/test/language/choice_types/cpp/EmptyChoiceWithCaseTest.cpp index 14c120e60..60eb4c5ba 100644 --- a/test/language/choice_types/cpp/EmptyChoiceWithCaseTest.cpp +++ b/test/language/choice_types/cpp/EmptyChoiceWithCaseTest.cpp @@ -1,11 +1,9 @@ +#include "choice_types/empty_choice_with_case/EmptyChoiceWithCase.h" #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" #include "zserio/CppRuntimeException.h" -#include "choice_types/empty_choice_with_case/EmptyChoiceWithCase.h" - namespace choice_types { namespace empty_choice_with_case @@ -87,8 +85,8 @@ TEST(EmptyChoiceWithCaseTest, propagateAllocatorCopyConstructor) EmptyChoiceWithCase emptyChoiceWithCase; emptyChoiceWithCase.initialize(selector); - const EmptyChoiceWithCase emptyChoiceWithCaseCopy(zserio::PropagateAllocator, emptyChoiceWithCase, - EmptyChoiceWithCase::allocator_type()); + const EmptyChoiceWithCase emptyChoiceWithCaseCopy( + zserio::PropagateAllocator, emptyChoiceWithCase, EmptyChoiceWithCase::allocator_type()); ASSERT_EQ(selector, emptyChoiceWithCaseCopy.getSelector()); ASSERT_EQ(0, emptyChoiceWithCaseCopy.bitSizeOf()); } diff --git a/test/language/choice_types/cpp/EmptyChoiceWithDefaultTest.cpp b/test/language/choice_types/cpp/EmptyChoiceWithDefaultTest.cpp index 7bb2c90ed..2030ffe66 100644 --- a/test/language/choice_types/cpp/EmptyChoiceWithDefaultTest.cpp +++ b/test/language/choice_types/cpp/EmptyChoiceWithDefaultTest.cpp @@ -1,11 +1,9 @@ +#include "choice_types/empty_choice_with_default/EmptyChoiceWithDefault.h" #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" #include "zserio/CppRuntimeException.h" -#include "choice_types/empty_choice_with_default/EmptyChoiceWithDefault.h" - namespace choice_types { namespace empty_choice_with_default @@ -87,8 +85,8 @@ TEST(EmptyChoiceWithDefaultTest, propagateAllocatorCopyConstructor) EmptyChoiceWithDefault emptyChoiceWithDefault; emptyChoiceWithDefault.initialize(selector); - const EmptyChoiceWithDefault emptyChoiceWithDefaultCopy(zserio::PropagateAllocator, emptyChoiceWithDefault, - EmptyChoiceWithDefault::allocator_type()); + const EmptyChoiceWithDefault emptyChoiceWithDefaultCopy( + zserio::PropagateAllocator, emptyChoiceWithDefault, EmptyChoiceWithDefault::allocator_type()); ASSERT_EQ(selector, emptyChoiceWithDefaultCopy.getSelector()); ASSERT_EQ(0, emptyChoiceWithDefaultCopy.bitSizeOf()); } diff --git a/test/language/choice_types/cpp/EnumParamChoiceTest.cpp b/test/language/choice_types/cpp/EnumParamChoiceTest.cpp index 57657aa0b..6e2c7e793 100644 --- a/test/language/choice_types/cpp/EnumParamChoiceTest.cpp +++ b/test/language/choice_types/cpp/EnumParamChoiceTest.cpp @@ -1,10 +1,8 @@ -#include "gtest/gtest.h" - -#include "choice_types/enum_param_choice/Selector.h" #include "choice_types/enum_param_choice/EnumParamChoice.h" - -#include "zserio/BitStreamWriter.h" +#include "choice_types/enum_param_choice/Selector.h" +#include "gtest/gtest.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace choice_types { @@ -127,8 +125,8 @@ TEST_F(EnumParamChoiceTest, propagateAllocatorCopyConstructor) const int8_t value = 99; enumParamChoice.setBlack(value); - const EnumParamChoice enumParamChoiceCopy(zserio::PropagateAllocator, enumParamChoice, - EnumParamChoice::allocator_type()); + const EnumParamChoice enumParamChoiceCopy( + zserio::PropagateAllocator, enumParamChoice, EnumParamChoice::allocator_type()); ASSERT_EQ(selector, enumParamChoiceCopy.getSelector()); ASSERT_EQ(value, enumParamChoiceCopy.getBlack()); } diff --git a/test/language/choice_types/cpp/EnumWithRemovedItemParamChoiceTest.cpp b/test/language/choice_types/cpp/EnumWithRemovedItemParamChoiceTest.cpp index 0c61af737..24e047cec 100644 --- a/test/language/choice_types/cpp/EnumWithRemovedItemParamChoiceTest.cpp +++ b/test/language/choice_types/cpp/EnumWithRemovedItemParamChoiceTest.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "choice_types/enum_with_removed_item_param_choice/EnumWithRemovedItemParamChoice.h" - +#include "gtest/gtest.h" #include "zserio/SerializeUtil.h" namespace choice_types diff --git a/test/language/choice_types/cpp/ExpressionSelectorChoiceTest.cpp b/test/language/choice_types/cpp/ExpressionSelectorChoiceTest.cpp index a4027077b..d2cc971de 100644 --- a/test/language/choice_types/cpp/ExpressionSelectorChoiceTest.cpp +++ b/test/language/choice_types/cpp/ExpressionSelectorChoiceTest.cpp @@ -1,6 +1,5 @@ -#include "gtest/gtest.h" - #include "choice_types/expression_selector_choice/ExpressionSelectorChoice.h" +#include "gtest/gtest.h" namespace choice_types { diff --git a/test/language/choice_types/cpp/FullBitmaskParamChoiceTest.cpp b/test/language/choice_types/cpp/FullBitmaskParamChoiceTest.cpp index 5aebe7f64..30df25513 100644 --- a/test/language/choice_types/cpp/FullBitmaskParamChoiceTest.cpp +++ b/test/language/choice_types/cpp/FullBitmaskParamChoiceTest.cpp @@ -1,10 +1,8 @@ -#include "gtest/gtest.h" - -#include "choice_types/full_bitmask_param_choice/Selector.h" #include "choice_types/full_bitmask_param_choice/FullBitmaskParamChoice.h" - -#include "zserio/BitStreamWriter.h" +#include "choice_types/full_bitmask_param_choice/Selector.h" +#include "gtest/gtest.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace choice_types { @@ -14,8 +12,8 @@ namespace full_bitmask_param_choice class FullBitmaskParamChoiceTest : public ::testing::Test { protected: - void writeFullBitmaskParamChoiceToByteArray(zserio::BitStreamWriter& writer, - Selector selector, uint16_t value) + void writeFullBitmaskParamChoiceToByteArray( + zserio::BitStreamWriter& writer, Selector selector, uint16_t value) { switch (selector.getValue()) { @@ -126,8 +124,8 @@ TEST_F(FullBitmaskParamChoiceTest, propagateAllocatorCopyConstructor) const uint8_t value = 99; fullBitmaskParamChoice.setBlack(value); - const FullBitmaskParamChoice fullBitmaskParamChoiceCopy(zserio::PropagateAllocator, fullBitmaskParamChoice, - FullBitmaskParamChoice::allocator_type()); + const FullBitmaskParamChoice fullBitmaskParamChoiceCopy( + zserio::PropagateAllocator, fullBitmaskParamChoice, FullBitmaskParamChoice::allocator_type()); ASSERT_EQ(selector, fullBitmaskParamChoiceCopy.getSelector()); ASSERT_EQ(value, fullBitmaskParamChoiceCopy.getBlack()); } diff --git a/test/language/choice_types/cpp/FullEnumParamChoiceTest.cpp b/test/language/choice_types/cpp/FullEnumParamChoiceTest.cpp index 23718d246..9ed7b16cf 100644 --- a/test/language/choice_types/cpp/FullEnumParamChoiceTest.cpp +++ b/test/language/choice_types/cpp/FullEnumParamChoiceTest.cpp @@ -1,10 +1,8 @@ -#include "gtest/gtest.h" - -#include "choice_types/full_enum_param_choice/Selector.h" #include "choice_types/full_enum_param_choice/FullEnumParamChoice.h" - -#include "zserio/BitStreamWriter.h" +#include "choice_types/full_enum_param_choice/Selector.h" +#include "gtest/gtest.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace choice_types { @@ -127,8 +125,8 @@ TEST_F(FullEnumParamChoiceTest, propagateAllocatorCopyConstructor) const int8_t value = 99; fullEnumParamChoice.setBlack(value); - const FullEnumParamChoice fullEnumParamChoiceCopy(zserio::PropagateAllocator, fullEnumParamChoice, - FullEnumParamChoice::allocator_type()); + const FullEnumParamChoice fullEnumParamChoiceCopy( + zserio::PropagateAllocator, fullEnumParamChoice, FullEnumParamChoice::allocator_type()); ASSERT_EQ(selector, fullEnumParamChoiceCopy.getSelector()); ASSERT_EQ(value, fullEnumParamChoiceCopy.getBlack()); } diff --git a/test/language/choice_types/cpp/FunctionReturningLiteralSelectorChoiceTest.cpp b/test/language/choice_types/cpp/FunctionReturningLiteralSelectorChoiceTest.cpp index ad3d8cdbc..9adfd6cf1 100644 --- a/test/language/choice_types/cpp/FunctionReturningLiteralSelectorChoiceTest.cpp +++ b/test/language/choice_types/cpp/FunctionReturningLiteralSelectorChoiceTest.cpp @@ -1,6 +1,5 @@ -#include "gtest/gtest.h" - #include "choice_types/function_returning_literal_selector_choice/TestChoice.h" +#include "gtest/gtest.h" // just testChoice setters and getters namespace choice_types diff --git a/test/language/choice_types/cpp/FunctionSelectorChoiceTest.cpp b/test/language/choice_types/cpp/FunctionSelectorChoiceTest.cpp index 25c470edb..2207cd597 100644 --- a/test/language/choice_types/cpp/FunctionSelectorChoiceTest.cpp +++ b/test/language/choice_types/cpp/FunctionSelectorChoiceTest.cpp @@ -1,6 +1,5 @@ -#include "gtest/gtest.h" - #include "choice_types/function_selector_choice/TestChoice.h" +#include "gtest/gtest.h" // just testChoice setters and getters namespace choice_types diff --git a/test/language/choice_types/cpp/UInt16ParamChoiceTest.cpp b/test/language/choice_types/cpp/UInt16ParamChoiceTest.cpp index 64ce7fc23..aa49254ca 100644 --- a/test/language/choice_types/cpp/UInt16ParamChoiceTest.cpp +++ b/test/language/choice_types/cpp/UInt16ParamChoiceTest.cpp @@ -1,9 +1,7 @@ +#include "choice_types/uint16_param_choice/UInt16ParamChoice.h" #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" - -#include "choice_types/uint16_param_choice/UInt16ParamChoice.h" +#include "zserio/BitStreamWriter.h" namespace choice_types { @@ -148,8 +146,8 @@ TEST_F(UInt16ParamChoiceTest, propagateAllocatorCopyConstructor) const VariantA value = 99; uint16ParamChoice.setA(value); - const UInt16ParamChoice uint16ParamChoiceCopy(zserio::PropagateAllocator, uint16ParamChoice, - UInt16ParamChoice::allocator_type()); + const UInt16ParamChoice uint16ParamChoiceCopy( + zserio::PropagateAllocator, uint16ParamChoice, UInt16ParamChoice::allocator_type()); ASSERT_EQ(selector, uint16ParamChoiceCopy.getSelector()); ASSERT_EQ(value, uint16ParamChoiceCopy.getA()); } @@ -356,7 +354,7 @@ TEST_F(UInt16ParamChoiceTest, write) UInt16ParamChoice readUInt16ParamChoiceB(readerB, selectorB); ASSERT_EQ(valueB, readUInt16ParamChoiceB.getB()); - const uint16_t selectorC= VARIANT_C_SELECTOR; + const uint16_t selectorC = VARIANT_C_SELECTOR; uint16ParamChoice.initialize(selectorC); const VariantC valueC = 65535; uint16ParamChoice.setC(valueC); diff --git a/test/language/choice_types/cpp/UInt32ParamChoiceTest.cpp b/test/language/choice_types/cpp/UInt32ParamChoiceTest.cpp index 6ac9abbdc..e782fa854 100644 --- a/test/language/choice_types/cpp/UInt32ParamChoiceTest.cpp +++ b/test/language/choice_types/cpp/UInt32ParamChoiceTest.cpp @@ -1,9 +1,7 @@ +#include "choice_types/uint32_param_choice/UInt32ParamChoice.h" #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" - -#include "choice_types/uint32_param_choice/UInt32ParamChoice.h" +#include "zserio/BitStreamWriter.h" namespace choice_types { @@ -148,8 +146,8 @@ TEST_F(UInt32ParamChoiceTest, propagateAllocatorCopyConstructor) const VariantA value = 99; uint32ParamChoice.setA(value); - const UInt32ParamChoice uint32ParamChoiceCopy(zserio::PropagateAllocator, uint32ParamChoice, - UInt32ParamChoice::allocator_type()); + const UInt32ParamChoice uint32ParamChoiceCopy( + zserio::PropagateAllocator, uint32ParamChoice, UInt32ParamChoice::allocator_type()); ASSERT_EQ(selector, uint32ParamChoiceCopy.getSelector()); ASSERT_EQ(value, uint32ParamChoiceCopy.getA()); } diff --git a/test/language/choice_types/cpp/UInt64ParamChoiceTest.cpp b/test/language/choice_types/cpp/UInt64ParamChoiceTest.cpp index 7463d47db..f9782d047 100644 --- a/test/language/choice_types/cpp/UInt64ParamChoiceTest.cpp +++ b/test/language/choice_types/cpp/UInt64ParamChoiceTest.cpp @@ -1,9 +1,7 @@ +#include "choice_types/uint64_param_choice/UInt64ParamChoice.h" #include "gtest/gtest.h" - #include "zserio/SerializeUtil.h" -#include "choice_types/uint64_param_choice/UInt64ParamChoice.h" - namespace choice_types { namespace uint64_param_choice @@ -12,8 +10,7 @@ namespace uint64_param_choice class UInt64ParamChoiceTest : public ::testing::Test { protected: - void writeUInt64ParamChoiceToByteArray(zserio::BitStreamWriter& writer, uint64_t selector, - int32_t value) + void writeUInt64ParamChoiceToByteArray(zserio::BitStreamWriter& writer, uint64_t selector, int32_t value) { switch (selector) { @@ -135,8 +132,8 @@ TEST_F(UInt64ParamChoiceTest, propagateAllocatorCopyConstructor) const int8_t value = 99; uint64ParamChoice.setA(value); - const UInt64ParamChoice uint64ParamChoiceCopy(zserio::PropagateAllocator, uint64ParamChoice, - UInt64ParamChoice::allocator_type()); + const UInt64ParamChoice uint64ParamChoiceCopy( + zserio::PropagateAllocator, uint64ParamChoice, UInt64ParamChoice::allocator_type()); ASSERT_EQ(selector, uint64ParamChoiceCopy.getSelector()); ASSERT_EQ(value, uint64ParamChoiceCopy.getA()); } diff --git a/test/language/constants/cpp/ConstantsTest.cpp b/test/language/constants/cpp/ConstantsTest.cpp index 23a26dd9d..af5320f29 100644 --- a/test/language/constants/cpp/ConstantsTest.cpp +++ b/test/language/constants/cpp/ConstantsTest.cpp @@ -1,7 +1,5 @@ #include -#include "gtest/gtest.h" - #include "constants/BITFIELD8_MAX_CONSTANT.h" #include "constants/BITFIELD8_MIN_CONSTANT.h" #include "constants/BOOL_FALSE_CONSTANT.h" @@ -27,11 +25,12 @@ #include "constants/READ_PERMISSION.h" #include "constants/READ_PERMISSION_VALUE.h" #include "constants/STRING_CONSTANT.h" -#include "constants/StringPascalCaseConstant.h" #include "constants/SUBTYPE_BLUE_COLOR_CONSTANT.h" #include "constants/SUBTYPE_INT25_CONSTANT.h" #include "constants/SUBTYPE_READ_PERMISSION.h" #include "constants/SUBTYPE_STRING_CONSTANT.h" +#include "constants/StringPascalCaseConstant.h" +#include "constants/StringSubtype.h" #include "constants/UINT16_MAX_CONSTANT.h" #include "constants/UINT16_MIN_CONSTANT.h" #include "constants/UINT32_FULL_MASK.h" @@ -52,6 +51,8 @@ #include "constants/VARINT64_MIN_CONSTANT.h" #include "constants/VARINT_MAX_CONSTANT.h" #include "constants/VARINT_MIN_CONSTANT.h" +#include "constants/VARSIZE_MAX_CONSTANT.h" +#include "constants/VARSIZE_MIN_CONSTANT.h" #include "constants/VARUINT16_MAX_CONSTANT.h" #include "constants/VARUINT16_MIN_CONSTANT.h" #include "constants/VARUINT32_MAX_CONSTANT.h" @@ -60,9 +61,7 @@ #include "constants/VARUINT64_MIN_CONSTANT.h" #include "constants/VARUINT_MAX_CONSTANT.h" #include "constants/VARUINT_MIN_CONSTANT.h" -#include "constants/VARSIZE_MAX_CONSTANT.h" -#include "constants/VARSIZE_MIN_CONSTANT.h" -#include "constants/StringSubtype.h" +#include "gtest/gtest.h" using namespace zserio::literals; diff --git a/test/language/constraints/cpp/ArrayLengthofConstraintTest.cpp b/test/language/constraints/cpp/ArrayLengthofConstraintTest.cpp index 4c9083c3b..a2717d4fe 100644 --- a/test/language/constraints/cpp/ArrayLengthofConstraintTest.cpp +++ b/test/language/constraints/cpp/ArrayLengthofConstraintTest.cpp @@ -1,12 +1,10 @@ +#include "constraints/array_lengthof_constraint/ArrayLengthofConstraint.h" #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" #include "zserio/CppRuntimeException.h" #include "zserio/RebindAlloc.h" -#include "constraints/array_lengthof_constraint/ArrayLengthofConstraint.h" - namespace constraints { namespace array_lengthof_constraint diff --git a/test/language/constraints/cpp/ChoiceConstraintsTest.cpp b/test/language/constraints/cpp/ChoiceConstraintsTest.cpp index 8dfa6e606..916bb480c 100644 --- a/test/language/constraints/cpp/ChoiceConstraintsTest.cpp +++ b/test/language/constraints/cpp/ChoiceConstraintsTest.cpp @@ -1,11 +1,9 @@ +#include "constraints/choice_constraints/ChoiceConstraints.h" #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" #include "zserio/CppRuntimeException.h" -#include "constraints/choice_constraints/ChoiceConstraints.h" - namespace constraints { namespace choice_constraints @@ -14,8 +12,8 @@ namespace choice_constraints class ChoiceConstraintsTest : public ::testing::Test { protected: - void writeChoiceConstraintsToByteArray(zserio::BitStreamWriter& writer, bool selector, uint8_t value8, - uint16_t value16) + void writeChoiceConstraintsToByteArray( + zserio::BitStreamWriter& writer, bool selector, uint8_t value8, uint16_t value16) { if (selector) writer.writeBits(value8, 8); diff --git a/test/language/constraints/cpp/LiteralConstraintTest.cpp b/test/language/constraints/cpp/LiteralConstraintTest.cpp index 01c10683f..bb7867bfa 100644 --- a/test/language/constraints/cpp/LiteralConstraintTest.cpp +++ b/test/language/constraints/cpp/LiteralConstraintTest.cpp @@ -1,12 +1,10 @@ +#include "constraints/literal_constraint/LiteralConstraint.h" #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" #include "zserio/CppRuntimeException.h" #include "zserio/RebindAlloc.h" -#include "constraints/literal_constraint/LiteralConstraint.h" - namespace constraints { namespace literal_constraint diff --git a/test/language/constraints/cpp/StructureBitmaskConstraintsTest.cpp b/test/language/constraints/cpp/StructureBitmaskConstraintsTest.cpp index b211c0b99..b688e2462 100644 --- a/test/language/constraints/cpp/StructureBitmaskConstraintsTest.cpp +++ b/test/language/constraints/cpp/StructureBitmaskConstraintsTest.cpp @@ -1,12 +1,10 @@ +#include "constraints/structure_bitmask_constraints/Availability.h" +#include "constraints/structure_bitmask_constraints/StructureBitmaskConstraints.h" #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" #include "zserio/CppRuntimeException.h" -#include "constraints/structure_bitmask_constraints/StructureBitmaskConstraints.h" -#include "constraints/structure_bitmask_constraints/Availability.h" - namespace constraints { namespace structure_bitmask_constraints @@ -15,8 +13,8 @@ namespace structure_bitmask_constraints class StructureBitmaskConstraintsTest : public ::testing::Test { protected: - void writeStructureBitmaskConstraintsToByteArray(zserio::BitStreamWriter& writer, Availability mask, - uint8_t x, uint8_t y, uint8_t z) + void writeStructureBitmaskConstraintsToByteArray( + zserio::BitStreamWriter& writer, Availability mask, uint8_t x, uint8_t y, uint8_t z) { writer.writeBits(mask.getValue(), 3); writer.writeBits(x, 8); diff --git a/test/language/constraints/cpp/StructureConstraintsTest.cpp b/test/language/constraints/cpp/StructureConstraintsTest.cpp index 65787ebcd..63ca7b656 100644 --- a/test/language/constraints/cpp/StructureConstraintsTest.cpp +++ b/test/language/constraints/cpp/StructureConstraintsTest.cpp @@ -1,13 +1,11 @@ +#include "constraints/structure_constraints/BasicColor.h" +#include "constraints/structure_constraints/ExtendedColor.h" +#include "constraints/structure_constraints/StructureConstraints.h" #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" #include "zserio/CppRuntimeException.h" -#include "constraints/structure_constraints/StructureConstraints.h" -#include "constraints/structure_constraints/BasicColor.h" -#include "constraints/structure_constraints/ExtendedColor.h" - namespace constraints { namespace structure_constraints diff --git a/test/language/constraints/cpp/UnionConstraintsTest.cpp b/test/language/constraints/cpp/UnionConstraintsTest.cpp index 904967cba..5635f3261 100644 --- a/test/language/constraints/cpp/UnionConstraintsTest.cpp +++ b/test/language/constraints/cpp/UnionConstraintsTest.cpp @@ -1,11 +1,9 @@ +#include "constraints/union_constraints/UnionConstraints.h" #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" #include "zserio/CppRuntimeException.h" -#include "constraints/union_constraints/UnionConstraints.h" - namespace constraints { namespace union_constraints @@ -83,7 +81,6 @@ TEST_F(UnionConstraintsTest, writeCorrectConstraints) zserio::BitStreamWriter writer(bitBuffer); unionConstraints.write(writer); - zserio::BitStreamReader reader(writer.getWriteBuffer(), writer.getBitPosition(), zserio::BitsTag()); const UnionConstraints readUnionConstraints(reader); ASSERT_EQ(UnionConstraints::CHOICE_value16, readUnionConstraints.choiceTag()); diff --git a/test/language/default_values/cpp/StructureDefaultValuesTest.cpp b/test/language/default_values/cpp/StructureDefaultValuesTest.cpp index af1d09573..4a5e40cbd 100644 --- a/test/language/default_values/cpp/StructureDefaultValuesTest.cpp +++ b/test/language/default_values/cpp/StructureDefaultValuesTest.cpp @@ -1,12 +1,10 @@ +#include "default_values/structure_default_values/BasicColor.h" +#include "default_values/structure_default_values/Permission.h" +#include "default_values/structure_default_values/StructureDefaultValues.h" #include "gtest/gtest.h" - #include "zserio/BitStreamReader.h" #include "zserio/CppRuntimeException.h" -#include "default_values/structure_default_values/StructureDefaultValues.h" -#include "default_values/structure_default_values/BasicColor.h" -#include "default_values/structure_default_values/Permission.h" - namespace default_values { namespace structure_default_values diff --git a/test/language/enumeration_types/cpp/BitfieldConstEnumTest.cpp b/test/language/enumeration_types/cpp/BitfieldConstEnumTest.cpp index 237f43bfd..df528ed7f 100644 --- a/test/language/enumeration_types/cpp/BitfieldConstEnumTest.cpp +++ b/test/language/enumeration_types/cpp/BitfieldConstEnumTest.cpp @@ -1,14 +1,12 @@ #include +#include "enumeration_types/bitfield_const_enum/Color.h" #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" #include "zserio/CppRuntimeException.h" #include "zserio/HashCodeUtil.h" -#include "enumeration_types/bitfield_const_enum/Color.h" - namespace enumeration_types { namespace bitfield_const_enum diff --git a/test/language/enumeration_types/cpp/BitfieldEnumTest.cpp b/test/language/enumeration_types/cpp/BitfieldEnumTest.cpp index 3d114d92e..db706d212 100644 --- a/test/language/enumeration_types/cpp/BitfieldEnumTest.cpp +++ b/test/language/enumeration_types/cpp/BitfieldEnumTest.cpp @@ -1,11 +1,9 @@ #include +#include "enumeration_types/bitfield_enum/Color.h" #include "gtest/gtest.h" - -#include "zserio/SerializeUtil.h" #include "zserio/CppRuntimeException.h" - -#include "enumeration_types/bitfield_enum/Color.h" +#include "zserio/SerializeUtil.h" namespace enumeration_types { diff --git a/test/language/enumeration_types/cpp/DeprecatedEnumItemTest.cpp b/test/language/enumeration_types/cpp/DeprecatedEnumItemTest.cpp index d96d155b0..f52cc7a09 100644 --- a/test/language/enumeration_types/cpp/DeprecatedEnumItemTest.cpp +++ b/test/language/enumeration_types/cpp/DeprecatedEnumItemTest.cpp @@ -1,16 +1,13 @@ -#include "gtest/gtest.h" - #include -#include "enumeration_types/deprecated_enum_item/Traffic.h" #include "enumeration_types/deprecated_enum_item/AllocatorType.h" - +#include "enumeration_types/deprecated_enum_item/Traffic.h" +#include "gtest/gtest.h" +#include "test_utils/Assertions.h" #include "zserio/BitStreamReader.h" #include "zserio/BitStreamWriter.h" #include "zserio/CppRuntimeException.h" -#include "test_utils/Assertions.h" - using namespace zserio::literals; namespace enumeration_types @@ -112,8 +109,7 @@ TEST_F(DeprecatedEnumItemTest, bitSizeOf) TEST_F(DeprecatedEnumItemTest, initializeOffsets) { const size_t bitPosition = 1; - ASSERT_EQ(bitPosition + TRAFFIC_BIT_SIZE, - zserio::initializeOffsets(bitPosition, Traffic::HEAVY)); + ASSERT_EQ(bitPosition + TRAFFIC_BIT_SIZE, zserio::initializeOffsets(bitPosition, Traffic::HEAVY)); } TEST_F(DeprecatedEnumItemTest, read) diff --git a/test/language/enumeration_types/cpp/EnumDefinedByConstantTest.cpp b/test/language/enumeration_types/cpp/EnumDefinedByConstantTest.cpp index be33f928b..ace0e6707 100644 --- a/test/language/enumeration_types/cpp/EnumDefinedByConstantTest.cpp +++ b/test/language/enumeration_types/cpp/EnumDefinedByConstantTest.cpp @@ -1,7 +1,6 @@ -#include "gtest/gtest.h" - #include "enumeration_types/enum_defined_by_constant/Colors.h" #include "enumeration_types/enum_defined_by_constant/WHITE_COLOR.h" +#include "gtest/gtest.h" namespace enumeration_types { @@ -9,8 +8,7 @@ namespace enum_defined_by_constant { class EnumDefinedByConstant : public ::testing::Test -{ -}; +{}; TEST_F(EnumDefinedByConstant, lightColor) { diff --git a/test/language/enumeration_types/cpp/EnumUsedByEnumTest.cpp b/test/language/enumeration_types/cpp/EnumUsedByEnumTest.cpp index 7f8a4a1d3..082e3b4a2 100644 --- a/test/language/enumeration_types/cpp/EnumUsedByEnumTest.cpp +++ b/test/language/enumeration_types/cpp/EnumUsedByEnumTest.cpp @@ -1,8 +1,7 @@ -#include "gtest/gtest.h" - -#include "enumeration_types/enum_used_by_enum/LightColor.h" -#include "enumeration_types/enum_used_by_enum/DarkColor.h" #include "enumeration_types/enum_used_by_enum/Color.h" +#include "enumeration_types/enum_used_by_enum/DarkColor.h" +#include "enumeration_types/enum_used_by_enum/LightColor.h" +#include "gtest/gtest.h" namespace enumeration_types { @@ -23,15 +22,15 @@ class EnumUsedByEnumTest : public ::testing::Test static const uint8_t VALUE_DARK_PINK; }; -const uint8_t EnumUsedByEnumTest::VALUE_NONE = 0x00; -const uint8_t EnumUsedByEnumTest::VALUE_LIGHT_RED = 0x01; -const uint8_t EnumUsedByEnumTest::VALUE_LIGHT_GREEN = 0x02; -const uint8_t EnumUsedByEnumTest::VALUE_LIGHT_BLUE = 0x03; -const uint8_t EnumUsedByEnumTest::VALUE_LIGHT_PINK = 0x04; -const uint8_t EnumUsedByEnumTest::VALUE_DARK_RED = 0x11; -const uint8_t EnumUsedByEnumTest::VALUE_DARK_GREEN = 0x12; -const uint8_t EnumUsedByEnumTest::VALUE_DARK_BLUE = 0x13; -const uint8_t EnumUsedByEnumTest::VALUE_DARK_PINK = 0x14; +const uint8_t EnumUsedByEnumTest::VALUE_NONE = 0x00; +const uint8_t EnumUsedByEnumTest::VALUE_LIGHT_RED = 0x01; +const uint8_t EnumUsedByEnumTest::VALUE_LIGHT_GREEN = 0x02; +const uint8_t EnumUsedByEnumTest::VALUE_LIGHT_BLUE = 0x03; +const uint8_t EnumUsedByEnumTest::VALUE_LIGHT_PINK = 0x04; +const uint8_t EnumUsedByEnumTest::VALUE_DARK_RED = 0x11; +const uint8_t EnumUsedByEnumTest::VALUE_DARK_GREEN = 0x12; +const uint8_t EnumUsedByEnumTest::VALUE_DARK_BLUE = 0x13; +const uint8_t EnumUsedByEnumTest::VALUE_DARK_PINK = 0x14; TEST_F(EnumUsedByEnumTest, lightColor) { diff --git a/test/language/enumeration_types/cpp/MultipleRemovedEnumItemsTest.cpp b/test/language/enumeration_types/cpp/MultipleRemovedEnumItemsTest.cpp index 006584dac..4f3332e6f 100644 --- a/test/language/enumeration_types/cpp/MultipleRemovedEnumItemsTest.cpp +++ b/test/language/enumeration_types/cpp/MultipleRemovedEnumItemsTest.cpp @@ -1,12 +1,10 @@ +#include "enumeration_types/multiple_removed_enum_items/AllocatorType.h" +#include "enumeration_types/multiple_removed_enum_items/Traffic.h" #include "gtest/gtest.h" - #include "zserio/BitStreamReader.h" #include "zserio/BitStreamWriter.h" #include "zserio/CppRuntimeException.h" -#include "enumeration_types/multiple_removed_enum_items/AllocatorType.h" -#include "enumeration_types/multiple_removed_enum_items/Traffic.h" - using namespace zserio::literals; namespace enumeration_types @@ -19,7 +17,6 @@ using allocator_type = AllocatorType::allocator_type; class MultipleRemovedEnumItemsTest : public ::testing::Test { protected: - static constexpr uint8_t NONE_VALUE = 1; static constexpr uint8_t HEAVY_VALUE = 2; static constexpr uint8_t LIGHT_VALUE = 3; diff --git a/test/language/enumeration_types/cpp/RemovedEnumItemTest.cpp b/test/language/enumeration_types/cpp/RemovedEnumItemTest.cpp index 08e31bf8a..c1930ef3d 100644 --- a/test/language/enumeration_types/cpp/RemovedEnumItemTest.cpp +++ b/test/language/enumeration_types/cpp/RemovedEnumItemTest.cpp @@ -1,12 +1,10 @@ +#include "enumeration_types/removed_enum_item/AllocatorType.h" +#include "enumeration_types/removed_enum_item/Traffic.h" #include "gtest/gtest.h" - #include "zserio/BitStreamReader.h" #include "zserio/BitStreamWriter.h" #include "zserio/CppRuntimeException.h" -#include "enumeration_types/removed_enum_item/AllocatorType.h" -#include "enumeration_types/removed_enum_item/Traffic.h" - using namespace zserio::literals; namespace enumeration_types @@ -19,7 +17,6 @@ using allocator_type = AllocatorType::allocator_type; class RemovedEnumItemTest : public ::testing::Test { protected: - static constexpr uint8_t NONE_VALUE = 1; static constexpr uint8_t HEAVY_VALUE = 2; static constexpr uint8_t LIGHT_VALUE = 3; @@ -126,17 +123,19 @@ TEST_F(RemovedEnumItemTest, write) ASSERT_EQ(Traffic::LIGHT, zserio::read(reader)); ASSERT_EQ(Traffic::MID, zserio::read(reader)); - ASSERT_THROW({ - try - { - zserio::write(writer, Traffic::ZSERIO_REMOVED_HEAVY); - } - catch (const zserio::CppRuntimeException& e) - { - ASSERT_STREQ("Trying to write removed enumeration item 'ZSERIO_REMOVED_HEAVY'!", e.what()); - throw; - } - }, zserio::CppRuntimeException); + ASSERT_THROW( + { + try + { + zserio::write(writer, Traffic::ZSERIO_REMOVED_HEAVY); + } + catch (const zserio::CppRuntimeException& e) + { + ASSERT_STREQ("Trying to write removed enumeration item 'ZSERIO_REMOVED_HEAVY'!", e.what()); + throw; + } + }, + zserio::CppRuntimeException); } TEST_F(RemovedEnumItemTest, enumTypeInfo) diff --git a/test/language/enumeration_types/cpp/UInt64EnumTest.cpp b/test/language/enumeration_types/cpp/UInt64EnumTest.cpp index 930af8293..a2b507fe4 100644 --- a/test/language/enumeration_types/cpp/UInt64EnumTest.cpp +++ b/test/language/enumeration_types/cpp/UInt64EnumTest.cpp @@ -1,11 +1,9 @@ +#include "enumeration_types/uint64_enum/DarkColor.h" #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" #include "zserio/CppRuntimeException.h" -#include "enumeration_types/uint64_enum/DarkColor.h" - namespace enumeration_types { namespace uint64_enum @@ -93,8 +91,8 @@ TEST_F(UInt64EnumTest, bitSizeOf) TEST_F(UInt64EnumTest, initializeOffsets) { const size_t bitPosition = 1; - ASSERT_TRUE(zserio::initializeOffsets(bitPosition, DarkColor::noneColor) == - bitPosition + DARK_COLOR_BITSIZEOF); + ASSERT_TRUE( + zserio::initializeOffsets(bitPosition, DarkColor::noneColor) == bitPosition + DARK_COLOR_BITSIZEOF); } TEST_F(UInt64EnumTest, read) diff --git a/test/language/enumeration_types/cpp/UInt8EnumTest.cpp b/test/language/enumeration_types/cpp/UInt8EnumTest.cpp index 34bc3d488..6d6bfe47d 100644 --- a/test/language/enumeration_types/cpp/UInt8EnumTest.cpp +++ b/test/language/enumeration_types/cpp/UInt8EnumTest.cpp @@ -1,11 +1,9 @@ +#include "enumeration_types/uint8_enum/DarkColor.h" #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" #include "zserio/CppRuntimeException.h" -#include "enumeration_types/uint8_enum/DarkColor.h" - namespace enumeration_types { namespace uint8_enum diff --git a/test/language/enumeration_types/cpp/VarUIntEnumTest.cpp b/test/language/enumeration_types/cpp/VarUIntEnumTest.cpp index f390329eb..8231ddf97 100644 --- a/test/language/enumeration_types/cpp/VarUIntEnumTest.cpp +++ b/test/language/enumeration_types/cpp/VarUIntEnumTest.cpp @@ -1,11 +1,9 @@ +#include "enumeration_types/varuint_enum/DarkColor.h" #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" #include "zserio/CppRuntimeException.h" -#include "enumeration_types/varuint_enum/DarkColor.h" - namespace enumeration_types { namespace varuint_enum @@ -102,8 +100,8 @@ TEST_F(VarUIntEnumTest, bitSizeOf) TEST_F(VarUIntEnumTest, initializeOffsets) { const size_t bitPosition = 1; - ASSERT_TRUE(zserio::initializeOffsets(bitPosition, DarkColor::NONE) == - bitPosition + DARK_COLOR_NONE_BITSIZEOF); + ASSERT_TRUE( + zserio::initializeOffsets(bitPosition, DarkColor::NONE) == bitPosition + DARK_COLOR_NONE_BITSIZEOF); ASSERT_TRUE(zserio::initializeOffsets(bitPosition, DarkColor::DARK_RED) == bitPosition + DARK_COLOR_DARK_RED_BITSIZEOF); ASSERT_TRUE(zserio::initializeOffsets(bitPosition, DarkColor::DARK_BLUE) == diff --git a/test/language/explicit_parameters/cpp/ExplicitBitmaskParamTest.cpp b/test/language/explicit_parameters/cpp/ExplicitBitmaskParamTest.cpp index 26084c271..6300cd5ce 100644 --- a/test/language/explicit_parameters/cpp/ExplicitBitmaskParamTest.cpp +++ b/test/language/explicit_parameters/cpp/ExplicitBitmaskParamTest.cpp @@ -1,11 +1,9 @@ #include -#include #include - -#include "gtest/gtest.h" +#include #include "explicit_parameters/ExplicitParametersDb.h" - +#include "gtest/gtest.h" #include "zserio/RebindAlloc.h" #include "zserio/StringConvertUtil.h" @@ -78,8 +76,8 @@ class ExplicitBitmaskParamTest : public ::testing::Test } } - static void checkBitmaskParamTableRow(const BitmaskParamTable::Row& row1, - const BitmaskParamTable::Row& row2) + static void checkBitmaskParamTableRow( + const BitmaskParamTable::Row& row1, const BitmaskParamTable::Row& row2) { ASSERT_EQ(row1.getId(), row2.getId()); ASSERT_EQ(row1.getName(), row2.getName()); @@ -91,8 +89,8 @@ class ExplicitBitmaskParamTest : public ::testing::Test ASSERT_EQ(row2.getBlob1().getCount(), row2.getBlob3().getCount()); } - static void checkBitmaskParamTableRows(const vector_type& rows1, - const vector_type& rows2) + static void checkBitmaskParamTableRows( + const vector_type& rows1, const vector_type& rows2) { ASSERT_EQ(rows1.size(), rows2.size()); for (size_t i = 0; i < rows1.size(); ++i) diff --git a/test/language/explicit_parameters/cpp/ExplicitBlobParamTest.cpp b/test/language/explicit_parameters/cpp/ExplicitBlobParamTest.cpp index e29ea8404..b1a7bcf78 100644 --- a/test/language/explicit_parameters/cpp/ExplicitBlobParamTest.cpp +++ b/test/language/explicit_parameters/cpp/ExplicitBlobParamTest.cpp @@ -1,11 +1,9 @@ #include -#include #include - -#include "gtest/gtest.h" +#include #include "explicit_parameters/ExplicitParametersDb.h" - +#include "gtest/gtest.h" #include "zserio/RebindAlloc.h" #include "zserio/StringConvertUtil.h" @@ -115,8 +113,8 @@ class ExplicitBlobParamTest : public ::testing::Test ASSERT_EQ(row2.getBlob1().getBlob(), row2.getBlob3().getBlob()); } - static void checkBlobParamTableRows(const vector_type& rows1, - const vector_type& rows2) + static void checkBlobParamTableRows( + const vector_type& rows1, const vector_type& rows2) { ASSERT_EQ(rows1.size(), rows2.size()); for (size_t i = 0; i < rows1.size(); ++i) diff --git a/test/language/explicit_parameters/cpp/ExplicitEnumParamTest.cpp b/test/language/explicit_parameters/cpp/ExplicitEnumParamTest.cpp index c9e4879d9..572b2bdd4 100644 --- a/test/language/explicit_parameters/cpp/ExplicitEnumParamTest.cpp +++ b/test/language/explicit_parameters/cpp/ExplicitEnumParamTest.cpp @@ -1,11 +1,9 @@ #include -#include #include - -#include "gtest/gtest.h" +#include #include "explicit_parameters/ExplicitParametersDb.h" - +#include "gtest/gtest.h" #include "zserio/RebindAlloc.h" #include "zserio/StringConvertUtil.h" @@ -90,8 +88,8 @@ class ExplicitEnumParamTest : public ::testing::Test ASSERT_EQ(row2.getBlob1().getCount(), row2.getBlob3().getCount()); } - static void checkEnumParamTableRows(const vector_type& rows1, - const vector_type& rows2) + static void checkEnumParamTableRows( + const vector_type& rows1, const vector_type& rows2) { ASSERT_EQ(rows1.size(), rows2.size()); for (size_t i = 0; i < rows1.size(); ++i) diff --git a/test/language/explicit_parameters/cpp/ExplicitSameAsFieldTest.cpp b/test/language/explicit_parameters/cpp/ExplicitSameAsFieldTest.cpp index 02d44554f..b42e7f173 100644 --- a/test/language/explicit_parameters/cpp/ExplicitSameAsFieldTest.cpp +++ b/test/language/explicit_parameters/cpp/ExplicitSameAsFieldTest.cpp @@ -1,11 +1,9 @@ #include -#include #include - -#include "gtest/gtest.h" +#include #include "explicit_parameters/ExplicitParametersDb.h" - +#include "gtest/gtest.h" #include "zserio/RebindAlloc.h" #include "zserio/StringConvertUtil.h" @@ -83,8 +81,8 @@ class ExplicitSameAsFieldTest : public ::testing::Test ASSERT_EQ(row1.getBlobExplicit(), row2.getBlobExplicit()); } - static void checkSameAsFieldTableRows(const vector_type& rows1, - const vector_type& rows2) + static void checkSameAsFieldTableRows( + const vector_type& rows1, const vector_type& rows2) { ASSERT_EQ(rows1.size(), rows2.size()); for (size_t i = 0; i < rows1.size(); ++i) diff --git a/test/language/explicit_parameters/cpp/ExplicitSimpleParamTest.cpp b/test/language/explicit_parameters/cpp/ExplicitSimpleParamTest.cpp index ea0929e39..891324c4a 100644 --- a/test/language/explicit_parameters/cpp/ExplicitSimpleParamTest.cpp +++ b/test/language/explicit_parameters/cpp/ExplicitSimpleParamTest.cpp @@ -1,11 +1,9 @@ #include -#include #include - -#include "gtest/gtest.h" +#include #include "explicit_parameters/ExplicitParametersDb.h" - +#include "gtest/gtest.h" #include "zserio/RebindAlloc.h" #include "zserio/StringConvertUtil.h" @@ -90,8 +88,8 @@ class ExplicitSimpleParamTest : public ::testing::Test ASSERT_EQ(row2.getBlob1().getCount(), row2.getBlob3().getCount()); } - static void checkSimpleParamTableRows(const vector_type& rows1, - const vector_type& rows2) + static void checkSimpleParamTableRows( + const vector_type& rows1, const vector_type& rows2) { ASSERT_EQ(rows1.size(), rows2.size()); for (size_t i = 0; i < rows1.size(); ++i) diff --git a/test/language/explicit_parameters/cpp/MultipleExplicitParamsTest.cpp b/test/language/explicit_parameters/cpp/MultipleExplicitParamsTest.cpp index 923f08bba..6f764506e 100644 --- a/test/language/explicit_parameters/cpp/MultipleExplicitParamsTest.cpp +++ b/test/language/explicit_parameters/cpp/MultipleExplicitParamsTest.cpp @@ -1,11 +1,9 @@ #include -#include #include - -#include "gtest/gtest.h" +#include #include "explicit_parameters/ExplicitParametersDb.h" - +#include "gtest/gtest.h" #include "zserio/RebindAlloc.h" #include "zserio/StringConvertUtil.h" @@ -95,8 +93,8 @@ class MultipleExplicitParamsTest : public ::testing::Test } } - static void checkMultipleParamsTableRow(const MultipleParamsTable::Row& row1, - const MultipleParamsTable::Row& row2) + static void checkMultipleParamsTableRow( + const MultipleParamsTable::Row& row1, const MultipleParamsTable::Row& row2) { ASSERT_EQ(row1.getId(), row2.getId()); ASSERT_EQ(row1.getName(), row2.getName()); diff --git a/test/language/explicit_parameters/cpp/MultipleWithSameNameTest.cpp b/test/language/explicit_parameters/cpp/MultipleWithSameNameTest.cpp index 11208cf22..c1b3ba161 100644 --- a/test/language/explicit_parameters/cpp/MultipleWithSameNameTest.cpp +++ b/test/language/explicit_parameters/cpp/MultipleWithSameNameTest.cpp @@ -1,11 +1,9 @@ #include -#include #include - -#include "gtest/gtest.h" +#include #include "explicit_parameters/ExplicitParametersDb.h" - +#include "gtest/gtest.h" #include "zserio/RebindAlloc.h" #include "zserio/StringConvertUtil.h" @@ -42,8 +40,8 @@ class MultipleWithSameNameTest : public ::testing::Test MultipleWithSameNameTest& operator=(MultipleWithSameNameTest&&) = delete; protected: - void fillMultipleWithSameNameTableRow(MultipleWithSameNameTable::Row& row, uint32_t id, - const string_type& name) + void fillMultipleWithSameNameTableRow( + MultipleWithSameNameTable::Row& row, uint32_t id, const string_type& name) { row.setId(id); row.setName(name); @@ -64,8 +62,8 @@ class MultipleWithSameNameTest : public ::testing::Test } } - static void checkMultipleWithSameNameTableRow(const MultipleWithSameNameTable::Row& row1, - const MultipleWithSameNameTable::Row& row2) + static void checkMultipleWithSameNameTableRow( + const MultipleWithSameNameTable::Row& row1, const MultipleWithSameNameTable::Row& row2) { ASSERT_EQ(row1.getId(), row2.getId()); ASSERT_EQ(row1.getName(), row2.getName()); @@ -165,7 +163,7 @@ TEST_F(MultipleWithSameNameTest, update) multipleWithSameNameTable.update(parameterProvider, updateRow, updateCondition); MultipleWithSameNameTable::Reader reader = - multipleWithSameNameTable.createReader(parameterProvider, updateCondition); + multipleWithSameNameTable.createReader(parameterProvider, updateCondition); ASSERT_TRUE(reader.hasNext()); MultipleWithSameNameTable::Row readRow = reader.next(); ASSERT_FALSE(reader.hasNext()); diff --git a/test/language/expressions/cpp/ArrayTypeTest.cpp b/test/language/expressions/cpp/ArrayTypeTest.cpp index 6f991ce3e..f7e24dcb7 100644 --- a/test/language/expressions/cpp/ArrayTypeTest.cpp +++ b/test/language/expressions/cpp/ArrayTypeTest.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "expressions/array_type/ArrayTypeExpression.h" - +#include "gtest/gtest.h" #include "zserio/RebindAlloc.h" namespace expressions diff --git a/test/language/expressions/cpp/BitmaskTypeTest.cpp b/test/language/expressions/cpp/BitmaskTypeTest.cpp index ce863c50c..4e1774ee7 100644 --- a/test/language/expressions/cpp/BitmaskTypeTest.cpp +++ b/test/language/expressions/cpp/BitmaskTypeTest.cpp @@ -1,6 +1,5 @@ -#include "gtest/gtest.h" - #include "expressions/bitmask_type/BitmaskTypeExpression.h" +#include "gtest/gtest.h" namespace expressions { diff --git a/test/language/expressions/cpp/CastUInt64ToUInt8Test.cpp b/test/language/expressions/cpp/CastUInt64ToUInt8Test.cpp index 702ee9b08..bedd79592 100644 --- a/test/language/expressions/cpp/CastUInt64ToUInt8Test.cpp +++ b/test/language/expressions/cpp/CastUInt64ToUInt8Test.cpp @@ -1,6 +1,5 @@ -#include "gtest/gtest.h" - #include "expressions/cast_uint64_to_uint8/CastUInt64ToUInt8Expression.h" +#include "gtest/gtest.h" namespace expressions { diff --git a/test/language/expressions/cpp/CastUInt8ToUInt64Test.cpp b/test/language/expressions/cpp/CastUInt8ToUInt64Test.cpp index 807cf22a0..899e857df 100644 --- a/test/language/expressions/cpp/CastUInt8ToUInt64Test.cpp +++ b/test/language/expressions/cpp/CastUInt8ToUInt64Test.cpp @@ -1,6 +1,5 @@ -#include "gtest/gtest.h" - #include "expressions/cast_uint8_to_uint64/CastUInt8ToUInt64Expression.h" +#include "gtest/gtest.h" namespace expressions { diff --git a/test/language/expressions/cpp/ConstTypeTest.cpp b/test/language/expressions/cpp/ConstTypeTest.cpp index d6931d44a..386add11f 100644 --- a/test/language/expressions/cpp/ConstTypeTest.cpp +++ b/test/language/expressions/cpp/ConstTypeTest.cpp @@ -1,6 +1,5 @@ -#include "gtest/gtest.h" - #include "expressions/const_type/ConstTypeExpression.h" +#include "gtest/gtest.h" namespace expressions { diff --git a/test/language/expressions/cpp/EnumerationTypeTest.cpp b/test/language/expressions/cpp/EnumerationTypeTest.cpp index 776371aff..ede95a17e 100644 --- a/test/language/expressions/cpp/EnumerationTypeTest.cpp +++ b/test/language/expressions/cpp/EnumerationTypeTest.cpp @@ -1,6 +1,5 @@ -#include "gtest/gtest.h" - #include "expressions/enumeration_type/EnumerationTypeExpression.h" +#include "gtest/gtest.h" namespace expressions { diff --git a/test/language/expressions/cpp/FieldTypeTest.cpp b/test/language/expressions/cpp/FieldTypeTest.cpp index ba55c1455..8b73ed1bd 100644 --- a/test/language/expressions/cpp/FieldTypeTest.cpp +++ b/test/language/expressions/cpp/FieldTypeTest.cpp @@ -1,6 +1,5 @@ -#include "gtest/gtest.h" - #include "expressions/field_type/FieldTypeExpression.h" +#include "gtest/gtest.h" namespace expressions { diff --git a/test/language/expressions/cpp/FieldTypeWithClashTest.cpp b/test/language/expressions/cpp/FieldTypeWithClashTest.cpp index 3cc6dfd5d..0e060f74f 100644 --- a/test/language/expressions/cpp/FieldTypeWithClashTest.cpp +++ b/test/language/expressions/cpp/FieldTypeWithClashTest.cpp @@ -1,6 +1,5 @@ -#include "gtest/gtest.h" - #include "expressions/field_type_with_clash/FieldTypeExpression.h" +#include "gtest/gtest.h" namespace expressions { diff --git a/test/language/expressions/cpp/FloatTypeTest.cpp b/test/language/expressions/cpp/FloatTypeTest.cpp index 9b1128584..2dd3e3d21 100644 --- a/test/language/expressions/cpp/FloatTypeTest.cpp +++ b/test/language/expressions/cpp/FloatTypeTest.cpp @@ -1,6 +1,5 @@ -#include "gtest/gtest.h" - #include "expressions/float_type/FloatTypeExpression.h" +#include "gtest/gtest.h" namespace expressions { diff --git a/test/language/expressions/cpp/FullConstTypeTest.cpp b/test/language/expressions/cpp/FullConstTypeTest.cpp index af455cc4d..a7e8db823 100644 --- a/test/language/expressions/cpp/FullConstTypeTest.cpp +++ b/test/language/expressions/cpp/FullConstTypeTest.cpp @@ -1,6 +1,5 @@ -#include "gtest/gtest.h" - #include "expressions/full_const_type/FullConstTypeExpression.h" +#include "gtest/gtest.h" namespace expressions { diff --git a/test/language/expressions/cpp/FullEnumerationTypeTest.cpp b/test/language/expressions/cpp/FullEnumerationTypeTest.cpp index 9d3d6839d..bee3c53e1 100644 --- a/test/language/expressions/cpp/FullEnumerationTypeTest.cpp +++ b/test/language/expressions/cpp/FullEnumerationTypeTest.cpp @@ -1,6 +1,5 @@ -#include "gtest/gtest.h" - #include "expressions/full_enumeration_type/FullEnumerationTypeExpression.h" +#include "gtest/gtest.h" namespace expressions { diff --git a/test/language/expressions/cpp/FunctionTypeTest.cpp b/test/language/expressions/cpp/FunctionTypeTest.cpp index ada556133..9dee0f6a2 100644 --- a/test/language/expressions/cpp/FunctionTypeTest.cpp +++ b/test/language/expressions/cpp/FunctionTypeTest.cpp @@ -1,6 +1,5 @@ -#include "gtest/gtest.h" - #include "expressions/function_type/FunctionTypeExpression.h" +#include "gtest/gtest.h" namespace expressions { diff --git a/test/language/expressions/cpp/IndexOperatorTest.cpp b/test/language/expressions/cpp/IndexOperatorTest.cpp index b03abe17a..d5c232ddb 100644 --- a/test/language/expressions/cpp/IndexOperatorTest.cpp +++ b/test/language/expressions/cpp/IndexOperatorTest.cpp @@ -1,14 +1,12 @@ #include +#include "expressions/index_operator/Element.h" +#include "expressions/index_operator/ElementList.h" #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" #include "zserio/CppRuntimeException.h" -#include "expressions/index_operator/ElementList.h" -#include "expressions/index_operator/Element.h" - namespace expressions { namespace index_operator @@ -63,8 +61,7 @@ class IndexOperatorTest : public ::testing::Test const bool wrong = lastWrong && i + 1 == length; Element element = list.getElements().at(i); if (wrong) - ASSERT_THROW(isEven ? element.getField16() : element.getField8(), - zserio::CppRuntimeException); + ASSERT_THROW(isEven ? element.getField16() : element.getField8(), zserio::CppRuntimeException); else ASSERT_EQ(ELEMENTS[i], isEven ? element.getField8() : element.getField16()); } @@ -78,7 +75,7 @@ class IndexOperatorTest : public ::testing::Test zserio::BitBuffer bitBuffer = zserio::BitBuffer(1024 * 8); }; -const std::array IndexOperatorTest::ELEMENTS = { 11, 33, 55, 77 }; +const std::array IndexOperatorTest::ELEMENTS = {11, 33, 55, 77}; const size_t IndexOperatorTest::LENGTH_SIZE = 16; const size_t IndexOperatorTest::FIELD8_SIZE = 8; const size_t IndexOperatorTest::FIELD16_SIZE = 16; diff --git a/test/language/expressions/cpp/IsSetOperatorTest.cpp b/test/language/expressions/cpp/IsSetOperatorTest.cpp index e307d8053..e69c8c069 100644 --- a/test/language/expressions/cpp/IsSetOperatorTest.cpp +++ b/test/language/expressions/cpp/IsSetOperatorTest.cpp @@ -1,6 +1,5 @@ -#include "gtest/gtest.h" - #include "expressions/isset_operator/IsSetOperator.h" +#include "gtest/gtest.h" namespace expressions { diff --git a/test/language/expressions/cpp/LengthOfOperatorTest.cpp b/test/language/expressions/cpp/LengthOfOperatorTest.cpp index 268b2669c..113332ac5 100644 --- a/test/language/expressions/cpp/LengthOfOperatorTest.cpp +++ b/test/language/expressions/cpp/LengthOfOperatorTest.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "expressions/lengthof_operator/LengthOfFunctions.h" - +#include "gtest/gtest.h" #include "zserio/RebindAlloc.h" namespace expressions diff --git a/test/language/expressions/cpp/ModuloOperatorTest.cpp b/test/language/expressions/cpp/ModuloOperatorTest.cpp index 626fa5316..2847bbeac 100644 --- a/test/language/expressions/cpp/ModuloOperatorTest.cpp +++ b/test/language/expressions/cpp/ModuloOperatorTest.cpp @@ -1,6 +1,5 @@ -#include "gtest/gtest.h" - #include "expressions/modulo_operator/ModuloFunction.h" +#include "gtest/gtest.h" namespace expressions { diff --git a/test/language/expressions/cpp/NegationOperatorTest.cpp b/test/language/expressions/cpp/NegationOperatorTest.cpp index 69f1a7a96..9baa5c25f 100644 --- a/test/language/expressions/cpp/NegationOperatorTest.cpp +++ b/test/language/expressions/cpp/NegationOperatorTest.cpp @@ -1,6 +1,5 @@ -#include "gtest/gtest.h" - #include "expressions/negation_operator/NegationOperatorExpression.h" +#include "gtest/gtest.h" namespace expressions { diff --git a/test/language/expressions/cpp/NumBitsOperatorTest.cpp b/test/language/expressions/cpp/NumBitsOperatorTest.cpp index cede9ae13..be301795f 100644 --- a/test/language/expressions/cpp/NumBitsOperatorTest.cpp +++ b/test/language/expressions/cpp/NumBitsOperatorTest.cpp @@ -1,8 +1,7 @@ #include -#include "gtest/gtest.h" - #include "expressions/numbits_operator/NumBitsFunctions.h" +#include "gtest/gtest.h" namespace expressions { @@ -11,17 +10,17 @@ namespace numbits_operator namespace { - uint8_t calculateExpectedNumBits(uint64_t value) - { - if (value == 0) - return 0; +uint8_t calculateExpectedNumBits(uint64_t value) +{ + if (value == 0) + return 0; - if (value == 1) - return 1; + if (value == 1) + return 1; - return static_cast(log2(static_cast(value - 1)) + 1); - } + return static_cast(log2(static_cast(value - 1)) + 1); } +} // namespace TEST(NumBitsOperatorTest, GetNumBits8) { @@ -29,8 +28,8 @@ TEST(NumBitsOperatorTest, GetNumBits8) for (uint8_t value8 = 1; value8 < 255; ++value8) { numBitsFunctions.setValue8(value8); - ASSERT_EQ(calculateExpectedNumBits(value8), numBitsFunctions.funcGetNumBits8()) << - "value8=" << static_cast(value8); + ASSERT_EQ(calculateExpectedNumBits(value8), numBitsFunctions.funcGetNumBits8()) + << "value8=" << static_cast(value8); } } @@ -40,8 +39,8 @@ TEST(NumBitsOperatorTest, GetNumBits16) for (uint16_t value16 = 1; value16 < 65535; ++value16) { numBitsFunctions.setValue16(value16); - ASSERT_EQ(calculateExpectedNumBits(value16), numBitsFunctions.funcGetNumBits16()) << - "value16=" << value16; + ASSERT_EQ(calculateExpectedNumBits(value16), numBitsFunctions.funcGetNumBits16()) + << "value16=" << value16; } } @@ -51,8 +50,8 @@ TEST(NumBitsOperatorTest, GetNumBits32) for (uint32_t value32 = 1; value32 < (1U << 31U); value32 <<= 1U) { numBitsFunctions.setValue32(value32); - ASSERT_EQ(calculateExpectedNumBits(value32), numBitsFunctions.funcGetNumBits32()) << - "value32=" << value32; + ASSERT_EQ(calculateExpectedNumBits(value32), numBitsFunctions.funcGetNumBits32()) + << "value32=" << value32; } } diff --git a/test/language/expressions/cpp/ParameterTypeTest.cpp b/test/language/expressions/cpp/ParameterTypeTest.cpp index 4612d7886..3ab75a295 100644 --- a/test/language/expressions/cpp/ParameterTypeTest.cpp +++ b/test/language/expressions/cpp/ParameterTypeTest.cpp @@ -1,6 +1,5 @@ -#include "gtest/gtest.h" - #include "expressions/parameter_type/ParameterTypeExpression.h" +#include "gtest/gtest.h" namespace expressions { diff --git a/test/language/expressions/cpp/ParameterizedArrayTypeTest.cpp b/test/language/expressions/cpp/ParameterizedArrayTypeTest.cpp index 2fcce6cc7..cf87bfddc 100644 --- a/test/language/expressions/cpp/ParameterizedArrayTypeTest.cpp +++ b/test/language/expressions/cpp/ParameterizedArrayTypeTest.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "expressions/parameterized_array_type/ParameterizedArrayTypeExpression.h" - +#include "gtest/gtest.h" #include "zserio/RebindAlloc.h" namespace expressions @@ -33,8 +31,8 @@ TEST(ParameterizedArrayTypeTest, bitSizeOfWithOptional) parameterizedArrayTypeExpression.initializeChildren(); const size_t parameterizedArrayTypeExpressionBitSizeWithOptional = 33; - ASSERT_EQ(parameterizedArrayTypeExpressionBitSizeWithOptional, - parameterizedArrayTypeExpression.bitSizeOf()); + ASSERT_EQ( + parameterizedArrayTypeExpressionBitSizeWithOptional, parameterizedArrayTypeExpression.bitSizeOf()); } TEST(ParameterizedArrayTypeTest, bitSizeOfWithoutOptional) @@ -57,8 +55,8 @@ TEST(ParameterizedArrayTypeTest, bitSizeOfWithoutOptional) parameterizedArrayTypeExpression.initializeChildren(); const size_t parameterizedArrayTypeExpressionBitSizeWithOptional = 32; - ASSERT_EQ(parameterizedArrayTypeExpressionBitSizeWithOptional, - parameterizedArrayTypeExpression.bitSizeOf()); + ASSERT_EQ( + parameterizedArrayTypeExpressionBitSizeWithOptional, parameterizedArrayTypeExpression.bitSizeOf()); } } // namespace parameterized_array_type diff --git a/test/language/expressions/cpp/ParenthesisTest.cpp b/test/language/expressions/cpp/ParenthesisTest.cpp index 02557ec54..c78e517ef 100644 --- a/test/language/expressions/cpp/ParenthesisTest.cpp +++ b/test/language/expressions/cpp/ParenthesisTest.cpp @@ -1,6 +1,5 @@ -#include "gtest/gtest.h" - #include "expressions/parenthesis/ParenthesisExpression.h" +#include "gtest/gtest.h" namespace expressions { diff --git a/test/language/expressions/cpp/QuestionMarkTest.cpp b/test/language/expressions/cpp/QuestionMarkTest.cpp index 706e7b0a0..7e1d79136 100644 --- a/test/language/expressions/cpp/QuestionMarkTest.cpp +++ b/test/language/expressions/cpp/QuestionMarkTest.cpp @@ -1,6 +1,5 @@ -#include "gtest/gtest.h" - #include "expressions/question_mark/QuestionMarkExpression.h" +#include "gtest/gtest.h" namespace expressions { diff --git a/test/language/expressions/cpp/StringTypeTest.cpp b/test/language/expressions/cpp/StringTypeTest.cpp index 0b60bc40f..9d3f97e3e 100644 --- a/test/language/expressions/cpp/StringTypeTest.cpp +++ b/test/language/expressions/cpp/StringTypeTest.cpp @@ -1,10 +1,7 @@ -#include "gtest/gtest.h" - -#include "expressions/string_type/StringTypeExpression.h" -#include "expressions/string_type/STRING_CONSTANT.h" #include "expressions/string_type/CHOOSER.h" - - +#include "expressions/string_type/STRING_CONSTANT.h" +#include "expressions/string_type/StringTypeExpression.h" +#include "gtest/gtest.h" #include "zserio/RebindAlloc.h" using namespace zserio::literals; @@ -59,16 +56,17 @@ TEST_F(StringTypeTest, returnValue) TEST_F(StringTypeTest, returnDefaultValue) { const StringTypeExpression stringTypeExpression = createStringTypeExpression(true); - ASSERT_EQ(CHOOSER ? zserio::toString(STRING_CONSTANT) : - zserio::toString(FALSE) + zserio::toString(SPACE) + zserio::toString(STRING_CONSTANT), + ASSERT_EQ(CHOOSER ? zserio::toString(STRING_CONSTANT) + : zserio::toString(FALSE) + zserio::toString(SPACE) + zserio::toString(STRING_CONSTANT), zserio::toString(stringTypeExpression.funcReturnDefaultValue())); } TEST_F(StringTypeTest, returnDefaultChosen) { const StringTypeExpression stringTypeExpression = createStringTypeExpression(true); - ASSERT_EQ(CHOOSER ? zserio::toString(CHOSEN) + zserio::toString(SPACE) + zserio::toString(STRING_CONSTANT) : - std::string(), zserio::toString(stringTypeExpression.funcReturnDefaultChosen())); + ASSERT_EQ(CHOOSER ? zserio::toString(CHOSEN) + zserio::toString(SPACE) + zserio::toString(STRING_CONSTANT) + : std::string(), + zserio::toString(stringTypeExpression.funcReturnDefaultChosen())); } TEST_F(StringTypeTest, appendix) @@ -81,8 +79,8 @@ TEST_F(StringTypeTest, appendix) TEST_F(StringTypeTest, appendToConst) { const StringTypeExpression stringTypeExpression = createStringTypeExpression(false); - ASSERT_EQ(zserio::toString(STRING_CONSTANT) + zserio::toString(UNDERSCORE) + - zserio::toString(APPEND) + zserio::toString(IX), + ASSERT_EQ(zserio::toString(STRING_CONSTANT) + zserio::toString(UNDERSCORE) + zserio::toString(APPEND) + + zserio::toString(IX), zserio::toString(stringTypeExpression.funcAppendToConst())); } diff --git a/test/language/expressions/cpp/UInt64TypeTest.cpp b/test/language/expressions/cpp/UInt64TypeTest.cpp index fd6ee60fb..fcf7c669c 100644 --- a/test/language/expressions/cpp/UInt64TypeTest.cpp +++ b/test/language/expressions/cpp/UInt64TypeTest.cpp @@ -1,6 +1,5 @@ -#include "gtest/gtest.h" - #include "expressions/uint64_type/UInt64TypeExpression.h" +#include "gtest/gtest.h" namespace expressions { diff --git a/test/language/expressions/cpp/UsedBeforeTypeTest.cpp b/test/language/expressions/cpp/UsedBeforeTypeTest.cpp index 4227be829..be47deecf 100644 --- a/test/language/expressions/cpp/UsedBeforeTypeTest.cpp +++ b/test/language/expressions/cpp/UsedBeforeTypeTest.cpp @@ -1,6 +1,5 @@ -#include "gtest/gtest.h" - #include "expressions/used_before_type/UsedBeforeTypeExpression.h" +#include "gtest/gtest.h" namespace expressions { diff --git a/test/language/expressions/cpp/ValueOfOperatorTest.cpp b/test/language/expressions/cpp/ValueOfOperatorTest.cpp index c901ee792..da4d59af3 100644 --- a/test/language/expressions/cpp/ValueOfOperatorTest.cpp +++ b/test/language/expressions/cpp/ValueOfOperatorTest.cpp @@ -1,6 +1,5 @@ -#include "gtest/gtest.h" - #include "expressions/valueof_operator/ValueOfFunctions.h" +#include "gtest/gtest.h" namespace expressions { diff --git a/test/language/extended_members/cpp/ExtendedChoiceFieldTest.cpp b/test/language/extended_members/cpp/ExtendedChoiceFieldTest.cpp index fd87a5429..43f3ea4d9 100644 --- a/test/language/extended_members/cpp/ExtendedChoiceFieldTest.cpp +++ b/test/language/extended_members/cpp/ExtendedChoiceFieldTest.cpp @@ -1,10 +1,8 @@ -#include "gtest/gtest.h" - -#include "extended_members/extended_choice_field/Original.h" #include "extended_members/extended_choice_field/Extended.h" - -#include "zserio/SerializeUtil.h" +#include "extended_members/extended_choice_field/Original.h" +#include "gtest/gtest.h" #include "zserio/BitSizeOfCalculator.h" +#include "zserio/SerializeUtil.h" #include "zserio/SizeConvertUtil.h" namespace extended_members @@ -32,8 +30,8 @@ class ExtendedChoiceFieldTest : public ::testing::Test // TODO[Mi-L@]: cannot do allocator propagating copy on uninitialized choice! if (extended.getExtendedValue().isInitialized()) { - Extended copiedWithPropagateAllocatorExtended(zserio::PropagateAllocator, extended, - allocator_type()); + Extended copiedWithPropagateAllocatorExtended( + zserio::PropagateAllocator, extended, allocator_type()); ASSERT_EQ(expectedIsPresent, copiedWithPropagateAllocatorExtended.isExtendedValuePresent()); ASSERT_EQ(extended, copiedWithPropagateAllocatorExtended); } @@ -61,7 +59,7 @@ const size_t ExtendedChoiceFieldTest::ORIGINAL_BIT_SIZE = 4 * 8; const size_t ExtendedChoiceFieldTest::EXTENDED_BIT_SIZE_EMPTY = ORIGINAL_BIT_SIZE; const size_t ExtendedChoiceFieldTest::EXTENDED_BIT_SIZE_VALUE = ORIGINAL_BIT_SIZE + 4 * 8; -const vector_type ExtendedChoiceFieldTest::VALUES = { 0, 1, 2, 3, 4 }; +const vector_type ExtendedChoiceFieldTest::VALUES = {0, 1, 2, 3, 4}; const size_t ExtendedChoiceFieldTest::EXTENDED_BIT_SIZE_VALUES = ORIGINAL_BIT_SIZE + VALUES.size() * 4 * 8; TEST_F(ExtendedChoiceFieldTest, defaultConstructor) diff --git a/test/language/extended_members/cpp/ExtendedCompoundFieldTest.cpp b/test/language/extended_members/cpp/ExtendedCompoundFieldTest.cpp index 925de2dd2..364adf3c5 100644 --- a/test/language/extended_members/cpp/ExtendedCompoundFieldTest.cpp +++ b/test/language/extended_members/cpp/ExtendedCompoundFieldTest.cpp @@ -1,10 +1,8 @@ -#include "gtest/gtest.h" - -#include "extended_members/extended_compound_field/Original.h" #include "extended_members/extended_compound_field/Extended.h" - -#include "zserio/SerializeUtil.h" +#include "extended_members/extended_compound_field/Original.h" +#include "gtest/gtest.h" #include "zserio/BitSizeOfCalculator.h" +#include "zserio/SerializeUtil.h" #include "zserio/SizeConvertUtil.h" namespace extended_members @@ -51,11 +49,11 @@ class ExtendedCompoundFieldTest : public ::testing::Test static const size_t EXTENDED_BIT_SIZE_WITH_ARRAY; }; -const vector_type ExtendedCompoundFieldTest::COMPOUND_ARRAY = { 0, 1, 2, 3, 4 }; +const vector_type ExtendedCompoundFieldTest::COMPOUND_ARRAY = {0, 1, 2, 3, 4}; const size_t ExtendedCompoundFieldTest::ORIGINAL_BIT_SIZE = 4 * 8; -const size_t ExtendedCompoundFieldTest::EXTENDED_BIT_SIZE_DEFAULT = ORIGINAL_BIT_SIZE + - zserio::bitSizeOfVarSize(0); +const size_t ExtendedCompoundFieldTest::EXTENDED_BIT_SIZE_DEFAULT = + ORIGINAL_BIT_SIZE + zserio::bitSizeOfVarSize(0); const size_t ExtendedCompoundFieldTest::EXTENDED_BIT_SIZE_WITH_ARRAY = ORIGINAL_BIT_SIZE + zserio::bitSizeOfVarSize(zserio::convertSizeToUInt32(COMPOUND_ARRAY.size())) + COMPOUND_ARRAY.size() * 4 * 8; diff --git a/test/language/extended_members/cpp/ExtendedEmptyStructureTest.cpp b/test/language/extended_members/cpp/ExtendedEmptyStructureTest.cpp index e362d0efc..e94526755 100644 --- a/test/language/extended_members/cpp/ExtendedEmptyStructureTest.cpp +++ b/test/language/extended_members/cpp/ExtendedEmptyStructureTest.cpp @@ -1,8 +1,6 @@ -#include "gtest/gtest.h" - -#include "extended_members/extended_empty_structure/Original.h" #include "extended_members/extended_empty_structure/Extended.h" - +#include "extended_members/extended_empty_structure/Original.h" +#include "gtest/gtest.h" #include "zserio/SerializeUtil.h" namespace extended_members @@ -25,8 +23,7 @@ class ExtendedEmptyStructureTest : public ::testing::Test ASSERT_EQ(expectedIsPresent, movedExtended.isExtendedValuePresent()); ASSERT_EQ(extended, movedExtended); - Extended copiedWithPropagateAllocatorExtended( - zserio::PropagateAllocator, extended, allocator_type()); + Extended copiedWithPropagateAllocatorExtended(zserio::PropagateAllocator, extended, allocator_type()); ASSERT_EQ(expectedIsPresent, copiedWithPropagateAllocatorExtended.isExtendedValuePresent()); ASSERT_EQ(extended, copiedWithPropagateAllocatorExtended); diff --git a/test/language/extended_members/cpp/ExtendedFieldInTemplateTest.cpp b/test/language/extended_members/cpp/ExtendedFieldInTemplateTest.cpp index 86c1f0534..6085f8de6 100644 --- a/test/language/extended_members/cpp/ExtendedFieldInTemplateTest.cpp +++ b/test/language/extended_members/cpp/ExtendedFieldInTemplateTest.cpp @@ -1,9 +1,7 @@ -#include "gtest/gtest.h" - -#include "extended_members/extended_field_in_template/Original.h" -#include "extended_members/extended_field_in_template/ExtendedSimple.h" #include "extended_members/extended_field_in_template/ExtendedCompound.h" - +#include "extended_members/extended_field_in_template/ExtendedSimple.h" +#include "extended_members/extended_field_in_template/Original.h" +#include "gtest/gtest.h" #include "zserio/SerializeUtil.h" namespace extended_members diff --git a/test/language/extended_members/cpp/ExtendedIndexedOffsetsTest.cpp b/test/language/extended_members/cpp/ExtendedIndexedOffsetsTest.cpp index f78dd6c74..ff6794a16 100644 --- a/test/language/extended_members/cpp/ExtendedIndexedOffsetsTest.cpp +++ b/test/language/extended_members/cpp/ExtendedIndexedOffsetsTest.cpp @@ -1,10 +1,8 @@ -#include "gtest/gtest.h" - #include -#include "extended_members/extended_indexed_offsets/Original.h" #include "extended_members/extended_indexed_offsets/Extended.h" - +#include "extended_members/extended_indexed_offsets/Original.h" +#include "gtest/gtest.h" #include "zserio/SerializeUtil.h" namespace extended_members @@ -52,19 +50,17 @@ class ExtendedIndexedOffsetsTest : public ::testing::Test static const size_t EXTENDED_BIT_SIZE; }; -const vector_type ExtendedIndexedOffsetsTest::OFFSETS = { 0, 0, 0, 0, 0 }; +const vector_type ExtendedIndexedOffsetsTest::OFFSETS = {0, 0, 0, 0, 0}; const vector_type ExtendedIndexedOffsetsTest::ARRAY = { - "extended", "indexed", "offsets", "test", "!" }; + "extended", "indexed", "offsets", "test", "!"}; const size_t ExtendedIndexedOffsetsTest::ORIGINAL_BIT_SIZE = - zserio::bitSizeOfVarSize(zserio::convertSizeToUInt32(OFFSETS.size())) + - OFFSETS.size() * 4 * 8; + zserio::bitSizeOfVarSize(zserio::convertSizeToUInt32(OFFSETS.size())) + OFFSETS.size() * 4 * 8; const size_t ExtendedIndexedOffsetsTest::EXTENDED_BIT_SIZE = ORIGINAL_BIT_SIZE + zserio::bitSizeOfVarSize(zserio::convertSizeToUInt32(ARRAY.size())) + std::accumulate(ARRAY.begin(), ARRAY.end(), static_cast(0), [](size_t size, const string_type& str) { return size + zserio::bitSizeOfString(str); }); - TEST_F(ExtendedIndexedOffsetsTest, defaultConstructor) { Extended extended; diff --git a/test/language/extended_members/cpp/ExtendedOptionalParameterizedFieldTest.cpp b/test/language/extended_members/cpp/ExtendedOptionalParameterizedFieldTest.cpp index b9f602a70..574ebad9e 100644 --- a/test/language/extended_members/cpp/ExtendedOptionalParameterizedFieldTest.cpp +++ b/test/language/extended_members/cpp/ExtendedOptionalParameterizedFieldTest.cpp @@ -1,10 +1,8 @@ -#include "gtest/gtest.h" - #include -#include "extended_members/extended_optional_parameterized_field/Original.h" #include "extended_members/extended_optional_parameterized_field/Extended.h" - +#include "extended_members/extended_optional_parameterized_field/Original.h" +#include "gtest/gtest.h" #include "zserio/SerializeUtil.h" namespace extended_members @@ -52,7 +50,7 @@ class ExtendedOptionalParameterizedFieldTest : public ::testing::Test static const size_t EXTENDED_BIT_SIZE_WITH_OPTIONAL; }; -const vector_type ExtendedOptionalParameterizedFieldTest::ARRAY = { "this", "is", "test" }; +const vector_type ExtendedOptionalParameterizedFieldTest::ARRAY = {"this", "is", "test"}; const size_t ExtendedOptionalParameterizedFieldTest::ORIGINAL_BIT_SIZE = 11; const size_t ExtendedOptionalParameterizedFieldTest::EXTENDED_BIT_SIZE_WITHOUT_OPTIONAL = diff --git a/test/language/extended_members/cpp/ExtendedSimpleFieldTest.cpp b/test/language/extended_members/cpp/ExtendedSimpleFieldTest.cpp index 1de21595c..02e84e654 100644 --- a/test/language/extended_members/cpp/ExtendedSimpleFieldTest.cpp +++ b/test/language/extended_members/cpp/ExtendedSimpleFieldTest.cpp @@ -1,8 +1,6 @@ -#include "gtest/gtest.h" - -#include "extended_members/extended_simple_field/Original.h" #include "extended_members/extended_simple_field/Extended.h" - +#include "extended_members/extended_simple_field/Original.h" +#include "gtest/gtest.h" #include "zserio/SerializeUtil.h" namespace extended_members diff --git a/test/language/extended_members/cpp/ExtendedUnalignedFieldTest.cpp b/test/language/extended_members/cpp/ExtendedUnalignedFieldTest.cpp index df35c3398..224675629 100644 --- a/test/language/extended_members/cpp/ExtendedUnalignedFieldTest.cpp +++ b/test/language/extended_members/cpp/ExtendedUnalignedFieldTest.cpp @@ -1,8 +1,6 @@ -#include "gtest/gtest.h" - -#include "extended_members/extended_unaligned_field/Original.h" #include "extended_members/extended_unaligned_field/Extended.h" - +#include "extended_members/extended_unaligned_field/Original.h" +#include "gtest/gtest.h" #include "zserio/SerializeUtil.h" namespace extended_members @@ -40,7 +38,6 @@ class ExtendedUnalignedFieldTest : public ::testing::Test ASSERT_EQ(extended, moveAssignedExtended); } - static const size_t ORIGINAL_BIT_SIZE; static const size_t EXTENDED_BIT_SIZE; }; diff --git a/test/language/extended_members/cpp/MultipleExtendedFieldsTest.cpp b/test/language/extended_members/cpp/MultipleExtendedFieldsTest.cpp index 7ed6baf44..3fb60ad27 100644 --- a/test/language/extended_members/cpp/MultipleExtendedFieldsTest.cpp +++ b/test/language/extended_members/cpp/MultipleExtendedFieldsTest.cpp @@ -1,11 +1,9 @@ -#include "gtest/gtest.h" - -#include "extended_members/multiple_extended_fields/Original.h" #include "extended_members/multiple_extended_fields/Extended1.h" #include "extended_members/multiple_extended_fields/Extended2.h" - -#include "zserio/SerializeUtil.h" +#include "extended_members/multiple_extended_fields/Original.h" +#include "gtest/gtest.h" #include "zserio/BitSizeOfCalculator.h" +#include "zserio/SerializeUtil.h" namespace extended_members { @@ -30,7 +28,8 @@ class MultipleExtendedFieldsTest : public ::testing::Test ASSERT_EQ(expectedIsPresent2, movedExtended2.isExtendedValue2Present()); ASSERT_EQ(extended2, movedExtended2); - Extended2 copiedWithPropagateAllocatorExtended2(zserio::PropagateAllocator, extended2, allocator_type()); + Extended2 copiedWithPropagateAllocatorExtended2( + zserio::PropagateAllocator, extended2, allocator_type()); ASSERT_EQ(expectedIsPresent1, copiedWithPropagateAllocatorExtended2.isExtendedValue1Present()); ASSERT_EQ(expectedIsPresent2, copiedWithPropagateAllocatorExtended2.isExtendedValue2Present()); ASSERT_EQ(extended2, copiedWithPropagateAllocatorExtended2); @@ -59,8 +58,8 @@ const string_type MultipleExtendedFieldsTest::DEFAULT_EXTENDED_VALUE2 = "test"; const size_t MultipleExtendedFieldsTest::ORIGINAL_BIT_SIZE = 4 * 8; const size_t MultipleExtendedFieldsTest::EXTENDED1_BIT_SIZE = ORIGINAL_BIT_SIZE + 4; -const size_t MultipleExtendedFieldsTest::EXTENDED2_BIT_SIZE = zserio::alignTo(8, EXTENDED1_BIT_SIZE) + - zserio::bitSizeOfString(DEFAULT_EXTENDED_VALUE2); +const size_t MultipleExtendedFieldsTest::EXTENDED2_BIT_SIZE = + zserio::alignTo(8, EXTENDED1_BIT_SIZE) + zserio::bitSizeOfString(DEFAULT_EXTENDED_VALUE2); TEST_F(MultipleExtendedFieldsTest, defaultConstructor) { diff --git a/test/language/extended_members/cpp/MultipleExtendedFieldsVariousTypesTest.cpp b/test/language/extended_members/cpp/MultipleExtendedFieldsVariousTypesTest.cpp index b23b3fec7..4ff1ff15a 100644 --- a/test/language/extended_members/cpp/MultipleExtendedFieldsVariousTypesTest.cpp +++ b/test/language/extended_members/cpp/MultipleExtendedFieldsVariousTypesTest.cpp @@ -1,13 +1,11 @@ -#include "gtest/gtest.h" - #include -#include "extended_members/multiple_extended_fields_various_types/Original.h" #include "extended_members/multiple_extended_fields_various_types/Extended1.h" #include "extended_members/multiple_extended_fields_various_types/Extended2.h" - -#include "zserio/SerializeUtil.h" +#include "extended_members/multiple_extended_fields_various_types/Original.h" +#include "gtest/gtest.h" #include "zserio/BitSizeOfCalculator.h" +#include "zserio/SerializeUtil.h" namespace extended_members { @@ -59,7 +57,8 @@ class MultipleExtendedFieldsVariousTypesTest : public ::testing::Test checkExtended2FieldsPresent(movedExtended2, expectedExtended2FieldsPresent); ASSERT_EQ(extended2, movedExtended2); - Extended2 copiedWithPropagateAllocatorExtended2(zserio::PropagateAllocator, extended2, allocator_type()); + Extended2 copiedWithPropagateAllocatorExtended2( + zserio::PropagateAllocator, extended2, allocator_type()); checkExtended1FieldsPresent(copiedWithPropagateAllocatorExtended2, expectedExtended1FieldsPresent); checkExtended2FieldsPresent(copiedWithPropagateAllocatorExtended2, expectedExtended2FieldsPresent); ASSERT_EQ(extended2, copiedWithPropagateAllocatorExtended2); @@ -125,10 +124,7 @@ class MultipleExtendedFieldsVariousTypesTest : public ::testing::Test bitSize += zserio::bitSizeOfVarSize(EXTENDED_VALUE5); bitSize = zserio::alignTo(8, bitSize); bitSize += std::accumulate(EXTENDED_VALUE6.begin(), EXTENDED_VALUE6.end(), static_cast(0), - [](size_t size, const string_type& str) - { - return size + zserio::bitSizeOfString(str); - }); + [](size_t size, const string_type& str) { return size + zserio::bitSizeOfString(str); }); bitSize = zserio::alignTo(8, bitSize); bitSize += 8 + 4 * 8; // extendedValue7 (choiceTag + valueU32) bitSize = zserio::alignTo(8, bitSize); @@ -153,12 +149,10 @@ class MultipleExtendedFieldsVariousTypesTest : public ::testing::Test constexpr int8_t MultipleExtendedFieldsVariousTypesTest::VALUE; constexpr uint32_t MultipleExtendedFieldsVariousTypesTest::EXTENDED_VALUE1; -const BitBuffer MultipleExtendedFieldsVariousTypesTest::EXTENDED_VALUE2 = - BitBuffer({ 0xCA, 0xFE }, 16); -const vector_type MultipleExtendedFieldsVariousTypesTest::EXTENDED_VALUE3 = { 0xDE, 0xAD }; +const BitBuffer MultipleExtendedFieldsVariousTypesTest::EXTENDED_VALUE2 = BitBuffer({0xCA, 0xFE}, 16); +const vector_type MultipleExtendedFieldsVariousTypesTest::EXTENDED_VALUE3 = {0xDE, 0xAD}; constexpr uint32_t MultipleExtendedFieldsVariousTypesTest::EXTENDED_VALUE5; -const vector_type MultipleExtendedFieldsVariousTypesTest::EXTENDED_VALUE6 = - { "this", "is", "test" }; +const vector_type MultipleExtendedFieldsVariousTypesTest::EXTENDED_VALUE6 = {"this", "is", "test"}; constexpr uint64_t MultipleExtendedFieldsVariousTypesTest::EXTENDED_VALUE9; const size_t MultipleExtendedFieldsVariousTypesTest::ORIGINAL_BIT_SIZE = 7; diff --git a/test/language/functions/cpp/ChoiceArrayTest.cpp b/test/language/functions/cpp/ChoiceArrayTest.cpp index fa5c71ade..d787c8afa 100644 --- a/test/language/functions/cpp/ChoiceArrayTest.cpp +++ b/test/language/functions/cpp/ChoiceArrayTest.cpp @@ -1,15 +1,13 @@ -#include #include - -#include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" -#include "zserio/BitStreamReader.h" +#include #include "functions/choice_array/Inner.h" #include "functions/choice_array/Item.h" #include "functions/choice_array/ItemRef.h" #include "functions/choice_array/OuterArray.h" +#include "gtest/gtest.h" +#include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace functions { diff --git a/test/language/functions/cpp/StructureArrayParamTest.cpp b/test/language/functions/cpp/StructureArrayParamTest.cpp index a9ccf5046..c8ce07449 100644 --- a/test/language/functions/cpp/StructureArrayParamTest.cpp +++ b/test/language/functions/cpp/StructureArrayParamTest.cpp @@ -1,13 +1,11 @@ -#include #include - -#include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" -#include "zserio/BitStreamReader.h" +#include #include "functions/structure_array_param/ChildStructure.h" #include "functions/structure_array_param/ParentStructure.h" +#include "gtest/gtest.h" +#include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace functions { @@ -63,15 +61,9 @@ class StructureArrayParamTest : public ::testing::Test static const std::array ANOTHER_VALUES; }; -const std::array StructureArrayParamTest::VALUES = -{ - 0xAABB, 0xCCDD -}; +const std::array StructureArrayParamTest::VALUES = {0xAABB, 0xCCDD}; -const std::array StructureArrayParamTest::ANOTHER_VALUES = -{ - 0xAABB, 0xCCDD -}; +const std::array StructureArrayParamTest::ANOTHER_VALUES = {0xAABB, 0xCCDD}; TEST_F(StructureArrayParamTest, checkParentStructure) { diff --git a/test/language/functions/cpp/StructureArrayTest.cpp b/test/language/functions/cpp/StructureArrayTest.cpp index 7fa3b14bd..423b65f56 100644 --- a/test/language/functions/cpp/StructureArrayTest.cpp +++ b/test/language/functions/cpp/StructureArrayTest.cpp @@ -1,13 +1,11 @@ -#include #include - -#include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" -#include "zserio/BitStreamReader.h" +#include #include "functions/structure_array/Item.h" #include "functions/structure_array/StructureArray.h" +#include "gtest/gtest.h" +#include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace functions { @@ -66,10 +64,7 @@ class StructureArrayTest : public ::testing::Test static const std::array ITEMS; }; -const std::array StructureArrayTest::ITEMS = -{ - Item{1, 2}, Item{3, 4}, Item{5, 6} -}; +const std::array StructureArrayTest::ITEMS = {Item{1, 2}, Item{3, 4}, Item{5, 6}}; TEST_F(StructureArrayTest, checkStructureArrayElement0) { diff --git a/test/language/functions/cpp/StructureBytesTest.cpp b/test/language/functions/cpp/StructureBytesTest.cpp index ca0f79bc5..eea1377a7 100644 --- a/test/language/functions/cpp/StructureBytesTest.cpp +++ b/test/language/functions/cpp/StructureBytesTest.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "functions/structure_bytes/TestStructure.h" - +#include "gtest/gtest.h" #include "zserio/Vector.h" namespace functions diff --git a/test/language/functions/cpp/StructureExternTest.cpp b/test/language/functions/cpp/StructureExternTest.cpp index 53337d284..6968dd9e4 100644 --- a/test/language/functions/cpp/StructureExternTest.cpp +++ b/test/language/functions/cpp/StructureExternTest.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "functions/structure_extern/TestStructure.h" - +#include "gtest/gtest.h" #include "zserio/Vector.h" namespace functions @@ -22,8 +20,7 @@ class StructureExternTest : public ::testing::Test }; const BitBuffer StructureExternTest::FIELD = BitBuffer{vector_type{{0xAB, 0xE0}}, 11}; -const BitBuffer StructureExternTest::CHILD_FIELD = - BitBuffer{vector_type{{0xCA, 0xFE}}, 15}; +const BitBuffer StructureExternTest::CHILD_FIELD = BitBuffer{vector_type{{0xCA, 0xFE}}, 15}; TEST_F(StructureExternTest, getField) { diff --git a/test/language/functions/cpp/StructureOptionalTest.cpp b/test/language/functions/cpp/StructureOptionalTest.cpp index 929aacb87..d0c355c8c 100644 --- a/test/language/functions/cpp/StructureOptionalTest.cpp +++ b/test/language/functions/cpp/StructureOptionalTest.cpp @@ -1,11 +1,9 @@ #include +#include "functions/structure_optional/ValueConsumerCreator.h" #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" - -#include "functions/structure_optional/ValueConsumerCreator.h" +#include "zserio/BitStreamWriter.h" namespace functions { @@ -20,8 +18,8 @@ class StructureOptionalTest : public ::testing::Test return (defaultValue != INVALID_DEFAULT_VALUE) ? defaultValue : externalValue; } - void writeValueConsumerCreatorToByteArray(zserio::BitStreamWriter& writer, uint8_t defaultValue, - uint8_t externalValue) + void writeValueConsumerCreatorToByteArray( + zserio::BitStreamWriter& writer, uint8_t defaultValue, uint8_t externalValue) { writer.writeBits(defaultValue, 4); if (defaultValue == INVALID_DEFAULT_VALUE) @@ -30,8 +28,8 @@ class StructureOptionalTest : public ::testing::Test writer.writeBool((calculateValue(defaultValue, externalValue) < SMALL_VALUE_THRESHOLD)); } - void createValueConsumerCreator(ValueConsumerCreator& valueConsumerCreator, uint8_t defaultValue, - uint8_t externalValue) + void createValueConsumerCreator( + ValueConsumerCreator& valueConsumerCreator, uint8_t defaultValue, uint8_t externalValue) { ValueCalculator& valueCalculator = valueConsumerCreator.getValueCalculator(); valueCalculator.setDefaultValue(defaultValue); @@ -66,10 +64,10 @@ class StructureOptionalTest : public ::testing::Test ASSERT_EQ(valueConsumerCreator, readValueConsumerCreator); } - static const uint8_t INVALID_DEFAULT_VALUE = 0; - static const uint8_t DEFAULT_VALUE = 1; - static const uint8_t EXTERNAL_VALUE = 2; - static const uint8_t SMALL_VALUE_THRESHOLD = 8; + static const uint8_t INVALID_DEFAULT_VALUE = 0; + static const uint8_t DEFAULT_VALUE = 1; + static const uint8_t EXTERNAL_VALUE = 2; + static const uint8_t SMALL_VALUE_THRESHOLD = 8; }; TEST_F(StructureOptionalTest, checkDefaultValueConsumerCreator) diff --git a/test/language/functions/cpp/StructureParamTest.cpp b/test/language/functions/cpp/StructureParamTest.cpp index 58d2396ec..acded2f81 100644 --- a/test/language/functions/cpp/StructureParamTest.cpp +++ b/test/language/functions/cpp/StructureParamTest.cpp @@ -1,12 +1,10 @@ #include -#include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" -#include "zserio/BitStreamReader.h" - #include "functions/structure_param/MetresConverter.h" #include "functions/structure_param/MetresConverterCaller.h" +#include "gtest/gtest.h" +#include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace functions { @@ -29,7 +27,7 @@ class StructureParamTest : public ::testing::Test metresConverterCaller.setCm(CONVERTED_CM_VALUE); metresConverterCaller.initializeChildren(); - } + } static const uint16_t VALUE_A = 0xABCD; static const uint16_t M_VALUE_TO_CONVERT = 2; diff --git a/test/language/functions/cpp/StructureParentChildValueTest.cpp b/test/language/functions/cpp/StructureParentChildValueTest.cpp index b7b6a88b2..91b4b3e34 100644 --- a/test/language/functions/cpp/StructureParentChildValueTest.cpp +++ b/test/language/functions/cpp/StructureParentChildValueTest.cpp @@ -1,11 +1,9 @@ #include +#include "functions/structure_parent_child_value/ParentValue.h" #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" - -#include "functions/structure_parent_child_value/ParentValue.h" +#include "zserio/BitStreamWriter.h" namespace functions { @@ -25,7 +23,7 @@ class StructureParentChildValueTest : public ::testing::Test ChildValue& childValue = parentValue.getChildValue(); childValue.setVal(CHILD_VALUE); parentValue.setChildValue(childValue); - } + } static const uint32_t CHILD_VALUE; }; diff --git a/test/language/functions/cpp/StructureStringTest.cpp b/test/language/functions/cpp/StructureStringTest.cpp index dae42a8a7..9a2b43913 100644 --- a/test/language/functions/cpp/StructureStringTest.cpp +++ b/test/language/functions/cpp/StructureStringTest.cpp @@ -1,7 +1,6 @@ -#include "gtest/gtest.h" - -#include "functions/structure_string/TestStructure.h" #include "functions/structure_string/StringPool.h" +#include "functions/structure_string/TestStructure.h" +#include "gtest/gtest.h" using namespace zserio::literals; diff --git a/test/language/functions/cpp/StructureValueTest.cpp b/test/language/functions/cpp/StructureValueTest.cpp index 898c6388c..f48a302bc 100644 --- a/test/language/functions/cpp/StructureValueTest.cpp +++ b/test/language/functions/cpp/StructureValueTest.cpp @@ -1,12 +1,10 @@ #include -#include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" -#include "zserio/BitStreamReader.h" - #include "functions/structure_value/CustomVarInt.h" #include "functions/structure_value/CustomVarList.h" +#include "gtest/gtest.h" +#include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace functions { @@ -74,9 +72,9 @@ class StructureValueTest : public ::testing::Test ASSERT_EQ(customVarInt, readcustomVarInt); } - static const uint32_t MAX_ONE_BYTE_VALUE = 253; - static const uint8_t TWO_BYTES_INDICATOR = 255; - static const uint8_t FOUR_BYTES_INDICATOR = 254; + static const uint32_t MAX_ONE_BYTE_VALUE = 253; + static const uint8_t TWO_BYTES_INDICATOR = 255; + static const uint8_t FOUR_BYTES_INDICATOR = 254; }; TEST_F(StructureValueTest, checkCustomVarIntValue42) diff --git a/test/language/functions/cpp/UnionArrayTest.cpp b/test/language/functions/cpp/UnionArrayTest.cpp index 09b83e11d..190e87abc 100644 --- a/test/language/functions/cpp/UnionArrayTest.cpp +++ b/test/language/functions/cpp/UnionArrayTest.cpp @@ -1,15 +1,13 @@ -#include #include - -#include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" -#include "zserio/BitStreamReader.h" +#include #include "functions/union_array/Inner.h" #include "functions/union_array/Item.h" #include "functions/union_array/ItemRef.h" #include "functions/union_array/OuterArray.h" +#include "gtest/gtest.h" +#include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace functions { @@ -101,10 +99,7 @@ class UnionArrayTest : public ::testing::Test static const Item EXPLICIT_ITEM; }; -const std::array UnionArrayTest::ITEMS = -{ - Item{12, 13}, Item{42, 18}, Item{17, 14} -}; +const std::array UnionArrayTest::ITEMS = {Item{12, 13}, Item{42, 18}, Item{17, 14}}; const Item UnionArrayTest::EXPLICIT_ITEM = {27, 29}; diff --git a/test/language/identifiers/cpp/BitmaskNameClashingWithJavaTest.cpp b/test/language/identifiers/cpp/BitmaskNameClashingWithJavaTest.cpp index 0b6f14fc6..80e58a6d9 100644 --- a/test/language/identifiers/cpp/BitmaskNameClashingWithJavaTest.cpp +++ b/test/language/identifiers/cpp/BitmaskNameClashingWithJavaTest.cpp @@ -1,9 +1,7 @@ #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" -#include "zserio/BitStreamReader.h" - #include "identifiers/bitmask_name_clashing_with_java/BitmaskNameClashingWithJava.h" +#include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace identifiers { diff --git a/test/language/identifiers/cpp/StructureNameClashingWithJavaTest.cpp b/test/language/identifiers/cpp/StructureNameClashingWithJavaTest.cpp index a135d79fb..198655f4e 100644 --- a/test/language/identifiers/cpp/StructureNameClashingWithJavaTest.cpp +++ b/test/language/identifiers/cpp/StructureNameClashingWithJavaTest.cpp @@ -1,9 +1,7 @@ #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" -#include "zserio/BitStreamReader.h" - #include "identifiers/structure_name_clashing_with_java/StructureNameClashingWithJava.h" +#include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace identifiers { @@ -16,8 +14,7 @@ class StructureNameClashingWithJavaTest : public ::testing::Test static const size_t BIT_SIZE; }; -const size_t StructureNameClashingWithJavaTest::BIT_SIZE = - 8 * 1 + // all auto optionals +const size_t StructureNameClashingWithJavaTest::BIT_SIZE = 8 * 1 + // all auto optionals 8 + // Byte 16 + // Short 32 + // Integer @@ -56,16 +53,9 @@ TEST_F(StructureNameClashingWithJavaTest, emptyConstructor) TEST_F(StructureNameClashingWithJavaTest, bitSizeOf) { - StructureNameClashingWithJava structureNameClashingWithJava{ - Byte{static_cast(0)}, - Short{static_cast(0)}, - Integer{static_cast(0)}, - Long{static_cast(0)}, - BigInteger{static_cast(0)}, - Float{0.0F}, - Double{0.0}, - String{""} - }; + StructureNameClashingWithJava structureNameClashingWithJava{Byte{static_cast(0)}, + Short{static_cast(0)}, Integer{static_cast(0)}, Long{static_cast(0)}, + BigInteger{static_cast(0)}, Float{0.0F}, Double{0.0}, String{""}}; ASSERT_EQ(BIT_SIZE, structureNameClashingWithJava.bitSizeOf()); } diff --git a/test/language/indexed_offsets/cpp/AutoIndexedOffsetArrayTest.cpp b/test/language/indexed_offsets/cpp/AutoIndexedOffsetArrayTest.cpp index b836f8dce..5ee76c355 100644 --- a/test/language/indexed_offsets/cpp/AutoIndexedOffsetArrayTest.cpp +++ b/test/language/indexed_offsets/cpp/AutoIndexedOffsetArrayTest.cpp @@ -1,9 +1,7 @@ #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" -#include "zserio/BitStreamReader.h" - #include "indexed_offsets/auto_indexed_offset_array/AutoIndexedOffsetArray.h" +#include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace indexed_offsets { @@ -89,21 +87,21 @@ class AutoIndexedOffsetArrayTest : public ::testing::Test data.push_back(i % 64); } - static const uint8_t NUM_ELEMENTS = 5; + static const uint8_t NUM_ELEMENTS = 5; - static const uint32_t WRONG_OFFSET = 0; + static const uint32_t WRONG_OFFSET = 0; - static const size_t AUTO_ARRAY_LENGTH_BYTE_SIZE = 1; - static const uint32_t ELEMENT0_OFFSET = AUTO_ARRAY_LENGTH_BYTE_SIZE + NUM_ELEMENTS * sizeof(uint32_t) + + static const size_t AUTO_ARRAY_LENGTH_BYTE_SIZE = 1; + static const uint32_t ELEMENT0_OFFSET = AUTO_ARRAY_LENGTH_BYTE_SIZE + NUM_ELEMENTS * sizeof(uint32_t) + sizeof(uint8_t) + AUTO_ARRAY_LENGTH_BYTE_SIZE; - static const uint8_t ELEMENT_SIZE = 5; - static const uint8_t ALIGNED_ELEMENT_SIZE = 8; - static const uint8_t ALIGNED_ELEMENT_BYTE_SIZE = ALIGNED_ELEMENT_SIZE / 8; + static const uint8_t ELEMENT_SIZE = 5; + static const uint8_t ALIGNED_ELEMENT_SIZE = 8; + static const uint8_t ALIGNED_ELEMENT_BYTE_SIZE = ALIGNED_ELEMENT_SIZE / 8; - static const uint8_t SPACER_VALUE = 1; + static const uint8_t SPACER_VALUE = 1; - static const size_t AUTO_INDEXED_OFFSET_ARRAY_BIT_SIZE = ELEMENT0_OFFSET * 8 + - (NUM_ELEMENTS - 1) * ALIGNED_ELEMENT_SIZE + ELEMENT_SIZE; + static const size_t AUTO_INDEXED_OFFSET_ARRAY_BIT_SIZE = + ELEMENT0_OFFSET * 8 + (NUM_ELEMENTS - 1) * ALIGNED_ELEMENT_SIZE + ELEMENT_SIZE; zserio::BitBuffer bitBuffer = zserio::BitBuffer(1024 * 8); }; diff --git a/test/language/indexed_offsets/cpp/Bit5IndexedOffsetArrayTest.cpp b/test/language/indexed_offsets/cpp/Bit5IndexedOffsetArrayTest.cpp index 8940d5a08..87313fcee 100644 --- a/test/language/indexed_offsets/cpp/Bit5IndexedOffsetArrayTest.cpp +++ b/test/language/indexed_offsets/cpp/Bit5IndexedOffsetArrayTest.cpp @@ -1,9 +1,7 @@ #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" -#include "zserio/BitStreamReader.h" - #include "indexed_offsets/bit5_indexed_offset_array/Bit5IndexedOffsetArray.h" +#include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace indexed_offsets { @@ -87,19 +85,19 @@ class Bit5IndexedOffsetArrayTest : public ::testing::Test data.push_back(i % 64); } - static const uint8_t NUM_ELEMENTS = 5; + static const uint8_t NUM_ELEMENTS = 5; - static const uint32_t WRONG_OFFSET = 0; + static const uint32_t WRONG_OFFSET = 0; - static const uint32_t ELEMENT0_OFFSET = NUM_ELEMENTS * sizeof(uint32_t) + sizeof(uint8_t); - static const uint8_t ELEMENT_SIZE = 5; - static const uint8_t ALIGNED_ELEMENT_SIZE = 8; - static const uint8_t ALIGNED_ELEMENT_BYTE_SIZE = ALIGNED_ELEMENT_SIZE / 8; + static const uint32_t ELEMENT0_OFFSET = NUM_ELEMENTS * sizeof(uint32_t) + sizeof(uint8_t); + static const uint8_t ELEMENT_SIZE = 5; + static const uint8_t ALIGNED_ELEMENT_SIZE = 8; + static const uint8_t ALIGNED_ELEMENT_BYTE_SIZE = ALIGNED_ELEMENT_SIZE / 8; - static const uint8_t SPACER_VALUE = 1; + static const uint8_t SPACER_VALUE = 1; - static const size_t BIT5_indexed_offset_ARRAY_BIT_SIZE = ELEMENT0_OFFSET * 8 + - (NUM_ELEMENTS - 1) * ALIGNED_ELEMENT_SIZE + ELEMENT_SIZE; + static const size_t BIT5_indexed_offset_ARRAY_BIT_SIZE = + ELEMENT0_OFFSET * 8 + (NUM_ELEMENTS - 1) * ALIGNED_ELEMENT_SIZE + ELEMENT_SIZE; zserio::BitBuffer bitBuffer = zserio::BitBuffer(1024 * 8); }; diff --git a/test/language/indexed_offsets/cpp/BoolIndexedOffsetArrayTest.cpp b/test/language/indexed_offsets/cpp/BoolIndexedOffsetArrayTest.cpp index f983468fb..d202bec0f 100644 --- a/test/language/indexed_offsets/cpp/BoolIndexedOffsetArrayTest.cpp +++ b/test/language/indexed_offsets/cpp/BoolIndexedOffsetArrayTest.cpp @@ -1,9 +1,7 @@ #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" -#include "zserio/BitStreamReader.h" - #include "indexed_offsets/bool_indexed_offset_array/BoolIndexedOffsetArray.h" +#include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace indexed_offsets { @@ -87,19 +85,19 @@ class BoolIndexedOffsetArrayTest : public ::testing::Test data.push_back((i & 0x01U) != 0); } - static const uint8_t NUM_ELEMENTS = 5; + static const uint8_t NUM_ELEMENTS = 5; - static const uint32_t WRONG_OFFSET = 0; + static const uint32_t WRONG_OFFSET = 0; - static const uint32_t ELEMENT0_OFFSET = NUM_ELEMENTS * sizeof(uint32_t) + sizeof(uint8_t); - static const uint8_t ELEMENT_SIZE = 1; - static const uint8_t ALIGNED_ELEMENT_SIZE = 8; - static const uint8_t ALIGNED_ELEMENT_BYTE_SIZE = ALIGNED_ELEMENT_SIZE / 8; + static const uint32_t ELEMENT0_OFFSET = NUM_ELEMENTS * sizeof(uint32_t) + sizeof(uint8_t); + static const uint8_t ELEMENT_SIZE = 1; + static const uint8_t ALIGNED_ELEMENT_SIZE = 8; + static const uint8_t ALIGNED_ELEMENT_BYTE_SIZE = ALIGNED_ELEMENT_SIZE / 8; - static const uint8_t SPACER_VALUE = 1; + static const uint8_t SPACER_VALUE = 1; - static const size_t BOOL_indexed_offset_ARRAY_BIT_SIZE = ELEMENT0_OFFSET * 8 + - (NUM_ELEMENTS - 1) * ALIGNED_ELEMENT_SIZE + ELEMENT_SIZE; + static const size_t BOOL_indexed_offset_ARRAY_BIT_SIZE = + ELEMENT0_OFFSET * 8 + (NUM_ELEMENTS - 1) * ALIGNED_ELEMENT_SIZE + ELEMENT_SIZE; zserio::BitBuffer bitBuffer = zserio::BitBuffer(1024 * 8); }; diff --git a/test/language/indexed_offsets/cpp/CompoundIndexedOffsetArrayTest.cpp b/test/language/indexed_offsets/cpp/CompoundIndexedOffsetArrayTest.cpp index 4a7ae8439..55ad28d4d 100644 --- a/test/language/indexed_offsets/cpp/CompoundIndexedOffsetArrayTest.cpp +++ b/test/language/indexed_offsets/cpp/CompoundIndexedOffsetArrayTest.cpp @@ -1,9 +1,7 @@ #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" -#include "zserio/BitStreamReader.h" - #include "indexed_offsets/compound_indexed_offset_array/CompoundIndexedOffsetArray.h" +#include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace indexed_offsets { @@ -70,8 +68,8 @@ class CompoundIndexedOffsetArrayTest : public ::testing::Test } } - void fillCompoundIndexedOffsetArray(CompoundIndexedOffsetArray& compoundIndexedOffsetArray, - bool createWrongOffsets) + void fillCompoundIndexedOffsetArray( + CompoundIndexedOffsetArray& compoundIndexedOffsetArray, bool createWrongOffsets) { auto& offsets = compoundIndexedOffsetArray.getOffsets(); offsets.reserve(NUM_ELEMENTS); @@ -98,19 +96,19 @@ class CompoundIndexedOffsetArrayTest : public ::testing::Test } } - static const uint8_t NUM_ELEMENTS = 5; + static const uint8_t NUM_ELEMENTS = 5; - static const uint32_t WRONG_OFFSET = 0; + static const uint32_t WRONG_OFFSET = 0; - static const uint32_t ELEMENT0_OFFSET = NUM_ELEMENTS * sizeof(uint32_t) + sizeof(uint8_t); - static const uint8_t ELEMENT_SIZE = 35; - static const uint8_t ALIGNED_ELEMENT_SIZE = 5 * 8; - static const uint8_t ALIGNED_ELEMENT_BYTE_SIZE = ALIGNED_ELEMENT_SIZE / 8; + static const uint32_t ELEMENT0_OFFSET = NUM_ELEMENTS * sizeof(uint32_t) + sizeof(uint8_t); + static const uint8_t ELEMENT_SIZE = 35; + static const uint8_t ALIGNED_ELEMENT_SIZE = 5 * 8; + static const uint8_t ALIGNED_ELEMENT_BYTE_SIZE = ALIGNED_ELEMENT_SIZE / 8; - static const uint8_t SPACER_VALUE = 1; + static const uint8_t SPACER_VALUE = 1; - static const size_t COMPOUND_INDEXED_OFFSET_ARRAY_BIT_SIZE = ELEMENT0_OFFSET * 8 + - (NUM_ELEMENTS - 1) * ALIGNED_ELEMENT_SIZE + ELEMENT_SIZE; + static const size_t COMPOUND_INDEXED_OFFSET_ARRAY_BIT_SIZE = + ELEMENT0_OFFSET * 8 + (NUM_ELEMENTS - 1) * ALIGNED_ELEMENT_SIZE + ELEMENT_SIZE; zserio::BitBuffer bitBuffer = zserio::BitBuffer(1024 * 8); }; @@ -133,8 +131,7 @@ TEST_F(CompoundIndexedOffsetArrayTest, readWrongOffsets) writeCompoundIndexedOffsetArrayToByteArray(writer, writeWrongOffsets); zserio::BitStreamReader reader(writer.getWriteBuffer(), writer.getBitPosition(), zserio::BitsTag()); - EXPECT_THROW(CompoundIndexedOffsetArray compoundIndexedOffsetArray(reader), - zserio::CppRuntimeException); + EXPECT_THROW(CompoundIndexedOffsetArray compoundIndexedOffsetArray(reader), zserio::CppRuntimeException); } TEST_F(CompoundIndexedOffsetArrayTest, bitSizeOf) diff --git a/test/language/indexed_offsets/cpp/EmptyIndexedOffsetArrayTest.cpp b/test/language/indexed_offsets/cpp/EmptyIndexedOffsetArrayTest.cpp index 3015aa12b..800efcfcb 100644 --- a/test/language/indexed_offsets/cpp/EmptyIndexedOffsetArrayTest.cpp +++ b/test/language/indexed_offsets/cpp/EmptyIndexedOffsetArrayTest.cpp @@ -1,9 +1,7 @@ #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" -#include "zserio/BitStreamReader.h" - #include "indexed_offsets/empty_indexed_offset_array/EmptyIndexedOffsetArray.h" +#include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace indexed_offsets { @@ -41,12 +39,12 @@ class EmptyIndexedOffsetArrayTest : public ::testing::Test emptyIndexedOffsetArray.setField(FIELD_VALUE); } - static const uint8_t NUM_ELEMENTS = 0; + static const uint8_t NUM_ELEMENTS = 0; - static const uint8_t SPACER_VALUE = 1; - static const uint8_t FIELD_VALUE = 63; + static const uint8_t SPACER_VALUE = 1; + static const uint8_t FIELD_VALUE = 63; - static const size_t EMPTY_INDEXED_OFFSET_ARRAY_BIT_SIZE = 1 + 6; + static const size_t EMPTY_INDEXED_OFFSET_ARRAY_BIT_SIZE = 1 + 6; zserio::BitBuffer bitBuffer = zserio::BitBuffer(1024 * 8); }; diff --git a/test/language/indexed_offsets/cpp/Int14IndexedOffsetArrayTest.cpp b/test/language/indexed_offsets/cpp/Int14IndexedOffsetArrayTest.cpp index ec7f18fd7..70b8217fc 100644 --- a/test/language/indexed_offsets/cpp/Int14IndexedOffsetArrayTest.cpp +++ b/test/language/indexed_offsets/cpp/Int14IndexedOffsetArrayTest.cpp @@ -1,9 +1,7 @@ #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" -#include "zserio/BitStreamReader.h" - #include "indexed_offsets/int14_indexed_offset_array/Int14IndexedOffsetArray.h" +#include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace indexed_offsets { @@ -87,19 +85,19 @@ class Int14IndexedOffsetArrayTest : public ::testing::Test data.push_back(i); } - static const uint8_t NUM_ELEMENTS = 5; + static const uint8_t NUM_ELEMENTS = 5; - static const uint32_t WRONG_OFFSET = 0; + static const uint32_t WRONG_OFFSET = 0; - static const uint32_t ELEMENT0_OFFSET = NUM_ELEMENTS * sizeof(uint32_t) + sizeof(uint8_t); - static const uint8_t ELEMENT_SIZE = 14; - static const uint8_t ALIGNED_ELEMENT_SIZE = 2 * 8; - static const uint8_t ALIGNED_ELEMENT_BYTE_SIZE = ALIGNED_ELEMENT_SIZE / 8; + static const uint32_t ELEMENT0_OFFSET = NUM_ELEMENTS * sizeof(uint32_t) + sizeof(uint8_t); + static const uint8_t ELEMENT_SIZE = 14; + static const uint8_t ALIGNED_ELEMENT_SIZE = 2 * 8; + static const uint8_t ALIGNED_ELEMENT_BYTE_SIZE = ALIGNED_ELEMENT_SIZE / 8; - static const uint8_t SPACER_VALUE = 1; + static const uint8_t SPACER_VALUE = 1; - static const size_t INT14_INDEXED_OFFSET_ARRAY_BIT_SIZE = ELEMENT0_OFFSET * 8 + - (NUM_ELEMENTS - 1) * ALIGNED_ELEMENT_SIZE + ELEMENT_SIZE; + static const size_t INT14_INDEXED_OFFSET_ARRAY_BIT_SIZE = + ELEMENT0_OFFSET * 8 + (NUM_ELEMENTS - 1) * ALIGNED_ELEMENT_SIZE + ELEMENT_SIZE; zserio::BitBuffer bitBuffer = zserio::BitBuffer(1024 * 8); }; diff --git a/test/language/indexed_offsets/cpp/OptionalIndexedOffsetArrayTest.cpp b/test/language/indexed_offsets/cpp/OptionalIndexedOffsetArrayTest.cpp index 35cd8d013..58a998a2d 100644 --- a/test/language/indexed_offsets/cpp/OptionalIndexedOffsetArrayTest.cpp +++ b/test/language/indexed_offsets/cpp/OptionalIndexedOffsetArrayTest.cpp @@ -1,12 +1,10 @@ #include #include "gtest/gtest.h" - #include "indexed_offsets/optional_indexed_offset_array/OptionalIndexedOffsetArray.h" - -#include "zserio/RebindAlloc.h" -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" +#include "zserio/RebindAlloc.h" namespace indexed_offsets { @@ -28,8 +26,8 @@ class OptionalIndexedOffsetArrayTest : public ::testing::Test } protected: - void writeOptionalIndexedOffsetArrayToByteArray(zserio::BitStreamWriter& writer, bool hasOptional, - bool writeWrongOffsets) + void writeOptionalIndexedOffsetArrayToByteArray( + zserio::BitStreamWriter& writer, bool hasOptional, bool writeWrongOffsets) { const uint32_t wrongOffset = WRONG_OFFSET; uint32_t currentOffset = ELEMENT0_OFFSET; @@ -67,8 +65,8 @@ class OptionalIndexedOffsetArrayTest : public ::testing::Test } } - void checkOptionalIndexedOffsetArray(const OptionalIndexedOffsetArray& optionalIndexedOffsetArray, - bool hasOptional) + void checkOptionalIndexedOffsetArray( + const OptionalIndexedOffsetArray& optionalIndexedOffsetArray, bool hasOptional) { const uint16_t offsetShift = 0; checkOffsets(optionalIndexedOffsetArray, offsetShift); @@ -88,8 +86,8 @@ class OptionalIndexedOffsetArrayTest : public ::testing::Test ASSERT_EQ(expectedField, optionalIndexedOffsetArray.getField()); } - void fillOptionalIndexedOffsetArray(OptionalIndexedOffsetArray& optionalIndexedOffsetArray, - bool hasOptional, bool createWrongOffsets) + void fillOptionalIndexedOffsetArray( + OptionalIndexedOffsetArray& optionalIndexedOffsetArray, bool hasOptional, bool createWrongOffsets) { vector_type& offsets = optionalIndexedOffsetArray.getOffsets(); offsets.reserve(NUM_ELEMENTS); @@ -125,12 +123,12 @@ class OptionalIndexedOffsetArrayTest : public ::testing::Test return bitSize; } - static const uint8_t NUM_ELEMENTS = 5; + static const uint8_t NUM_ELEMENTS = 5; - static const uint32_t WRONG_OFFSET = 0; - static const uint32_t ELEMENT0_OFFSET = NUM_ELEMENTS * sizeof(uint32_t) + sizeof(uint8_t); + static const uint32_t WRONG_OFFSET = 0; + static const uint32_t ELEMENT0_OFFSET = NUM_ELEMENTS * sizeof(uint32_t) + sizeof(uint8_t); - static const uint8_t FIELD_VALUE = 63; + static const uint8_t FIELD_VALUE = 63; zserio::BitBuffer bitBuffer = zserio::BitBuffer(1024 * 8); diff --git a/test/language/indexed_offsets/cpp/OptionalNestedIndexedOffsetArrayTest.cpp b/test/language/indexed_offsets/cpp/OptionalNestedIndexedOffsetArrayTest.cpp index 57c52c318..99f32dee1 100644 --- a/test/language/indexed_offsets/cpp/OptionalNestedIndexedOffsetArrayTest.cpp +++ b/test/language/indexed_offsets/cpp/OptionalNestedIndexedOffsetArrayTest.cpp @@ -1,13 +1,11 @@ #include #include "gtest/gtest.h" - -#include "indexed_offsets/optional_nested_indexed_offset_array/OptionalNestedIndexedOffsetArray.h" #include "indexed_offsets/optional_nested_indexed_offset_array/Header.h" - -#include "zserio/RebindAlloc.h" -#include "zserio/BitStreamWriter.h" +#include "indexed_offsets/optional_nested_indexed_offset_array/OptionalNestedIndexedOffsetArray.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" +#include "zserio/RebindAlloc.h" namespace indexed_offsets { @@ -29,8 +27,8 @@ class OptionalNestedIndexedOffsetArrayTest : public ::testing::Test } protected: - void writeOptionalNestedIndexedOffsetArrayToByteArray(zserio::BitStreamWriter& writer, uint16_t length, - bool writeWrongOffsets) + void writeOptionalNestedIndexedOffsetArrayToByteArray( + zserio::BitStreamWriter& writer, uint16_t length, bool writeWrongOffsets) { writer.writeBits(length, 16); @@ -55,8 +53,8 @@ class OptionalNestedIndexedOffsetArrayTest : public ::testing::Test writer.writeBits(FIELD_VALUE, 6); } - void checkOffsets(const OptionalNestedIndexedOffsetArray& optionalNestedIndexedOffsetArray, - uint16_t offsetShift) + void checkOffsets( + const OptionalNestedIndexedOffsetArray& optionalNestedIndexedOffsetArray, uint16_t offsetShift) { const uint16_t length = optionalNestedIndexedOffsetArray.getHeader().getLength(); const vector_type& offsets = optionalNestedIndexedOffsetArray.getHeader().getOffsets(); @@ -116,7 +114,7 @@ class OptionalNestedIndexedOffsetArrayTest : public ::testing::Test size_t getOptionalNestedIndexedOffsetArrayBitSize(uint16_t length) { - size_t bitSize = sizeof(int16_t) * 8 + length * sizeof(uint32_t) * 8; + size_t bitSize = sizeof(int16_t) * 8 + length * sizeof(uint32_t) * 8; if (length > 0) { // already aligned @@ -128,12 +126,12 @@ class OptionalNestedIndexedOffsetArrayTest : public ::testing::Test return bitSize; } - static const uint8_t NUM_ELEMENTS = 5; + static const uint8_t NUM_ELEMENTS = 5; - static const uint32_t WRONG_OFFSET = 0; - static const uint32_t ELEMENT0_OFFSET = sizeof(int16_t) + NUM_ELEMENTS * sizeof(uint32_t); + static const uint32_t WRONG_OFFSET = 0; + static const uint32_t ELEMENT0_OFFSET = sizeof(int16_t) + NUM_ELEMENTS * sizeof(uint32_t); - static const uint8_t FIELD_VALUE = 63; + static const uint8_t FIELD_VALUE = 63; zserio::BitBuffer bitBuffer = zserio::BitBuffer(1024 * 8); diff --git a/test/language/indexed_offsets/cpp/PackedAutoIndexedOffsetArrayTest.cpp b/test/language/indexed_offsets/cpp/PackedAutoIndexedOffsetArrayTest.cpp index 21a124e80..791197ac7 100644 --- a/test/language/indexed_offsets/cpp/PackedAutoIndexedOffsetArrayTest.cpp +++ b/test/language/indexed_offsets/cpp/PackedAutoIndexedOffsetArrayTest.cpp @@ -1,8 +1,6 @@ #include "gtest/gtest.h" - -#include "zserio/SerializeUtil.h" - #include "indexed_offsets/packed_auto_indexed_offset_array/AutoIndexedOffsetArray.h" +#include "zserio/SerializeUtil.h" namespace indexed_offsets { @@ -95,26 +93,25 @@ class PackedAutoIndexedOffsetArrayTest : public ::testing::Test static const std::string BLOB_NAME; - static const uint8_t NUM_ELEMENTS = 5; + static const uint8_t NUM_ELEMENTS = 5; - static const uint32_t WRONG_OFFSET = 0; + static const uint32_t WRONG_OFFSET = 0; - static const size_t AUTO_ARRAY_LENGTH_BYTE_SIZE = 1; - static const uint32_t ELEMENT0_OFFSET = AUTO_ARRAY_LENGTH_BYTE_SIZE + NUM_ELEMENTS * 4 + + static const size_t AUTO_ARRAY_LENGTH_BYTE_SIZE = 1; + static const uint32_t ELEMENT0_OFFSET = AUTO_ARRAY_LENGTH_BYTE_SIZE + NUM_ELEMENTS * 4 + (3 + AUTO_ARRAY_LENGTH_BYTE_SIZE * 8 + 5 /* alignment */) / 8; - static const uint8_t ELEMENT_SIZE = 5; - static const uint8_t ALIGNED_FIRST_ELEMENT_SIZE = 1 + 6 + ELEMENT_SIZE + 4 /* alignment */; - static const uint8_t ALIGNED_FIRST_ELEMENT_BYTE_SIZE = ALIGNED_FIRST_ELEMENT_SIZE / 8; - static const uint8_t ALIGNED_ELEMENT_SIZE = 8; - static const uint8_t ALIGNED_ELEMENT_BYTE_SIZE = ALIGNED_ELEMENT_SIZE / 8; + static const uint8_t ELEMENT_SIZE = 5; + static const uint8_t ALIGNED_FIRST_ELEMENT_SIZE = 1 + 6 + ELEMENT_SIZE + 4 /* alignment */; + static const uint8_t ALIGNED_FIRST_ELEMENT_BYTE_SIZE = ALIGNED_FIRST_ELEMENT_SIZE / 8; + static const uint8_t ALIGNED_ELEMENT_SIZE = 8; + static const uint8_t ALIGNED_ELEMENT_BYTE_SIZE = ALIGNED_ELEMENT_SIZE / 8; - static const uint8_t SPACER_VALUE = 7; + static const uint8_t SPACER_VALUE = 7; - static const int8_t PACKED_ARRAY_DELTA = 1; - static const uint8_t PACKED_ARRAY_MAX_BIT_NUMBER = 1; + static const int8_t PACKED_ARRAY_DELTA = 1; + static const uint8_t PACKED_ARRAY_MAX_BIT_NUMBER = 1; - static const size_t AUTO_INDEXED_OFFSET_ARRAY_BIT_SIZE = ELEMENT0_OFFSET * 8 + - ALIGNED_FIRST_ELEMENT_SIZE + + static const size_t AUTO_INDEXED_OFFSET_ARRAY_BIT_SIZE = ELEMENT0_OFFSET * 8 + ALIGNED_FIRST_ELEMENT_SIZE + (NUM_ELEMENTS - 2) * ALIGNED_ELEMENT_SIZE + PACKED_ARRAY_MAX_BIT_NUMBER + 1; zserio::BitBuffer bitBuffer = zserio::BitBuffer(1024 * 8); diff --git a/test/language/indexed_offsets/cpp/PackedIndexedOffsetArrayHolderTest.cpp b/test/language/indexed_offsets/cpp/PackedIndexedOffsetArrayHolderTest.cpp index bccec4ecd..3e472ad82 100644 --- a/test/language/indexed_offsets/cpp/PackedIndexedOffsetArrayHolderTest.cpp +++ b/test/language/indexed_offsets/cpp/PackedIndexedOffsetArrayHolderTest.cpp @@ -1,8 +1,6 @@ #include "gtest/gtest.h" - -#include "zserio/SerializeUtil.h" - #include "indexed_offsets/packed_indexed_offset_array_holder/AutoIndexedOffsetArray.h" +#include "zserio/SerializeUtil.h" namespace indexed_offsets { @@ -67,8 +65,7 @@ class PackedIndexedOffsetArrayHolderTest : public ::testing::Test ASSERT_GT(unpackedBitSize * minCompressionRation, packedBitSize) << "Unpacked array has " << std::to_string(unpackedBitSize) << " bits, " << "packed array has " << std::to_string(packedBitSize) << " bits, " - << "compression ratio is " - << std::to_string(packedBitSize / unpackedBitSize * 100) << "%!"; + << "compression ratio is " << std::to_string(packedBitSize / unpackedBitSize * 100) << "%!"; } void checkWriteRead(size_t numElements) diff --git a/test/language/indexed_offsets/cpp/VarInt32IndexedOffsetArrayTest.cpp b/test/language/indexed_offsets/cpp/VarInt32IndexedOffsetArrayTest.cpp index 170af1762..c83ad1c74 100644 --- a/test/language/indexed_offsets/cpp/VarInt32IndexedOffsetArrayTest.cpp +++ b/test/language/indexed_offsets/cpp/VarInt32IndexedOffsetArrayTest.cpp @@ -1,9 +1,7 @@ #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" -#include "zserio/BitStreamReader.h" - #include "indexed_offsets/varint32_indexed_offset_array/VarInt32IndexedOffsetArray.h" +#include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace indexed_offsets { @@ -63,8 +61,8 @@ class VarInt32IndexedOffsetArrayTest : public ::testing::Test ASSERT_EQ(i, data[i]); } - void fillVarInt32IndexedOffsetArray(VarInt32IndexedOffsetArray& varint32IndexedOffsetArray, - bool createWrongOffsets) + void fillVarInt32IndexedOffsetArray( + VarInt32IndexedOffsetArray& varint32IndexedOffsetArray, bool createWrongOffsets) { auto& offsets = varint32IndexedOffsetArray.getOffsets(); offsets.reserve(NUM_ELEMENTS); @@ -95,12 +93,12 @@ class VarInt32IndexedOffsetArrayTest : public ::testing::Test return bitSize; } - static const uint8_t NUM_ELEMENTS = 5; - static const uint32_t WRONG_OFFSET = 0; + static const uint8_t NUM_ELEMENTS = 5; + static const uint32_t WRONG_OFFSET = 0; - static const uint32_t ELEMENT0_OFFSET = NUM_ELEMENTS * sizeof(uint32_t) + sizeof(uint8_t); + static const uint32_t ELEMENT0_OFFSET = NUM_ELEMENTS * sizeof(uint32_t) + sizeof(uint8_t); - static const uint8_t SPACER_VALUE = 1; + static const uint8_t SPACER_VALUE = 1; zserio::BitBuffer bitBuffer = zserio::BitBuffer(1024 * 8); }; @@ -123,8 +121,7 @@ TEST_F(VarInt32IndexedOffsetArrayTest, readWrongOffsets) writeVarInt32IndexedOffsetArrayToByteArray(writer, writeWrongOffsets); zserio::BitStreamReader reader(writer.getWriteBuffer(), writer.getBitPosition(), zserio::BitsTag()); - EXPECT_THROW(VarInt32IndexedOffsetArray varint32IndexedOffsetArray(reader), - zserio::CppRuntimeException); + EXPECT_THROW(VarInt32IndexedOffsetArray varint32IndexedOffsetArray(reader), zserio::CppRuntimeException); } TEST_F(VarInt32IndexedOffsetArrayTest, bitSizeOf) diff --git a/test/language/literals/cpp/LiteralsTest.cpp b/test/language/literals/cpp/LiteralsTest.cpp index b095a6084..8d7487027 100644 --- a/test/language/literals/cpp/LiteralsTest.cpp +++ b/test/language/literals/cpp/LiteralsTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "literals/BINARY_NEGATIVE.h" #include "literals/BINARY_POSITIVE.h" #include "literals/BINARY_POSITIVE_WITH_CAPITAL_B.h" diff --git a/test/language/member_access/cpp/AccessWithinTypeTest.cpp b/test/language/member_access/cpp/AccessWithinTypeTest.cpp index b53837506..9b497bc5a 100644 --- a/test/language/member_access/cpp/AccessWithinTypeTest.cpp +++ b/test/language/member_access/cpp/AccessWithinTypeTest.cpp @@ -1,12 +1,10 @@ #include #include "gtest/gtest.h" - #include "member_access/access_within_type/Message.h" - -#include "zserio/RebindAlloc.h" -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" +#include "zserio/RebindAlloc.h" #include "zserio/StringConvertUtil.h" namespace member_access @@ -22,8 +20,7 @@ using vector_type = zserio::vector; class AccessWithinTypeTest : public ::testing::Test { protected: - void writeMessageToByteArray(zserio::BitStreamWriter& writer, uint16_t numSentences, - bool wrongArrayLength) + void writeMessageToByteArray(zserio::BitStreamWriter& writer, uint16_t numSentences, bool wrongArrayLength) { writer.writeBits(VERSION_VALUE, 16); writer.writeBits(numSentences, 16); @@ -66,7 +63,7 @@ class AccessWithinTypeTest : public ::testing::Test return string_type("This is sentence #") + zserio::toString(index); } - static const uint16_t VERSION_VALUE = 0xAB; + static const uint16_t VERSION_VALUE = 0xAB; zserio::BitBuffer bitBuffer = zserio::BitBuffer(1024 * 8); }; diff --git a/test/language/offsets/cpp/AutoArrayOffsetTest.cpp b/test/language/offsets/cpp/AutoArrayOffsetTest.cpp index a8b651b76..141b912b1 100644 --- a/test/language/offsets/cpp/AutoArrayOffsetTest.cpp +++ b/test/language/offsets/cpp/AutoArrayOffsetTest.cpp @@ -1,10 +1,8 @@ #include "gtest/gtest.h" - #include "offsets/auto_array_offset/AutoArrayHolder.h" - -#include "zserio/RebindAlloc.h" -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" +#include "zserio/RebindAlloc.h" namespace offsets { @@ -62,24 +60,24 @@ class AutoArrayOffsetTest : public ::testing::Test autoArrayHolder.setAutoArray(autoArray); } - static const size_t AUTO_ARRAY_LENGTH; - static const uint8_t FORCED_ALIGNMENT_VALUE; + static const size_t AUTO_ARRAY_LENGTH; + static const uint8_t FORCED_ALIGNMENT_VALUE; - static const uint32_t WRONG_AUTO_ARRAY_OFFSET; - static const uint32_t AUTO_ARRAY_OFFSET; + static const uint32_t WRONG_AUTO_ARRAY_OFFSET; + static const uint32_t AUTO_ARRAY_OFFSET; - static const size_t AUTO_ARRAY_HOLDER_BIT_SIZE; + static const size_t AUTO_ARRAY_HOLDER_BIT_SIZE; zserio::BitBuffer bitBuffer = zserio::BitBuffer(1024 * 8); }; -const size_t AutoArrayOffsetTest::AUTO_ARRAY_LENGTH = 5; -const uint8_t AutoArrayOffsetTest::FORCED_ALIGNMENT_VALUE = 0; +const size_t AutoArrayOffsetTest::AUTO_ARRAY_LENGTH = 5; +const uint8_t AutoArrayOffsetTest::FORCED_ALIGNMENT_VALUE = 0; -const uint32_t AutoArrayOffsetTest::WRONG_AUTO_ARRAY_OFFSET = 0; -const uint32_t AutoArrayOffsetTest::AUTO_ARRAY_OFFSET = 5; +const uint32_t AutoArrayOffsetTest::WRONG_AUTO_ARRAY_OFFSET = 0; +const uint32_t AutoArrayOffsetTest::AUTO_ARRAY_OFFSET = 5; -const size_t AutoArrayOffsetTest::AUTO_ARRAY_HOLDER_BIT_SIZE = 32 + 1 + 7 + 8 + AUTO_ARRAY_LENGTH * 7; +const size_t AutoArrayOffsetTest::AUTO_ARRAY_HOLDER_BIT_SIZE = 32 + 1 + 7 + 8 + AUTO_ARRAY_LENGTH * 7; TEST_F(AutoArrayOffsetTest, readConstructor) { diff --git a/test/language/offsets/cpp/BitOffsetTest.cpp b/test/language/offsets/cpp/BitOffsetTest.cpp index 15e9a941d..393b0708a 100644 --- a/test/language/offsets/cpp/BitOffsetTest.cpp +++ b/test/language/offsets/cpp/BitOffsetTest.cpp @@ -1,11 +1,9 @@ #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" +#include "offsets/bit_offset/BitOffset.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" #include "zserio/CppRuntimeException.h" -#include "offsets/bit_offset/BitOffset.h" - namespace offsets { namespace bit_offset @@ -142,32 +140,32 @@ class BitOffsetTest : public ::testing::Test static const size_t BIT_OFFSET_BIT_SIZE = 192; - static const uint8_t WRONG_FIELD1_OFFSET = 0; + static const uint8_t WRONG_FIELD1_OFFSET = 0; static const uint16_t WRONG_FIELD2_OFFSET = 0; static const uint32_t WRONG_FIELD3_OFFSET = 0; - static const uint8_t WRONG_FIELD4_OFFSET = 0; + static const uint8_t WRONG_FIELD4_OFFSET = 0; static const uint16_t WRONG_FIELD5_OFFSET = 0; static const uint32_t WRONG_FIELD6_OFFSET = 0; static const uint32_t WRONG_FIELD7_OFFSET = 0; - static const uint8_t WRONG_FIELD8_OFFSET = 0; + static const uint8_t WRONG_FIELD8_OFFSET = 0; - static const uint8_t FIELD1_OFFSET = 16; + static const uint8_t FIELD1_OFFSET = 16; static const uint16_t FIELD2_OFFSET = 17; static const uint32_t FIELD3_OFFSET = 18; - static const uint8_t FIELD4_OFFSET = 19; + static const uint8_t FIELD4_OFFSET = 19; static const uint16_t FIELD5_OFFSET = 20; static const uint32_t FIELD6_OFFSET = 21; static const uint32_t FIELD7_OFFSET = 22; - static const uint8_t FIELD8_OFFSET = 23; - - static const uint8_t FIELD1_VALUE = 1; - static const uint8_t FIELD2_VALUE = 2; - static const uint8_t FIELD3_VALUE = 5; - static const uint8_t FIELD4_VALUE = 13; - static const uint8_t FIELD5_VALUE = 26; - static const uint8_t FIELD6_VALUE = 56; - static const uint8_t FIELD7_VALUE = 88; - static const uint8_t FIELD8_VALUE = 222; + static const uint8_t FIELD8_OFFSET = 23; + + static const uint8_t FIELD1_VALUE = 1; + static const uint8_t FIELD2_VALUE = 2; + static const uint8_t FIELD3_VALUE = 5; + static const uint8_t FIELD4_VALUE = 13; + static const uint8_t FIELD5_VALUE = 26; + static const uint8_t FIELD6_VALUE = 56; + static const uint8_t FIELD7_VALUE = 88; + static const uint8_t FIELD8_VALUE = 222; zserio::BitBuffer bitBuffer = zserio::BitBuffer(1024 * 8); }; diff --git a/test/language/offsets/cpp/NestedOffsetTest.cpp b/test/language/offsets/cpp/NestedOffsetTest.cpp index 1041527b5..877ce3334 100644 --- a/test/language/offsets/cpp/NestedOffsetTest.cpp +++ b/test/language/offsets/cpp/NestedOffsetTest.cpp @@ -1,9 +1,7 @@ #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" -#include "zserio/BitStreamReader.h" - #include "offsets/nested_offset/NestedOffset.h" +#include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace offsets { @@ -46,8 +44,7 @@ class NestedOffsetTest : public ::testing::Test nestedOffsetUnion.getNestedOffsetArrayStructure(); ASSERT_EQ(NUM_ELEMENTS, nestedOffsetArrayStructure.getNumElements()); - const auto& nestedOffsetStructureList = - nestedOffsetArrayStructure.getNestedOffsetStructureList(); + const auto& nestedOffsetStructureList = nestedOffsetArrayStructure.getNestedOffsetStructureList(); ASSERT_EQ(NUM_ELEMENTS, nestedOffsetStructureList.size()); for (uint32_t i = 0; i < NUM_ELEMENTS; ++i) { @@ -75,8 +72,7 @@ class NestedOffsetTest : public ::testing::Test NestedOffsetUnion nestedOffsetUnion; NestedOffsetArrayStructure nestedOffsetArrayStructure; nestedOffsetArrayStructure.setNumElements(NUM_ELEMENTS); - auto& nestedOffsetStructureList = - nestedOffsetArrayStructure.getNestedOffsetStructureList(); + auto& nestedOffsetStructureList = nestedOffsetArrayStructure.getNestedOffsetStructureList(); nestedOffsetStructureList.reserve(NUM_ELEMENTS); for (uint32_t i = 0; i < NUM_ELEMENTS; ++i) { @@ -90,8 +86,8 @@ class NestedOffsetTest : public ::testing::Test nestedOffsetChoice.setNestedOffsetUnion(nestedOffsetUnion); } - static const bool BOOL_VALUE; - static const uint8_t NUM_ELEMENTS; + static const bool BOOL_VALUE; + static const uint8_t NUM_ELEMENTS; static const uint32_t WRONG_TERMINATOR_OFFSET; static const uint32_t TERMINATOR_OFFSET; @@ -99,15 +95,15 @@ class NestedOffsetTest : public ::testing::Test static const uint32_t WRONG_DATA_OFFSET; static const uint32_t FIRST_DATA_OFFSET; - static const uint8_t TERMINATOR_VALUE; + static const uint8_t TERMINATOR_VALUE; - static const size_t NESTED_OFFSET_BIT_SIZE; + static const size_t NESTED_OFFSET_BIT_SIZE; zserio::BitBuffer bitBuffer = zserio::BitBuffer(1024 * 8); }; -const bool NestedOffsetTest::BOOL_VALUE = true; -const uint8_t NestedOffsetTest::NUM_ELEMENTS = 2; +const bool NestedOffsetTest::BOOL_VALUE = true; +const uint8_t NestedOffsetTest::NUM_ELEMENTS = 2; const uint32_t NestedOffsetTest::WRONG_TERMINATOR_OFFSET = 0; const uint32_t NestedOffsetTest::TERMINATOR_OFFSET = 7 + NUM_ELEMENTS * 8; diff --git a/test/language/offsets/cpp/OptionalMemberOffsetTest.cpp b/test/language/offsets/cpp/OptionalMemberOffsetTest.cpp index 3d0dd7a4e..3b0e8f8e6 100644 --- a/test/language/offsets/cpp/OptionalMemberOffsetTest.cpp +++ b/test/language/offsets/cpp/OptionalMemberOffsetTest.cpp @@ -1,9 +1,7 @@ #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" -#include "zserio/BitStreamReader.h" - #include "offsets/optional_member_offset/OptionalMemberOffset.h" +#include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace offsets { @@ -117,8 +115,8 @@ TEST_F(OptionalMemberOffsetTest, initializeOffsetsWithOptional) const uint32_t optionalField = 0x1010; const int32_t field = 0x2020; OptionalMemberOffset optionalMemberOffset; - fillOptionalMemberOffset(optionalMemberOffset, hasOptional, WRONG_OPTIONAL_FIELD_OFFSET, optionalField, - field); + fillOptionalMemberOffset( + optionalMemberOffset, hasOptional, WRONG_OPTIONAL_FIELD_OFFSET, optionalField, field); const size_t bitPosition = 2; const size_t expectedBitSize = WITH_OPTIONAL_MEMBER_OFFSET_BIT_SIZE; @@ -155,8 +153,8 @@ TEST_F(OptionalMemberOffsetTest, writeWithOptional) zserio::BitStreamReader reader(writer.getWriteBuffer(), writer.getBitPosition(), zserio::BitsTag()); OptionalMemberOffset readOptionalMemberOffset(reader); - checkOptionalMemberOffset(readOptionalMemberOffset, hasOptional, OPTIONAL_FIELD_OFFSET, optionalField, - field); + checkOptionalMemberOffset( + readOptionalMemberOffset, hasOptional, OPTIONAL_FIELD_OFFSET, optionalField, field); ASSERT_TRUE(optionalMemberOffset == readOptionalMemberOffset); } diff --git a/test/language/offsets/cpp/PackedAutoArrayOffsetTest.cpp b/test/language/offsets/cpp/PackedAutoArrayOffsetTest.cpp index 96df7fbb6..04169714c 100644 --- a/test/language/offsets/cpp/PackedAutoArrayOffsetTest.cpp +++ b/test/language/offsets/cpp/PackedAutoArrayOffsetTest.cpp @@ -1,7 +1,5 @@ #include "gtest/gtest.h" - #include "offsets/packed_auto_array_offset/AutoArrayHolder.h" - #include "zserio/RebindAlloc.h" #include "zserio/SerializeUtil.h" @@ -44,7 +42,7 @@ class PackedAutoArrayOffsetTest : public ::testing::Test writer.writeBool(true); writer.writeBits(PACKED_ARRAY_MAX_BIT_NUMBER, 6); writer.writeBits(0, 7); - for (size_t i = 0; i < AUTO_ARRAY_LENGTH-1; ++i) + for (size_t i = 0; i < AUTO_ARRAY_LENGTH - 1; ++i) writer.writeSignedBits(PACKED_ARRAY_DELTA, PACKED_ARRAY_MAX_BIT_NUMBER + 1); } @@ -162,7 +160,7 @@ TEST_F(PackedAutoArrayOffsetTest, initializeOffsetsWithPosition) const size_t bitPosition = 2; const size_t expectedEndBitPosition = getAutoArrayHolderBitSize(); - ASSERT_EQ(expectedEndBitPosition , autoArrayHolder.initializeOffsets(bitPosition)); + ASSERT_EQ(expectedEndBitPosition, autoArrayHolder.initializeOffsets(bitPosition)); checkAutoArrayHolder(autoArrayHolder, bitPosition); } diff --git a/test/language/offsets/cpp/ParameterOffsetTest.cpp b/test/language/offsets/cpp/ParameterOffsetTest.cpp index 8d2d13395..0c3841811 100644 --- a/test/language/offsets/cpp/ParameterOffsetTest.cpp +++ b/test/language/offsets/cpp/ParameterOffsetTest.cpp @@ -1,11 +1,9 @@ #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" +#include "offsets/parameter_offset/School.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" #include "zserio/CppRuntimeException.h" -#include "offsets/parameter_offset/School.h" - namespace offsets { namespace parameter_offset @@ -29,8 +27,8 @@ class ParameterOffsetTest : public ::testing::Test const uint16_t expectedSchoolId = SCHOOL_ID; ASSERT_EQ(expectedSchoolId, school.getSchoolId()); - const uint32_t expectedRoomOffset = static_cast( - (bitPosition == 0) ? ROOM_OFFSET : ROOM_OFFSET + (bitPosition / 8) + 1); + const uint32_t expectedRoomOffset = + static_cast((bitPosition == 0) ? ROOM_OFFSET : ROOM_OFFSET + (bitPosition / 8) + 1); ASSERT_EQ(expectedRoomOffset, school.getOffsetHolder().getRoomOffset()); const uint16_t expectedRoomId = ROOM_ID; @@ -48,13 +46,13 @@ class ParameterOffsetTest : public ::testing::Test school.initializeChildren(); } - static const uint16_t SCHOOL_ID = 0x01; - static const uint16_t ROOM_ID = 0x11; + static const uint16_t SCHOOL_ID = 0x01; + static const uint16_t ROOM_ID = 0x11; - static const uint32_t WRONG_ROOM_OFFSET = 0; - static const uint32_t ROOM_OFFSET = 6; + static const uint32_t WRONG_ROOM_OFFSET = 0; + static const uint32_t ROOM_OFFSET = 6; - static const size_t SCHOOL_BIT_SIZE = (ROOM_OFFSET + 2) * 8; + static const size_t SCHOOL_BIT_SIZE = (ROOM_OFFSET + 2) * 8; zserio::BitBuffer bitBuffer = zserio::BitBuffer(1024 * 8); }; diff --git a/test/language/offsets/cpp/TernaryOperatorOffsetTest.cpp b/test/language/offsets/cpp/TernaryOperatorOffsetTest.cpp index 269f754fb..99220fe1d 100644 --- a/test/language/offsets/cpp/TernaryOperatorOffsetTest.cpp +++ b/test/language/offsets/cpp/TernaryOperatorOffsetTest.cpp @@ -1,11 +1,9 @@ #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" +#include "offsets/ternary_operator_offset/TernaryOffset.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" #include "zserio/CppRuntimeException.h" -#include "offsets/ternary_operator_offset/TernaryOffset.h" - namespace offsets { namespace ternary_operator_offset @@ -18,8 +16,8 @@ using vector_type = zserio::vector; class TernaryOperatorOffsetTest : public ::testing::Test { protected: - void writeTernaryOffsetToByteArray(zserio::BitStreamWriter& writer, bool isFirstOffsetUsed, - bool writeWrongOffset) + void writeTernaryOffsetToByteArray( + zserio::BitStreamWriter& writer, bool isFirstOffsetUsed, bool writeWrongOffset) { writer.writeBool(isFirstOffsetUsed); if (isFirstOffsetUsed) @@ -54,7 +52,7 @@ class TernaryOperatorOffsetTest : public ::testing::Test void fillTernaryOffset(TernaryOffset& ternaryOffset, bool isFirstOffsetUsed, bool createWrongOffset) { ternaryOffset.setIsFirstOffsetUsed(isFirstOffsetUsed); - const vector_type offsets = { WRONG_FIELD_OFFSET, WRONG_FIELD_OFFSET }; + const vector_type offsets = {WRONG_FIELD_OFFSET, WRONG_FIELD_OFFSET}; ternaryOffset.setOffsets(offsets); ternaryOffset.setValue(FIELD_VALUE); if (!createWrongOffset) @@ -103,7 +101,7 @@ class TernaryOperatorOffsetTest : public ::testing::Test }; const uint32_t TernaryOperatorOffsetTest::WRONG_FIELD_OFFSET = 0; -const uint32_t TernaryOperatorOffsetTest::FIELD_OFFSET = (1 + 32 + 32 + /* align */ + 7) / 8; +const uint32_t TernaryOperatorOffsetTest::FIELD_OFFSET = (1 + 32 + 32 + /* align */ +7) / 8; const int32_t TernaryOperatorOffsetTest::FIELD_VALUE = 0xABCD; TEST_F(TernaryOperatorOffsetTest, firstOffset) diff --git a/test/language/offsets/cpp/UInt64OffsetTest.cpp b/test/language/offsets/cpp/UInt64OffsetTest.cpp index 4b8d12fd2..0078cc8b5 100644 --- a/test/language/offsets/cpp/UInt64OffsetTest.cpp +++ b/test/language/offsets/cpp/UInt64OffsetTest.cpp @@ -1,11 +1,9 @@ #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" -#include "zserio/BitStreamReader.h" +#include "offsets/uint64_offset/UInt64Offset.h" #include "zserio/BitPositionUtil.h" #include "zserio/BitSizeOfCalculator.h" - -#include "offsets/uint64_offset/UInt64Offset.h" +#include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" using namespace zserio; @@ -38,9 +36,7 @@ class UInt64OffsetTest : public ::testing::Test }; const size_t UInt64OffsetTest::ARRAY_SIZE = 13; -const size_t UInt64OffsetTest::OFFSET = 8 + - bitSizeOfVarUInt64(ARRAY_SIZE) / 8 + - ARRAY_SIZE; +const size_t UInt64OffsetTest::OFFSET = 8 + bitSizeOfVarUInt64(ARRAY_SIZE) / 8 + ARRAY_SIZE; const size_t UInt64OffsetTest::WRONG_OFFSET = OFFSET + 1; const size_t UInt64OffsetTest::BIT_SIZE = (OFFSET + 4) * 8; @@ -135,6 +131,3 @@ TEST_F(UInt64OffsetTest, writeWrongOffsets) } // namespace uint64_offset } // namespace offsets - - - diff --git a/test/language/optional_members/cpp/AutoOptionalTest.cpp b/test/language/optional_members/cpp/AutoOptionalTest.cpp index 2428278e9..97585eee9 100644 --- a/test/language/optional_members/cpp/AutoOptionalTest.cpp +++ b/test/language/optional_members/cpp/AutoOptionalTest.cpp @@ -1,9 +1,7 @@ #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" -#include "zserio/BitStreamReader.h" - #include "optional_members/auto_optional/Container.h" +#include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace optional_members { @@ -190,8 +188,8 @@ TEST_F(AutoOptionalTest, write) zserio::BitStreamWriter writeNonOptional(bitBuffer); container.write(writeNonOptional); - zserio::BitStreamReader readerNonOptional(writeNonOptional.getWriteBuffer(), - writeNonOptional.getBitPosition(), zserio::BitsTag()); + zserio::BitStreamReader readerNonOptional( + writeNonOptional.getWriteBuffer(), writeNonOptional.getBitPosition(), zserio::BitsTag()); checkContainerInBitStream(readerNonOptional, NON_OPTIONAL_INT_VALUE, false, 0); Container readContainerNonOptional(readerNonOptional); ASSERT_EQ(NON_OPTIONAL_INT_VALUE, readContainerNonOptional.getNonOptionalInt()); @@ -204,8 +202,8 @@ TEST_F(AutoOptionalTest, write) zserio::BitStreamWriter writeOptional(bitBuffer); container.write(writeOptional); - zserio::BitStreamReader readerOptional(writeOptional.getWriteBuffer(), - writeOptional.getBitPosition(), zserio::BitsTag()); + zserio::BitStreamReader readerOptional( + writeOptional.getWriteBuffer(), writeOptional.getBitPosition(), zserio::BitsTag()); checkContainerInBitStream(readerOptional, NON_OPTIONAL_INT_VALUE, true, autoOptionalIntValue); Container readContainerOptional(readerOptional); ASSERT_EQ(NON_OPTIONAL_INT_VALUE, readContainerOptional.getNonOptionalInt()); diff --git a/test/language/optional_members/cpp/OptionalArrayRecursionTest.cpp b/test/language/optional_members/cpp/OptionalArrayRecursionTest.cpp index 835f92183..ae6870dcf 100644 --- a/test/language/optional_members/cpp/OptionalArrayRecursionTest.cpp +++ b/test/language/optional_members/cpp/OptionalArrayRecursionTest.cpp @@ -1,10 +1,8 @@ #include #include "gtest/gtest.h" - #include "optional_members/optional_array_recursion/Employee.h" #include "optional_members/optional_array_recursion/Title.h" - #include "zserio/RebindAlloc.h" #include "zserio/SerializeUtil.h" @@ -43,8 +41,8 @@ class OptionalArrayRecursionTest : public ::testing::Test teamLead.setTeamMembers(teamMembers); } - void checkEmployeeInBitStream(zserio::BitStreamReader& reader, const char* name, uint16_t salary, - Title title) + void checkEmployeeInBitStream( + zserio::BitStreamReader& reader, const char* name, uint16_t salary, Title title) { ASSERT_EQ(name, reader.readString()); ASSERT_EQ(salary, reader.readBits(16)); @@ -55,15 +53,15 @@ class OptionalArrayRecursionTest : public ::testing::Test { checkEmployeeInBitStream(reader, EMPLOYEE_TEAM_LEAD_NAME, EMPLOYEE_TEAM_LEAD_SALARY, Title::TEAM_LEAD); ASSERT_EQ(NUM_DEVELOPERS, reader.readVarUInt64()); - checkEmployeeInBitStream(reader, EMPLOYEE_DEVELOPER1_NAME, EMPLOYEE_DEVELOPER1_SALARY, - Title::DEVELOPER); - checkEmployeeInBitStream(reader, EMPLOYEE_DEVELOPER2_NAME, EMPLOYEE_DEVELOPER2_SALARY, - Title::DEVELOPER); + checkEmployeeInBitStream( + reader, EMPLOYEE_DEVELOPER1_NAME, EMPLOYEE_DEVELOPER1_SALARY, Title::DEVELOPER); + checkEmployeeInBitStream( + reader, EMPLOYEE_DEVELOPER2_NAME, EMPLOYEE_DEVELOPER2_SALARY, Title::DEVELOPER); } static const std::string BLOB_NAME_BASE; - static const char*const EMPTY_EMPLOYEE_NAME; + static const char* const EMPTY_EMPLOYEE_NAME; static const uint16_t EMPTY_EMPLOYEE_SALARY; static const char* const EMPLOYEE_TEAM_LEAD_NAME; @@ -106,8 +104,8 @@ const size_t OptionalArrayRecursionTest::TEAM_LEAD_BIT_SIZE = EMPTY_EMPLOYEE_BIT strlen(OptionalArrayRecursionTest::EMPLOYEE_DEVELOPER1_NAME) * 8 + strlen(OptionalArrayRecursionTest::EMPLOYEE_DEVELOPER2_NAME) * 8; -const size_t OptionalArrayRecursionTest::TEAM_LEAD_BIT_SIZE_UNUSED_TEAM_MEMBERS = EMPTY_EMPLOYEE_BIT_SIZE + - strlen(OptionalArrayRecursionTest::EMPLOYEE_TEAM_LEAD_NAME) * 8; +const size_t OptionalArrayRecursionTest::TEAM_LEAD_BIT_SIZE_UNUSED_TEAM_MEMBERS = + EMPTY_EMPLOYEE_BIT_SIZE + strlen(OptionalArrayRecursionTest::EMPLOYEE_TEAM_LEAD_NAME) * 8; TEST_F(OptionalArrayRecursionTest, isTeamMembersSetAndUsed) { diff --git a/test/language/optional_members/cpp/OptionalArrayTest.cpp b/test/language/optional_members/cpp/OptionalArrayTest.cpp index c8a5d2cd2..35c6803ee 100644 --- a/test/language/optional_members/cpp/OptionalArrayTest.cpp +++ b/test/language/optional_members/cpp/OptionalArrayTest.cpp @@ -1,7 +1,5 @@ #include "gtest/gtest.h" - #include "optional_members/optional_array/TestStruct.h" - #include "zserio/RebindAlloc.h" // just test setters and getters diff --git a/test/language/optional_members/cpp/OptionalExpressionTest.cpp b/test/language/optional_members/cpp/OptionalExpressionTest.cpp index 2aaa812f3..d871e9ef1 100644 --- a/test/language/optional_members/cpp/OptionalExpressionTest.cpp +++ b/test/language/optional_members/cpp/OptionalExpressionTest.cpp @@ -1,10 +1,8 @@ #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" -#include "zserio/BitStreamReader.h" - -#include "optional_members/optional_expression/Container.h" #include "optional_members/optional_expression/BasicColor.h" +#include "optional_members/optional_expression/Container.h" +#include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace optional_members { @@ -21,8 +19,8 @@ class OptionalExpressionTest : public ::testing::Test tones.push_back(i + 1); } - void checkContainerInBitStream(zserio::BitStreamReader& reader, BasicColor basicColor, - uint8_t numBlackTones) + void checkContainerInBitStream( + zserio::BitStreamReader& reader, BasicColor basicColor, uint8_t numBlackTones) { ASSERT_EQ(zserio::enumToValue(basicColor), reader.readBits(8)); @@ -275,8 +273,8 @@ TEST_F(OptionalExpressionTest, write) zserio::BitStreamWriter writerWhite(bitBuffer); container.write(writerWhite); - zserio::BitStreamReader readerWhite(writerWhite.getWriteBuffer(), writerWhite.getBitPosition(), - zserio::BitsTag()); + zserio::BitStreamReader readerWhite( + writerWhite.getWriteBuffer(), writerWhite.getBitPosition(), zserio::BitsTag()); checkContainerInBitStream(readerWhite, BasicColor::WHITE, NUM_BLACK_TONES); Container readContainerWhite(readerWhite); @@ -297,8 +295,8 @@ TEST_F(OptionalExpressionTest, write) zserio::BitStreamWriter writerBlack(bitBuffer); container.write(writerBlack); - zserio::BitStreamReader readerBlack(writerBlack.getWriteBuffer(), writerBlack.getBitPosition(), - zserio::BitsTag()); + zserio::BitStreamReader readerBlack( + writerBlack.getWriteBuffer(), writerBlack.getBitPosition(), zserio::BitsTag()); checkContainerInBitStream(readerBlack, BasicColor::BLACK, numBlackTones); Container readContainerBlack(readerBlack); @@ -315,8 +313,8 @@ TEST_F(OptionalExpressionTest, write) zserio::BitStreamWriter writerBlackToWhite(bitBuffer); container.write(writerBlackToWhite); - zserio::BitStreamReader readerBlackToWhite(writerBlackToWhite.getWriteBuffer(), - writerBlackToWhite.getBitPosition(), zserio::BitsTag()); + zserio::BitStreamReader readerBlackToWhite( + writerBlackToWhite.getWriteBuffer(), writerBlackToWhite.getBitPosition(), zserio::BitsTag()); checkContainerInBitStream(readerBlackToWhite, BasicColor::WHITE, NUM_BLACK_TONES); Container readContainerBlackToWhite(readerBlackToWhite); diff --git a/test/language/optional_members/cpp/OptionalExpressionWithRemovedEnumItemTest.cpp b/test/language/optional_members/cpp/OptionalExpressionWithRemovedEnumItemTest.cpp index ea0d1f27d..8c61ae108 100644 --- a/test/language/optional_members/cpp/OptionalExpressionWithRemovedEnumItemTest.cpp +++ b/test/language/optional_members/cpp/OptionalExpressionWithRemovedEnumItemTest.cpp @@ -1,8 +1,6 @@ #include "gtest/gtest.h" - -#include "zserio/SerializeUtil.h" - #include "optional_members/optional_expression_with_removed_enum_item/Compound.h" +#include "zserio/SerializeUtil.h" namespace optional_members { diff --git a/test/language/optional_members/cpp/OptionalRecursionTest.cpp b/test/language/optional_members/cpp/OptionalRecursionTest.cpp index b51ccef8d..cdc0cbc29 100644 --- a/test/language/optional_members/cpp/OptionalRecursionTest.cpp +++ b/test/language/optional_members/cpp/OptionalRecursionTest.cpp @@ -1,12 +1,10 @@ #include #include "gtest/gtest.h" - #include "optional_members/optional_recursion/Block.h" - -#include "zserio/RebindAlloc.h" -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" +#include "zserio/RebindAlloc.h" namespace optional_members { diff --git a/test/language/packages/cpp/IndexTest.cpp b/test/language/packages/cpp/IndexTest.cpp index 4a15c26e8..9927d8b4f 100644 --- a/test/language/packages/cpp/IndexTest.cpp +++ b/test/language/packages/cpp/IndexTest.cpp @@ -1,9 +1,7 @@ -#include "index_workaround/index/Test.h" - #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" +#include "index_workaround/index/Test.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace index_workaround { @@ -41,4 +39,4 @@ TEST_F(IndexTest, readWrite) ASSERT_EQ(test, readTest); } -} // namespace index +} // namespace index_workaround diff --git a/test/language/packages/cpp/PackageNameConflictTest.cpp b/test/language/packages/cpp/PackageNameConflictTest.cpp index c183672d1..774b30a5c 100644 --- a/test/language/packages/cpp/PackageNameConflictTest.cpp +++ b/test/language/packages/cpp/PackageNameConflictTest.cpp @@ -1,7 +1,6 @@ #include "gtest/gtest.h" - -#include "package_name_conflict/PackageNameConflictLocal.h" #include "package_name_conflict/PackageNameConflictImported.h" +#include "package_name_conflict/PackageNameConflictLocal.h" namespace package_name_conflict { diff --git a/test/language/packages/cpp/ReaderTest.cpp b/test/language/packages/cpp/ReaderTest.cpp index 8827b085a..fa17a4fcd 100644 --- a/test/language/packages/cpp/ReaderTest.cpp +++ b/test/language/packages/cpp/ReaderTest.cpp @@ -1,9 +1,7 @@ #include "gtest/gtest.h" - #include "reader/Test.h" - -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace reader { diff --git a/test/language/parameterized_types/cpp/ArrayElementParamTest.cpp b/test/language/parameterized_types/cpp/ArrayElementParamTest.cpp index edc946336..d2d5e6a62 100644 --- a/test/language/parameterized_types/cpp/ArrayElementParamTest.cpp +++ b/test/language/parameterized_types/cpp/ArrayElementParamTest.cpp @@ -1,9 +1,7 @@ #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" -#include "zserio/BitStreamReader.h" - #include "parameterized_types/array_element_param/Database.h" +#include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace parameterized_types { @@ -74,8 +72,7 @@ class ArrayElementParamTest : public ::testing::Test }; const uint16_t ArrayElementParamTest::NUM_BLOCKS = 3; -const uint32_t ArrayElementParamTest::FIRST_BYTE_OFFSET = - 2 + ArrayElementParamTest::NUM_BLOCKS * (2 + 4); +const uint32_t ArrayElementParamTest::FIRST_BYTE_OFFSET = 2 + ArrayElementParamTest::NUM_BLOCKS * (2 + 4); TEST_F(ArrayElementParamTest, fieldConstructor) { diff --git a/test/language/parameterized_types/cpp/ArrayElementParamWithOptionalTest.cpp b/test/language/parameterized_types/cpp/ArrayElementParamWithOptionalTest.cpp index 4bd425f3a..01013b743 100644 --- a/test/language/parameterized_types/cpp/ArrayElementParamWithOptionalTest.cpp +++ b/test/language/parameterized_types/cpp/ArrayElementParamWithOptionalTest.cpp @@ -1,7 +1,5 @@ #include "gtest/gtest.h" - #include "parameterized_types/array_element_param_with_optional/Holder.h" - #include "zserio/SerializeUtil.h" namespace parameterized_types @@ -51,7 +49,8 @@ class ArrayElementParamWithOptionalTest : public ::testing::Test zserio::BitBuffer bitBuffer = zserio::BitBuffer(1024 * 8); }; -const std::string ArrayElementParamWithOptionalTest::BLOB_NAME = "language/parameterized_types/array_element_param_with_optional.blob"; +const std::string ArrayElementParamWithOptionalTest::BLOB_NAME = + "language/parameterized_types/array_element_param_with_optional.blob"; const bool ArrayElementParamWithOptionalTest::HAS_EXTRA = true; const uint8_t ArrayElementParamWithOptionalTest::EXTRA_PARAM = 0x00; diff --git a/test/language/parameterized_types/cpp/BytesParamTest.cpp b/test/language/parameterized_types/cpp/BytesParamTest.cpp index 7bcc48468..6d8c02104 100644 --- a/test/language/parameterized_types/cpp/BytesParamTest.cpp +++ b/test/language/parameterized_types/cpp/BytesParamTest.cpp @@ -1,8 +1,6 @@ #include "gtest/gtest.h" - -#include "zserio/SerializeUtil.h" - #include "parameterized_types/bytes_param/BytesParam.h" +#include "zserio/SerializeUtil.h" namespace parameterized_types { diff --git a/test/language/parameterized_types/cpp/DynamicBitfieldParamTest.cpp b/test/language/parameterized_types/cpp/DynamicBitfieldParamTest.cpp index 55d2a2cf8..bf1cbd43e 100644 --- a/test/language/parameterized_types/cpp/DynamicBitfieldParamTest.cpp +++ b/test/language/parameterized_types/cpp/DynamicBitfieldParamTest.cpp @@ -1,9 +1,7 @@ #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" -#include "zserio/BitStreamReader.h" - #include "parameterized_types/dynamic_bitfield_param/DynamicBitfieldParamHolder.h" +#include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace parameterized_types { @@ -22,8 +20,8 @@ class DynamicBitfieldParamTest : public ::testing::Test dynamicBitfieldParamHolder.initializeChildren(); } - void checkDynamicBitfieldParamHolderInBitStream(zserio::BitStreamReader& reader, - const DynamicBitfieldParamHolder& dynamicBitfieldParamHolder) + void checkDynamicBitfieldParamHolderInBitStream( + zserio::BitStreamReader& reader, const DynamicBitfieldParamHolder& dynamicBitfieldParamHolder) { ASSERT_EQ(dynamicBitfieldParamHolder.getLength(), reader.readBits(4)); ASSERT_EQ(dynamicBitfieldParamHolder.getBitfield(), reader.readSignedBits(LENGTH)); diff --git a/test/language/parameterized_types/cpp/ExternParamTest.cpp b/test/language/parameterized_types/cpp/ExternParamTest.cpp index 71d25f0f8..ace5aae0f 100644 --- a/test/language/parameterized_types/cpp/ExternParamTest.cpp +++ b/test/language/parameterized_types/cpp/ExternParamTest.cpp @@ -1,8 +1,6 @@ #include "gtest/gtest.h" - -#include "zserio/SerializeUtil.h" - #include "parameterized_types/extern_param/ExternParam.h" +#include "zserio/SerializeUtil.h" namespace parameterized_types { diff --git a/test/language/parameterized_types/cpp/FixedAndVariableParamTest.cpp b/test/language/parameterized_types/cpp/FixedAndVariableParamTest.cpp index de3424ef5..f9b5c6ae9 100644 --- a/test/language/parameterized_types/cpp/FixedAndVariableParamTest.cpp +++ b/test/language/parameterized_types/cpp/FixedAndVariableParamTest.cpp @@ -1,8 +1,6 @@ #include "gtest/gtest.h" - -#include "zserio/SerializeUtil.h" - #include "parameterized_types/fixed_and_variable_param/FixedAndVariableParam.h" +#include "zserio/SerializeUtil.h" namespace parameterized_types { @@ -78,8 +76,8 @@ class FixedAndVariableParamTest : public ::testing::Test ASSERT_EQ(floatValue, reader.readFloat16()); const ArrayHolder& arrayHolder = fixedAndVariableParam.getArrayHolder(); const LimitHolder& limitHolder = fixedAndVariableParam.getLimitHolder(); - checkArrayHolderInBitStream(reader, arrayHolder, size, extraLimit, limitHolder, color, access, - floatValue); + checkArrayHolderInBitStream( + reader, arrayHolder, size, extraLimit, limitHolder, color, access, floatValue); } static const std::string BLOB_NAME; @@ -119,15 +117,15 @@ const float FixedAndVariableParamTest::WRONG_FLOAT_VALUE = 1.0; TEST_F(FixedAndVariableParamTest, writeRead) { FixedAndVariableParam fixedAndVariableParam; - fillFixedAndVariableParam(fixedAndVariableParam, ARRAY_SIZE, EXTRA_LIMIT, LIMIT, COLOR, ACCESS, - FLOAT_VALUE); + fillFixedAndVariableParam( + fixedAndVariableParam, ARRAY_SIZE, EXTRA_LIMIT, LIMIT, COLOR, ACCESS, FLOAT_VALUE); zserio::BitStreamWriter writer(bitBuffer); fixedAndVariableParam.write(writer); zserio::BitStreamReader reader(writer.getWriteBuffer(), writer.getBitPosition(), zserio::BitsTag()); - checkFixedAndVariableParamInBitStream(reader, fixedAndVariableParam, ARRAY_SIZE, EXTRA_LIMIT, - LIMIT, COLOR, ACCESS, FLOAT_VALUE); + checkFixedAndVariableParamInBitStream( + reader, fixedAndVariableParam, ARRAY_SIZE, EXTRA_LIMIT, LIMIT, COLOR, ACCESS, FLOAT_VALUE); reader.setBitPosition(0); FixedAndVariableParam readFixedAndVariableParam(reader); @@ -137,8 +135,8 @@ TEST_F(FixedAndVariableParamTest, writeRead) TEST_F(FixedAndVariableParamTest, writeReadFile) { FixedAndVariableParam fixedAndVariableParam; - fillFixedAndVariableParam(fixedAndVariableParam, ARRAY_SIZE, EXTRA_LIMIT, LIMIT, COLOR, ACCESS, - FLOAT_VALUE); + fillFixedAndVariableParam( + fixedAndVariableParam, ARRAY_SIZE, EXTRA_LIMIT, LIMIT, COLOR, ACCESS, FLOAT_VALUE); zserio::serializeToFile(fixedAndVariableParam, BLOB_NAME); @@ -149,8 +147,8 @@ TEST_F(FixedAndVariableParamTest, writeReadFile) TEST_F(FixedAndVariableParamTest, writeFailureWrongArraySize) { FixedAndVariableParam fixedAndVariableParam; - fillFixedAndVariableParam(fixedAndVariableParam, WRONG_ARRAY_SIZE, EXTRA_LIMIT, LIMIT, COLOR, ACCESS, - FLOAT_VALUE); + fillFixedAndVariableParam( + fixedAndVariableParam, WRONG_ARRAY_SIZE, EXTRA_LIMIT, LIMIT, COLOR, ACCESS, FLOAT_VALUE); zserio::BitStreamWriter writer1(bitBuffer); ASSERT_THROW(fixedAndVariableParam.write(writer1), zserio::CppRuntimeException); @@ -164,8 +162,8 @@ TEST_F(FixedAndVariableParamTest, writeFailureWrongArraySize) TEST_F(FixedAndVariableParamTest, writeFailureWrongExtraLimit) { FixedAndVariableParam fixedAndVariableParam; - fillFixedAndVariableParam(fixedAndVariableParam, ARRAY_SIZE, EXTRA_LIMIT, LIMIT, COLOR, ACCESS, - FLOAT_VALUE); + fillFixedAndVariableParam( + fixedAndVariableParam, ARRAY_SIZE, EXTRA_LIMIT, LIMIT, COLOR, ACCESS, FLOAT_VALUE); fixedAndVariableParam.setExtraLimit(WRONG_EXTRA_LIMIT); zserio::BitStreamWriter writer(bitBuffer); @@ -175,8 +173,8 @@ TEST_F(FixedAndVariableParamTest, writeFailureWrongExtraLimit) TEST_F(FixedAndVariableParamTest, writeFailureWrongLimitHolder) { FixedAndVariableParam fixedAndVariableParam; - fillFixedAndVariableParam(fixedAndVariableParam, ARRAY_SIZE, EXTRA_LIMIT, LIMIT, COLOR, ACCESS, - FLOAT_VALUE); + fillFixedAndVariableParam( + fixedAndVariableParam, ARRAY_SIZE, EXTRA_LIMIT, LIMIT, COLOR, ACCESS, FLOAT_VALUE); LimitHolder limitHolder(LIMIT); ArrayHolder& arrayHolder = fixedAndVariableParam.getArrayHolder(); arrayHolder.initialize(arrayHolder.getSize(), arrayHolder.getExtraLimit(), limitHolder, @@ -189,8 +187,8 @@ TEST_F(FixedAndVariableParamTest, writeFailureWrongLimitHolder) TEST_F(FixedAndVariableParamTest, writeFailureWrongColor) { FixedAndVariableParam fixedAndVariableParam; - fillFixedAndVariableParam(fixedAndVariableParam, ARRAY_SIZE, EXTRA_LIMIT, LIMIT, COLOR, ACCESS, - FLOAT_VALUE); + fillFixedAndVariableParam( + fixedAndVariableParam, ARRAY_SIZE, EXTRA_LIMIT, LIMIT, COLOR, ACCESS, FLOAT_VALUE); fixedAndVariableParam.setColor(WRONG_COLOR); zserio::BitStreamWriter writer(bitBuffer); @@ -200,8 +198,8 @@ TEST_F(FixedAndVariableParamTest, writeFailureWrongColor) TEST_F(FixedAndVariableParamTest, writeFailureWrongAccess) { FixedAndVariableParam fixedAndVariableParam; - fillFixedAndVariableParam(fixedAndVariableParam, ARRAY_SIZE, EXTRA_LIMIT, LIMIT, COLOR, ACCESS, - FLOAT_VALUE); + fillFixedAndVariableParam( + fixedAndVariableParam, ARRAY_SIZE, EXTRA_LIMIT, LIMIT, COLOR, ACCESS, FLOAT_VALUE); fixedAndVariableParam.setAccess(WRONG_ACCESS); zserio::BitStreamWriter writer(bitBuffer); @@ -211,8 +209,8 @@ TEST_F(FixedAndVariableParamTest, writeFailureWrongAccess) TEST_F(FixedAndVariableParamTest, writeFailureWrongFloatValue) { FixedAndVariableParam fixedAndVariableParam; - fillFixedAndVariableParam(fixedAndVariableParam, ARRAY_SIZE, EXTRA_LIMIT, LIMIT, COLOR, ACCESS, - FLOAT_VALUE); + fillFixedAndVariableParam( + fixedAndVariableParam, ARRAY_SIZE, EXTRA_LIMIT, LIMIT, COLOR, ACCESS, FLOAT_VALUE); fixedAndVariableParam.setFloatValue(WRONG_FLOAT_VALUE); zserio::BitStreamWriter writer(bitBuffer); diff --git a/test/language/parameterized_types/cpp/GrandChildParamTest.cpp b/test/language/parameterized_types/cpp/GrandChildParamTest.cpp index 0c8ad59d3..94f251463 100644 --- a/test/language/parameterized_types/cpp/GrandChildParamTest.cpp +++ b/test/language/parameterized_types/cpp/GrandChildParamTest.cpp @@ -1,8 +1,6 @@ #include "gtest/gtest.h" - -#include "zserio/SerializeUtil.h" - #include "parameterized_types/grand_child_param/GrandChildParam.h" +#include "zserio/SerializeUtil.h" namespace parameterized_types { @@ -40,8 +38,8 @@ class GrandChildParamTest : public ::testing::Test grandChildParam.initializeChildren(); } - void checkItemChoiceHolderInBitStream(zserio::BitStreamReader& reader, - const ItemChoiceHolder& itemChoiceHolder) + void checkItemChoiceHolderInBitStream( + zserio::BitStreamReader& reader, const ItemChoiceHolder& itemChoiceHolder) { ASSERT_EQ(itemChoiceHolder.getHasItem(), reader.readBool()); @@ -50,8 +48,8 @@ class GrandChildParamTest : public ::testing::Test ASSERT_EQ(item.getExtraParam(), reader.readBits(32)); } - void checkGrandChildParamInBitStream(zserio::BitStreamReader& reader, - const GrandChildParam& grandChildParam) + void checkGrandChildParamInBitStream( + zserio::BitStreamReader& reader, const GrandChildParam& grandChildParam) { const ItemChoiceHolder& itemChoiceHolder = grandChildParam.getItemChoiceHolder(); checkItemChoiceHolderInBitStream(reader, itemChoiceHolder); @@ -75,15 +73,14 @@ class GrandChildParamTest : public ::testing::Test zserio::BitBuffer bitBuffer = zserio::BitBuffer(1024 * 8); private: - static const bool ITEM_CHOICE_HOLDER_HAS_ITEM; + static const bool ITEM_CHOICE_HOLDER_HAS_ITEM; static const uint16_t ITEM_PARAM; static const uint32_t ITEM_EXTRA_PARAM; }; -const std::string GrandChildParamTest::BLOB_NAME = - "language/parameterized_types/grand_child_param.blob"; +const std::string GrandChildParamTest::BLOB_NAME = "language/parameterized_types/grand_child_param.blob"; -const bool GrandChildParamTest::ITEM_CHOICE_HOLDER_HAS_ITEM = true; +const bool GrandChildParamTest::ITEM_CHOICE_HOLDER_HAS_ITEM = true; const uint16_t GrandChildParamTest::ITEM_PARAM = 0xAABB; const uint32_t GrandChildParamTest::ITEM_EXTRA_PARAM = 0x11223344; diff --git a/test/language/parameterized_types/cpp/NestedParameterizedFieldTest.cpp b/test/language/parameterized_types/cpp/NestedParameterizedFieldTest.cpp index b7570c437..8d55539b5 100644 --- a/test/language/parameterized_types/cpp/NestedParameterizedFieldTest.cpp +++ b/test/language/parameterized_types/cpp/NestedParameterizedFieldTest.cpp @@ -1,9 +1,7 @@ #include #include "gtest/gtest.h" - #include "parameterized_types/nested_parameterized_field/TopLevel.h" - #include "zserio/SerializeUtil.h" namespace parameterized_types diff --git a/test/language/parameterized_types/cpp/PackedArrayElementParamTest.cpp b/test/language/parameterized_types/cpp/PackedArrayElementParamTest.cpp index 8061eb4dc..2732f5db5 100644 --- a/test/language/parameterized_types/cpp/PackedArrayElementParamTest.cpp +++ b/test/language/parameterized_types/cpp/PackedArrayElementParamTest.cpp @@ -1,8 +1,6 @@ #include "gtest/gtest.h" - -#include "zserio/SerializeUtil.h" - #include "parameterized_types/packed_array_element_param/Database.h" +#include "zserio/SerializeUtil.h" namespace parameterized_types { @@ -61,8 +59,7 @@ class PackedArrayElementParamTest : public ::testing::Test ASSERT_GT(unpackedBitSize * minCompressionRatio, packedBitSize) << "Unpacked array has " << std::to_string(unpackedBitSize) << " bits, " << "packed array has " << std::to_string(packedBitSize) << " bits, " - << "compression ratio is " - << std::to_string(packedBitSize /unpackedBitSize * 100) << "%!"; + << "compression ratio is " << std::to_string(packedBitSize / unpackedBitSize * 100) << "%!"; } void checkWriteRead(uint16_t numBlocks) diff --git a/test/language/parameterized_types/cpp/ParamWithOptionalTest.cpp b/test/language/parameterized_types/cpp/ParamWithOptionalTest.cpp index f74a7461c..508670790 100644 --- a/test/language/parameterized_types/cpp/ParamWithOptionalTest.cpp +++ b/test/language/parameterized_types/cpp/ParamWithOptionalTest.cpp @@ -1,9 +1,7 @@ #include #include "gtest/gtest.h" - #include "parameterized_types/param_with_optional/Holder.h" - #include "zserio/SerializeUtil.h" namespace parameterized_types diff --git a/test/language/parameterized_types/cpp/ParameterizedInnerClassesClashingTest.cpp b/test/language/parameterized_types/cpp/ParameterizedInnerClassesClashingTest.cpp index bbc33ec06..3ceb2df29 100644 --- a/test/language/parameterized_types/cpp/ParameterizedInnerClassesClashingTest.cpp +++ b/test/language/parameterized_types/cpp/ParameterizedInnerClassesClashingTest.cpp @@ -1,11 +1,9 @@ #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" -#include "zserio/BitStreamReader.h" - #include "parameterized_types/parameterized_inner_classes_clashing/ElementChildrenInitializer_array.h" #include "parameterized_types/parameterized_inner_classes_clashing/ElementFactory_array.h" #include "parameterized_types/parameterized_inner_classes_clashing/ElementInitializer_array.h" +#include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace parameterized_types { @@ -52,11 +50,7 @@ TEST_F(ParameterizedInnerClassesClashingTest, writeReadElementChildrenInitialize { const uint32_t param = 100; ElementChildrenInitializer_array testStructure{ - vector_type{{ - Parent{param, Compound{13}}, - Parent{param, Compound{42}} - }} - }; + vector_type{{Parent{param, Compound{13}}, Parent{param, Compound{42}}}}}; testStructure.initializeChildren(); zserio::BitStreamWriter writer(bitBuffer); diff --git a/test/language/parameterized_types/cpp/ParameterizedParamTest.cpp b/test/language/parameterized_types/cpp/ParameterizedParamTest.cpp index 6454439fe..2776ae471 100644 --- a/test/language/parameterized_types/cpp/ParameterizedParamTest.cpp +++ b/test/language/parameterized_types/cpp/ParameterizedParamTest.cpp @@ -1,9 +1,7 @@ #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" -#include "zserio/BitStreamReader.h" - #include "parameterized_types/parameterized_param/ParameterizedParamHolder.h" +#include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace parameterized_types { @@ -26,8 +24,8 @@ class ParameterizedParamTest : public ::testing::Test parameterizedParamHolder.initializeChildren(); } - void checkParameterizedParamHolderInBitStream(zserio::BitStreamReader& reader, - const ParameterizedParamHolder& parameterizedParamHolder) + void checkParameterizedParamHolderInBitStream( + zserio::BitStreamReader& reader, const ParameterizedParamHolder& parameterizedParamHolder) { ASSERT_EQ(parameterizedParamHolder.getParameter(), reader.readBits(16)); diff --git a/test/language/parameterized_types/cpp/SimpleParamTest.cpp b/test/language/parameterized_types/cpp/SimpleParamTest.cpp index a6e9b418b..c551273f2 100644 --- a/test/language/parameterized_types/cpp/SimpleParamTest.cpp +++ b/test/language/parameterized_types/cpp/SimpleParamTest.cpp @@ -1,11 +1,9 @@ #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" +#include "parameterized_types/simple_param/Item.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" #include "zserio/CppRuntimeException.h" -#include "parameterized_types/simple_param/Item.h" - namespace parameterized_types { namespace simple_param @@ -14,8 +12,8 @@ namespace simple_param class SimpleParamTest : public ::testing::Test { protected: - void writeItemToByteArray(zserio::BitStreamWriter& writer, uint32_t version, uint16_t param, - uint32_t extraParam) + void writeItemToByteArray( + zserio::BitStreamWriter& writer, uint32_t version, uint16_t param, uint32_t extraParam) { writer.writeBits(param, 16); if (version >= HIGHER_VERSION) diff --git a/test/language/parameterized_types/cpp/SubtypedBitfieldParamTest.cpp b/test/language/parameterized_types/cpp/SubtypedBitfieldParamTest.cpp index c15cd522a..5f2037bbe 100644 --- a/test/language/parameterized_types/cpp/SubtypedBitfieldParamTest.cpp +++ b/test/language/parameterized_types/cpp/SubtypedBitfieldParamTest.cpp @@ -1,9 +1,7 @@ #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" -#include "zserio/BitStreamReader.h" - #include "parameterized_types/subtyped_bitfield_param/SubtypedBitfieldParamHolder.h" +#include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace parameterized_types { @@ -21,8 +19,8 @@ class SubtypedBitfieldParamTest : public ::testing::Test subtypedBitfieldParamHolder.initializeChildren(); } - void checkSubtypedBitfieldParamHolderInBitStream(zserio::BitStreamReader& reader, - const SubtypedBitfieldParamHolder& subtypedBitfieldParamHolder) + void checkSubtypedBitfieldParamHolderInBitStream( + zserio::BitStreamReader& reader, const SubtypedBitfieldParamHolder& subtypedBitfieldParamHolder) { const SubtypedBitfieldParam& subtypedBitfieldParam = subtypedBitfieldParamHolder.getSubtypedBitfieldParam(); diff --git a/test/language/pubsub_types/cpp/SimplePubsubTest.cpp b/test/language/pubsub_types/cpp/SimplePubsubTest.cpp index ed1f90a75..dc671cc28 100644 --- a/test/language/pubsub_types/cpp/SimplePubsubTest.cpp +++ b/test/language/pubsub_types/cpp/SimplePubsubTest.cpp @@ -1,11 +1,8 @@ #include "gtest/gtest.h" - -#include "test_utils/TestPubsub.h" - -#include "pubsub_types/simple_pubsub/SimplePubsubProvider.h" -#include "pubsub_types/simple_pubsub/SimplePubsubClient.h" #include "pubsub_types/simple_pubsub/SimplePubsub.h" - +#include "pubsub_types/simple_pubsub/SimplePubsubClient.h" +#include "pubsub_types/simple_pubsub/SimplePubsubProvider.h" +#include "test_utils/TestPubsub.h" #include "zserio/PubsubException.h" #include "zserio/RebindAlloc.h" #include "zserio/SerializeUtil.h" @@ -25,10 +22,10 @@ using BitBuffer = zserio::BasicBitBuffer; class SimplePubsubTest : public ::testing::Test { public: - SimplePubsubTest() - : simplePubsubProvider(pubsub), - simplePubsubClient(pubsub), - simplePubsub(createPubsub()) + SimplePubsubTest() : + simplePubsubProvider(pubsub), + simplePubsubClient(pubsub), + simplePubsub(createPubsub()) {} protected: @@ -189,8 +186,8 @@ TEST_F(SimplePubsubTest, powerOfTwoSimplePubsub) TEST_F(SimplePubsubTest, powerOfTwoRawClientAndProvider) { - struct RequestRawCallback : - public SimplePubsubProvider::SimplePubsubProviderCallback> + struct RequestRawCallback + : public SimplePubsubProvider::SimplePubsubProviderCallback> { explicit RequestRawCallback(SimplePubsubProvider& provider) : simplePubsubProvider(provider) @@ -216,7 +213,8 @@ TEST_F(SimplePubsubTest, powerOfTwoRawClientAndProvider) simplePubsubProvider.subscribeRequestRaw( std::allocate_shared(allocator_type(), simplePubsubProvider)); - struct PowerOfTwoRawCallback : public SimplePubsubClient::SimplePubsubClientCallback> + struct PowerOfTwoRawCallback + : public SimplePubsubClient::SimplePubsubClientCallback> { void operator()(zserio::StringView topic, const zserio::Span& valueData) override { diff --git a/test/language/service_types/cpp/ComplexTypesServiceTest.cpp b/test/language/service_types/cpp/ComplexTypesServiceTest.cpp index 917fe3213..cdf7e630e 100644 --- a/test/language/service_types/cpp/ComplexTypesServiceTest.cpp +++ b/test/language/service_types/cpp/ComplexTypesServiceTest.cpp @@ -1,14 +1,11 @@ #include -#include #include +#include #include "gtest/gtest.h" - -#include "zserio/RebindAlloc.h" - -#include "test_utils/LocalServiceClient.h" - #include "service_types/complex_types_service/ComplexTypesService.h" +#include "test_utils/LocalServiceClient.h" +#include "zserio/RebindAlloc.h" using namespace zserio::literals; @@ -24,31 +21,29 @@ using LocalServiceClient = test_utils::LocalServiceClient; namespace { - void convertRgbToCmyk(uint8_t r, uint8_t g, uint8_t b, - uint8_t& c, uint8_t &m, uint8_t &y, uint8_t& k) - { - // see https://www.rapidtables.com/convert/color/rgb-to-cmyk.html - const double rr = r / 255. * 100; - const double gg = g / 255. * 100; - const double bb = b / 255. * 100; +void convertRgbToCmyk(uint8_t r, uint8_t g, uint8_t b, uint8_t& c, uint8_t& m, uint8_t& y, uint8_t& k) +{ + // see https://www.rapidtables.com/convert/color/rgb-to-cmyk.html + const double rr = r / 255. * 100; + const double gg = g / 255. * 100; + const double bb = b / 255. * 100; - double kk = 100. - std::max(std::max(rr, gg), bb); + double kk = 100. - std::max(std::max(rr, gg), bb); - c = static_cast(std::round((100. - rr - kk) / (100. - kk) * 100)); - m = static_cast(std::round((100. - gg - kk) / (100. - kk) * 100)); - y = static_cast(std::round((100. - bb - kk) / (100. - kk) * 100)); - k = static_cast(std::round(kk)); - } + c = static_cast(std::round((100. - rr - kk) / (100. - kk) * 100)); + m = static_cast(std::round((100. - gg - kk) / (100. - kk) * 100)); + y = static_cast(std::round((100. - bb - kk) / (100. - kk) * 100)); + k = static_cast(std::round(kk)); +} - void convertCmykToRgb(uint8_t c, uint8_t m, uint8_t y, uint8_t k, - uint8_t& r, uint8_t& g, uint8_t& b) - { - // see https://www.rapidtables.com/convert/color/cmyk-to-rgb.html - r = static_cast(std::round(255 * (1 - c / 100.) * (1 - k / 100.))); - g = static_cast(std::round(255 * (1 - m / 100.) * (1 - k / 100.))); - b = static_cast(std::round(255 * (1 - y / 100.) * (1 - k / 100.))); - } +void convertCmykToRgb(uint8_t c, uint8_t m, uint8_t y, uint8_t k, uint8_t& r, uint8_t& g, uint8_t& b) +{ + // see https://www.rapidtables.com/convert/color/cmyk-to-rgb.html + r = static_cast(std::round(255 * (1 - c / 100.) * (1 - k / 100.))); + g = static_cast(std::round(255 * (1 - m / 100.) * (1 - k / 100.))); + b = static_cast(std::round(255 * (1 - y / 100.) * (1 - k / 100.))); } +} // namespace class ComplexTypesServiceImpl : public ComplexTypesService::Service { @@ -119,8 +114,10 @@ class ComplexTypesServiceImpl : public ComplexTypesService::Service class ComplexTypesServiceTest : public ::testing::Test { public: - ComplexTypesServiceTest() - : localServiceClient(service), client(localServiceClient), cmykValues() + ComplexTypesServiceTest() : + localServiceClient(service), + client(localServiceClient), + cmykValues() { for (size_t i = 0; i < 3; ++i) { @@ -143,8 +140,8 @@ class ComplexTypesServiceTest : public ::testing::Test // note that conversion is slightly inaccurate and therefore this values are carefully chosen // to provide consistent results for the test needs - static constexpr std::array, 3> rgbValues = {{ - { 0 ,128, 255 }, { 222, 222, 0 }, { 65, 196, 31 } }}; + static constexpr std::array, 3> rgbValues = { + {{0, 128, 255}, {222, 222, 0}, {65, 196, 31}}}; std::array, 3> cmykValues; }; diff --git a/test/language/service_types/cpp/SimpleServiceTest.cpp b/test/language/service_types/cpp/SimpleServiceTest.cpp index a9fec21b8..da02ddfed 100644 --- a/test/language/service_types/cpp/SimpleServiceTest.cpp +++ b/test/language/service_types/cpp/SimpleServiceTest.cpp @@ -2,14 +2,11 @@ #include #include "gtest/gtest.h" - -#include "zserio/ServiceException.h" +#include "service_types/simple_service/SimpleService.h" +#include "test_utils/LocalServiceClient.h" #include "zserio/RebindAlloc.h" #include "zserio/SerializeUtil.h" - -#include "test_utils/LocalServiceClient.h" - -#include "service_types/simple_service/SimpleService.h" +#include "zserio/ServiceException.h" using namespace zserio::literals; @@ -26,11 +23,11 @@ using BitBuffer = zserio::BasicBitBuffer; namespace { - struct FakeContext - { - bool seenByService = false; - }; -} +struct FakeContext +{ + bool seenByService = false; +}; +} // namespace class SimpleServiceImpl : public SimpleService::Service { @@ -64,12 +61,12 @@ class SimpleServiceImpl : public SimpleService::Service class SimpleServiceTest : public ::testing::Test { public: - SimpleServiceTest() - : localServiceClient(service), - client(localServiceClient), - movedService(createService()), - movedLocalServiceClient(movedService), - movedClient(createClient()) + SimpleServiceTest() : + localServiceClient(service), + client(localServiceClient), + movedService(createService()), + movedLocalServiceClient(movedService), + movedClient(createClient()) {} private: @@ -99,8 +96,7 @@ class SimpleServiceTest : public ::testing::Test TEST_F(SimpleServiceTest, serviceFullName) { - ASSERT_EQ("service_types.simple_service.SimpleService"_sv, - SimpleService::Service::serviceFullName()); + ASSERT_EQ("service_types.simple_service.SimpleService"_sv, SimpleService::Service::serviceFullName()); } TEST_F(SimpleServiceTest, methodNames) diff --git a/test/language/sql_constraints/cpp/FieldConstraintsTest.cpp b/test/language/sql_constraints/cpp/FieldConstraintsTest.cpp index 8d37c7aca..ef0d19d0c 100644 --- a/test/language/sql_constraints/cpp/FieldConstraintsTest.cpp +++ b/test/language/sql_constraints/cpp/FieldConstraintsTest.cpp @@ -2,12 +2,10 @@ #include #include "gtest/gtest.h" - #include "sql_constraints/TestDb.h" #include "sql_constraints/field_constraints/FieldConstraintsTable.h" - -#include "zserio/SqliteException.h" #include "zserio/RebindAlloc.h" +#include "zserio/SqliteException.h" namespace sql_constraints { @@ -69,8 +67,7 @@ class FieldConstraintsTest : public ::testing::Test sql_constraints::TestDb* m_database; }; -const char* const FieldConstraintsTest::DB_FILE_NAME = - "language/sql_constraints/field_constraints_test.sqlite"; +const char* const FieldConstraintsTest::DB_FILE_NAME = "language/sql_constraints/field_constraints_test.sqlite"; const uint8_t FieldConstraintsTest::UNICODE_ESCAPE_CONST = 1; const uint8_t FieldConstraintsTest::HEX_ESCAPE_CONST = 2; diff --git a/test/language/sql_constraints/cpp/TableConstraintsTest.cpp b/test/language/sql_constraints/cpp/TableConstraintsTest.cpp index a465c23f6..213cec241 100644 --- a/test/language/sql_constraints/cpp/TableConstraintsTest.cpp +++ b/test/language/sql_constraints/cpp/TableConstraintsTest.cpp @@ -2,12 +2,10 @@ #include #include "gtest/gtest.h" - #include "sql_constraints/TestDb.h" #include "sql_constraints/table_constraints/TableConstraintsTable.h" - -#include "zserio/SqliteException.h" #include "zserio/RebindAlloc.h" +#include "zserio/SqliteException.h" namespace sql_constraints { @@ -46,8 +44,7 @@ class TableConstraintsTest : public ::testing::Test sql_constraints::TestDb* m_database; }; -const char* const TableConstraintsTest::DB_FILE_NAME = - "language/sql_constraints/table_constraints_test.sqlite"; +const char* const TableConstraintsTest::DB_FILE_NAME = "language/sql_constraints/table_constraints_test.sqlite"; TEST_F(TableConstraintsTest, primaryKey) { diff --git a/test/language/sql_databases/cpp/DbWithRelocationTest.cpp b/test/language/sql_databases/cpp/DbWithRelocationTest.cpp index f645ec3b6..1203a431f 100644 --- a/test/language/sql_databases/cpp/DbWithRelocationTest.cpp +++ b/test/language/sql_databases/cpp/DbWithRelocationTest.cpp @@ -1,16 +1,14 @@ #include -#include -#include #include +#include +#include #include "gtest/gtest.h" - -#include "sql_databases/db_with_relocation/EuropeDb.h" #include "sql_databases/db_with_relocation/AmericaDb.h" - +#include "sql_databases/db_with_relocation/EuropeDb.h" #include "zserio/RebindAlloc.h" -#include "zserio/StringConvertUtil.h" #include "zserio/SqliteFinalizer.h" +#include "zserio/StringConvertUtil.h" namespace sql_databases { @@ -51,8 +49,8 @@ class DbWithRelocationTest : public ::testing::Test protected: bool isTableInDb(zserio::ISqliteDatabase& database, const string_type& checkTableName) { - string_type sqlQuery = "SELECT name FROM sqlite_master WHERE type='table' AND name='" + checkTableName + - "'"; + string_type sqlQuery = + "SELECT name FROM sqlite_master WHERE type='table' AND name='" + checkTableName + "'"; std::unique_ptr statement( database.connection().prepareStatement(sqlQuery)); @@ -168,7 +166,7 @@ TEST_F(DbWithRelocationTest, relocatedCzechiaTable) TEST_F(DbWithRelocationTest, attachedDatabases) { std::unique_ptr statement( - m_americaDb->connection().prepareStatement("PRAGMA database_list")); + m_americaDb->connection().prepareStatement("PRAGMA database_list")); while (sqlite3_step(statement.get()) == SQLITE_ROW) { diff --git a/test/language/sql_databases/cpp/SimpleDbTest.cpp b/test/language/sql_databases/cpp/SimpleDbTest.cpp index 9c4577091..9a47a7a7a 100644 --- a/test/language/sql_databases/cpp/SimpleDbTest.cpp +++ b/test/language/sql_databases/cpp/SimpleDbTest.cpp @@ -1,18 +1,16 @@ +#include #include -#include -#include #include #include -#include +#include +#include #include "gtest/gtest.h" - #include "sql_databases/simple_db/WorldDb.h" - #include "zserio/RebindAlloc.h" #include "zserio/SqliteFinalizer.h" -#include "zserio/StringView.h" #include "zserio/StringConvertUtil.h" +#include "zserio/StringView.h" namespace sql_databases { @@ -31,7 +29,9 @@ class SimpleDbTest : public ::testing::Test public: SimpleDbTest() : m_dbFileName("language/sql_databases/simple_db_test.sqlite"), - m_worldDbName("WorldDb"), m_europeTableName("europe"), m_americaTableName("america") + m_worldDbName("WorldDb"), + m_europeTableName("europe"), + m_americaTableName("america") { std::remove(m_dbFileName.c_str()); } @@ -39,8 +39,8 @@ class SimpleDbTest : public ::testing::Test protected: bool isTableInDb(zserio::ISqliteDatabase& database, const string_type& checkTableName) { - string_type sqlQuery = "SELECT name FROM sqlite_master WHERE type='table' AND name='" + checkTableName + - "'"; + string_type sqlQuery = + "SELECT name FROM sqlite_master WHERE type='table' AND name='" + checkTableName + "'"; std::unique_ptr statement( database.connection().prepareStatement(sqlQuery)); @@ -61,7 +61,7 @@ class SimpleDbTest : public ::testing::Test TEST_F(SimpleDbTest, externalConstructor) { - sqlite3 *externalConnection = nullptr; + sqlite3* externalConnection = nullptr; const int result = sqlite3_open(m_dbFileName.c_str(), &externalConnection); ASSERT_EQ(SQLITE_OK, result); @@ -142,11 +142,7 @@ TEST_F(SimpleDbTest, tableNames) { vector_type tableNames; std::transform(WorldDb::tableNames().begin(), WorldDb::tableNames().end(), std::back_inserter(tableNames), - [](zserio::StringView name) -> string_type - { - return zserio::toString(name, allocator_type()); - } - ); + [](zserio::StringView name) -> string_type { return zserio::toString(name, allocator_type()); }); vector_type expectedTableNames; expectedTableNames.push_back(m_europeTableName); diff --git a/test/language/sql_tables/cpp/BlobFieldWithChildrenInitializationTableTest.cpp b/test/language/sql_tables/cpp/BlobFieldWithChildrenInitializationTableTest.cpp index 55d663b2d..bd9a62c8a 100644 --- a/test/language/sql_tables/cpp/BlobFieldWithChildrenInitializationTableTest.cpp +++ b/test/language/sql_tables/cpp/BlobFieldWithChildrenInitializationTableTest.cpp @@ -2,9 +2,7 @@ #include #include "gtest/gtest.h" - #include "sql_tables/TestDb.h" - #include "zserio/RebindAlloc.h" namespace sql_tables diff --git a/test/language/sql_tables/cpp/BlobOffsetsParamTableTest.cpp b/test/language/sql_tables/cpp/BlobOffsetsParamTableTest.cpp index 846e499b8..d89b76518 100644 --- a/test/language/sql_tables/cpp/BlobOffsetsParamTableTest.cpp +++ b/test/language/sql_tables/cpp/BlobOffsetsParamTableTest.cpp @@ -1,16 +1,14 @@ #include -#include -#include #include #include +#include +#include #include "gtest/gtest.h" - #include "sql_tables/TestDb.h" - #include "zserio/RebindAlloc.h" -#include "zserio/StringConvertUtil.h" #include "zserio/SqliteFinalizer.h" +#include "zserio/StringConvertUtil.h" namespace sql_tables { @@ -45,8 +43,8 @@ class BlobOffsetsParamTableTest : public ::testing::Test BlobOffsetsParamTableTest& operator=(BlobOffsetsParamTableTest&&) = delete; protected: - static void fillBlobOffsetsParamTableRow(BlobOffsetsParamTable::Row& row, uint32_t blobId, - const string_type& name) + static void fillBlobOffsetsParamTableRow( + BlobOffsetsParamTable::Row& row, uint32_t blobId, const string_type& name) { row.setBlobId(blobId); row.setName(name); @@ -74,8 +72,8 @@ class BlobOffsetsParamTableTest : public ::testing::Test } } - static void checkBlobOffsetsParamTableRow(const BlobOffsetsParamTable::Row& row1, - const BlobOffsetsParamTable::Row& row2) + static void checkBlobOffsetsParamTableRow( + const BlobOffsetsParamTable::Row& row1, const BlobOffsetsParamTable::Row& row2) { ASSERT_EQ(row1.getBlobId(), row2.getBlobId()); ASSERT_EQ(row1.getName(), row2.getName()); @@ -94,8 +92,8 @@ class BlobOffsetsParamTableTest : public ::testing::Test bool isTableInDb() { string_type checkTableName = "blobOffsetsParamTable"; - string_type sqlQuery = "SELECT name FROM sqlite_master WHERE type='table' AND name='" + checkTableName + - "'"; + string_type sqlQuery = + "SELECT name FROM sqlite_master WHERE type='table' AND name='" + checkTableName + "'"; std::unique_ptr statement( m_database->connection().prepareStatement(sqlQuery)); diff --git a/test/language/sql_tables/cpp/BlobParamTableTest.cpp b/test/language/sql_tables/cpp/BlobParamTableTest.cpp index 412f74caa..20a780481 100644 --- a/test/language/sql_tables/cpp/BlobParamTableTest.cpp +++ b/test/language/sql_tables/cpp/BlobParamTableTest.cpp @@ -1,16 +1,14 @@ #include -#include -#include #include #include +#include +#include #include "gtest/gtest.h" - #include "sql_tables/TestDb.h" - #include "zserio/RebindAlloc.h" -#include "zserio/StringConvertUtil.h" #include "zserio/SqliteFinalizer.h" +#include "zserio/StringConvertUtil.h" namespace sql_tables { @@ -113,8 +111,8 @@ class BlobParamTableTest : public ::testing::Test ASSERT_EQ(row1.isBlobSet(), row2.isBlobSet()); } - static void checkBlobParamTableRows(const vector_type& rows1, - const vector_type& rows2) + static void checkBlobParamTableRows( + const vector_type& rows1, const vector_type& rows2) { ASSERT_EQ(rows1.size(), rows2.size()); for (size_t i = 0; i < rows1.size(); ++i) @@ -124,8 +122,8 @@ class BlobParamTableTest : public ::testing::Test bool isTableInDb() { string_type checkTableName = "blobParamTable"; - string_type sqlQuery = "SELECT name FROM sqlite_master WHERE type='table' AND name='" + checkTableName + - "'"; + string_type sqlQuery = + "SELECT name FROM sqlite_master WHERE type='table' AND name='" + checkTableName + "'"; std::unique_ptr statement( m_database->connection().prepareStatement(sqlQuery)); @@ -176,7 +174,6 @@ TEST_F(BlobParamTableTest, readWithoutCondition) checkBlobParamTableRows(writtenRows, readRows); } - TEST_F(BlobParamTableTest, readWithoutConditionWithNullValues) { BlobParamTable& testTable = m_database->getBlobParamTable(); diff --git a/test/language/sql_tables/cpp/ColumnParamTableTest.cpp b/test/language/sql_tables/cpp/ColumnParamTableTest.cpp index 4e95e2611..eb35dc256 100644 --- a/test/language/sql_tables/cpp/ColumnParamTableTest.cpp +++ b/test/language/sql_tables/cpp/ColumnParamTableTest.cpp @@ -1,12 +1,10 @@ #include -#include -#include #include +#include +#include #include "gtest/gtest.h" - #include "sql_tables/TestDb.h" - #include "zserio/RebindAlloc.h" #include "zserio/StringConvertUtil.h" @@ -72,8 +70,8 @@ class ColumnParamTableTest : public ::testing::Test ASSERT_EQ(row1.getBlob(), row2.getBlob()); } - static void checkColumnParamTableRows(const vector_type& rows1, - const vector_type& rows2) + static void checkColumnParamTableRows( + const vector_type& rows1, const vector_type& rows2) { ASSERT_EQ(rows1.size(), rows2.size()); for (size_t i = 0; i < rows1.size(); ++i) @@ -83,8 +81,8 @@ class ColumnParamTableTest : public ::testing::Test bool isTableInDb() { string_type checkTableName = "columnParamTable"; - string_type sqlQuery = "SELECT name FROM sqlite_master WHERE type='table' AND name='" + checkTableName + - "'"; + string_type sqlQuery = + "SELECT name FROM sqlite_master WHERE type='table' AND name='" + checkTableName + "'"; std::unique_ptr statement( m_database->connection().prepareStatement(sqlQuery)); diff --git a/test/language/sql_tables/cpp/ComplexTableTest.cpp b/test/language/sql_tables/cpp/ComplexTableTest.cpp index 944462f1c..8ab134f2e 100644 --- a/test/language/sql_tables/cpp/ComplexTableTest.cpp +++ b/test/language/sql_tables/cpp/ComplexTableTest.cpp @@ -1,13 +1,11 @@ #include -#include -#include #include #include +#include +#include #include "gtest/gtest.h" - #include "sql_tables/TestDb.h" - #include "zserio/RebindAlloc.h" #include "zserio/SqliteFinalizer.h" @@ -114,8 +112,8 @@ class ComplexTableTest : public ::testing::Test ASSERT_EQ(row1.getBlob(), row2.getBlob()); } - static void checkComplexTableRows(const vector_type& rows1, - const vector_type& rows2) + static void checkComplexTableRows( + const vector_type& rows1, const vector_type& rows2) { ASSERT_EQ(rows1.size(), rows2.size()); for (size_t i = 0; i < rows1.size(); ++i) @@ -167,8 +165,8 @@ class ComplexTableTest : public ::testing::Test ASSERT_EQ(row1.isBlobSet(), row2.isBlobSet()); } - static void checkComplexTableRowsWithNullValues(const vector_type& rows1, - const vector_type& rows2) + static void checkComplexTableRowsWithNullValues( + const vector_type& rows1, const vector_type& rows2) { ASSERT_EQ(rows1.size(), rows2.size()); for (size_t i = 0; i < rows1.size(); ++i) @@ -178,8 +176,8 @@ class ComplexTableTest : public ::testing::Test bool isTableInDb() { string_type checkTableName = "complexTable"; - string_type sqlQuery = "SELECT name FROM sqlite_master WHERE type='table' AND name='" + checkTableName + - "'"; + string_type sqlQuery = + "SELECT name FROM sqlite_master WHERE type='table' AND name='" + checkTableName + "'"; std::unique_ptr statement( m_database->connection().prepareStatement(sqlQuery)); diff --git a/test/language/sql_tables/cpp/ConstParamTableTest.cpp b/test/language/sql_tables/cpp/ConstParamTableTest.cpp index e6d9413b4..782d8ab5f 100644 --- a/test/language/sql_tables/cpp/ConstParamTableTest.cpp +++ b/test/language/sql_tables/cpp/ConstParamTableTest.cpp @@ -1,16 +1,14 @@ #include -#include -#include #include #include +#include +#include #include "gtest/gtest.h" - #include "sql_tables/TestDb.h" - #include "zserio/RebindAlloc.h" -#include "zserio/StringConvertUtil.h" #include "zserio/SqliteFinalizer.h" +#include "zserio/StringConvertUtil.h" namespace sql_tables { @@ -75,8 +73,8 @@ class ConstParamTableTest : public ::testing::Test ASSERT_EQ(row1.getBlob(), row2.getBlob()); } - static void checkConstParamTableRows(const vector_type& rows1, - const vector_type& rows2) + static void checkConstParamTableRows( + const vector_type& rows1, const vector_type& rows2) { ASSERT_EQ(rows1.size(), rows2.size()); for (size_t i = 0; i < rows1.size(); ++i) @@ -86,8 +84,8 @@ class ConstParamTableTest : public ::testing::Test bool isTableInDb() { string_type checkTableName = "constParamTable"; - string_type sqlQuery = "SELECT name FROM sqlite_master WHERE type='table' AND name='" + checkTableName + - "'"; + string_type sqlQuery = + "SELECT name FROM sqlite_master WHERE type='table' AND name='" + checkTableName + "'"; std::unique_ptr statement( m_database->connection().prepareStatement(sqlQuery)); diff --git a/test/language/sql_tables/cpp/DynamicBitFieldEnumFieldTableTest.cpp b/test/language/sql_tables/cpp/DynamicBitFieldEnumFieldTableTest.cpp index d9a12e505..df17a0947 100644 --- a/test/language/sql_tables/cpp/DynamicBitFieldEnumFieldTableTest.cpp +++ b/test/language/sql_tables/cpp/DynamicBitFieldEnumFieldTableTest.cpp @@ -1,11 +1,9 @@ #include -#include #include +#include #include "gtest/gtest.h" - #include "sql_tables/TestDb.h" - #include "zserio/RebindAlloc.h" namespace sql_tables @@ -43,11 +41,7 @@ class DynamicBitFieldEnumFieldTableTest : public ::testing::Test static void fillRow(DynamicBitFieldEnumFieldTable::Row& row, size_t i) { row.setId(static_cast(i)); - row.setEnumField(i % 3 == 0 - ? TestEnum::ONE - : i % 3 == 1 - ? TestEnum::TWO - : TestEnum::THREE); + row.setEnumField(i % 3 == 0 ? TestEnum::ONE : i % 3 == 1 ? TestEnum::TWO : TestEnum::THREE); } static void fillRows(vector_type& rows) @@ -61,8 +55,8 @@ class DynamicBitFieldEnumFieldTableTest : public ::testing::Test } } - static void checkRow(const DynamicBitFieldEnumFieldTable::Row& row1, - const DynamicBitFieldEnumFieldTable::Row& row2) + static void checkRow( + const DynamicBitFieldEnumFieldTable::Row& row1, const DynamicBitFieldEnumFieldTable::Row& row2) { ASSERT_EQ(row1.getId(), row2.getId()); ASSERT_EQ(row1.getEnumField(), row2.getEnumField()); diff --git a/test/language/sql_tables/cpp/MultiplePkTableTest.cpp b/test/language/sql_tables/cpp/MultiplePkTableTest.cpp index c863d9cd1..0042e401a 100644 --- a/test/language/sql_tables/cpp/MultiplePkTableTest.cpp +++ b/test/language/sql_tables/cpp/MultiplePkTableTest.cpp @@ -1,15 +1,13 @@ #include -#include -#include #include +#include +#include #include "gtest/gtest.h" - #include "sql_tables/TestDb.h" - #include "zserio/RebindAlloc.h" -#include "zserio/StringConvertUtil.h" #include "zserio/SqliteFinalizer.h" +#include "zserio/StringConvertUtil.h" namespace sql_tables { @@ -70,8 +68,8 @@ class MultiplePkTableTest : public ::testing::Test ASSERT_EQ(row1.getName(), row2.getName()); } - static void checkMultiplePkTableRows(const vector_type& rows1, - const vector_type& rows2) + static void checkMultiplePkTableRows( + const vector_type& rows1, const vector_type& rows2) { ASSERT_EQ(rows1.size(), rows2.size()); for (size_t i = 0; i < rows1.size(); ++i) @@ -81,8 +79,8 @@ class MultiplePkTableTest : public ::testing::Test bool isTableInDb() { string_type checkTableName = "multiplePkTable"; - string_type sqlQuery = "SELECT name FROM sqlite_master WHERE type='table' AND name='" + checkTableName + - "'"; + string_type sqlQuery = + "SELECT name FROM sqlite_master WHERE type='table' AND name='" + checkTableName + "'"; std::unique_ptr statement( m_database->connection().prepareStatement(sqlQuery)); diff --git a/test/language/sql_tables/cpp/SubtypedBitmaskFieldTableTest.cpp b/test/language/sql_tables/cpp/SubtypedBitmaskFieldTableTest.cpp index b0fdfc7a9..ec6d1d3c0 100644 --- a/test/language/sql_tables/cpp/SubtypedBitmaskFieldTableTest.cpp +++ b/test/language/sql_tables/cpp/SubtypedBitmaskFieldTableTest.cpp @@ -1,11 +1,9 @@ #include -#include #include +#include #include "gtest/gtest.h" - #include "sql_tables/TestDb.h" - #include "zserio/RebindAlloc.h" namespace sql_tables @@ -43,11 +41,9 @@ class SubtypedBitmaskFieldTableTest : public ::testing::Test static void fillRow(SubtypedBitmaskFieldTable::Row& row, size_t i) { row.setId(static_cast(i)); - row.setBitmaskField(i % 3 == 0 - ? TestBitmask::Values::ONE - : i % 3 == 1 - ? TestBitmask::Values::TWO - : TestBitmask::Values::THREE); + row.setBitmaskField(i % 3 == 0 ? TestBitmask::Values::ONE + : i % 3 == 1 ? TestBitmask::Values::TWO + : TestBitmask::Values::THREE); } static void fillRows(vector_type& rows) diff --git a/test/language/sql_tables/cpp/SubtypedBoolFieldTableTest.cpp b/test/language/sql_tables/cpp/SubtypedBoolFieldTableTest.cpp index a18ecadb8..79b50b29c 100644 --- a/test/language/sql_tables/cpp/SubtypedBoolFieldTableTest.cpp +++ b/test/language/sql_tables/cpp/SubtypedBoolFieldTableTest.cpp @@ -1,11 +1,9 @@ #include -#include #include +#include #include "gtest/gtest.h" - #include "sql_tables/TestDb.h" - #include "zserio/RebindAlloc.h" namespace sql_tables diff --git a/test/language/sql_tables/cpp/SubtypedEnumFieldTableTest.cpp b/test/language/sql_tables/cpp/SubtypedEnumFieldTableTest.cpp index b6162cf4d..90cd8a76c 100644 --- a/test/language/sql_tables/cpp/SubtypedEnumFieldTableTest.cpp +++ b/test/language/sql_tables/cpp/SubtypedEnumFieldTableTest.cpp @@ -1,11 +1,9 @@ #include -#include #include +#include #include "gtest/gtest.h" - #include "sql_tables/TestDb.h" - #include "zserio/RebindAlloc.h" namespace sql_tables @@ -43,11 +41,7 @@ class SubtypedEnumFieldTableTest : public ::testing::Test static void fillRow(SubtypedEnumFieldTable::Row& row, size_t i) { row.setId(static_cast(i)); - row.setEnumField(i % 3 == 0 - ? TestEnum::ONE - : i % 3 == 1 - ? TestEnum::TWO - : TestEnum::THREE); + row.setEnumField(i % 3 == 0 ? TestEnum::ONE : i % 3 == 1 ? TestEnum::TWO : TestEnum::THREE); } static void fillRows(vector_type& rows) diff --git a/test/language/sql_tables/cpp/SubtypedTableTest.cpp b/test/language/sql_tables/cpp/SubtypedTableTest.cpp index 6eca3fdaa..e62c306a4 100644 --- a/test/language/sql_tables/cpp/SubtypedTableTest.cpp +++ b/test/language/sql_tables/cpp/SubtypedTableTest.cpp @@ -1,12 +1,10 @@ #include -#include #include #include +#include #include "gtest/gtest.h" - #include "sql_tables/TestDb.h" - #include "zserio/SqliteFinalizer.h" namespace sql_tables @@ -43,8 +41,8 @@ class SubtypedTableTest : public ::testing::Test bool isTableInDb() { string_type checkTableName = "subtypedTable"; - string_type sqlQuery = "SELECT name FROM sqlite_master WHERE type='table' AND name='" + checkTableName + - "'"; + string_type sqlQuery = + "SELECT name FROM sqlite_master WHERE type='table' AND name='" + checkTableName + "'"; std::unique_ptr statement( m_database->connection().prepareStatement(sqlQuery)); diff --git a/test/language/sql_tables/cpp/WithoutPkTableTest.cpp b/test/language/sql_tables/cpp/WithoutPkTableTest.cpp index b9912388c..3e572f404 100644 --- a/test/language/sql_tables/cpp/WithoutPkTableTest.cpp +++ b/test/language/sql_tables/cpp/WithoutPkTableTest.cpp @@ -1,15 +1,13 @@ #include -#include -#include #include +#include +#include #include "gtest/gtest.h" - #include "sql_tables/TestDb.h" - #include "zserio/RebindAlloc.h" -#include "zserio/StringConvertUtil.h" #include "zserio/SqliteFinalizer.h" +#include "zserio/StringConvertUtil.h" namespace sql_tables { @@ -68,8 +66,8 @@ class WithoutPkTableTest : public ::testing::Test ASSERT_EQ(row1.getName(), row2.getName()); } - static void checkWithoutPkTableRows(const vector_type& rows1, - const vector_type& rows2) + static void checkWithoutPkTableRows( + const vector_type& rows1, const vector_type& rows2) { ASSERT_EQ(rows1.size(), rows2.size()); for (size_t i = 0; i < rows1.size(); ++i) @@ -79,8 +77,8 @@ class WithoutPkTableTest : public ::testing::Test bool isTableInDb() { string_type checkTableName = "withoutPkTable"; - string_type sqlQuery = "SELECT name FROM sqlite_master WHERE type='table' AND name='" + checkTableName + - "'"; + string_type sqlQuery = + "SELECT name FROM sqlite_master WHERE type='table' AND name='" + checkTableName + "'"; std::unique_ptr statement( m_database->connection().prepareStatement(sqlQuery)); diff --git a/test/language/sql_types/cpp/SqlTypesTest.cpp b/test/language/sql_types/cpp/SqlTypesTest.cpp index a229e4bbc..81332652b 100644 --- a/test/language/sql_types/cpp/SqlTypesTest.cpp +++ b/test/language/sql_types/cpp/SqlTypesTest.cpp @@ -1,12 +1,10 @@ #include #include -#include #include +#include #include "gtest/gtest.h" - #include "sql_types/SqlTypesDb.h" - #include "zserio/SqliteFinalizer.h" namespace sql_types @@ -196,7 +194,6 @@ TEST_F(SqlTypesTest, variableUnsignedIntegerTypes) it = sqlColumnTypes.find("varsizeType"); ASSERT_TRUE(it != sqlColumnTypes.end()); ASSERT_EQ("INTEGER", it->second); - } TEST_F(SqlTypesTest, variableSignedIntegerTypes) diff --git a/test/language/sql_virtual_columns/cpp/HiddenVirtualColumnsTest.cpp b/test/language/sql_virtual_columns/cpp/HiddenVirtualColumnsTest.cpp index ba2d7203b..88c9b27b0 100644 --- a/test/language/sql_virtual_columns/cpp/HiddenVirtualColumnsTest.cpp +++ b/test/language/sql_virtual_columns/cpp/HiddenVirtualColumnsTest.cpp @@ -3,13 +3,11 @@ #include #include "gtest/gtest.h" - #include "sql_virtual_columns/hidden_virtual_columns/HiddenVirtualColumnsDb.h" - #include "zserio/RebindAlloc.h" +#include "zserio/SqliteFinalizer.h" #include "zserio/StringConvertUtil.h" #include "zserio/ValidationSqliteUtil.h" -#include "zserio/SqliteFinalizer.h" using namespace zserio::literals; @@ -26,7 +24,8 @@ using vector_type = zserio::vector; class HiddenVirtualColumnsTest : public ::testing::Test { public: - HiddenVirtualColumnsTest() : m_tableName("hiddenVirtualColumnsTable") + HiddenVirtualColumnsTest() : + m_tableName("hiddenVirtualColumnsTable") { std::remove(DB_FILE_NAME); @@ -46,8 +45,8 @@ class HiddenVirtualColumnsTest : public ::testing::Test HiddenVirtualColumnsTest& operator=(HiddenVirtualColumnsTest&&) = delete; protected: - static void fillHiddenVirtualColumnsTableRow(HiddenVirtualColumnsTable::Row& row, int64_t docId, - const string_type& searchTags) + static void fillHiddenVirtualColumnsTableRow( + HiddenVirtualColumnsTable::Row& row, int64_t docId, const string_type& searchTags) { row.setDocId(docId); const uint16_t languageCode = 1; @@ -69,8 +68,8 @@ class HiddenVirtualColumnsTest : public ::testing::Test } } - static void checkHiddenVirtualColumnsTableRow(const HiddenVirtualColumnsTable::Row& row1, - const HiddenVirtualColumnsTable::Row& row2) + static void checkHiddenVirtualColumnsTableRow( + const HiddenVirtualColumnsTable::Row& row1, const HiddenVirtualColumnsTable::Row& row2) { ASSERT_EQ(row1.getDocId(), row2.getDocId()); ASSERT_EQ(row1.getLanguageCode(), row2.getLanguageCode()); @@ -88,8 +87,8 @@ class HiddenVirtualColumnsTest : public ::testing::Test bool isTableInDb() { - string_type sqlQuery = "SELECT name FROM sqlite_master WHERE type='table' AND name='" + m_tableName + - "'"; + string_type sqlQuery = + "SELECT name FROM sqlite_master WHERE type='table' AND name='" + m_tableName + "'"; std::unique_ptr statement( m_database->connection().prepareStatement(sqlQuery)); @@ -193,5 +192,5 @@ TEST_F(HiddenVirtualColumnsTest, checkVirtualColumn) ASSERT_TRUE(isHiddenVirtualColumnInTable("languageCode")); } -} // hidden_virtual_columns +} // namespace hidden_virtual_columns } // namespace sql_virtual_columns diff --git a/test/language/sql_virtual_columns/cpp/SimpleVirtualColumnsTest.cpp b/test/language/sql_virtual_columns/cpp/SimpleVirtualColumnsTest.cpp index eaf9f4d45..d529cd2f4 100644 --- a/test/language/sql_virtual_columns/cpp/SimpleVirtualColumnsTest.cpp +++ b/test/language/sql_virtual_columns/cpp/SimpleVirtualColumnsTest.cpp @@ -1,15 +1,13 @@ #include +#include #include #include -#include #include "gtest/gtest.h" - #include "sql_virtual_columns/simple_virtual_columns/SimpleVirtualColumnsDb.h" - #include "zserio/RebindAlloc.h" -#include "zserio/StringConvertUtil.h" #include "zserio/SqliteFinalizer.h" +#include "zserio/StringConvertUtil.h" namespace sql_virtual_columns { @@ -24,7 +22,9 @@ using vector_type = zserio::vector; class SimpleVirtualColumnsTest : public ::testing::Test { public: - SimpleVirtualColumnsTest() : m_tableName("simpleVirtualColumnsTable"), m_virtualColumnName("content") + SimpleVirtualColumnsTest() : + m_tableName("simpleVirtualColumnsTable"), + m_virtualColumnName("content") { std::remove(DB_FILE_NAME); @@ -44,8 +44,8 @@ class SimpleVirtualColumnsTest : public ::testing::Test SimpleVirtualColumnsTest& operator=(SimpleVirtualColumnsTest&&) = delete; protected: - static void fillSimpleVirtualColumnsTableRow(SimpleVirtualColumnsTable::Row& row, - const string_type& content) + static void fillSimpleVirtualColumnsTableRow( + SimpleVirtualColumnsTable::Row& row, const string_type& content) { row.setContent(content); } @@ -62,8 +62,8 @@ class SimpleVirtualColumnsTest : public ::testing::Test } } - static void checkSimpleVirtualColumnsTableRow(const SimpleVirtualColumnsTable::Row& row1, - const SimpleVirtualColumnsTable::Row& row2) + static void checkSimpleVirtualColumnsTableRow( + const SimpleVirtualColumnsTable::Row& row1, const SimpleVirtualColumnsTable::Row& row2) { ASSERT_EQ(row1.getContent(), row2.getContent()); } @@ -78,8 +78,8 @@ class SimpleVirtualColumnsTest : public ::testing::Test bool isTableInDb() { - string_type sqlQuery = "SELECT name FROM sqlite_master WHERE type='table' AND name='" + m_tableName + - "'"; + string_type sqlQuery = + "SELECT name FROM sqlite_master WHERE type='table' AND name='" + m_tableName + "'"; std::unique_ptr statement( m_database->connection().prepareStatement(sqlQuery)); @@ -202,5 +202,5 @@ TEST_F(SimpleVirtualColumnsTest, checkVirtualColumn) ASSERT_TRUE(isVirtualColumnInTable()); } -} // simple_virtual_columns +} // namespace simple_virtual_columns } // namespace sql_virtual_columns diff --git a/test/language/sql_virtual_tables/cpp/Fts3VirtualTableTest.cpp b/test/language/sql_virtual_tables/cpp/Fts3VirtualTableTest.cpp index 20252bd64..7763a9fc1 100644 --- a/test/language/sql_virtual_tables/cpp/Fts3VirtualTableTest.cpp +++ b/test/language/sql_virtual_tables/cpp/Fts3VirtualTableTest.cpp @@ -1,15 +1,13 @@ #include +#include #include #include -#include #include "gtest/gtest.h" - #include "sql_virtual_tables/fts3_virtual_table/Fts3TestDb.h" - #include "zserio/RebindAlloc.h" -#include "zserio/StringConvertUtil.h" #include "zserio/SqliteFinalizer.h" +#include "zserio/StringConvertUtil.h" namespace sql_virtual_tables { @@ -44,8 +42,8 @@ class Fts3VirtualTableTest : public ::testing::Test Fts3VirtualTableTest& operator=(Fts3VirtualTableTest&&) = delete; protected: - static void fillFts3VirtualTableRow(Fts3VirtualTable::Row& row, const string_type& title, - const string_type& body) + static void fillFts3VirtualTableRow( + Fts3VirtualTable::Row& row, const string_type& title, const string_type& body) { row.setTitle(title); row.setBody(body); @@ -70,8 +68,8 @@ class Fts3VirtualTableTest : public ::testing::Test ASSERT_EQ(row1.getBody(), row2.getBody()); } - static void checkFts3VirtualTableRows(const vector_type& rows1, - const vector_type& rows2) + static void checkFts3VirtualTableRows( + const vector_type& rows1, const vector_type& rows2) { ASSERT_EQ(rows1.size(), rows2.size()); for (size_t i = 0; i < rows1.size(); ++i) @@ -81,8 +79,8 @@ class Fts3VirtualTableTest : public ::testing::Test bool isTableInDb() { string_type checkTableName = "fts3VirtualTable"; - string_type sqlQuery = "SELECT name FROM sqlite_master WHERE type='table' AND name='" + checkTableName + - "'"; + string_type sqlQuery = + "SELECT name FROM sqlite_master WHERE type='table' AND name='" + checkTableName + "'"; std::unique_ptr statement( m_database->connection().prepareStatement(sqlQuery)); @@ -100,7 +98,8 @@ class Fts3VirtualTableTest : public ::testing::Test sql_virtual_tables::fts3_virtual_table::Fts3TestDb* m_database; }; -const char* const Fts3VirtualTableTest::DB_FILE_NAME = "language/sql_virtual_tables/fts3_virtual_table_test.sqlite"; +const char* const Fts3VirtualTableTest::DB_FILE_NAME = + "language/sql_virtual_tables/fts3_virtual_table_test.sqlite"; const int32_t Fts3VirtualTableTest::NUM_VIRTUAL_TABLE_ROWS = 5; TEST_F(Fts3VirtualTableTest, deleteTable) diff --git a/test/language/sql_virtual_tables/cpp/Fts5VirtualTableTest.cpp b/test/language/sql_virtual_tables/cpp/Fts5VirtualTableTest.cpp index d12f20430..d881648b3 100644 --- a/test/language/sql_virtual_tables/cpp/Fts5VirtualTableTest.cpp +++ b/test/language/sql_virtual_tables/cpp/Fts5VirtualTableTest.cpp @@ -1,15 +1,13 @@ #include +#include #include #include -#include #include "gtest/gtest.h" - #include "sql_virtual_tables/fts5_virtual_table/Fts5TestDb.h" - #include "zserio/RebindAlloc.h" -#include "zserio/StringConvertUtil.h" #include "zserio/SqliteFinalizer.h" +#include "zserio/StringConvertUtil.h" namespace sql_virtual_tables { @@ -44,8 +42,8 @@ class Fts5VirtualTableTest : public ::testing::Test Fts5VirtualTableTest& operator=(Fts5VirtualTableTest&&) = delete; protected: - static void fillFts5VirtualTableRow(Fts5VirtualTable::Row& row, const string_type& title, - const string_type& body) + static void fillFts5VirtualTableRow( + Fts5VirtualTable::Row& row, const string_type& title, const string_type& body) { row.setTitle(title); row.setBody(body); @@ -70,8 +68,8 @@ class Fts5VirtualTableTest : public ::testing::Test ASSERT_EQ(row1.getBody(), row2.getBody()); } - static void checkFts5VirtualTableRows(const vector_type& rows1, - const vector_type& rows2) + static void checkFts5VirtualTableRows( + const vector_type& rows1, const vector_type& rows2) { ASSERT_EQ(rows1.size(), rows2.size()); for (size_t i = 0; i < rows1.size(); ++i) @@ -81,8 +79,8 @@ class Fts5VirtualTableTest : public ::testing::Test bool isTableInDb() { string_type checkTableName = "fts5VirtualTable"; - string_type sqlQuery = "SELECT name FROM sqlite_master WHERE type='table' AND name='" + checkTableName + - "'"; + string_type sqlQuery = + "SELECT name FROM sqlite_master WHERE type='table' AND name='" + checkTableName + "'"; std::unique_ptr statement( m_database->connection().prepareStatement(sqlQuery)); @@ -98,10 +96,10 @@ class Fts5VirtualTableTest : public ::testing::Test static const int32_t NUM_VIRTUAL_TABLE_ROWS; sql_virtual_tables::fts5_virtual_table::Fts5TestDb* m_database; - }; -const char* const Fts5VirtualTableTest::DB_FILE_NAME = "language/sql_virtual_tables/fts5_virtual_table_test.sqlite"; +const char* const Fts5VirtualTableTest::DB_FILE_NAME = + "language/sql_virtual_tables/fts5_virtual_table_test.sqlite"; const int32_t Fts5VirtualTableTest::NUM_VIRTUAL_TABLE_ROWS = 5; TEST_F(Fts5VirtualTableTest, deleteTable) diff --git a/test/language/sql_without_rowid_tables/cpp/RowIdAndWithoutRowIdTablesTest.cpp b/test/language/sql_without_rowid_tables/cpp/RowIdAndWithoutRowIdTablesTest.cpp index 9274d818e..35fb3a897 100644 --- a/test/language/sql_without_rowid_tables/cpp/RowIdAndWithoutRowIdTablesTest.cpp +++ b/test/language/sql_without_rowid_tables/cpp/RowIdAndWithoutRowIdTablesTest.cpp @@ -1,11 +1,9 @@ #include -#include #include +#include #include "gtest/gtest.h" - #include "sql_without_rowid_tables/rowid_and_without_rowid_tables/RowIdAndWithoutRowIdDb.h" - #include "zserio/ValidationSqliteUtil.h" using namespace zserio::literals; @@ -33,8 +31,8 @@ class RowIdAndWithoutRowIdTablesTest : public ::testing::Test } protected: - bool isColumnInTable(zserio::ISqliteDatabase& database, - const string_type& columnName, const string_type& tableName) + bool isColumnInTable( + zserio::ISqliteDatabase& database, const string_type& columnName, const string_type& tableName) { return zserio::ValidationSqliteUtil::isColumnInTable( database.connection(), ""_sv, tableName, columnName, allocator_type()); diff --git a/test/language/sql_without_rowid_tables/cpp/SimpleWithoutRowIdTableTest.cpp b/test/language/sql_without_rowid_tables/cpp/SimpleWithoutRowIdTableTest.cpp index caedb9c4a..a5fb8d029 100644 --- a/test/language/sql_without_rowid_tables/cpp/SimpleWithoutRowIdTableTest.cpp +++ b/test/language/sql_without_rowid_tables/cpp/SimpleWithoutRowIdTableTest.cpp @@ -1,11 +1,9 @@ #include -#include #include +#include #include "gtest/gtest.h" - #include "sql_without_rowid_tables/simple_without_rowid_table/SimpleWithoutRowIdDb.h" - #include "zserio/ValidationSqliteUtil.h" using namespace zserio::literals; @@ -32,8 +30,8 @@ class SimpleWithoutRowIdTableTest : public ::testing::Test } protected: - bool isColumnInTable(zserio::ISqliteDatabase& database, - const string_type& columnName, const string_type& tableName) + bool isColumnInTable( + zserio::ISqliteDatabase& database, const string_type& columnName, const string_type& tableName) { return zserio::ValidationSqliteUtil::isColumnInTable( database.connection(), ""_sv, tableName, columnName, allocator_type()); diff --git a/test/language/structure_types/cpp/EmptyStructureTest.cpp b/test/language/structure_types/cpp/EmptyStructureTest.cpp index 69d9e09c9..4525af828 100644 --- a/test/language/structure_types/cpp/EmptyStructureTest.cpp +++ b/test/language/structure_types/cpp/EmptyStructureTest.cpp @@ -1,9 +1,7 @@ #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" -#include "zserio/BitStreamReader.h" - #include "structure_types/empty_structure/EmptyStructure.h" +#include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace structure_types { @@ -67,8 +65,8 @@ TEST(EmptyStructureTest, moveAssignmentOperator) TEST(EmptyStructureTest, propagateAllocatorCopyConstructor) { EmptyStructure emptyStructure; - EmptyStructure emptyStructureCopy(zserio::PropagateAllocator, emptyStructure, - EmptyStructure::allocator_type()); + EmptyStructure emptyStructureCopy( + zserio::PropagateAllocator, emptyStructure, EmptyStructure::allocator_type()); ASSERT_EQ(0, emptyStructure.bitSizeOf()); ASSERT_EQ(0, emptyStructureCopy.bitSizeOf()); } diff --git a/test/language/structure_types/cpp/EmptyStructureWithParameterTest.cpp b/test/language/structure_types/cpp/EmptyStructureWithParameterTest.cpp index 8fc881730..a791f94b1 100644 --- a/test/language/structure_types/cpp/EmptyStructureWithParameterTest.cpp +++ b/test/language/structure_types/cpp/EmptyStructureWithParameterTest.cpp @@ -1,11 +1,9 @@ #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" +#include "structure_types/empty_structure_with_parameter/EmptyStructureWithParameter.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" #include "zserio/CppRuntimeException.h" -#include "structure_types/empty_structure_with_parameter/EmptyStructureWithParameter.h" - namespace structure_types { namespace empty_structure_with_parameter diff --git a/test/language/structure_types/cpp/FieldConstructorClashingTest.cpp b/test/language/structure_types/cpp/FieldConstructorClashingTest.cpp index 9e7c1897a..9c3ceeaae 100644 --- a/test/language/structure_types/cpp/FieldConstructorClashingTest.cpp +++ b/test/language/structure_types/cpp/FieldConstructorClashingTest.cpp @@ -1,9 +1,7 @@ #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" -#include "zserio/BitStreamReader.h" - #include "structure_types/field_constructor_clashing/FieldConstructorClashing.h" +#include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace structure_types { diff --git a/test/language/structure_types/cpp/OneStringStructureTest.cpp b/test/language/structure_types/cpp/OneStringStructureTest.cpp index 61256cda0..82481d3eb 100644 --- a/test/language/structure_types/cpp/OneStringStructureTest.cpp +++ b/test/language/structure_types/cpp/OneStringStructureTest.cpp @@ -1,11 +1,9 @@ #include #include "gtest/gtest.h" - #include "structure_types/one_string_structure/OneStringStructure.h" - -#include "zserio/SerializeUtil.h" #include "zserio/RebindAlloc.h" +#include "zserio/SerializeUtil.h" namespace structure_types { @@ -61,7 +59,7 @@ TEST_F(OneStringStructureTest, fieldConstructor) string_type movedString(1000, 'a'); // long enough to prevent small string optimization const void* ptr = movedString.data(); OneStringStructure oneStringStructure(std::move(movedString)); - const void* movedPtr= oneStringStructure.getOneString().data(); + const void* movedPtr = oneStringStructure.getOneString().data(); ASSERT_EQ(ptr, movedPtr); } { @@ -129,8 +127,8 @@ TEST_F(OneStringStructureTest, propagateAllocatorCopyConstructor) { const char* str = "test"; OneStringStructure oneStringStructure(str); - OneStringStructure oneStringStructureCopy(zserio::PropagateAllocator, oneStringStructure, - OneStringStructure::allocator_type()); + OneStringStructure oneStringStructureCopy( + zserio::PropagateAllocator, oneStringStructure, OneStringStructure::allocator_type()); ASSERT_EQ(str, oneStringStructure.getOneString()); ASSERT_EQ(str, oneStringStructureCopy.getOneString()); } diff --git a/test/language/structure_types/cpp/SimpleStructureTest.cpp b/test/language/structure_types/cpp/SimpleStructureTest.cpp index 641c44784..8a7300ca5 100644 --- a/test/language/structure_types/cpp/SimpleStructureTest.cpp +++ b/test/language/structure_types/cpp/SimpleStructureTest.cpp @@ -1,9 +1,7 @@ #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" -#include "zserio/BitStreamReader.h" - #include "structure_types/simple_structure/SimpleStructure.h" +#include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace structure_types { @@ -13,8 +11,8 @@ namespace simple_structure class SimpleStructureTest : public ::testing::Test { protected: - void writeSimpleStructureToByteArray(zserio::BitStreamWriter& writer, uint8_t numberA, uint8_t numberB, - uint8_t numberC) + void writeSimpleStructureToByteArray( + zserio::BitStreamWriter& writer, uint8_t numberA, uint8_t numberB, uint8_t numberC) { writer.writeBits(numberA, 3); writer.writeBits(numberB, 8); @@ -132,8 +130,8 @@ TEST_F(SimpleStructureTest, propagateAllocatorCopyConstructor) const uint8_t numberB = 0xFF; const uint8_t numberC = 0x7F; SimpleStructure simpleStructure(numberA, numberB, numberC); - SimpleStructure simpleStructureCopy(zserio::PropagateAllocator, simpleStructure, - SimpleStructure::allocator_type()); + SimpleStructure simpleStructureCopy( + zserio::PropagateAllocator, simpleStructure, SimpleStructure::allocator_type()); ASSERT_EQ(numberA, simpleStructureCopy.getNumberA()); ASSERT_EQ(numberB, simpleStructureCopy.getNumberB()); ASSERT_EQ(numberC, simpleStructureCopy.getNumberC()); diff --git a/test/language/structure_types/cpp/StructureInnerClassesClashingTest.cpp b/test/language/structure_types/cpp/StructureInnerClassesClashingTest.cpp index b87c5c9e4..45ce7261a 100644 --- a/test/language/structure_types/cpp/StructureInnerClassesClashingTest.cpp +++ b/test/language/structure_types/cpp/StructureInnerClassesClashingTest.cpp @@ -1,11 +1,9 @@ #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" -#include "zserio/BitStreamReader.h" - #include "structure_types/structure_inner_classes_clashing/ArrayType_array.h" #include "structure_types/structure_inner_classes_clashing/OffsetChecker_array.h" #include "structure_types/structure_inner_classes_clashing/OffsetInitializer_array.h" +#include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace structure_types { diff --git a/test/language/structure_types/cpp/StructureWithRemovedEnumItemFieldTest.cpp b/test/language/structure_types/cpp/StructureWithRemovedEnumItemFieldTest.cpp index 6e5a4cecc..57b0242d5 100644 --- a/test/language/structure_types/cpp/StructureWithRemovedEnumItemFieldTest.cpp +++ b/test/language/structure_types/cpp/StructureWithRemovedEnumItemFieldTest.cpp @@ -1,13 +1,11 @@ #include "gtest/gtest.h" - +#include "structure_types/structure_with_removed_enum_item_field/StructureWithRemovedEnumItemField.h" #include "zserio/BitStreamReader.h" #include "zserio/BitStreamWriter.h" #include "zserio/CppRuntimeException.h" #include "zserio/DebugStringUtil.h" #include "zserio/SerializeUtil.h" -#include "structure_types/structure_with_removed_enum_item_field/StructureWithRemovedEnumItemField.h" - namespace structure_types { namespace structure_with_removed_enum_item_field @@ -73,10 +71,10 @@ TEST_F(StructureWithRemovedEnumItemFieldTest, toJsonString) TEST_F(StructureWithRemovedEnumItemFieldTest, fromJsonString) { - auto structureWithRemovedEnumItemField = zserio::fromJsonString( - "{\n \"enumeration\": \"REMOVED\"\n}"); + auto structureWithRemovedEnumItemField = + zserio::fromJsonString("{\n \"enumeration\": \"REMOVED\"\n}"); ASSERT_EQ(Enumeration::ZSERIO_REMOVED_REMOVED, structureWithRemovedEnumItemField.getEnumeration()); } -} // structure_with_removed_enum_item_field +} // namespace structure_with_removed_enum_item_field } // namespace structure_types diff --git a/test/language/subtypes/cpp/BitmaskSubtypeTest.cpp b/test/language/subtypes/cpp/BitmaskSubtypeTest.cpp index d367dce7f..69273290f 100644 --- a/test/language/subtypes/cpp/BitmaskSubtypeTest.cpp +++ b/test/language/subtypes/cpp/BitmaskSubtypeTest.cpp @@ -1,11 +1,10 @@ #include -#include #include +#include #include "gtest/gtest.h" - -#include "subtypes/bitmask_subtype/Permission.h" #include "subtypes/bitmask_subtype/CONST_READ.h" +#include "subtypes/bitmask_subtype/Permission.h" namespace subtypes { diff --git a/test/language/subtypes/cpp/EnumSubtypeTest.cpp b/test/language/subtypes/cpp/EnumSubtypeTest.cpp index 3b82b5b70..bdf70e56e 100644 --- a/test/language/subtypes/cpp/EnumSubtypeTest.cpp +++ b/test/language/subtypes/cpp/EnumSubtypeTest.cpp @@ -1,11 +1,10 @@ #include -#include #include +#include #include "gtest/gtest.h" - -#include "subtypes/enum_subtype/Color.h" #include "subtypes/enum_subtype/CONST_BLACK.h" +#include "subtypes/enum_subtype/Color.h" namespace subtypes { diff --git a/test/language/subtypes/cpp/ParamStructureSubtypeTest.cpp b/test/language/subtypes/cpp/ParamStructureSubtypeTest.cpp index 39c0d2e6b..73e5c1ba6 100644 --- a/test/language/subtypes/cpp/ParamStructureSubtypeTest.cpp +++ b/test/language/subtypes/cpp/ParamStructureSubtypeTest.cpp @@ -1,13 +1,11 @@ #include -#include #include +#include #include "gtest/gtest.h" - #include "subtypes/param_structure_subtype/ParameterizedSubtypeStruct.h" - -#include "zserio/pmr/PolymorphicAllocator.h" #include "zserio/RebindAlloc.h" +#include "zserio/pmr/PolymorphicAllocator.h" namespace subtypes { @@ -20,12 +18,10 @@ template struct MethodNames { // TODO[Mi-L@]: Since we don't know allocator name provided by user, we use just the fixed substring here - static constexpr const char* GET_PARAMETERIZED_SUBTYPE_ARRAY = - ">& getParameterizedSubtypeArray()"; + static constexpr const char* GET_PARAMETERIZED_SUBTYPE_ARRAY = ">& getParameterizedSubtypeArray()"; static constexpr const char* GET_PARAMETERIZED_SUBTYPE_ARRAY_CONST = ">& getParameterizedSubtypeArray() const"; - static constexpr const char* SET_PARAMETERIZED_SYBTYPE_ARRAY = - "void setParameterizedSubtypeArray(const ::"; + static constexpr const char* SET_PARAMETERIZED_SYBTYPE_ARRAY = "void setParameterizedSubtypeArray(const ::"; static constexpr const char* SET_PARAMETERIZED_SYBTYPE_ARRAY_RVALUE = "void setParameterizedSubtypeArray(::"; }; @@ -35,17 +31,17 @@ struct MethodNames> { static constexpr const char* GET_PARAMETERIZED_SUBTYPE_ARRAY = "::zserio::pmr::vector<::subtypes::param_structure_subtype::ParameterizedSubtype>& " - "getParameterizedSubtypeArray()"; + "getParameterizedSubtypeArray()"; static constexpr const char* GET_PARAMETERIZED_SUBTYPE_ARRAY_CONST = - "const ::zserio::pmr::vector<::subtypes::param_structure_subtype::ParameterizedSubtype>& " - "getParameterizedSubtypeArray() const"; + "const ::zserio::pmr::vector<::subtypes::param_structure_subtype::ParameterizedSubtype>& " + "getParameterizedSubtypeArray() const"; static constexpr const char* SET_PARAMETERIZED_SYBTYPE_ARRAY = "void setParameterizedSubtypeArray(" - "const ::zserio::pmr::vector<::subtypes::param_structure_subtype::ParameterizedSubtype>& " - "parameterizedSubtypeArray_)"; + "const ::zserio::pmr::vector<::subtypes::param_structure_subtype::ParameterizedSubtype>& " + "parameterizedSubtypeArray_)"; static constexpr const char* SET_PARAMETERIZED_SYBTYPE_ARRAY_RVALUE = "void setParameterizedSubtypeArray(::zserio::pmr::vector<::subtypes::param_structure_subtype::" - "ParameterizedSubtype>&& parameterizedSubtypeArray_)"; + "ParameterizedSubtype>&& parameterizedSubtypeArray_)"; }; template <> @@ -53,38 +49,38 @@ struct MethodNames<::std::allocator> { static constexpr const char* GET_PARAMETERIZED_SUBTYPE_ARRAY = "::zserio::vector<::subtypes::param_structure_subtype::ParameterizedSubtype>& " - "getParameterizedSubtypeArray()"; + "getParameterizedSubtypeArray()"; static constexpr const char* GET_PARAMETERIZED_SUBTYPE_ARRAY_CONST = "const ::zserio::vector<::subtypes::param_structure_subtype::ParameterizedSubtype>& " - "getParameterizedSubtypeArray() const"; + "getParameterizedSubtypeArray() const"; static constexpr const char* SET_PARAMETERIZED_SYBTYPE_ARRAY = "void setParameterizedSubtypeArray(const ::zserio::vector<::subtypes::param_structure_subtype::" - "ParameterizedSubtype>& parameterizedSubtypeArray_)"; + "ParameterizedSubtype>& parameterizedSubtypeArray_)"; static constexpr const char* SET_PARAMETERIZED_SYBTYPE_ARRAY_RVALUE = "void setParameterizedSubtypeArray(::zserio::vector<::subtypes::param_structure_subtype::" - "ParameterizedSubtype>&& parameterizedSubtypeArray_)"; + "ParameterizedSubtype>&& parameterizedSubtypeArray_)"; }; namespace { - bool isCodeInFilePresent(const char* fileName, const char* code) +bool isCodeInFilePresent(const char* fileName, const char* code) +{ + std::ifstream file(fileName); + bool isPresent = false; + std::string line; + while (std::getline(file, line)) { - std::ifstream file(fileName); - bool isPresent = false; - std::string line; - while (std::getline(file, line)) + if (line.find(code) != std::string::npos) { - if (line.find(code) != std::string::npos) - { - isPresent = true; - break; - } + isPresent = true; + break; } - file.close(); - - return isPresent; } + file.close(); + + return isPresent; } +} // namespace TEST(ParamStructureSubtypeTest, testSubtype) { @@ -109,11 +105,11 @@ TEST(ParamStructureSubtypeTest, testSubtype) ASSERT_TRUE(isCodeInFilePresent( "language/subtypes/gen/subtypes/param_structure_subtype/ParameterizedSubtypeStruct.h", "const ::subtypes::param_structure_subtype::ParameterizedSubtype& " - "getParameterizedSubtype() const")); + "getParameterizedSubtype() const")); ASSERT_TRUE(isCodeInFilePresent( "language/subtypes/gen/subtypes/param_structure_subtype/ParameterizedSubtypeStruct.h", "void setParameterizedSubtype" - "(const ::subtypes::param_structure_subtype::ParameterizedSubtype& parameterizedSubtype_)")); + "(const ::subtypes::param_structure_subtype::ParameterizedSubtype& parameterizedSubtype_)")); ASSERT_TRUE(isCodeInFilePresent( "language/subtypes/gen/subtypes/param_structure_subtype/ParameterizedSubtypeStruct.h", diff --git a/test/language/subtypes/cpp/StructureSubtypeTest.cpp b/test/language/subtypes/cpp/StructureSubtypeTest.cpp index 952fc0952..67105a7ca 100644 --- a/test/language/subtypes/cpp/StructureSubtypeTest.cpp +++ b/test/language/subtypes/cpp/StructureSubtypeTest.cpp @@ -1,12 +1,10 @@ #include -#include #include +#include #include "gtest/gtest.h" - -#include "subtypes/structure_subtype/SubtypeStructure.h" #include "subtypes/structure_subtype/Student.h" - +#include "subtypes/structure_subtype/SubtypeStructure.h" #include "zserio/RebindAlloc.h" namespace subtypes diff --git a/test/language/subtypes/cpp/SubtypeImportedTest.cpp b/test/language/subtypes/cpp/SubtypeImportedTest.cpp index 23e78c5ea..8709d435a 100644 --- a/test/language/subtypes/cpp/SubtypeImportedTest.cpp +++ b/test/language/subtypes/cpp/SubtypeImportedTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "subtypes/subtype_imported/SubtypeImported.h" namespace subtypes diff --git a/test/language/subtypes/cpp/UInt16SubtypeTest.cpp b/test/language/subtypes/cpp/UInt16SubtypeTest.cpp index 96aa07ea4..82ce92c40 100644 --- a/test/language/subtypes/cpp/UInt16SubtypeTest.cpp +++ b/test/language/subtypes/cpp/UInt16SubtypeTest.cpp @@ -1,9 +1,8 @@ #include -#include #include +#include #include "gtest/gtest.h" - #include "subtypes/uint16_subtype/TestStructure.h" namespace subtypes diff --git a/test/language/templates/cpp/ChoiceTemplatedEnumSelectorTest.cpp b/test/language/templates/cpp/ChoiceTemplatedEnumSelectorTest.cpp index d251f93e4..08803dc14 100644 --- a/test/language/templates/cpp/ChoiceTemplatedEnumSelectorTest.cpp +++ b/test/language/templates/cpp/ChoiceTemplatedEnumSelectorTest.cpp @@ -1,7 +1,5 @@ #include "gtest/gtest.h" - #include "templates/choice_templated_enum_selector/ChoiceTemplatedEnumSelector.h" - #include "zserio/RebindAlloc.h" namespace templates diff --git a/test/language/templates/cpp/ChoiceTemplatedFieldTest.cpp b/test/language/templates/cpp/ChoiceTemplatedFieldTest.cpp index dd6c8de6d..ed3b25976 100644 --- a/test/language/templates/cpp/ChoiceTemplatedFieldTest.cpp +++ b/test/language/templates/cpp/ChoiceTemplatedFieldTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "templates/choice_templated_field/ChoiceTemplatedField.h" namespace templates diff --git a/test/language/templates/cpp/ChoiceTemplatedSelectorTest.cpp b/test/language/templates/cpp/ChoiceTemplatedSelectorTest.cpp index ff5d5c9d8..829880ebb 100644 --- a/test/language/templates/cpp/ChoiceTemplatedSelectorTest.cpp +++ b/test/language/templates/cpp/ChoiceTemplatedSelectorTest.cpp @@ -1,7 +1,5 @@ #include "gtest/gtest.h" - #include "templates/choice_templated_selector/ChoiceTemplatedSelector.h" - #include "zserio/RebindAlloc.h" namespace templates diff --git a/test/language/templates/cpp/ExpressionBitmaskTemplateArgumentTest.cpp b/test/language/templates/cpp/ExpressionBitmaskTemplateArgumentTest.cpp index 02a521585..09e28e40d 100644 --- a/test/language/templates/cpp/ExpressionBitmaskTemplateArgumentTest.cpp +++ b/test/language/templates/cpp/ExpressionBitmaskTemplateArgumentTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "templates/expression_bitmask_template_argument/BitmaskTemplateArgumentHolder.h" namespace templates diff --git a/test/language/templates/cpp/ExpressionEnumTemplateArgumentConflictTest.cpp b/test/language/templates/cpp/ExpressionEnumTemplateArgumentConflictTest.cpp index 05a5456ce..e8c83b024 100644 --- a/test/language/templates/cpp/ExpressionEnumTemplateArgumentConflictTest.cpp +++ b/test/language/templates/cpp/ExpressionEnumTemplateArgumentConflictTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "templates/expression_enum_template_argument_conflict/EnumTemplateArgumentConflictHolder.h" namespace templates diff --git a/test/language/templates/cpp/ExpressionEnumTemplateArgumentTest.cpp b/test/language/templates/cpp/ExpressionEnumTemplateArgumentTest.cpp index fbef2d363..e962af66e 100644 --- a/test/language/templates/cpp/ExpressionEnumTemplateArgumentTest.cpp +++ b/test/language/templates/cpp/ExpressionEnumTemplateArgumentTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "templates/expression_enum_template_argument/EnumTemplateArgumentHolder.h" namespace templates diff --git a/test/language/templates/cpp/ExpressionFullTemplateArgumentTest.cpp b/test/language/templates/cpp/ExpressionFullTemplateArgumentTest.cpp index fd465d596..f133ca414 100644 --- a/test/language/templates/cpp/ExpressionFullTemplateArgumentTest.cpp +++ b/test/language/templates/cpp/ExpressionFullTemplateArgumentTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "templates/expression_full_template_argument/FullTemplateArgumentHolder.h" namespace templates diff --git a/test/language/templates/cpp/FunctionTemplatedReturnTypeTest.cpp b/test/language/templates/cpp/FunctionTemplatedReturnTypeTest.cpp index 29ae7c25c..4896d1468 100644 --- a/test/language/templates/cpp/FunctionTemplatedReturnTypeTest.cpp +++ b/test/language/templates/cpp/FunctionTemplatedReturnTypeTest.cpp @@ -1,7 +1,5 @@ #include "gtest/gtest.h" - #include "templates/function_templated_return_type/FunctionTemplatedReturnType.h" - #include "zserio/RebindAlloc.h" using namespace zserio::literals; @@ -19,8 +17,8 @@ TEST(FunctionTemplatedReturnTypeTest, readWrite) FunctionTemplatedReturnType functionTemplatedReturnType; functionTemplatedReturnType.setHasHolder(true); functionTemplatedReturnType.setUint32Test(TestStructure_uint32{zserio::NullOpt, Holder_uint32{42}}); - functionTemplatedReturnType.setStringTest(TestStructure_string{zserio::NullOpt, - Holder_string{string_type{"string"}}}); + functionTemplatedReturnType.setStringTest( + TestStructure_string{zserio::NullOpt, Holder_string{string_type{"string"}}}); functionTemplatedReturnType.setFloatTest(TestStructure_float32{4.2F, zserio::NullOpt}); functionTemplatedReturnType.initializeChildren(); diff --git a/test/language/templates/cpp/InstantiateClashOtherTemplateTest.cpp b/test/language/templates/cpp/InstantiateClashOtherTemplateTest.cpp index 3db66a49f..8118cb215 100644 --- a/test/language/templates/cpp/InstantiateClashOtherTemplateTest.cpp +++ b/test/language/templates/cpp/InstantiateClashOtherTemplateTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "templates/instantiate_clash_other_template/InstantiateClashOtherTemplate.h" namespace templates diff --git a/test/language/templates/cpp/InstantiateImportedTest.cpp b/test/language/templates/cpp/InstantiateImportedTest.cpp index 0097383a5..799bcef68 100644 --- a/test/language/templates/cpp/InstantiateImportedTest.cpp +++ b/test/language/templates/cpp/InstantiateImportedTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "templates/instantiate_imported/InstantiateImported.h" namespace templates diff --git a/test/language/templates/cpp/InstantiateNestedTemplateTest.cpp b/test/language/templates/cpp/InstantiateNestedTemplateTest.cpp index 38423b532..60b44e14c 100644 --- a/test/language/templates/cpp/InstantiateNestedTemplateTest.cpp +++ b/test/language/templates/cpp/InstantiateNestedTemplateTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "templates/instantiate_nested_template/InstantiateNestedTemplate.h" namespace templates diff --git a/test/language/templates/cpp/InstantiateNotImportedTest.cpp b/test/language/templates/cpp/InstantiateNotImportedTest.cpp index 9e31fcac1..653565d2a 100644 --- a/test/language/templates/cpp/InstantiateNotImportedTest.cpp +++ b/test/language/templates/cpp/InstantiateNotImportedTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "templates/instantiate_not_imported/InstantiateNotImported.h" #include "templates/instantiate_not_imported/pkg/U32.h" diff --git a/test/language/templates/cpp/InstantiateOnlyNestedTest.cpp b/test/language/templates/cpp/InstantiateOnlyNestedTest.cpp index 9a2b6ee0b..13d2cb6f3 100644 --- a/test/language/templates/cpp/InstantiateOnlyNestedTest.cpp +++ b/test/language/templates/cpp/InstantiateOnlyNestedTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "templates/instantiate_only_nested/InstantiateOnlyNested.h" namespace templates diff --git a/test/language/templates/cpp/InstantiateSimpleTest.cpp b/test/language/templates/cpp/InstantiateSimpleTest.cpp index e94367852..cc6e7c950 100644 --- a/test/language/templates/cpp/InstantiateSimpleTest.cpp +++ b/test/language/templates/cpp/InstantiateSimpleTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "templates/instantiate_simple/InstantiateSimple.h" namespace templates diff --git a/test/language/templates/cpp/InstantiateSqlTableTest.cpp b/test/language/templates/cpp/InstantiateSqlTableTest.cpp index 4e720b7d3..47381300e 100644 --- a/test/language/templates/cpp/InstantiateSqlTableTest.cpp +++ b/test/language/templates/cpp/InstantiateSqlTableTest.cpp @@ -1,10 +1,7 @@ #include "gtest/gtest.h" - - #include "templates/instantiate_sql_table/U32Table.h" - -#include "zserio/SqliteConnection.h" #include "zserio/RebindAlloc.h" +#include "zserio/SqliteConnection.h" namespace templates { @@ -19,7 +16,7 @@ static const char* const SQLITE3_MEM_DB = ":memory:"; TEST(InstantiateSqlTableTest, instantiationOfU32Table) { - sqlite3 *internalConnection = nullptr; + sqlite3* internalConnection = nullptr; int result = sqlite3_open(SQLITE3_MEM_DB, &internalConnection); ASSERT_EQ(SQLITE_OK, result); zserio::SqliteConnection connection(internalConnection, ::zserio::SqliteConnection::INTERNAL_CONNECTION); diff --git a/test/language/templates/cpp/InstantiateTemplateArgumentTest.cpp b/test/language/templates/cpp/InstantiateTemplateArgumentTest.cpp index 8d2bd77fd..f896f7584 100644 --- a/test/language/templates/cpp/InstantiateTemplateArgumentTest.cpp +++ b/test/language/templates/cpp/InstantiateTemplateArgumentTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "templates/instantiate_template_argument/InstantiateTemplateArgument.h" namespace templates diff --git a/test/language/templates/cpp/InstantiateTypeAsChoiceFieldTest.cpp b/test/language/templates/cpp/InstantiateTypeAsChoiceFieldTest.cpp index 0703e4f75..f13065ee1 100644 --- a/test/language/templates/cpp/InstantiateTypeAsChoiceFieldTest.cpp +++ b/test/language/templates/cpp/InstantiateTypeAsChoiceFieldTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "templates/instantiate_type_as_choice_field/InstantiateTypeAsChoiceField.h" namespace templates diff --git a/test/language/templates/cpp/InstantiateTypeAsParameterTest.cpp b/test/language/templates/cpp/InstantiateTypeAsParameterTest.cpp index 72725c7c8..d945c0e4e 100644 --- a/test/language/templates/cpp/InstantiateTypeAsParameterTest.cpp +++ b/test/language/templates/cpp/InstantiateTypeAsParameterTest.cpp @@ -1,7 +1,5 @@ #include "gtest/gtest.h" - #include "templates/instantiate_type_as_parameter/InstantiateTypeAsParameter.h" - #include "zserio/RebindAlloc.h" namespace templates @@ -16,8 +14,7 @@ using vector_type = zserio::vector; TEST(InstantiateTypeAsParameterTest, readWrite) { InstantiateTypeAsParameter instantiateTypeAsParameter{ - P32{2}, Parameterized_P32{vector_type{13, 42}} - }; + P32{2}, Parameterized_P32{vector_type{13, 42}}}; instantiateTypeAsParameter.initializeChildren(); zserio::BitBuffer bitBuffer = zserio::BitBuffer(1024 * 8); diff --git a/test/language/templates/cpp/InstantiateTypeAsSqlDatabaseFieldTest.cpp b/test/language/templates/cpp/InstantiateTypeAsSqlDatabaseFieldTest.cpp index a96f82e53..755d80efc 100644 --- a/test/language/templates/cpp/InstantiateTypeAsSqlDatabaseFieldTest.cpp +++ b/test/language/templates/cpp/InstantiateTypeAsSqlDatabaseFieldTest.cpp @@ -1,9 +1,7 @@ #include #include "gtest/gtest.h" - #include "templates/instantiate_type_as_sql_database_field/InstantiateTypeAsSqlDatabaseFieldDb.h" - #include "zserio/RebindAlloc.h" namespace templates diff --git a/test/language/templates/cpp/InstantiateTypeAsSqlTableFieldTest.cpp b/test/language/templates/cpp/InstantiateTypeAsSqlTableFieldTest.cpp index 56ec685e6..03b60db46 100644 --- a/test/language/templates/cpp/InstantiateTypeAsSqlTableFieldTest.cpp +++ b/test/language/templates/cpp/InstantiateTypeAsSqlTableFieldTest.cpp @@ -1,10 +1,7 @@ #include "gtest/gtest.h" - -#include "zserio/SqliteConnection.h" - #include "templates/instantiate_type_as_sql_table_field/Test32Table.h" - #include "zserio/RebindAlloc.h" +#include "zserio/SqliteConnection.h" namespace templates { @@ -19,7 +16,7 @@ static const char* const SQLITE3_MEM_DB = ":memory:"; TEST(InstantiateSqlTableTest, instantiationOfTest32Table) { - sqlite3 *internalConnection = nullptr; + sqlite3* internalConnection = nullptr; int result = sqlite3_open(SQLITE3_MEM_DB, &internalConnection); ASSERT_EQ(SQLITE_OK, result); zserio::SqliteConnection connection(internalConnection, ::zserio::SqliteConnection::INTERNAL_CONNECTION); diff --git a/test/language/templates/cpp/InstantiateTypeAsStructArrayFieldTest.cpp b/test/language/templates/cpp/InstantiateTypeAsStructArrayFieldTest.cpp index 4b09efc4d..c76de773d 100644 --- a/test/language/templates/cpp/InstantiateTypeAsStructArrayFieldTest.cpp +++ b/test/language/templates/cpp/InstantiateTypeAsStructArrayFieldTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "templates/instantiate_type_as_struct_array_field/InstantiateTypeAsStructArrayField.h" namespace templates diff --git a/test/language/templates/cpp/InstantiateTypeAsStructFieldTest.cpp b/test/language/templates/cpp/InstantiateTypeAsStructFieldTest.cpp index ef0bee534..deeb16688 100644 --- a/test/language/templates/cpp/InstantiateTypeAsStructFieldTest.cpp +++ b/test/language/templates/cpp/InstantiateTypeAsStructFieldTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "templates/instantiate_type_as_struct_field/InstantiateTypeAsStructField.h" namespace templates diff --git a/test/language/templates/cpp/InstantiateTypeAsTemplateArgumentTest.cpp b/test/language/templates/cpp/InstantiateTypeAsTemplateArgumentTest.cpp index 89c1ca282..722abb78c 100644 --- a/test/language/templates/cpp/InstantiateTypeAsTemplateArgumentTest.cpp +++ b/test/language/templates/cpp/InstantiateTypeAsTemplateArgumentTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "templates/instantiate_type_as_template_argument/InstantiateTypeAsTemplateArgument.h" namespace templates @@ -9,9 +8,7 @@ namespace instantiate_type_as_template_argument TEST(InstantiateTypeAsTemplateArgumentTest, readWrite) { - InstantiateTypeAsTemplateArgument instantiateTypeAsTemplateArgument{ - Other_Str{Str{"test"}} - }; + InstantiateTypeAsTemplateArgument instantiateTypeAsTemplateArgument{Other_Str{Str{"test"}}}; zserio::BitBuffer bitBuffer = zserio::BitBuffer(1024 * 8); zserio::BitStreamWriter writer(bitBuffer); diff --git a/test/language/templates/cpp/InstantiateTypeImportedAsStructFieldTest.cpp b/test/language/templates/cpp/InstantiateTypeImportedAsStructFieldTest.cpp index 7d0c17f8c..7aca5c2b8 100644 --- a/test/language/templates/cpp/InstantiateTypeImportedAsStructFieldTest.cpp +++ b/test/language/templates/cpp/InstantiateTypeImportedAsStructFieldTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "templates/instantiate_type_imported_as_struct_field/InstantiateTypeImportedAsStructField.h" namespace templates diff --git a/test/language/templates/cpp/InstantiateTypeOnParameterizedTemplateTest.cpp b/test/language/templates/cpp/InstantiateTypeOnParameterizedTemplateTest.cpp index 118bee922..d8b62a591 100644 --- a/test/language/templates/cpp/InstantiateTypeOnParameterizedTemplateTest.cpp +++ b/test/language/templates/cpp/InstantiateTypeOnParameterizedTemplateTest.cpp @@ -1,7 +1,5 @@ #include "gtest/gtest.h" - #include "templates/instantiate_type_on_parameterized_template/InstantiateTypeOnParameterizedTemplate.h" - #include "zserio/RebindAlloc.h" namespace templates @@ -16,8 +14,7 @@ using vector_type = zserio::vector; TEST(InstantiateTypeOnParameterizedTemplateTest, readWrite) { InstantiateTypeOnParameterizedTemplate instantiateTypeOnParameterizedTemplate{ - 2, TestP{Parameterized{vector_type{13, 42}}} - }; + 2, TestP{Parameterized{vector_type{13, 42}}}}; instantiateTypeOnParameterizedTemplate.initializeChildren(); zserio::BitBuffer bitBuffer = zserio::BitBuffer(1024 * 8); diff --git a/test/language/templates/cpp/InstantiateUnusedTest.cpp b/test/language/templates/cpp/InstantiateUnusedTest.cpp index 44b5ed6cd..f07999200 100644 --- a/test/language/templates/cpp/InstantiateUnusedTest.cpp +++ b/test/language/templates/cpp/InstantiateUnusedTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "templates/instantiate_unused/U32.h" namespace templates diff --git a/test/language/templates/cpp/InstantiateViaImportTest.cpp b/test/language/templates/cpp/InstantiateViaImportTest.cpp index 8dec3300f..8f2e5d693 100644 --- a/test/language/templates/cpp/InstantiateViaImportTest.cpp +++ b/test/language/templates/cpp/InstantiateViaImportTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "templates/instantiate_via_import/InstantiateViaImport.h" namespace templates diff --git a/test/language/templates/cpp/InstantiateViaSingleImportTest.cpp b/test/language/templates/cpp/InstantiateViaSingleImportTest.cpp index 72aff8369..4504342f1 100644 --- a/test/language/templates/cpp/InstantiateViaSingleImportTest.cpp +++ b/test/language/templates/cpp/InstantiateViaSingleImportTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "templates/instantiate_via_single_import/InstantiateViaSingleImport.h" namespace templates diff --git a/test/language/templates/cpp/InstantiateVsDefaultTest.cpp b/test/language/templates/cpp/InstantiateVsDefaultTest.cpp index f29fd4872..c2908c748 100644 --- a/test/language/templates/cpp/InstantiateVsDefaultTest.cpp +++ b/test/language/templates/cpp/InstantiateVsDefaultTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "templates/instantiate_vs_default/InstantiateVsDefault.h" namespace templates diff --git a/test/language/templates/cpp/InstantiateWithInstantiateTemplateArgumentTest.cpp b/test/language/templates/cpp/InstantiateWithInstantiateTemplateArgumentTest.cpp index a772a7304..a67036314 100644 --- a/test/language/templates/cpp/InstantiateWithInstantiateTemplateArgumentTest.cpp +++ b/test/language/templates/cpp/InstantiateWithInstantiateTemplateArgumentTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "templates/instantiate_with_instantiate_template_argument/InstantiateWithInstantiateTemplateArgument.h" namespace templates diff --git a/test/language/templates/cpp/SqlTableTemplatedFieldTest.cpp b/test/language/templates/cpp/SqlTableTemplatedFieldTest.cpp index 2dedc9412..4b1e647a9 100644 --- a/test/language/templates/cpp/SqlTableTemplatedFieldTest.cpp +++ b/test/language/templates/cpp/SqlTableTemplatedFieldTest.cpp @@ -1,9 +1,7 @@ #include #include "gtest/gtest.h" - #include "templates/sql_table_templated_field/SqlTableTemplatedFieldDb.h" - #include "zserio/RebindAlloc.h" namespace templates diff --git a/test/language/templates/cpp/StructFullAndShortTemplateArgumentTest.cpp b/test/language/templates/cpp/StructFullAndShortTemplateArgumentTest.cpp index 404e777ba..5a844c2ce 100644 --- a/test/language/templates/cpp/StructFullAndShortTemplateArgumentTest.cpp +++ b/test/language/templates/cpp/StructFullAndShortTemplateArgumentTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "templates/struct_full_and_short_template_argument/StructFullNameTemplateArgument.h" #include "templates/struct_full_and_short_template_argument/templated_struct/StructShortNameTemplateArgument.h" diff --git a/test/language/templates/cpp/StructFullNameTemplateArgumentTest.cpp b/test/language/templates/cpp/StructFullNameTemplateArgumentTest.cpp index e1fa396ae..051bf0a20 100644 --- a/test/language/templates/cpp/StructFullNameTemplateArgumentTest.cpp +++ b/test/language/templates/cpp/StructFullNameTemplateArgumentTest.cpp @@ -1,7 +1,5 @@ #include "gtest/gtest.h" - #include "templates/struct_full_name_template_argument/StructFullNameTemplateArgument.h" - #include "zserio/RebindAlloc.h" namespace templates diff --git a/test/language/templates/cpp/StructLongTemplateArgumentClashTest.cpp b/test/language/templates/cpp/StructLongTemplateArgumentClashTest.cpp index d0c032150..0d68b9ce3 100644 --- a/test/language/templates/cpp/StructLongTemplateArgumentClashTest.cpp +++ b/test/language/templates/cpp/StructLongTemplateArgumentClashTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "templates/struct_long_template_argument_clash/StructLongTemplateArgumentClash.h" namespace templates @@ -10,12 +9,10 @@ namespace struct_long_template_argument_clash TEST(StructLongTemplateArgumentClashTest, readWrite) { const TemplatedStruct_ThisIsVeryVeryVeryLongNamedStructure_Th_619A1B35 t1( - ThisIsVeryVeryVeryLongNamedStructure("StringT"), - ThisIsVeryVeryVeryLongNamedStructure("StringU"), + ThisIsVeryVeryVeryLongNamedStructure("StringT"), ThisIsVeryVeryVeryLongNamedStructure("StringU"), ThisIsVeryVeryVeryLongNamedStructure("StringV")); const TemplatedStruct_ThisIsVeryVeryVeryLongNamedStructure_Th_1B45EF08 t2( - ThisIsVeryVeryVeryLongNamedStructure("StringT"), - ThisIsVeryVeryVeryLongNamedStructure("StringU"), + ThisIsVeryVeryVeryLongNamedStructure("StringT"), ThisIsVeryVeryVeryLongNamedStructure("StringU"), ThisIsVeryVeryVeryLongNamedStructure_(42)); StructLongTemplateArgumentClash structLongTemplateArgumentClash(t1, t2); diff --git a/test/language/templates/cpp/StructLongTemplateArgumentTest.cpp b/test/language/templates/cpp/StructLongTemplateArgumentTest.cpp index a7c1b7db1..8973f410c 100644 --- a/test/language/templates/cpp/StructLongTemplateArgumentTest.cpp +++ b/test/language/templates/cpp/StructLongTemplateArgumentTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "templates/struct_long_template_argument/StructLongTemplateArgument.h" namespace templates @@ -10,8 +9,7 @@ namespace struct_long_template_argument TEST(StructLongTemplateArgumentTest, readWrite) { const TemplatedStruct_ThisIsVeryVeryVeryLongNamedStructure_ThisIsVery_ templ( - ThisIsVeryVeryVeryLongNamedStructure("StringT"), - ThisIsVeryVeryVeryLongNamedStructure("StringU"), + ThisIsVeryVeryVeryLongNamedStructure("StringT"), ThisIsVeryVeryVeryLongNamedStructure("StringU"), ThisIsVeryVeryVeryLongNamedStructure("StringV")); StructLongTemplateArgument structLongTemplateArgument(templ); diff --git a/test/language/templates/cpp/StructRecursiveTemplateTest.cpp b/test/language/templates/cpp/StructRecursiveTemplateTest.cpp index 31c7990ab..4332d9f82 100644 --- a/test/language/templates/cpp/StructRecursiveTemplateTest.cpp +++ b/test/language/templates/cpp/StructRecursiveTemplateTest.cpp @@ -1,7 +1,5 @@ #include "gtest/gtest.h" - #include "templates/struct_recursive_template/StructRecursiveTemplate.h" - #include "zserio/RebindAlloc.h" namespace templates diff --git a/test/language/templates/cpp/StructTemplateClashAcrossPackagesTest.cpp b/test/language/templates/cpp/StructTemplateClashAcrossPackagesTest.cpp index ac2f7a765..d109f7f91 100644 --- a/test/language/templates/cpp/StructTemplateClashAcrossPackagesTest.cpp +++ b/test/language/templates/cpp/StructTemplateClashAcrossPackagesTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "templates/struct_template_clash_across_packages/pkg1/InstantiationInPkg1.h" #include "templates/struct_template_clash_across_packages/pkg2/InstantiationInPkg2.h" @@ -28,7 +27,7 @@ TEST(StructTemplateClashAcrossPackagesTest, readWriteInPkg1) ASSERT_TRUE(instantiationInPkg1 == readInstantiationInPkg1); } -} // pkg1 +} // namespace pkg1 namespace pkg2 { @@ -50,7 +49,7 @@ TEST(StructTemplateClashAcrossPackagesTest, readWriteInPkg2) ASSERT_TRUE(instantiationInPkg2 == readInstantiationInPkg2); } -} // pkg2 +} // namespace pkg2 } // namespace struct_template_clash_across_packages } // namespace templates diff --git a/test/language/templates/cpp/StructTemplateClashOtherTemplateTest.cpp b/test/language/templates/cpp/StructTemplateClashOtherTemplateTest.cpp index 3e762219e..6b13b8ec2 100644 --- a/test/language/templates/cpp/StructTemplateClashOtherTemplateTest.cpp +++ b/test/language/templates/cpp/StructTemplateClashOtherTemplateTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "templates/struct_template_clash_other_template/InstantiationNameClashOtherTemplate.h" namespace templates diff --git a/test/language/templates/cpp/StructTemplateClashOtherTypeTest.cpp b/test/language/templates/cpp/StructTemplateClashOtherTypeTest.cpp index c22fd9c72..b11629c56 100644 --- a/test/language/templates/cpp/StructTemplateClashOtherTypeTest.cpp +++ b/test/language/templates/cpp/StructTemplateClashOtherTypeTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "templates/struct_template_clash_other_type/InstantiationNameClashOtherType.h" namespace templates diff --git a/test/language/templates/cpp/StructTemplateClashTest.cpp b/test/language/templates/cpp/StructTemplateClashTest.cpp index bae4779dc..08a77e5f6 100644 --- a/test/language/templates/cpp/StructTemplateClashTest.cpp +++ b/test/language/templates/cpp/StructTemplateClashTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "templates/struct_template_clash/InstantiationNameClash.h" namespace templates @@ -10,9 +9,7 @@ namespace struct_template_clash TEST(StructTemplateClashTest, readWrite) { const TestStruct_uint32 testStruct_uint32( - 42, - Template_A_B_C_7FE93D34(A_B(1), C(true)), - Template_A_B_C_5EB4E3FC(A(1), B_C("string"))); + 42, Template_A_B_C_7FE93D34(A_B(1), C(true)), Template_A_B_C_5EB4E3FC(A(1), B_C("string"))); InstantiationNameClash instantiationNameClash(testStruct_uint32); zserio::BitBuffer bitBuffer = zserio::BitBuffer(1024 * 8); diff --git a/test/language/templates/cpp/StructTemplateInTemplateTest.cpp b/test/language/templates/cpp/StructTemplateInTemplateTest.cpp index b01cdf6b7..9bce00d97 100644 --- a/test/language/templates/cpp/StructTemplateInTemplateTest.cpp +++ b/test/language/templates/cpp/StructTemplateInTemplateTest.cpp @@ -1,7 +1,5 @@ #include "gtest/gtest.h" - #include "templates/struct_template_in_template/StructTemplateInTemplate.h" - #include "zserio/RebindAlloc.h" namespace templates diff --git a/test/language/templates/cpp/StructTemplatedFieldTest.cpp b/test/language/templates/cpp/StructTemplatedFieldTest.cpp index fac92e632..ab87c0f99 100644 --- a/test/language/templates/cpp/StructTemplatedFieldTest.cpp +++ b/test/language/templates/cpp/StructTemplatedFieldTest.cpp @@ -1,7 +1,5 @@ #include "gtest/gtest.h" - #include "templates/struct_templated_field/StructTemplatedField.h" - #include "zserio/RebindAlloc.h" namespace templates diff --git a/test/language/templates/cpp/StructTemplatedTemplateArgumentTest.cpp b/test/language/templates/cpp/StructTemplatedTemplateArgumentTest.cpp index 2692fa61c..2edc6bc7e 100644 --- a/test/language/templates/cpp/StructTemplatedTemplateArgumentTest.cpp +++ b/test/language/templates/cpp/StructTemplatedTemplateArgumentTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "templates/struct_templated_template_argument/StructTemplatedTemplateArgument.h" namespace templates diff --git a/test/language/templates/cpp/StructTemplatedTypeArgumentTest.cpp b/test/language/templates/cpp/StructTemplatedTypeArgumentTest.cpp index cb2e4984c..b33cd2b1d 100644 --- a/test/language/templates/cpp/StructTemplatedTypeArgumentTest.cpp +++ b/test/language/templates/cpp/StructTemplatedTypeArgumentTest.cpp @@ -1,7 +1,5 @@ #include "gtest/gtest.h" - #include "templates/struct_templated_type_argument/StructTemplatedTypeArgument.h" - #include "zserio/RebindAlloc.h" namespace templates diff --git a/test/language/templates/cpp/SubtypeTemplateArgumentTest.cpp b/test/language/templates/cpp/SubtypeTemplateArgumentTest.cpp index a8b854a48..6b0ca346c 100644 --- a/test/language/templates/cpp/SubtypeTemplateArgumentTest.cpp +++ b/test/language/templates/cpp/SubtypeTemplateArgumentTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "templates/subtype_template_argument/SubtypeTemplateArgument.h" namespace templates @@ -11,8 +10,8 @@ TEST(SubtypeTemplateArgumentTest, bitSizeOf) { const Field_uint32 field_uint32(10); const Field_Compound field_compound(Compound(10)); - const SubtypeTemplateArgument subtypeTemplateArgument(field_uint32, field_uint32, field_uint32, - field_compound, field_compound, field_compound); + const SubtypeTemplateArgument subtypeTemplateArgument( + field_uint32, field_uint32, field_uint32, field_compound, field_compound, field_compound); ASSERT_EQ(192, subtypeTemplateArgument.bitSizeOf()); } diff --git a/test/language/templates/cpp/SubtypeTemplateWithBuiltinTest.cpp b/test/language/templates/cpp/SubtypeTemplateWithBuiltinTest.cpp index 9b004a04e..65478f1ac 100644 --- a/test/language/templates/cpp/SubtypeTemplateWithBuiltinTest.cpp +++ b/test/language/templates/cpp/SubtypeTemplateWithBuiltinTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "templates/subtype_template_with_builtin/SubtypeTemplateWithBuiltin.h" namespace templates diff --git a/test/language/templates/cpp/SubtypeTemplateWithCompoundTest.cpp b/test/language/templates/cpp/SubtypeTemplateWithCompoundTest.cpp index 46a81c616..41aad5d50 100644 --- a/test/language/templates/cpp/SubtypeTemplateWithCompoundTest.cpp +++ b/test/language/templates/cpp/SubtypeTemplateWithCompoundTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "templates/subtype_template_with_compound/SubtypeTemplateWithCompound.h" namespace templates diff --git a/test/language/templates/cpp/TemplatedStructRecursionTest.cpp b/test/language/templates/cpp/TemplatedStructRecursionTest.cpp index 5f7267a45..89fc70c33 100644 --- a/test/language/templates/cpp/TemplatedStructRecursionTest.cpp +++ b/test/language/templates/cpp/TemplatedStructRecursionTest.cpp @@ -1,7 +1,5 @@ #include "gtest/gtest.h" - #include "templates/templated_struct_recursion/TemplatedStructRecursion.h" - #include "zserio/RebindAlloc.h" namespace templates @@ -16,18 +14,11 @@ using vector_type = zserio::vector; TEST(TemplatedStructRecursionTest, writeRead) { TemplatedStructRecursion templatedStructRecursion; - templatedStructRecursion.getRecursiveTemplate().setData( - vector_type{{1, 2, 3}}); - templatedStructRecursion.getRecursiveTemplate().setRecursiveTemplate( - RecursiveTemplate_uint32{ - vector_type{2, 3, 4}, - RecursiveTemplate_uint32{ - vector_type{}, // lengthof(data) == 0 -> end of recursion - zserio::NullOpt - } - } - ); - + templatedStructRecursion.getRecursiveTemplate().setData(vector_type{{1, 2, 3}}); + templatedStructRecursion.getRecursiveTemplate().setRecursiveTemplate(RecursiveTemplate_uint32{ + vector_type{2, 3, 4}, + RecursiveTemplate_uint32{vector_type{}, // lengthof(data) == 0 -> end of recursion + zserio::NullOpt}}); zserio::BitBuffer bitBuffer = zserio::BitBuffer(1024 * 8); zserio::BitStreamWriter writer(bitBuffer); diff --git a/test/language/templates/cpp/UnionTemplatedFieldTest.cpp b/test/language/templates/cpp/UnionTemplatedFieldTest.cpp index d3d34ad58..fa0401ad1 100644 --- a/test/language/templates/cpp/UnionTemplatedFieldTest.cpp +++ b/test/language/templates/cpp/UnionTemplatedFieldTest.cpp @@ -1,5 +1,4 @@ #include "gtest/gtest.h" - #include "templates/union_templated_field/UnionTemplatedField.h" namespace templates diff --git a/test/language/union_types/cpp/EmptyUnionTest.cpp b/test/language/union_types/cpp/EmptyUnionTest.cpp index d3820ef78..e75bcdd3d 100644 --- a/test/language/union_types/cpp/EmptyUnionTest.cpp +++ b/test/language/union_types/cpp/EmptyUnionTest.cpp @@ -1,9 +1,7 @@ #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" -#include "zserio/BitStreamReader.h" - #include "union_types/empty_union/EmptyUnion.h" +#include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" namespace union_types { diff --git a/test/language/union_types/cpp/EmptyUnionWithParameterTest.cpp b/test/language/union_types/cpp/EmptyUnionWithParameterTest.cpp index 56b2201dd..6ccb05ad0 100644 --- a/test/language/union_types/cpp/EmptyUnionWithParameterTest.cpp +++ b/test/language/union_types/cpp/EmptyUnionWithParameterTest.cpp @@ -1,11 +1,9 @@ #include "gtest/gtest.h" - -#include "zserio/BitStreamWriter.h" +#include "union_types/empty_union_with_parameter/EmptyUnionWithParameter.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" #include "zserio/CppRuntimeException.h" -#include "union_types/empty_union_with_parameter/EmptyUnionWithParameter.h" - namespace union_types { namespace empty_union_with_parameter @@ -110,15 +108,15 @@ TEST(EmptyUnionWithParameterTest, moveAssignmentOperator) TEST(EmptyUnionWithParameterTest, propagateAllocatorCopyConstructor) { EmptyUnionWithParameter emptyUnionWithParameter; - EmptyUnionWithParameter emptyUnionCopy1WithParameter(zserio::PropagateAllocator, - emptyUnionWithParameter, EmptyUnionWithParameter::allocator_type()); + EmptyUnionWithParameter emptyUnionCopy1WithParameter( + zserio::PropagateAllocator, emptyUnionWithParameter, EmptyUnionWithParameter::allocator_type()); ASSERT_THROW(emptyUnionWithParameter.getParam(), zserio::CppRuntimeException); ASSERT_THROW(emptyUnionCopy1WithParameter.getParam(), zserio::CppRuntimeException); emptyUnionWithParameter.initialize(1); - EmptyUnionWithParameter emptyUnionCopy2WithParameter(zserio::PropagateAllocator, - emptyUnionWithParameter, EmptyUnionWithParameter::allocator_type()); + EmptyUnionWithParameter emptyUnionCopy2WithParameter( + zserio::PropagateAllocator, emptyUnionWithParameter, EmptyUnionWithParameter::allocator_type()); ASSERT_EQ(emptyUnionWithParameter.getParam(), emptyUnionCopy2WithParameter.getParam()); } @@ -161,12 +159,12 @@ TEST(EmptyUnionWithParameterTest, operatorEquality) { EmptyUnionWithParameter emptyUnionWithParameter1; EmptyUnionWithParameter emptyUnionWithParameter2; - ASSERT_THROW(ASSERT_FALSE(emptyUnionWithParameter1 == emptyUnionWithParameter2), - zserio::CppRuntimeException); + ASSERT_THROW( + ASSERT_FALSE(emptyUnionWithParameter1 == emptyUnionWithParameter2), zserio::CppRuntimeException); emptyUnionWithParameter1.initialize(1); - ASSERT_THROW(ASSERT_FALSE(emptyUnionWithParameter1 == emptyUnionWithParameter2), - zserio::CppRuntimeException); + ASSERT_THROW( + ASSERT_FALSE(emptyUnionWithParameter1 == emptyUnionWithParameter2), zserio::CppRuntimeException); emptyUnionWithParameter2.initialize(1); ASSERT_TRUE(emptyUnionWithParameter1 == emptyUnionWithParameter2); @@ -179,14 +177,14 @@ TEST(EmptyUnionWithParameterTest, operatorLessThan) { EmptyUnionWithParameter emptyUnionWithParameter1; EmptyUnionWithParameter emptyUnionWithParameter2; - ASSERT_THROW(ASSERT_FALSE(emptyUnionWithParameter1 < emptyUnionWithParameter2), - zserio::CppRuntimeException); - ASSERT_THROW(ASSERT_FALSE(emptyUnionWithParameter2 < emptyUnionWithParameter1), - zserio::CppRuntimeException); + ASSERT_THROW( + ASSERT_FALSE(emptyUnionWithParameter1 < emptyUnionWithParameter2), zserio::CppRuntimeException); + ASSERT_THROW( + ASSERT_FALSE(emptyUnionWithParameter2 < emptyUnionWithParameter1), zserio::CppRuntimeException); emptyUnionWithParameter1.initialize(1); - ASSERT_THROW(ASSERT_FALSE(emptyUnionWithParameter1 < emptyUnionWithParameter2), - zserio::CppRuntimeException); + ASSERT_THROW( + ASSERT_FALSE(emptyUnionWithParameter1 < emptyUnionWithParameter2), zserio::CppRuntimeException); emptyUnionWithParameter2.initialize(1); ASSERT_FALSE(emptyUnionWithParameter1 < emptyUnionWithParameter2); diff --git a/test/language/union_types/cpp/SimpleUnionTest.cpp b/test/language/union_types/cpp/SimpleUnionTest.cpp index 5e0c37232..ca77b7623 100644 --- a/test/language/union_types/cpp/SimpleUnionTest.cpp +++ b/test/language/union_types/cpp/SimpleUnionTest.cpp @@ -1,10 +1,8 @@ #include "gtest/gtest.h" - #include "union_types/simple_union/SimpleUnion.h" - -#include "zserio/BitStreamWriter.h" -#include "zserio/BitStreamReader.h" #include "zserio/BitSizeOfCalculator.h" +#include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" #include "zserio/CppRuntimeException.h" #include "zserio/RebindAlloc.h" @@ -289,7 +287,7 @@ TEST_F(SimpleUnionTest, operatorEquality) SimpleUnion simpleUnion22; simpleUnion22.setCase2Field(CASE2_FIELD); SimpleUnion simpleUnion23; - simpleUnion23.setCase2Field(CASE2_FIELD-1); + simpleUnion23.setCase2Field(CASE2_FIELD - 1); ASSERT_TRUE(simpleUnion21 == simpleUnion21); ASSERT_TRUE(simpleUnion21 == simpleUnion22); ASSERT_FALSE(simpleUnion21 == simpleUnion23); diff --git a/test/language/union_types/cpp/UnionCompatibilityCheckTest.cpp b/test/language/union_types/cpp/UnionCompatibilityCheckTest.cpp index 5eadcf9a8..4b9beb6d4 100644 --- a/test/language/union_types/cpp/UnionCompatibilityCheckTest.cpp +++ b/test/language/union_types/cpp/UnionCompatibilityCheckTest.cpp @@ -1,8 +1,6 @@ #include "gtest/gtest.h" - #include "union_types/union_compatibility_check/UnionCompatibilityCheckVersion1.h" #include "union_types/union_compatibility_check/UnionCompatibilityCheckVersion2.h" - #include "zserio/SerializeUtil.h" namespace union_types @@ -14,7 +12,6 @@ using allocator_type = UnionCompatibilityCheckVersion1::allocator_type; template using vector_type = zserio::vector; - class UnionCompatibilityCheckTest : public ::testing::Test { protected: @@ -60,11 +57,7 @@ class UnionCompatibilityCheckTest : public ::testing::Test vector_type createArrayVersion1() { return vector_type{ - createUnion(0), - createUnion(1), - createUnion(2), - createUnion(3) - }; + createUnion(0), createUnion(1), createUnion(2), createUnion(3)}; } UnionVersion2 createUnionXYZ(uint32_t index) @@ -97,8 +90,8 @@ TEST_F(UnionCompatibilityCheckTest, writeVersion1ReadVersion1) UnionCompatibilityCheckVersion1 unionCompatibilityCheckVersion1; fill(unionCompatibilityCheckVersion1, createArrayVersion1()); - auto readUnionCompatibilityCheckVersion1 = writeRead( - unionCompatibilityCheckVersion1); + auto readUnionCompatibilityCheckVersion1 = + writeRead(unionCompatibilityCheckVersion1); ASSERT_EQ(unionCompatibilityCheckVersion1, readUnionCompatibilityCheckVersion1); } @@ -117,8 +110,8 @@ TEST_F(UnionCompatibilityCheckTest, writeVersion1ReadVersion2) UnionCompatibilityCheckVersion1 unionCompatibilityCheckVersion1; fill(unionCompatibilityCheckVersion1, createArrayVersion1()); - auto readUnionCompatibilityCheckVersion2 = writeRead( - unionCompatibilityCheckVersion1); + auto readUnionCompatibilityCheckVersion2 = + writeRead(unionCompatibilityCheckVersion1); const auto expectedArrayVersion2 = createArrayVersion1(); ASSERT_EQ(expectedArrayVersion2, readUnionCompatibilityCheckVersion2.getArray()); ASSERT_EQ(expectedArrayVersion2, readUnionCompatibilityCheckVersion2.getPackedArray()); @@ -141,8 +134,8 @@ TEST_F(UnionCompatibilityCheckTest, writeVersion2ReadVersion1) UnionCompatibilityCheckVersion2 unionCompatibilityCheckVersion2; fill(unionCompatibilityCheckVersion2, createArrayVersion1()); - auto readUnionCompatibilityCheckVersion1 = writeRead( - unionCompatibilityCheckVersion2); + auto readUnionCompatibilityCheckVersion1 = + writeRead(unionCompatibilityCheckVersion2); const auto expectedArrayVersion1 = createArrayVersion1(); ASSERT_EQ(expectedArrayVersion1, readUnionCompatibilityCheckVersion1.getArray()); ASSERT_EQ(expectedArrayVersion1, readUnionCompatibilityCheckVersion1.getPackedArray()); @@ -165,8 +158,8 @@ TEST_F(UnionCompatibilityCheckTest, writeVersion2ReadVersion2) UnionCompatibilityCheckVersion2 unionCompatibilityCheckVersion2; fill(unionCompatibilityCheckVersion2, createArrayVersion2()); - auto readUnionCompatibilityCheckVersion2 = writeRead( - unionCompatibilityCheckVersion2); + auto readUnionCompatibilityCheckVersion2 = + writeRead(unionCompatibilityCheckVersion2); ASSERT_EQ(unionCompatibilityCheckVersion2, readUnionCompatibilityCheckVersion2); } diff --git a/test/language/union_types/cpp/UnionWithArrayTest.cpp b/test/language/union_types/cpp/UnionWithArrayTest.cpp index 821ef2aaf..cd5e7ca85 100644 --- a/test/language/union_types/cpp/UnionWithArrayTest.cpp +++ b/test/language/union_types/cpp/UnionWithArrayTest.cpp @@ -1,12 +1,10 @@ #include #include "gtest/gtest.h" - #include "union_types/union_with_array/TestUnion.h" - +#include "zserio/CppRuntimeException.h" #include "zserio/RebindAlloc.h" #include "zserio/SerializeUtil.h" -#include "zserio/CppRuntimeException.h" namespace union_types { @@ -39,7 +37,7 @@ class UnionWithArrayTest : public ::testing::Test template void checkArray(const std::array& array, const vector_type& vector) { - for (size_t i = 0 ; i < array.size(); ++i) + for (size_t i = 0; i < array.size(); ++i) { ASSERT_EQ(array[i], vector.at(i)); } @@ -48,7 +46,7 @@ class UnionWithArrayTest : public ::testing::Test template void checkArray(const std::array& array, const vector_type& vector) { - for (size_t i = 0 ; i < array.size(); ++i) + for (size_t i = 0; i < array.size(); ++i) { ASSERT_EQ(array[i], vector.at(i).getData()); } @@ -83,11 +81,11 @@ const std::string UnionWithArrayTest::BLOB_NAME_BASE = "language/union_types/uni constexpr size_t UnionWithArrayTest::ARRAY8_SIZE; constexpr size_t UnionWithArrayTest::ARRAY8_BITSIZE; -const std::array UnionWithArrayTest::ARRAY8 = { -1, -2, -3, -4 }; +const std::array UnionWithArrayTest::ARRAY8 = {-1, -2, -3, -4}; constexpr size_t UnionWithArrayTest::ARRAY16_SIZE; constexpr size_t UnionWithArrayTest::ARRAY16_BITSIZE; const std::array UnionWithArrayTest::ARRAY16 = { - -10, -20, -30, -40, -50 }; + -10, -20, -30, -40, -50}; TEST_F(UnionWithArrayTest, emptyConstructor) { diff --git a/test/language/union_types/cpp/UnionWithParameterTest.cpp b/test/language/union_types/cpp/UnionWithParameterTest.cpp index 2ba595d70..1abeaca75 100644 --- a/test/language/union_types/cpp/UnionWithParameterTest.cpp +++ b/test/language/union_types/cpp/UnionWithParameterTest.cpp @@ -1,9 +1,7 @@ #include "gtest/gtest.h" - #include "union_types/union_with_parameter/TestUnion.h" - -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" #include "zserio/CppRuntimeException.h" namespace union_types @@ -184,6 +182,5 @@ TEST(UnionWithParameterTestTest, isInitialized) ASSERT_TRUE(testUnion.isInitialized()); } - -} //namespace union_with_parameter +} // namespace union_with_parameter } // namespace union_types diff --git a/test/language/union_types/cpp/UnionWithParameterizedFieldTest.cpp b/test/language/union_types/cpp/UnionWithParameterizedFieldTest.cpp index 69ff0bf7a..95e00e1d6 100644 --- a/test/language/union_types/cpp/UnionWithParameterizedFieldTest.cpp +++ b/test/language/union_types/cpp/UnionWithParameterizedFieldTest.cpp @@ -1,9 +1,7 @@ #include "gtest/gtest.h" - #include "union_types/union_with_parameterized_field/TestUnion.h" - -#include "zserio/BitStreamWriter.h" #include "zserio/BitStreamReader.h" +#include "zserio/BitStreamWriter.h" #include "zserio/CppRuntimeException.h" namespace union_types @@ -307,5 +305,5 @@ TEST_F(UnionWithParameterizedFieldTest, write) } } -} //namespace union_with_parameterized_field +} // namespace union_with_parameterized_field } // namespace union_types diff --git a/test/others/gif/cpp/GifTest.cpp b/test/others/gif/cpp/GifTest.cpp index c194f7a34..117559bb0 100644 --- a/test/others/gif/cpp/GifTest.cpp +++ b/test/others/gif/cpp/GifTest.cpp @@ -1,11 +1,9 @@ #include -#include #include +#include #include "gif/GifFile.h" - #include "gtest/gtest.h" - #include "zserio/RebindAlloc.h" namespace gif diff --git a/test/utils/cpp/test_utils/Assertions.h b/test/utils/cpp/test_utils/Assertions.h index 0c02098e9..b4fc3582d 100644 --- a/test/utils/cpp/test_utils/Assertions.h +++ b/test/utils/cpp/test_utils/Assertions.h @@ -27,8 +27,8 @@ inline bool isStringInFilePresent(const std::string& fileName, const std::string return isPresent; } -inline void assertMethodPresent(const std::string& path, const std::string& typeName, - const char* declaration, const char* definition, const char* srcFile, int srcLine) +inline void assertMethodPresent(const std::string& path, const std::string& typeName, const char* declaration, + const char* definition, const char* srcFile, int srcLine) { const std::string filePath = path + typeName; if (declaration != nullptr) @@ -52,45 +52,44 @@ inline void assertMethodNotPresent(const std::string& path, const std::string& t if (declaration != nullptr) { ASSERT_FALSE(isStringInFilePresent(filePath + ".h", declaration)) - << "Method declaration '" << declaration << "' is present in '" << typeName << "'! " - << srcFile << ":" << srcLine; + << "Method declaration '" << declaration << "' is present in '" << typeName << "'! " << srcFile + << ":" << srcLine; } if (definition != nullptr) { ASSERT_FALSE(isStringInFilePresent(filePath + ".cpp", definition)) - << "Method definition '" << definition << "' is present'" << typeName << "'! " - << srcFile << ":" << srcLine; + << "Method definition '" << definition << "' is present'" << typeName << "'! " << srcFile << ":" + << srcLine; } } -inline void assertStringInFilePresent(const std::string& filePath, const std::string& str, - const char* srcFile, int srcLine) +inline void assertStringInFilePresent( + const std::string& filePath, const std::string& str, const char* srcFile, int srcLine) { ASSERT_TRUE(isStringInFilePresent(filePath, str)) - << "String '" << str << "' is not present in file '" << filePath << "'! " - << srcFile << ":" << srcLine; + << "String '" << str << "' is not present in file '" << filePath << "'! " << srcFile << ":" + << srcLine; } -inline void assertStringInFileNotPresent(const std::string& filePath, const std::string& str, - const char* srcFile, int srcLine) +inline void assertStringInFileNotPresent( + const std::string& filePath, const std::string& str, const char* srcFile, int srcLine) { ASSERT_FALSE(isStringInFilePresent(filePath, str)) - << "String '" << str << "' is present in file '" << filePath << "'! " - << srcFile << ":" << srcLine; + << "String '" << str << "' is present in file '" << filePath << "'! " << srcFile << ":" << srcLine; } } // namespace detail } // namespace test_utils -#define ASSERT_METHOD_PRESENT(path, typeName, declaration, definition) \ - test_utils::detail::assertMethodPresent(path, typeName, declaration, definition, __FILE__, __LINE__) +#define ASSERT_METHOD_PRESENT(path, typeName, declaration, definition) \ + test_utils::detail::assertMethodPresent(path, typeName, declaration, definition, __FILE__, __LINE__) -#define ASSERT_METHOD_NOT_PRESENT(path, typeName, declaration, definition) \ - test_utils::detail::assertMethodNotPresent(path, typeName, declaration, definition, __FILE__, __LINE__) +#define ASSERT_METHOD_NOT_PRESENT(path, typeName, declaration, definition) \ + test_utils::detail::assertMethodNotPresent(path, typeName, declaration, definition, __FILE__, __LINE__) -#define ASSERT_STRING_IN_FILE_PRESENT(filePath, str) \ - test_utils::detail::assertStringInFilePresent(filePath, str, __FILE__, __LINE__) +#define ASSERT_STRING_IN_FILE_PRESENT(filePath, str) \ + test_utils::detail::assertStringInFilePresent(filePath, str, __FILE__, __LINE__) -#define ASSERT_STRING_IN_FILE_NOT_PRESENT(filePath, str) \ - test_utils::detail::assertStringInFileNotPresent(filePath, str, __FILE__, __LINE__) +#define ASSERT_STRING_IN_FILE_NOT_PRESENT(filePath, str) \ + test_utils::detail::assertStringInFileNotPresent(filePath, str, __FILE__, __LINE__) diff --git a/test/utils/cpp/test_utils/CMakeLists.txt b/test/utils/cpp/test_utils/CMakeLists.txt new file mode 100644 index 000000000..cc0298b22 --- /dev/null +++ b/test/utils/cpp/test_utils/CMakeLists.txt @@ -0,0 +1,33 @@ +# Zserio C++ integration test utility library. +# +# This CMake file defines utility library which is used for all C++ integration tests. +# +cmake_minimum_required(VERSION 3.6.0) + +project(ZserioCppTestUtils) + +# input parameters +set(CLANG_FORMAT_BIN "" CACHE STRING "Name of clang-format binary. If empty, clang-format tool is not called.") +set(ZSERIO_PROJECT_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../../../..") + +# cmake helpers +include(clang_format_utils) + +set(ZSERIO_CPP_TEST_UTILS_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/Assertions.h + ${CMAKE_CURRENT_SOURCE_DIR}/LocalServiceClient.h + ${CMAKE_CURRENT_SOURCE_DIR}/MemoryResources.h + ${CMAKE_CURRENT_SOURCE_DIR}/TestPubsub.h + ${CMAKE_CURRENT_SOURCE_DIR}/ValidationObservers.h + ${CMAKE_CURRENT_SOURCE_DIR}/ZserioErrorOutput.h +) + +clang_format_add_custom_target(${PROJECT_NAME}-clang-format + DEPENDS ${PROJECT_NAME} + SOURCES "${ZSERIO_CPP_TEST_UTILS_SOURCES}" + CONFIG_FILE "${ZSERIO_PROJECT_ROOT}/.clang-format" + WERROR ON +) + +add_library(${PROJECT_NAME} INTERFACE) +target_include_directories(${PROJECT_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/..) diff --git a/test/utils/cpp/test_utils/LocalServiceClient.h b/test/utils/cpp/test_utils/LocalServiceClient.h index b9814ab32..d6cb3c8b1 100644 --- a/test/utils/cpp/test_utils/LocalServiceClient.h +++ b/test/utils/cpp/test_utils/LocalServiceClient.h @@ -1,8 +1,8 @@ #ifndef TEST_UTILS_LOCAL_SERVICE_CLIENT_H_INC #define TEST_UTILS_LOCAL_SERVICE_CLIENT_H_INC -#include "zserio/IService.h" #include "zserio/AllocatorHolder.h" +#include "zserio/IService.h" namespace test_utils { @@ -15,19 +15,19 @@ class LocalServiceClient : public zserio::IBasicServiceClient, public zse public: explicit LocalServiceClient(zserio::IBasicService& service, const ALLOC& allocator = ALLOC()) : - zserio::AllocatorHolder(allocator), m_service(service) + zserio::AllocatorHolder(allocator), + m_service(service) {} std::vector callMethod(zserio::StringView methodName, - const zserio::IBasicServiceData& requestData, - void* context) override + const zserio::IBasicServiceData& requestData, void* context) override { return callMethodOnService(methodName, requestData.getData(), context); } private: - virtual std::vector callMethodOnService(zserio::StringView methodName, - zserio::Span requestBytes, void* context) + virtual std::vector callMethodOnService( + zserio::StringView methodName, zserio::Span requestBytes, void* context) { auto responseData = m_service.callMethod(methodName, requestBytes, context); zserio::Span responseBytes = responseData->getData(); diff --git a/test/utils/cpp/test_utils/MemoryResources.h b/test/utils/cpp/test_utils/MemoryResources.h index 553029397..0dfaa76da 100644 --- a/test/utils/cpp/test_utils/MemoryResources.h +++ b/test/utils/cpp/test_utils/MemoryResources.h @@ -3,9 +3,9 @@ #include +#include "zserio/CppRuntimeException.h" #include "zserio/Types.h" #include "zserio/pmr/MemoryResource.h" -#include "zserio/CppRuntimeException.h" namespace test_utils { @@ -15,14 +15,14 @@ class InvalidMemoryResource : public zserio::pmr::MemoryResource private: void* doAllocate(size_t bytes, size_t align) override { - throw zserio::CppRuntimeException("Trying to allocate using default memory resource (") << bytes << - ", " << align << ")!"; + throw zserio::CppRuntimeException("Trying to allocate using default memory resource (") + << bytes << ", " << align << ")!"; } void doDeallocate(void*, size_t bytes, size_t align) override { - throw zserio::CppRuntimeException("Trying to deallocate using default memory resource (") << bytes << - ", " << align << ")!"; + throw zserio::CppRuntimeException("Trying to deallocate using default memory resource (") + << bytes << ", " << align << ")!"; } bool doIsEqual(const MemoryResource& other) const noexcept override @@ -80,7 +80,8 @@ template class TestMemoryResource : public zserio::pmr::MemoryResource { public: - explicit TestMemoryResource(const char* name) : m_name(name) + explicit TestMemoryResource(const char* name) : + m_name(name) { m_buffer.fill(0); m_nextPtr = m_buffer.begin(); @@ -144,8 +145,8 @@ class TestMemoryResource : public zserio::pmr::MemoryResource class MemoryResourceScopedSetter { public: - explicit MemoryResourceScopedSetter(zserio::pmr::MemoryResource& memoryResource) - : m_origMemoryResource(zserio::pmr::setDefaultResource(&memoryResource)) + explicit MemoryResourceScopedSetter(zserio::pmr::MemoryResource& memoryResource) : + m_origMemoryResource(zserio::pmr::setDefaultResource(&memoryResource)) {} ~MemoryResourceScopedSetter() diff --git a/test/utils/cpp/test_utils/TestPubsub.h b/test/utils/cpp/test_utils/TestPubsub.h index 46ee1ecb2..531356ee5 100644 --- a/test/utils/cpp/test_utils/TestPubsub.h +++ b/test/utils/cpp/test_utils/TestPubsub.h @@ -2,9 +2,9 @@ #define TEST_UTILS_TEST_PUBSUB_H_INC #include "zserio/AllocatorHolder.h" -#include "zserio/RebindAlloc.h" #include "zserio/IPubsub.h" #include "zserio/PubsubException.h" +#include "zserio/RebindAlloc.h" namespace test_utils { @@ -29,8 +29,8 @@ class TestPubsub : public zserio::IPubsub, public zserio::AllocatorHolder } } - SubscriptionId subscribe(zserio::StringView topic, const std::shared_ptr& callback, - void *context) override + SubscriptionId subscribe( + zserio::StringView topic, const std::shared_ptr& callback, void* context) override { processSubscribeContext(context); @@ -47,8 +47,10 @@ class TestPubsub : public zserio::IPubsub, public zserio::AllocatorHolder } protected: - virtual void processPublishContext(void*) {} - virtual void processSubscribeContext(void*) {} + virtual void processPublishContext(void*) + {} + virtual void processSubscribeContext(void*) + {} private: SubscriptionId m_numIds = 0; @@ -68,4 +70,3 @@ class TestPubsub : public zserio::IPubsub, public zserio::AllocatorHolder } // namespace test_utils #endif // TEST_UTILS_TEST_PUBSUB_H_INC - diff --git a/test/utils/cpp/test_utils/ValidationObservers.h b/test/utils/cpp/test_utils/ValidationObservers.h index 530d82049..8750ebec7 100644 --- a/test/utils/cpp/test_utils/ValidationObservers.h +++ b/test/utils/cpp/test_utils/ValidationObservers.h @@ -35,19 +35,33 @@ class CountingValidationObserver : public zserio::IValidationObserver return true; } - bool reportError(zserio::StringView, zserio::StringView, - zserio::Span, ErrorType, + bool reportError(zserio::StringView, zserio::StringView, zserio::Span, ErrorType, zserio::StringView) override { m_numberOfErrors++; return true; } - size_t getNumberOfTables() const { return m_numberOfTables; } - size_t getNumberOfValidatedTables() const { return m_numberOfValidatedTables; } - size_t getNumberOfRows() const { return m_numberOfRows; } - size_t getNumberOfValidatedRows() const { return m_numberOfValidatedRows; } - size_t getNumberOfErrors() const { return m_numberOfErrors; } + size_t getNumberOfTables() const + { + return m_numberOfTables; + } + size_t getNumberOfValidatedTables() const + { + return m_numberOfValidatedTables; + } + size_t getNumberOfRows() const + { + return m_numberOfRows; + } + size_t getNumberOfValidatedRows() const + { + return m_numberOfValidatedRows; + } + size_t getNumberOfErrors() const + { + return m_numberOfErrors; + } private: size_t m_numberOfTables = 0; @@ -74,9 +88,7 @@ class ValidationObserver : public zserio::IValidationObserver { std::transform(primaryKeyValuesSpan.begin(), primaryKeyValuesSpan.end(), std::back_inserter(this->primaryKeyValues), - [](zserio::StringView msg) -> std::string { - return ::zserio::toString(msg); - }); + [](zserio::StringView msg) -> std::string { return ::zserio::toString(msg); }); } std::string tableName; @@ -98,8 +110,7 @@ class ValidationObserver : public zserio::IValidationObserver bool beginTable(zserio::StringView tableName, size_t numberOfRows) override { - m_rowCountsMap[zserio::toString(tableName)] = - std::make_tuple(numberOfRows, static_cast(0)); + m_rowCountsMap[zserio::toString(tableName)] = std::make_tuple(numberOfRows, static_cast(0)); return true; } diff --git a/test/utils/cpp/test_utils/ZserioErrorOutput.h b/test/utils/cpp/test_utils/ZserioErrorOutput.h index 83f039eeb..17fb8746f 100644 --- a/test/utils/cpp/test_utils/ZserioErrorOutput.h +++ b/test/utils/cpp/test_utils/ZserioErrorOutput.h @@ -1,8 +1,8 @@ #ifndef TEST_UTILS_ZSERIO_ERRORS_H_INC #define TEST_UTILS_ZSERIO_ERRORS_H_INC -#include #include +#include #include namespace test_utils @@ -11,8 +11,8 @@ namespace test_utils class ZserioErrorOutput { public: - explicit ZserioErrorOutput(const std::string& prefix, - const std::string& fileName = ZSERIO_ERROR_OUTPUT_FILE_NAME) + explicit ZserioErrorOutput( + const std::string& prefix, const std::string& fileName = ZSERIO_ERROR_OUTPUT_FILE_NAME) { const std::string errorsFileName = prefix + "/" + fileName; std::ifstream errorsFile(errorsFileName); diff --git a/test/warnings/array_types_warning/cpp/ArrayTypesWarningTest.cpp b/test/warnings/array_types_warning/cpp/ArrayTypesWarningTest.cpp index bfa2afaad..81b1ea721 100644 --- a/test/warnings/array_types_warning/cpp/ArrayTypesWarningTest.cpp +++ b/test/warnings/array_types_warning/cpp/ArrayTypesWarningTest.cpp @@ -2,14 +2,13 @@ #include #include "gtest/gtest.h" - #include "test_utils/ZserioErrorOutput.h" class ArrayTypesWarningTest : public ::testing::Test { protected: - ArrayTypesWarningTest() - : zserioWarnings("warnings/array_types_warning") + ArrayTypesWarningTest() : + zserioWarnings("warnings/array_types_warning") {} const test_utils::ZserioErrorOutput zserioWarnings; @@ -17,7 +16,8 @@ class ArrayTypesWarningTest : public ::testing::Test TEST_F(ArrayTypesWarningTest, packedArrayChoiceHasNoPackableField) { - const std::string warning = "packed_array_choice_has_no_packable_field.zs:40:12: " + const std::string warning = + "packed_array_choice_has_no_packable_field.zs:40:12: " "Keyword 'packed' doesn't have any effect. " "'ChoiceWithoutPackableField' doesn't contain any packable field."; ASSERT_TRUE(zserioWarnings.isPresent(warning)); @@ -25,7 +25,8 @@ TEST_F(ArrayTypesWarningTest, packedArrayChoiceHasNoPackableField) TEST_F(ArrayTypesWarningTest, packedArrayStructHasNoPackableField) { - const std::string warning = "packed_array_struct_has_no_packable_field.zs:48:12: " + const std::string warning = + "packed_array_struct_has_no_packable_field.zs:48:12: " "Keyword 'packed' doesn't have any effect. " "'StructWithoutPackable' doesn't contain any packable field."; ASSERT_TRUE(zserioWarnings.isPresent(warning)); @@ -33,63 +34,65 @@ TEST_F(ArrayTypesWarningTest, packedArrayStructHasNoPackableField) TEST_F(ArrayTypesWarningTest, packedArrayTemplateHasNoPackableField) { - const std::vector warnings1 = - { - "packed_array_template_has_no_packable_field.zs:22:13: " - " In instantiation of 'Template' required from here", - "packed_array_template_has_no_packable_field.zs:5:12: " - "Keyword 'packed' doesn't have any effect. 'string' is not packable element type." - }; + const std::vector warnings1 = { + "packed_array_template_has_no_packable_field.zs:22:13: " + " In instantiation of 'Template' required from here", + "packed_array_template_has_no_packable_field.zs:5:12: " + "Keyword 'packed' doesn't have any effect. 'string' is not packable element type."}; ASSERT_TRUE(zserioWarnings.isPresent(warnings1)); - const std::vector warnings2 = - { - "packed_array_template_has_no_packable_field.zs:24:13: " - " In instantiation of 'Template' required from here", - "packed_array_template_has_no_packable_field.zs:5:12: " - "Keyword 'packed' doesn't have any effect. 'Unpackable' doesn't contain any packable field." - }; + const std::vector warnings2 = { + "packed_array_template_has_no_packable_field.zs:24:13: " + " In instantiation of 'Template' required from here", + "packed_array_template_has_no_packable_field.zs:5:12: " + "Keyword 'packed' doesn't have any effect. 'Unpackable' doesn't contain any packable field."}; ASSERT_TRUE(zserioWarnings.isPresent(warnings2)); } TEST_F(ArrayTypesWarningTest, packedArrayUnionHasNoPackableField) { - const std::string warning = "packed_array_union_has_no_packable_field.zs:25:12: " + const std::string warning = + "packed_array_union_has_no_packable_field.zs:25:12: " "Union 'UnionWithoutPackableField' doesn't contain any packable field."; ASSERT_TRUE(zserioWarnings.isPresent(warning)); } TEST_F(ArrayTypesWarningTest, packedArrayUnpackableBoolElement) { - const std::string warning = "packed_array_unpackable_bool_element.zs:23:12: " + const std::string warning = + "packed_array_unpackable_bool_element.zs:23:12: " "Keyword 'packed' doesn't have any effect. 'bool' is not packable element type."; ASSERT_TRUE(zserioWarnings.isPresent(warning)); } TEST_F(ArrayTypesWarningTest, packedArrayUnpackableBytesElement) { - const std::string warning = "packed_array_unpackable_bytes_element.zs:6:12: " + const std::string warning = + "packed_array_unpackable_bytes_element.zs:6:12: " "Keyword 'packed' doesn't have any effect. 'bytes' is not packable element type."; ASSERT_TRUE(zserioWarnings.isPresent(warning)); } TEST_F(ArrayTypesWarningTest, packedArrayUnpackableExternElement) { - const std::string warning = "packed_array_unpackable_extern_element.zs:6:12: " + const std::string warning = + "packed_array_unpackable_extern_element.zs:6:12: " "Keyword 'packed' doesn't have any effect. 'extern' is not packable element type."; ASSERT_TRUE(zserioWarnings.isPresent(warning)); } TEST_F(ArrayTypesWarningTest, packedArrayUnpackableFloatElement) { - const std::string warning = "packed_array_unpackable_float_element.zs:6:12: " + const std::string warning = + "packed_array_unpackable_float_element.zs:6:12: " "Keyword 'packed' doesn't have any effect. 'float64' is not packable element type."; ASSERT_TRUE(zserioWarnings.isPresent(warning)); } TEST_F(ArrayTypesWarningTest, packedArrayUnpackableStringElement) { - const std::string warning = "packed_array_unpackable_string_element.zs:6:12: " + const std::string warning = + "packed_array_unpackable_string_element.zs:6:12: " "Keyword 'packed' doesn't have any effect. 'string' is not packable element type."; ASSERT_TRUE(zserioWarnings.isPresent(warning)); } diff --git a/test/warnings/array_types_warning/cpp/PackedArrayChoiceHasNoPackableFieldTest.cpp b/test/warnings/array_types_warning/cpp/PackedArrayChoiceHasNoPackableFieldTest.cpp index 787ee68c8..c659520e4 100644 --- a/test/warnings/array_types_warning/cpp/PackedArrayChoiceHasNoPackableFieldTest.cpp +++ b/test/warnings/array_types_warning/cpp/PackedArrayChoiceHasNoPackableFieldTest.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "array_types_warning/packed_array_choice_has_no_packable_field/PackedArrayChoiceHasNoPackableField.h" - +#include "gtest/gtest.h" #include "zserio/SerializeUtil.h" namespace array_types_warning @@ -22,11 +20,8 @@ TEST_F(PackedArrayChoiceHasNoPackableFieldTest, writeRead) { PackedArrayChoiceHasNoPackableField packedArrayChoiceHasNoPackableField; - packedArrayChoiceHasNoPackableField.setArray1({{ - StructWithPackable("A", 65), - StructWithPackable("B", 66), - StructWithPackable("C", 67) - }}); + packedArrayChoiceHasNoPackableField.setArray1( + {{StructWithPackable("A", 65), StructWithPackable("B", 66), StructWithPackable("C", 67)}}); auto& array2 = packedArrayChoiceHasNoPackableField.getArray2(); array2.resize(3); @@ -34,11 +29,8 @@ TEST_F(PackedArrayChoiceHasNoPackableFieldTest, writeRead) array2[1].setField2(TestEnum::TWO); array2[2].setField2(TestEnum::ONE); - packedArrayChoiceHasNoPackableField.setArray3({{ - StructWithPackableArray("ABC", {{ 65, 66, 67 }}), - StructWithPackableArray("DEF", {{ 68, 69, 70 }}), - StructWithPackableArray("GHI", {{ 71, 72, 73 }}) - }}); + packedArrayChoiceHasNoPackableField.setArray3({{StructWithPackableArray("ABC", {{65, 66, 67}}), + StructWithPackableArray("DEF", {{68, 69, 70}}), StructWithPackableArray("GHI", {{71, 72, 73}})}}); auto& array4 = packedArrayChoiceHasNoPackableField.getArray4(); array4.resize(3); diff --git a/test/warnings/array_types_warning/cpp/PackedArrayStructHasNoPackableFieldTest.cpp b/test/warnings/array_types_warning/cpp/PackedArrayStructHasNoPackableFieldTest.cpp index bffc26153..3686fc27a 100644 --- a/test/warnings/array_types_warning/cpp/PackedArrayStructHasNoPackableFieldTest.cpp +++ b/test/warnings/array_types_warning/cpp/PackedArrayStructHasNoPackableFieldTest.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "array_types_warning/packed_array_struct_has_no_packable_field/PackedArrayStructHasNoPackableField.h" - +#include "gtest/gtest.h" #include "zserio/SerializeUtil.h" namespace array_types_warning @@ -27,11 +25,8 @@ TEST_F(PackedArrayStructHasNoPackableFieldTest, writeRead) { PackedArrayStructHasNoPackableField packedArrayStructHasNoPackableField; - packedArrayStructHasNoPackableField.setArray1({{ - StructWithPackable("A", 65), - StructWithPackable("B", 66), - StructWithPackable("C", 67) - }}); + packedArrayStructHasNoPackableField.setArray1( + {{StructWithPackable("A", 65), StructWithPackable("B", 66), StructWithPackable("C", 67)}}); auto& array2 = packedArrayStructHasNoPackableField.getArray2(); array2.resize(3); @@ -39,20 +34,16 @@ TEST_F(PackedArrayStructHasNoPackableFieldTest, writeRead) array2[1].setField2(TestEnum::TWO); array2[2].setField2(TestEnum::ONE); - packedArrayStructHasNoPackableField.setArray3({{ - StructWithPackableArray("ABC", {{ 65, 66, 67 }}), - StructWithPackableArray("DEF", {{ 68, 69, 70 }}), - StructWithPackableArray("GHI", {{ 71, 72, 73 }}) - }}); + packedArrayStructHasNoPackableField.setArray3({{StructWithPackableArray("ABC", {{65, 66, 67}}), + StructWithPackableArray("DEF", {{68, 69, 70}}), StructWithPackableArray("GHI", {{71, 72, 73}})}}); - packedArrayStructHasNoPackableField.setArray4({{ - StructWithoutPackable(4.0F, BitBuffer(vector_type({0xF0}), 5), 0, "A", - {{0, 0, 0}}, {{true, false, true}}), - StructWithoutPackable(1.0F, BitBuffer(vector_type({0xE0}), 5), 0, "B", - {{0, 0, 0}}, {{true, false, true}}), - StructWithoutPackable(0.0F, BitBuffer(vector_type({0xD0}), 5), 0, "C", - {{0, 0, 0}}, {{true, false, true}}) - }}); + packedArrayStructHasNoPackableField.setArray4( + {{StructWithoutPackable(4.0F, BitBuffer(vector_type({0xF0}), 5), 0, "A", {{0, 0, 0}}, + {{true, false, true}}), + StructWithoutPackable(1.0F, BitBuffer(vector_type({0xE0}), 5), 0, "B", {{0, 0, 0}}, + {{true, false, true}}), + StructWithoutPackable(0.0F, BitBuffer(vector_type({0xD0}), 5), 0, "C", {{0, 0, 0}}, + {{true, false, true}})}}); packedArrayStructHasNoPackableField.getArray5().resize(3); diff --git a/test/warnings/array_types_warning/cpp/PackedArrayTemplateHasNoPackableFieldTest.cpp b/test/warnings/array_types_warning/cpp/PackedArrayTemplateHasNoPackableFieldTest.cpp index c577bbab2..bfbe85832 100644 --- a/test/warnings/array_types_warning/cpp/PackedArrayTemplateHasNoPackableFieldTest.cpp +++ b/test/warnings/array_types_warning/cpp/PackedArrayTemplateHasNoPackableFieldTest.cpp @@ -1,10 +1,8 @@ -#include "gtest/gtest.h" - -#include "array_types_warning/packed_array_template_has_no_packable_field/T_u32.h" -#include "array_types_warning/packed_array_template_has_no_packable_field/T_str.h" #include "array_types_warning/packed_array_template_has_no_packable_field/T_packable.h" +#include "array_types_warning/packed_array_template_has_no_packable_field/T_str.h" +#include "array_types_warning/packed_array_template_has_no_packable_field/T_u32.h" #include "array_types_warning/packed_array_template_has_no_packable_field/T_unpackable.h" - +#include "gtest/gtest.h" #include "zserio/SerializeUtil.h" namespace array_types_warning @@ -48,9 +46,9 @@ TEST_F(PackedArrayTemplateHasNoPackableFieldTest, writeReadStr) TEST_F(PackedArrayTemplateHasNoPackableFieldTest, writeReadPackable) { T_packable packable(vector_type{{ - Packable(0, 4.0, "A"), - Packable(1, 1.0, "B"), - Packable(2, 0.0, "C"), + Packable(0, 4.0, "A"), + Packable(1, 1.0, "B"), + Packable(2, 0.0, "C"), }}); const std::string blobName = BLOB_NAME_BASE + "_packable.blob"; @@ -62,9 +60,9 @@ TEST_F(PackedArrayTemplateHasNoPackableFieldTest, writeReadPackable) TEST_F(PackedArrayTemplateHasNoPackableFieldTest, writeReadUnpackable) { T_unpackable unpackable(vector_type{{ - Unpackable(4.0, "A"), - Unpackable(1.0, "B"), - Unpackable(0.0, "C"), + Unpackable(4.0, "A"), + Unpackable(1.0, "B"), + Unpackable(0.0, "C"), }}); const std::string blobName = BLOB_NAME_BASE + "_unpackable.blob"; diff --git a/test/warnings/array_types_warning/cpp/PackedArrayUnionHasNoPackableFieldTest.cpp b/test/warnings/array_types_warning/cpp/PackedArrayUnionHasNoPackableFieldTest.cpp index 3bcf123b4..034b109e6 100644 --- a/test/warnings/array_types_warning/cpp/PackedArrayUnionHasNoPackableFieldTest.cpp +++ b/test/warnings/array_types_warning/cpp/PackedArrayUnionHasNoPackableFieldTest.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "array_types_warning/packed_array_union_has_no_packable_field/PackedArrayUnionHasNoPackableField.h" - +#include "gtest/gtest.h" #include "zserio/SerializeUtil.h" namespace array_types_warning @@ -22,17 +20,11 @@ TEST_F(PackedArrayUnionHasNoPackableFieldTest, writeRead) { PackedArrayUnionHasNoPackableField packedArrayUnionHasNoPackableField; - packedArrayUnionHasNoPackableField.setArray1({{ - StructWithPackable("A", 65), - StructWithPackable("B", 66), - StructWithPackable("C", 67) - }}); - - packedArrayUnionHasNoPackableField.setArray2({{ - StructWithPackableArray("ABC", {{ 65, 66, 67 }}), - StructWithPackableArray("DEF", {{ 68, 69, 70 }}), - StructWithPackableArray("GHI", {{ 71, 72, 73 }}) - }}); + packedArrayUnionHasNoPackableField.setArray1( + {{StructWithPackable("A", 65), StructWithPackable("B", 66), StructWithPackable("C", 67)}}); + + packedArrayUnionHasNoPackableField.setArray2({{StructWithPackableArray("ABC", {{65, 66, 67}}), + StructWithPackableArray("DEF", {{68, 69, 70}}), StructWithPackableArray("GHI", {{71, 72, 73}})}}); auto& array3 = packedArrayUnionHasNoPackableField.getArray3(); array3.resize(3); diff --git a/test/warnings/array_types_warning/cpp/PackedArrayUnpackableBoolElementTest.cpp b/test/warnings/array_types_warning/cpp/PackedArrayUnpackableBoolElementTest.cpp index a95bbf441..c9b16d786 100644 --- a/test/warnings/array_types_warning/cpp/PackedArrayUnpackableBoolElementTest.cpp +++ b/test/warnings/array_types_warning/cpp/PackedArrayUnpackableBoolElementTest.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "array_types_warning/packed_array_unpackable_bool_element/PackedArrayUnpackableBoolElement.h" - +#include "gtest/gtest.h" #include "zserio/SerializeUtil.h" namespace array_types_warning @@ -20,15 +18,10 @@ const std::string PackedArrayUnpackableBoolElementTest::BLOB_NAME = TEST_F(PackedArrayUnpackableBoolElementTest, writeRead) { - PackedArrayUnpackableBoolElement packedArrayUnpackableBoolElement( - {{0, 1, 2}}, - {{TestEnum::ONE, TestEnum::TWO, TestEnum::ONE}}, - {{TestBitmask::Values::BLACK, TestBitmask::Values::BLACK, TestBitmask::Values::BLACK}}, - {{0, 1, 2}}, - 5, - {{0, -1, -2}}, - {{true, false, true}} - ); + PackedArrayUnpackableBoolElement packedArrayUnpackableBoolElement({{0, 1, 2}}, + {{TestEnum::ONE, TestEnum::TWO, TestEnum::ONE}}, + {{TestBitmask::Values::BLACK, TestBitmask::Values::BLACK, TestBitmask::Values::BLACK}}, {{0, 1, 2}}, + 5, {{0, -1, -2}}, {{true, false, true}}); zserio::serializeToFile(packedArrayUnpackableBoolElement, BLOB_NAME); auto readPackedArrayUnpackableBoolElement = diff --git a/test/warnings/array_types_warning/cpp/PackedArrayUnpackableBytesElementTest.cpp b/test/warnings/array_types_warning/cpp/PackedArrayUnpackableBytesElementTest.cpp index c1476a3cf..c01e97a30 100644 --- a/test/warnings/array_types_warning/cpp/PackedArrayUnpackableBytesElementTest.cpp +++ b/test/warnings/array_types_warning/cpp/PackedArrayUnpackableBytesElementTest.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "array_types_warning/packed_array_unpackable_bytes_element/PackedArrayUnpackableBytesElement.h" - +#include "gtest/gtest.h" #include "zserio/SerializeUtil.h" namespace array_types_warning @@ -21,9 +19,7 @@ const std::string PackedArrayUnpackableBytesElementTest::BLOB_NAME = TEST_F(PackedArrayUnpackableBytesElementTest, writeRead) { PackedArrayUnpackableBytesElement packedArrayUnpackableBytesElement( - {{10, 11, 12}}, - {{ {{0, 1, 2}}, {{11, 12, 13}}, {{100, 101, 102}} }} - ); + {{10, 11, 12}}, {{{{0, 1, 2}}, {{11, 12, 13}}, {{100, 101, 102}}}}); zserio::serializeToFile(packedArrayUnpackableBytesElement, BLOB_NAME); auto readPackedArrayUnpackableBytesElement = diff --git a/test/warnings/array_types_warning/cpp/PackedArrayUnpackableExternElementTest.cpp b/test/warnings/array_types_warning/cpp/PackedArrayUnpackableExternElementTest.cpp index 1e486f6a6..2fbe3cd04 100644 --- a/test/warnings/array_types_warning/cpp/PackedArrayUnpackableExternElementTest.cpp +++ b/test/warnings/array_types_warning/cpp/PackedArrayUnpackableExternElementTest.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "array_types_warning/packed_array_unpackable_extern_element/PackedArrayUnpackableExternElement.h" - +#include "gtest/gtest.h" #include "zserio/SerializeUtil.h" namespace array_types_warning @@ -25,14 +23,10 @@ const std::string PackedArrayUnpackableExternElementTest::BLOB_NAME = TEST_F(PackedArrayUnpackableExternElementTest, writeRead) { - PackedArrayUnpackableExternElement packedArrayUnpackableExternElement( - {{10, 11, 12}}, - {{ - BitBuffer(vector_type{{0xFF, 0xC0}}, 10), - BitBuffer(vector_type{{0xFF, 0x80}}, 10), - BitBuffer(vector_type{{0xFF, 0x40}}, 10) - }} - ); + PackedArrayUnpackableExternElement packedArrayUnpackableExternElement({{10, 11, 12}}, + {{BitBuffer(vector_type{{0xFF, 0xC0}}, 10), + BitBuffer(vector_type{{0xFF, 0x80}}, 10), + BitBuffer(vector_type{{0xFF, 0x40}}, 10)}}); zserio::serializeToFile(packedArrayUnpackableExternElement, BLOB_NAME); auto readPackedArrayUnpackableExternElement = diff --git a/test/warnings/array_types_warning/cpp/PackedArrayUnpackableFloatElementTest.cpp b/test/warnings/array_types_warning/cpp/PackedArrayUnpackableFloatElementTest.cpp index e509b25d9..060793557 100644 --- a/test/warnings/array_types_warning/cpp/PackedArrayUnpackableFloatElementTest.cpp +++ b/test/warnings/array_types_warning/cpp/PackedArrayUnpackableFloatElementTest.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "array_types_warning/packed_array_unpackable_float_element/PackedArrayUnpackableFloatElement.h" - +#include "gtest/gtest.h" #include "zserio/SerializeUtil.h" namespace array_types_warning @@ -20,10 +18,7 @@ const std::string PackedArrayUnpackableFloatElementTest::BLOB_NAME = TEST_F(PackedArrayUnpackableFloatElementTest, writeRead) { - PackedArrayUnpackableFloatElement packedArrayUnpackableFloatElement( - {{10, 11, 12}}, - {{4.0, 1.0, 0.0}} - ); + PackedArrayUnpackableFloatElement packedArrayUnpackableFloatElement({{10, 11, 12}}, {{4.0, 1.0, 0.0}}); zserio::serializeToFile(packedArrayUnpackableFloatElement, BLOB_NAME); auto readPackedArrayUnpackableFloatElement = diff --git a/test/warnings/array_types_warning/cpp/PackedArrayUnpackableStringElementTest.cpp b/test/warnings/array_types_warning/cpp/PackedArrayUnpackableStringElementTest.cpp index ce0958148..dbeb4c54a 100644 --- a/test/warnings/array_types_warning/cpp/PackedArrayUnpackableStringElementTest.cpp +++ b/test/warnings/array_types_warning/cpp/PackedArrayUnpackableStringElementTest.cpp @@ -1,7 +1,5 @@ -#include "gtest/gtest.h" - #include "array_types_warning/packed_array_unpackable_string_element/PackedArrayUnpackableStringElement.h" - +#include "gtest/gtest.h" #include "zserio/SerializeUtil.h" namespace array_types_warning @@ -20,10 +18,7 @@ const std::string PackedArrayUnpackableStringElementTest::BLOB_NAME = TEST_F(PackedArrayUnpackableStringElementTest, writeRead) { - PackedArrayUnpackableStringElement packedArrayUnpackableStringElement( - {{10, 11, 12}}, - {{"A", "B", "C"}} - ); + PackedArrayUnpackableStringElement packedArrayUnpackableStringElement({{10, 11, 12}}, {{"A", "B", "C"}}); zserio::serializeToFile(packedArrayUnpackableStringElement, BLOB_NAME); auto readPackedArrayUnpackableStringElement = diff --git a/test/warnings/choice_types_warning/cpp/ChoiceTypesWarningTest.cpp b/test/warnings/choice_types_warning/cpp/ChoiceTypesWarningTest.cpp index 3e6aab705..44eac4cca 100644 --- a/test/warnings/choice_types_warning/cpp/ChoiceTypesWarningTest.cpp +++ b/test/warnings/choice_types_warning/cpp/ChoiceTypesWarningTest.cpp @@ -2,14 +2,13 @@ #include #include "gtest/gtest.h" - #include "test_utils/ZserioErrorOutput.h" class ChoiceTypesWarningTest : public ::testing::Test { protected: - ChoiceTypesWarningTest() - : zserioWarnings("warnings/choice_types_warning") + ChoiceTypesWarningTest() : + zserioWarnings("warnings/choice_types_warning") {} const test_utils::ZserioErrorOutput zserioWarnings; @@ -17,7 +16,8 @@ class ChoiceTypesWarningTest : public ::testing::Test TEST_F(ChoiceTypesWarningTest, optionalReferencesInSelector) { - const std::string warning = "optional_references_in_selector.zs:8:41: Choice 'TestChoice' selector " + const std::string warning = + "optional_references_in_selector.zs:8:41: Choice 'TestChoice' selector " "contains reference to optional field 'numBits'."; ASSERT_TRUE(zserioWarnings.isPresent(warning)); } diff --git a/test/warnings/comments_warning/cpp/CommentsWarningTest.cpp b/test/warnings/comments_warning/cpp/CommentsWarningTest.cpp index 510699bfd..2c8583375 100644 --- a/test/warnings/comments_warning/cpp/CommentsWarningTest.cpp +++ b/test/warnings/comments_warning/cpp/CommentsWarningTest.cpp @@ -2,14 +2,13 @@ #include #include "gtest/gtest.h" - #include "test_utils/ZserioErrorOutput.h" class CommentsWarningTest : public ::testing::Test { protected: - CommentsWarningTest() - : zserioWarnings("warnings/comments_warning", "zserio_log_comments.txt") + CommentsWarningTest() : + zserioWarnings("warnings/comments_warning", "zserio_log_comments.txt") {} const test_utils::ZserioErrorOutput zserioWarnings; @@ -17,83 +16,98 @@ class CommentsWarningTest : public ::testing::Test TEST_F(CommentsWarningTest, docCommentFormat) { - ASSERT_TRUE(zserioWarnings.isPresent("doc_comment_format.zs:4:4: " + ASSERT_TRUE(zserioWarnings.isPresent( + "doc_comment_format.zs:4:4: " "Documentation: no viable alternative at input")); // '\\n * /**' won't work under Windows } TEST_F(CommentsWarningTest, markdownCommentWithWrongTerminator) { - ASSERT_TRUE(zserioWarnings.isPresent("markdown_comment_with_wrong_terminator.zs:3:1: " + ASSERT_TRUE(zserioWarnings.isPresent( + "markdown_comment_with_wrong_terminator.zs:3:1: " "Markdown documentation comment should be terminated by '!*/'.")); - ASSERT_TRUE(zserioWarnings.isPresent("markdown_comment_with_wrong_terminator.zs:7:1: " + ASSERT_TRUE(zserioWarnings.isPresent( + "markdown_comment_with_wrong_terminator.zs:7:1: " "Markdown documentation comment should be terminated by '!*/'.")); - ASSERT_TRUE(zserioWarnings.isPresent("markdown_comment_with_wrong_terminator.zs:21:1: " + ASSERT_TRUE(zserioWarnings.isPresent( + "markdown_comment_with_wrong_terminator.zs:21:1: " "Markdown documentation comment should be terminated by '!*/'.")); - ASSERT_TRUE(zserioWarnings.isPresent("markdown_comment_with_wrong_terminator.zs:26:5: " + ASSERT_TRUE(zserioWarnings.isPresent( + "markdown_comment_with_wrong_terminator.zs:26:5: " "Markdown documentation comment should be terminated by '!*/'.")); - ASSERT_TRUE(zserioWarnings.isPresent("markdown_comment_with_wrong_terminator.zs:38:5: " + ASSERT_TRUE(zserioWarnings.isPresent( + "markdown_comment_with_wrong_terminator.zs:38:5: " "Markdown documentation comment should be terminated by '!*/'.")); } TEST_F(CommentsWarningTest, unresolvedMarkdownSeeTagReference) { - ASSERT_TRUE(zserioWarnings.isPresent("unresolved_markdown_see_tag_reference.zs:7:5: " + ASSERT_TRUE(zserioWarnings.isPresent( + "unresolved_markdown_see_tag_reference.zs:7:5: " "Documentation: Unresolved referenced symbol 'comments_warning.unknown.Unknown'!")); - ASSERT_TRUE(zserioWarnings.isPresent("unresolved_markdown_see_tag_reference.zs:14:41: " + ASSERT_TRUE(zserioWarnings.isPresent( + "unresolved_markdown_see_tag_reference.zs:14:41: " "Documentation: Unresolved referenced symbol 'comments_warning.unknown'!")); - ASSERT_TRUE(zserioWarnings.isPresent("unresolved_markdown_see_tag_reference.zs:22:34: " + ASSERT_TRUE(zserioWarnings.isPresent( + "unresolved_markdown_see_tag_reference.zs:22:34: " "Documentation: Unresolved referenced symbol 'comments_warning.unknown'!")); - ASSERT_TRUE(zserioWarnings.isPresent("unresolved_markdown_see_tag_reference.zs:27:23: " + ASSERT_TRUE(zserioWarnings.isPresent( + "unresolved_markdown_see_tag_reference.zs:27:23: " "Documentation: Unresolved referenced symbol 'comments_warning.unknown.Unknown'!")); - ASSERT_TRUE(zserioWarnings.isPresent("unresolved_markdown_see_tag_reference.zs:33:6: " + ASSERT_TRUE(zserioWarnings.isPresent( + "unresolved_markdown_see_tag_reference.zs:33:6: " "Documentation: Unresolved referenced symbol 'comments_warning.unknown.Unknown'!")); - ASSERT_TRUE(zserioWarnings.isPresent("unresolved_markdown_see_tag_reference.zs:38:20: " + ASSERT_TRUE(zserioWarnings.isPresent( + "unresolved_markdown_see_tag_reference.zs:38:20: " "Documentation: Unresolved referenced symbol 'comments_warning.unknown'!")); - ASSERT_TRUE(zserioWarnings.isPresent("unresolved_markdown_see_tag_reference.zs:42:46: " + ASSERT_TRUE(zserioWarnings.isPresent( + "unresolved_markdown_see_tag_reference.zs:42:46: " "Documentation: Unresolved referenced symbol 'comments_warning.unknown.Unknown'!")); } TEST_F(CommentsWarningTest, unresolvedSeeTagInTemplatedStruct) { - ASSERT_TRUE(zserioWarnings.isPresent("unresolved_see_tag_in_templated_struct.zs:3:5: " + ASSERT_TRUE(zserioWarnings.isPresent( + "unresolved_see_tag_in_templated_struct.zs:3:5: " "Documentation: Unresolved referenced symbol 'unknown'!")); } TEST_F(CommentsWarningTest, unresolvedSeeTagReference) { - ASSERT_TRUE(zserioWarnings.isPresent("unresolved_see_tag_reference.zs:8:4: " + ASSERT_TRUE(zserioWarnings.isPresent( + "unresolved_see_tag_reference.zs:8:4: " "Documentation: Unresolved referenced symbol 'Unexisting'!")); - ASSERT_TRUE(zserioWarnings.isPresent("unresolved_see_tag_reference.zs:9:4: " + ASSERT_TRUE(zserioWarnings.isPresent( + "unresolved_see_tag_reference.zs:9:4: " "Documentation: Unresolved referenced symbol 'comments_warning.unexisting_package'!")); - ASSERT_TRUE(zserioWarnings.isPresent("unresolved_see_tag_reference.zs:16:4: " + ASSERT_TRUE(zserioWarnings.isPresent( + "unresolved_see_tag_reference.zs:16:4: " "Documentation: Unresolved referenced symbol 'unexisting' for type 'Table'!")); - ASSERT_TRUE(zserioWarnings.isPresent("unresolved_see_tag_reference.zs:17:4: " + ASSERT_TRUE(zserioWarnings.isPresent( + "unresolved_see_tag_reference.zs:17:4: " "Documentation: Unresolved referenced symbol 'unexisting' for type 'Table'!")); } TEST_F(CommentsWarningTest, unusedFieldComments) { - ASSERT_TRUE(zserioWarnings.isPresent( - "unused_field_comments.zs:11:11: Documentation comment is not used.")); + ASSERT_TRUE(zserioWarnings.isPresent("unused_field_comments.zs:11:11: Documentation comment is not used.")); - ASSERT_TRUE(zserioWarnings.isPresent( - "unused_field_comments.zs:55:45: Documentation comment is not used.")); + ASSERT_TRUE(zserioWarnings.isPresent("unused_field_comments.zs:55:45: Documentation comment is not used.")); - ASSERT_TRUE(zserioWarnings.isPresent( - "unused_field_comments.zs:61:45: Documentation comment is not used.")); + ASSERT_TRUE(zserioWarnings.isPresent("unused_field_comments.zs:61:45: Documentation comment is not used.")); } TEST_F(CommentsWarningTest, unusedStructCommentById) @@ -104,7 +118,8 @@ TEST_F(CommentsWarningTest, unusedStructCommentById) TEST_F(CommentsWarningTest, unusedStructCommentMultipleComments) { - const std::string warning = "unused_struct_comment_multiple_comments.zs:5:9: " + const std::string warning = + "unused_struct_comment_multiple_comments.zs:5:9: " "Documentation comment is not used."; ASSERT_TRUE(zserioWarnings.isPresent(warning)); } diff --git a/test/warnings/comments_warning/cpp/DocCommentMissingWarningTest.cpp b/test/warnings/comments_warning/cpp/DocCommentMissingWarningTest.cpp index ac77d545a..d07ae6fee 100644 --- a/test/warnings/comments_warning/cpp/DocCommentMissingWarningTest.cpp +++ b/test/warnings/comments_warning/cpp/DocCommentMissingWarningTest.cpp @@ -2,14 +2,13 @@ #include #include "gtest/gtest.h" - #include "test_utils/ZserioErrorOutput.h" class DocCommentMissingWarningTest : public ::testing::Test { protected: - DocCommentMissingWarningTest() - : zserioWarnings("warnings/comments_warning", "zserio_log_doc_comment_missing.txt") + DocCommentMissingWarningTest() : + zserioWarnings("warnings/comments_warning", "zserio_log_doc_comment_missing.txt") {} const test_utils::ZserioErrorOutput zserioWarnings; @@ -17,173 +16,205 @@ class DocCommentMissingWarningTest : public ::testing::Test TEST_F(DocCommentMissingWarningTest, compatibilityVersion) { - ASSERT_TRUE(zserioWarnings.isPresent("doc_comment_missing_warning.zs:3:30: " + ASSERT_TRUE(zserioWarnings.isPresent( + "doc_comment_missing_warning.zs:3:30: " "Missing documentation comment for compatibility version.")); } TEST_F(DocCommentMissingWarningTest, package) { - ASSERT_TRUE(zserioWarnings.isPresent("doc_comment_missing_warning.zs:5:9: " + ASSERT_TRUE(zserioWarnings.isPresent( + "doc_comment_missing_warning.zs:5:9: " "Missing documentation comment for package.")); - ASSERT_TRUE(zserioWarnings.isPresent("all_nodes.zs:1:9: " + ASSERT_TRUE(zserioWarnings.isPresent( + "all_nodes.zs:1:9: " "Missing documentation comment for package.")); } TEST_F(DocCommentMissingWarningTest, import) { - ASSERT_TRUE(zserioWarnings.isPresent("doc_comment_missing_warning.zs:7:8: " + ASSERT_TRUE(zserioWarnings.isPresent( + "doc_comment_missing_warning.zs:7:8: " "Missing documentation comment for import.")); } TEST_F(DocCommentMissingWarningTest, constant) { - ASSERT_TRUE(zserioWarnings.isPresent("all_nodes.zs:13:14: " + ASSERT_TRUE(zserioWarnings.isPresent( + "all_nodes.zs:13:14: " "Missing documentation comment for constant 'CONSTANT'.")); } TEST_F(DocCommentMissingWarningTest, subtype) { - ASSERT_TRUE(zserioWarnings.isPresent("all_nodes.zs:23:16: " + ASSERT_TRUE(zserioWarnings.isPresent( + "all_nodes.zs:23:16: " "Missing documentation comment for subtype 'Subtype'.")); } TEST_F(DocCommentMissingWarningTest, instantiateType) { - ASSERT_TRUE(zserioWarnings.isPresent("all_nodes.zs:20:35: " + ASSERT_TRUE(zserioWarnings.isPresent( + "all_nodes.zs:20:35: " "Missing documentation comment for instantiate type 'StructureTypeU32'.")); - ASSERT_TRUE(zserioWarnings.isPresent("all_nodes.zs:21:35: " + ASSERT_TRUE(zserioWarnings.isPresent( + "all_nodes.zs:21:35: " "Missing documentation comment for instantiate type 'StructureTypeSTR'.")); } TEST_F(DocCommentMissingWarningTest, bitmaskType) { - ASSERT_TRUE(zserioWarnings.isPresent("all_nodes.zs:3:15: " + ASSERT_TRUE(zserioWarnings.isPresent( + "all_nodes.zs:3:15: " "Missing documentation comment for bitmask 'BitmaskType'.")); } TEST_F(DocCommentMissingWarningTest, bitmaskValue) { - ASSERT_TRUE(zserioWarnings.isPresent("all_nodes.zs:5:5: " + ASSERT_TRUE(zserioWarnings.isPresent( + "all_nodes.zs:5:5: " "Missing documentation comment for bitmask value 'BITMASK_VALUE'.")); } TEST_F(DocCommentMissingWarningTest, enumType) { - ASSERT_TRUE(zserioWarnings.isPresent("all_nodes.zs:8:12: " + ASSERT_TRUE(zserioWarnings.isPresent( + "all_nodes.zs:8:12: " "Missing documentation comment for enumeration 'EnumType'.")); } TEST_F(DocCommentMissingWarningTest, enumItem) { - ASSERT_TRUE(zserioWarnings.isPresent("all_nodes.zs:10:5: " + ASSERT_TRUE(zserioWarnings.isPresent( + "all_nodes.zs:10:5: " "Missing documentation comment for enum item 'ENUM_ITEM'.")); } TEST_F(DocCommentMissingWarningTest, structureType) { - ASSERT_TRUE(zserioWarnings.isPresent("all_nodes.zs:15:8: " + ASSERT_TRUE(zserioWarnings.isPresent( + "all_nodes.zs:15:8: " "Missing documentation comment for structure 'StructureType'.")); } TEST_F(DocCommentMissingWarningTest, choiceType) { - ASSERT_TRUE(zserioWarnings.isPresent("all_nodes.zs:25:8: " + ASSERT_TRUE(zserioWarnings.isPresent( + "all_nodes.zs:25:8: " "Missing documentation comment for choice 'ChoiceType'.")); } TEST_F(DocCommentMissingWarningTest, unionType) { - ASSERT_TRUE(zserioWarnings.isPresent("all_nodes.zs:38:7: " + ASSERT_TRUE(zserioWarnings.isPresent( + "all_nodes.zs:38:7: " "Missing documentation comment for union 'UnionType'.")); } TEST_F(DocCommentMissingWarningTest, field) { // structure field - ASSERT_TRUE(zserioWarnings.isPresent("all_nodes.zs:17:7: " + ASSERT_TRUE(zserioWarnings.isPresent( + "all_nodes.zs:17:7: " "Missing documentation comment for field 'field'.")); // choice field - ASSERT_TRUE(zserioWarnings.isPresent("all_nodes.zs:28:16: " + ASSERT_TRUE(zserioWarnings.isPresent( + "all_nodes.zs:28:16: " "Missing documentation comment for field 'field'.")); // union field - ASSERT_TRUE(zserioWarnings.isPresent("all_nodes.zs:40:12: " + ASSERT_TRUE(zserioWarnings.isPresent( + "all_nodes.zs:40:12: " "Missing documentation comment for field 'fieldU32'.")); - ASSERT_TRUE(zserioWarnings.isPresent("all_nodes.zs:41:12: " + ASSERT_TRUE(zserioWarnings.isPresent( + "all_nodes.zs:41:12: " "Missing documentation comment for field 'fieldSTR'.")); // sql table field - ASSERT_TRUE(zserioWarnings.isPresent("all_nodes.zs:46:12: " + ASSERT_TRUE(zserioWarnings.isPresent( + "all_nodes.zs:46:12: " "Missing documentation comment for field 'id'.")); // sql database field - ASSERT_TRUE(zserioWarnings.isPresent("all_nodes.zs:51:18: " + ASSERT_TRUE(zserioWarnings.isPresent( + "all_nodes.zs:51:18: " "Missing documentation comment for field 'sqlTable'.")); } TEST_F(DocCommentMissingWarningTest, function) { - ASSERT_TRUE(zserioWarnings.isPresent("all_nodes.zs:32:21: " + ASSERT_TRUE(zserioWarnings.isPresent( + "all_nodes.zs:32:21: " "Missing documentation comment for function 'getField'.")); } TEST_F(DocCommentMissingWarningTest, choiceCaseExpression) { - ASSERT_TRUE(zserioWarnings.isPresent("all_nodes.zs:27:5: " + ASSERT_TRUE(zserioWarnings.isPresent( + "all_nodes.zs:27:5: " "Missing documentation comment for choice case expression.")); } TEST_F(DocCommentMissingWarningTest, choiceDefault) { - ASSERT_TRUE(zserioWarnings.isPresent("all_nodes.zs:29:5: " + ASSERT_TRUE(zserioWarnings.isPresent( + "all_nodes.zs:29:5: " "Missing documentation comment for choice default.")); } TEST_F(DocCommentMissingWarningTest, sqlTable) { - ASSERT_TRUE(zserioWarnings.isPresent("all_nodes.zs:44:11: " + ASSERT_TRUE(zserioWarnings.isPresent( + "all_nodes.zs:44:11: " "Missing documentation comment for SQL table 'SqlTableType'.")); } TEST_F(DocCommentMissingWarningTest, sqlDatabase) { - ASSERT_TRUE(zserioWarnings.isPresent("all_nodes.zs:49:14: " + ASSERT_TRUE(zserioWarnings.isPresent( + "all_nodes.zs:49:14: " "Missing documentation comment for SQL database 'SqlDatabaseType'.")); } TEST_F(DocCommentMissingWarningTest, ruleGroup) { - ASSERT_TRUE(zserioWarnings.isPresent("all_nodes.zs:54:12: " + ASSERT_TRUE(zserioWarnings.isPresent( + "all_nodes.zs:54:12: " "Missing documentation comment for rule group 'Rules'.")); } TEST_F(DocCommentMissingWarningTest, rule) { - ASSERT_TRUE(zserioWarnings.isPresent("all_nodes.zs:56:10: " + ASSERT_TRUE(zserioWarnings.isPresent( + "all_nodes.zs:56:10: " "Missing documentation comment for rule 'test-rule'.")); } TEST_F(DocCommentMissingWarningTest, serviceType) { - ASSERT_TRUE(zserioWarnings.isPresent("all_nodes.zs:59:9: " + ASSERT_TRUE(zserioWarnings.isPresent( + "all_nodes.zs:59:9: " "Missing documentation comment for service 'ServiceType'.")); } TEST_F(DocCommentMissingWarningTest, serviceMethod) { - ASSERT_TRUE(zserioWarnings.isPresent("all_nodes.zs:61:22: " + ASSERT_TRUE(zserioWarnings.isPresent( + "all_nodes.zs:61:22: " "Missing documentation comment for method 'serviceMethod'.")); } TEST_F(DocCommentMissingWarningTest, pubsubType) { - ASSERT_TRUE(zserioWarnings.isPresent("all_nodes.zs:64:8: " + ASSERT_TRUE(zserioWarnings.isPresent( + "all_nodes.zs:64:8: " "Missing documentation comment for pubsub 'PubsubType'.")); } TEST_F(DocCommentMissingWarningTest, pubsubMessage) { - ASSERT_TRUE(zserioWarnings.isPresent("all_nodes.zs:66:46: " + ASSERT_TRUE(zserioWarnings.isPresent( + "all_nodes.zs:66:46: " "Missing documentation comment for message 'pubsubMessage'.")); } diff --git a/test/warnings/compatibility_warning/cpp/CompatibilityWarningTest.cpp b/test/warnings/compatibility_warning/cpp/CompatibilityWarningTest.cpp index bd57e5552..19de72145 100644 --- a/test/warnings/compatibility_warning/cpp/CompatibilityWarningTest.cpp +++ b/test/warnings/compatibility_warning/cpp/CompatibilityWarningTest.cpp @@ -1,15 +1,13 @@ #include #include "gtest/gtest.h" - #include "test_utils/ZserioErrorOutput.h" class CompatibilityWarningTest : public ::testing::Test { protected: - - CompatibilityWarningTest() - : zserioWarnings("warnings/compatibility_warning") + CompatibilityWarningTest() : + zserioWarnings("warnings/compatibility_warning") {} const test_utils::ZserioErrorOutput zserioWarnings; @@ -17,7 +15,8 @@ class CompatibilityWarningTest : public ::testing::Test TEST_F(CompatibilityWarningTest, rootWithDiffCompatibility) { - const std::string error = "subpackage.zs:1:30: " + const std::string error = + "subpackage.zs:1:30: " "Package compatibility version '2.4.2' doesn't match to '2.5.0' specified in root package!"; ASSERT_TRUE(zserioWarnings.isPresent(error)); @@ -25,7 +24,8 @@ TEST_F(CompatibilityWarningTest, rootWithDiffCompatibility) TEST_F(CompatibilityWarningTest, rootWithoutCompatibility) { - const std::string error = "subpackage.zs:1:30: " + const std::string error = + "subpackage.zs:1:30: " "Package specifies compatibility version '2.4.2' while root package specifies nothing!"; ASSERT_TRUE(zserioWarnings.isPresent(error)); diff --git a/test/warnings/file_encoding_warning/cpp/FileEncodingWarningTest.cpp b/test/warnings/file_encoding_warning/cpp/FileEncodingWarningTest.cpp index c9475cc1b..78ed9b037 100644 --- a/test/warnings/file_encoding_warning/cpp/FileEncodingWarningTest.cpp +++ b/test/warnings/file_encoding_warning/cpp/FileEncodingWarningTest.cpp @@ -2,14 +2,13 @@ #include #include "gtest/gtest.h" - #include "test_utils/ZserioErrorOutput.h" class FileEncodingWarningTest : public ::testing::Test { protected: - FileEncodingWarningTest() - : zserioWarnings("warnings/file_encoding_warning") + FileEncodingWarningTest() : + zserioWarnings("warnings/file_encoding_warning") {} const test_utils::ZserioErrorOutput zserioWarnings; diff --git a/test/warnings/functions_warning/cpp/FunctionsWarningTest.cpp b/test/warnings/functions_warning/cpp/FunctionsWarningTest.cpp index 4b2e6a915..a7ddc6bef 100644 --- a/test/warnings/functions_warning/cpp/FunctionsWarningTest.cpp +++ b/test/warnings/functions_warning/cpp/FunctionsWarningTest.cpp @@ -2,14 +2,13 @@ #include #include "gtest/gtest.h" - #include "test_utils/ZserioErrorOutput.h" class FunctionsWarningTest : public ::testing::Test { protected: - FunctionsWarningTest() - : zserioWarnings("warnings/functions_warning") + FunctionsWarningTest() : + zserioWarnings("warnings/functions_warning") {} const test_utils::ZserioErrorOutput zserioWarnings; @@ -17,11 +16,13 @@ class FunctionsWarningTest : public ::testing::Test TEST_F(FunctionsWarningTest, optionalReferencesInFunction) { - const std::string warning1 = "optional_references_in_function.zs:11:16: Function " + const std::string warning1 = + "optional_references_in_function.zs:11:16: Function " "'suspicionFunction' contains reference to optional field 'additionalValue'."; ASSERT_TRUE(zserioWarnings.isPresent(warning1)); - const std::string warning2 = "optional_references_in_function.zs:16:16: Function " + const std::string warning2 = + "optional_references_in_function.zs:16:16: Function " "'autoSuspicionFunction' contains reference to optional field 'autoAdditionalValue'."; ASSERT_TRUE(zserioWarnings.isPresent(warning2)); } diff --git a/test/warnings/not_handled_warning/cpp/NotHandledWarningTest.cpp b/test/warnings/not_handled_warning/cpp/NotHandledWarningTest.cpp index afcfa76d4..66ad592a8 100644 --- a/test/warnings/not_handled_warning/cpp/NotHandledWarningTest.cpp +++ b/test/warnings/not_handled_warning/cpp/NotHandledWarningTest.cpp @@ -2,14 +2,13 @@ #include #include "gtest/gtest.h" - #include "test_utils/ZserioErrorOutput.h" class NotHandledWarningTest : public ::testing::Test { protected: - NotHandledWarningTest() - : zserioWarnings("warnings/not_handled_warning") + NotHandledWarningTest() : + zserioWarnings("warnings/not_handled_warning") {} const test_utils::ZserioErrorOutput zserioWarnings; @@ -17,14 +16,16 @@ class NotHandledWarningTest : public ::testing::Test TEST_F(NotHandledWarningTest, notHandledWhite) { - const std::string warning = "not_handled_warning.zs:15:8: " + const std::string warning = + "not_handled_warning.zs:15:8: " "Enumeration item 'WHITE' is not handled in choice 'EnumParamChoice'."; ASSERT_TRUE(zserioWarnings.isPresent(warning)); } TEST_F(NotHandledWarningTest, notHandledRed) { - const std::string warning = "not_handled_warning.zs:15:8: " + const std::string warning = + "not_handled_warning.zs:15:8: " "Enumeration item 'RED' is not handled in choice 'EnumParamChoice'."; ASSERT_TRUE(zserioWarnings.isPresent(warning)); } diff --git a/test/warnings/optional_members_warning/cpp/OptionalMembersWarningTest.cpp b/test/warnings/optional_members_warning/cpp/OptionalMembersWarningTest.cpp index 6ec6c7fd6..c096faa60 100644 --- a/test/warnings/optional_members_warning/cpp/OptionalMembersWarningTest.cpp +++ b/test/warnings/optional_members_warning/cpp/OptionalMembersWarningTest.cpp @@ -2,14 +2,13 @@ #include #include "gtest/gtest.h" - #include "test_utils/ZserioErrorOutput.h" class OptionalMembersWarningTest : public ::testing::Test { protected: - OptionalMembersWarningTest() - : zserioWarnings("warnings/optional_members_warning") + OptionalMembersWarningTest() : + zserioWarnings("warnings/optional_members_warning") {} const test_utils::ZserioErrorOutput zserioWarnings; @@ -22,7 +21,8 @@ TEST_F(OptionalMembersWarningTest, optionalReferencesInArrayLength) "and contains reference to optional field 'arrayLength' in array length."; ASSERT_TRUE(zserioWarnings.isPresent(warning1)); - const std::string warning2 = "optional_references_in_array_length.zs:10:20: Field 'array3' is not optional " + const std::string warning2 = + "optional_references_in_array_length.zs:10:20: Field 'array3' is not optional " "and contains reference to optional field 'arrayLength' in array length."; ASSERT_TRUE(zserioWarnings.isPresent(warning2)); } @@ -47,7 +47,8 @@ TEST_F(OptionalMembersWarningTest, optionalReferencesInConstraint) "and contains reference to optional field 'value1' in constraint."; ASSERT_TRUE(zserioWarnings.isPresent(warning1)); - const std::string warning2 = "optional_references_in_constraint.zs:10:20: Field 'value4' is not optional " + const std::string warning2 = + "optional_references_in_constraint.zs:10:20: Field 'value4' is not optional " "and contains reference to optional field 'value1' in constraint."; ASSERT_TRUE(zserioWarnings.isPresent(warning2)); @@ -59,15 +60,18 @@ TEST_F(OptionalMembersWarningTest, optionalReferencesInConstraint) TEST_F(OptionalMembersWarningTest, optionalReferencesInOffset) { - const std::string warning1 = "optional_references_in_offset.zs:22:11: Field 'value2' is not optional " + const std::string warning1 = + "optional_references_in_offset.zs:22:11: Field 'value2' is not optional " "and contains reference to optional field 'optionalOffset' in offset."; ASSERT_TRUE(zserioWarnings.isPresent(warning1)); - const std::string warning2 = "optional_references_in_offset.zs:26:11: Field 'value3' is not optional " + const std::string warning2 = + "optional_references_in_offset.zs:26:11: Field 'value3' is not optional " "and contains reference to optional field 'offsetHolder' in offset."; ASSERT_TRUE(zserioWarnings.isPresent(warning2)); - const std::string warning3 = "optional_references_in_offset.zs:30:11: Field 'value4' is not optional " + const std::string warning3 = + "optional_references_in_offset.zs:30:11: Field 'value4' is not optional " "and contains reference to optional field 'offset' in offset."; ASSERT_TRUE(zserioWarnings.isPresent(warning3)); } @@ -134,11 +138,13 @@ TEST_F(OptionalMembersWarningTest, optionalReferencesInTypeArguments) "and contains reference to optional field 'autoNumBlackTones' in type arguments."; ASSERT_TRUE(zserioWarnings.isPresent(warning8)); - const std::string warning9 = "optional_references_in_type_arguments.zs:46:47: Field 'blackAndWhiteTones' " + const std::string warning9 = + "optional_references_in_type_arguments.zs:46:47: Field 'blackAndWhiteTones' " "has different optional condition than field 'numWhiteTones' referenced in type arguments."; ASSERT_TRUE(zserioWarnings.isPresent(warning9)); - const std::string warning10 = "optional_references_in_type_arguments.zs:47:51: Field 'mixedTones' " + const std::string warning10 = + "optional_references_in_type_arguments.zs:47:51: Field 'mixedTones' " "has different optional condition than field 'autoNumBlackTones' referenced in type arguments."; ASSERT_TRUE(zserioWarnings.isPresent(warning10)); diff --git a/test/warnings/packages_warning/cpp/PackagesWarningTest.cpp b/test/warnings/packages_warning/cpp/PackagesWarningTest.cpp index 25d7dbec2..b53cf381a 100644 --- a/test/warnings/packages_warning/cpp/PackagesWarningTest.cpp +++ b/test/warnings/packages_warning/cpp/PackagesWarningTest.cpp @@ -2,14 +2,13 @@ #include #include "gtest/gtest.h" - #include "test_utils/ZserioErrorOutput.h" class PackagesWarningTest : public ::testing::Test { protected: - PackagesWarningTest() - : zserioWarnings("warnings/packages_warning") + PackagesWarningTest() : + zserioWarnings("warnings/packages_warning") {} const test_utils::ZserioErrorOutput zserioWarnings; @@ -17,21 +16,24 @@ class PackagesWarningTest : public ::testing::Test TEST_F(PackagesWarningTest, optionalReferencesInSelector) { - const std::string warning = "duplicated_package_import_warning.zs:6:8: " + const std::string warning = + "duplicated_package_import_warning.zs:6:8: " "Duplicated import of package 'packages_warning.simple_database'."; ASSERT_TRUE(zserioWarnings.isPresent(warning)); } TEST_F(PackagesWarningTest, duplicatedSingleTypeImport) { - const std::string warning = "duplicated_single_type_import_warning.zs:6:8: " + const std::string warning = + "duplicated_single_type_import_warning.zs:6:8: " "Duplicated import of 'packages_warning.simple_database.SimpleTable'."; ASSERT_TRUE(zserioWarnings.isPresent(warning)); } TEST_F(PackagesWarningTest, packageImportOverwrite) { - const std::string warning = "package_import_overwrite_warning.zs:6:8: " + const std::string warning = + "package_import_overwrite_warning.zs:6:8: " "Import of package 'packages_warning.simple_database' overwrites single import of " "'packages_warning.simple_database.SimpleTable'."; ASSERT_TRUE(zserioWarnings.isPresent(warning)); @@ -39,7 +41,8 @@ TEST_F(PackagesWarningTest, packageImportOverwrite) TEST_F(PackagesWarningTest, singleTypeAlreadyImported) { - const std::string warning = "single_type_already_imported_warning.zs:6:8: " + const std::string warning = + "single_type_already_imported_warning.zs:6:8: " "Single import of 'packages_warning.simple_database.SimpleTable' " "already covered by package import."; ASSERT_TRUE(zserioWarnings.isPresent(warning)); diff --git a/test/warnings/sql_tables_warning/cpp/SqlTablesWarningTest.cpp b/test/warnings/sql_tables_warning/cpp/SqlTablesWarningTest.cpp index fd43f2a0d..04a474f44 100644 --- a/test/warnings/sql_tables_warning/cpp/SqlTablesWarningTest.cpp +++ b/test/warnings/sql_tables_warning/cpp/SqlTablesWarningTest.cpp @@ -2,14 +2,13 @@ #include #include "gtest/gtest.h" - #include "test_utils/ZserioErrorOutput.h" class SqlTablesWarningTest : public ::testing::Test { protected: - SqlTablesWarningTest() - : zserioWarnings("warnings/sql_tables_warning") + SqlTablesWarningTest() : + zserioWarnings("warnings/sql_tables_warning") {} const test_utils::ZserioErrorOutput zserioWarnings; @@ -17,46 +16,53 @@ class SqlTablesWarningTest : public ::testing::Test TEST_F(SqlTablesWarningTest, badOrderedPrimaryKey) { - const std::string warning = "bad_ordered_primary_key_warning.zs:9:9: " + const std::string warning = + "bad_ordered_primary_key_warning.zs:9:9: " "Primary key column 'classId' is in bad order in sql table 'BadOrderedPrimaryKeyTable'."; ASSERT_TRUE(zserioWarnings.isPresent(warning)); } TEST_F(SqlTablesWarningTest, duplicatedPrimaryKey) { - const std::string warning = "duplicated_primary_key_warning.zs:6:33: " + const std::string warning = + "duplicated_primary_key_warning.zs:6:33: " "Duplicated primary key column 'classId' in sql table 'DuplicatedPrimaryKeyTable'."; ASSERT_TRUE(zserioWarnings.isPresent(warning)); } TEST_F(SqlTablesWarningTest, multiplePrimaryKeys) { - const std::string warning = "multiple_primary_keys_warning.zs:9:9: " + const std::string warning = + "multiple_primary_keys_warning.zs:9:9: " "Multiple primary keys in sql table 'MultiplePrimaryKeysTable'."; ASSERT_TRUE(zserioWarnings.isPresent(warning)); } TEST_F(SqlTablesWarningTest, noPrimaryKey) { - const std::string warning = "no_primary_key_warning.zs:3:11: " + const std::string warning = + "no_primary_key_warning.zs:3:11: " "No primary key in sql table 'NoPrimaryKeyTable'."; ASSERT_TRUE(zserioWarnings.isPresent(warning)); } TEST_F(SqlTablesWarningTest, notFirstPrimaryKey) { - const std::string warning = "not_first_primary_key_warning.zs:6:29: " + const std::string warning = + "not_first_primary_key_warning.zs:6:29: " "Primary key column 'classId' is not the first one in sql table 'NotFirstPrimaryKeyTable'."; ASSERT_TRUE(zserioWarnings.isPresent(warning)); } TEST_F(SqlTablesWarningTest, notNullPrimaryKey) { - const std::string warning1 = "not_null_primary_key_warning.zs:5:17: " + const std::string warning1 = + "not_null_primary_key_warning.zs:5:17: " "Primary key column 'schoolId' can contain NULL in sql table 'NotNullPrimaryKeyTable1'."; ASSERT_TRUE(zserioWarnings.isPresent(warning1)); - const std::string warning2 = "not_null_primary_key_warning.zs:14:17: " + const std::string warning2 = + "not_null_primary_key_warning.zs:14:17: " "Primary key column 'schoolId' can contain NULL in sql table 'NotNullPrimaryKeyTable2'."; ASSERT_TRUE(zserioWarnings.isPresent(warning2)); } diff --git a/test/warnings/sql_without_rowid_tables_warning/cpp/SqlWithoutRowIdTablesWarningTest.cpp b/test/warnings/sql_without_rowid_tables_warning/cpp/SqlWithoutRowIdTablesWarningTest.cpp index d52bbb834..c91e417d3 100644 --- a/test/warnings/sql_without_rowid_tables_warning/cpp/SqlWithoutRowIdTablesWarningTest.cpp +++ b/test/warnings/sql_without_rowid_tables_warning/cpp/SqlWithoutRowIdTablesWarningTest.cpp @@ -2,14 +2,13 @@ #include #include "gtest/gtest.h" - #include "test_utils/ZserioErrorOutput.h" class SqlWithoutRowIdTablesWarningTest : public ::testing::Test { protected: - SqlWithoutRowIdTablesWarningTest() - : zserioWarnings("warnings/sql_without_rowid_tables_warning") + SqlWithoutRowIdTablesWarningTest() : + zserioWarnings("warnings/sql_without_rowid_tables_warning") {} const test_utils::ZserioErrorOutput zserioWarnings; @@ -17,7 +16,8 @@ class SqlWithoutRowIdTablesWarningTest : public ::testing::Test TEST_F(SqlWithoutRowIdTablesWarningTest, integerPrimaryKey) { - const std::string warning = "integer_primary_key_warning.zs:3:11: " + const std::string warning = + "integer_primary_key_warning.zs:3:11: " "Single integer primary key in without rowid table 'WithoutRowIdTable' " "brings performance drop."; ASSERT_TRUE(zserioWarnings.isPresent(warning)); diff --git a/test/warnings/templates_warning/cpp/TemplatesWarningTest.cpp b/test/warnings/templates_warning/cpp/TemplatesWarningTest.cpp index 22475ee83..1ae50626a 100644 --- a/test/warnings/templates_warning/cpp/TemplatesWarningTest.cpp +++ b/test/warnings/templates_warning/cpp/TemplatesWarningTest.cpp @@ -2,14 +2,13 @@ #include #include "gtest/gtest.h" - #include "test_utils/ZserioErrorOutput.h" class TemplatesWarningTest : public ::testing::Test { protected: - TemplatesWarningTest() - : zserioWarnings("warnings/templates_warning") + TemplatesWarningTest() : + zserioWarnings("warnings/templates_warning") {} const test_utils::ZserioErrorOutput zserioWarnings; @@ -17,24 +16,25 @@ class TemplatesWarningTest : public ::testing::Test TEST_F(TemplatesWarningTest, defaultInitialization) { - const std::string warning1 = "default_instantiation_warning.zs:15:5: " + const std::string warning1 = + "default_instantiation_warning.zs:15:5: " "Default instantiation of 'Template' as 'Template_uint32."; ASSERT_TRUE(zserioWarnings.isPresent(warning1)); - const std::string warning2 = "default_instantiation_warning.zs:17:5: " + const std::string warning2 = + "default_instantiation_warning.zs:17:5: " "Default instantiation of 'Subpackage1Template' as 'Subpackage1Template_string."; ASSERT_TRUE(zserioWarnings.isPresent(warning2)); - const std::string warning3 = "default_instantiation_warning.zs:19:5: " + const std::string warning3 = + "default_instantiation_warning.zs:19:5: " "Default instantiation of 'Subpackage2Template' as 'Subpackage2Template_string."; ASSERT_TRUE(zserioWarnings.isPresent(warning3)); - const std::vector warnings4 = - { - "default_instantiation_warning.zs:20:5: " - " In instantiation of 'Subpackage3Template' required from here", - "default_instantiation_subpackage3.zs:10:5: " - "Default instantiation of 'Subpackage3InnerTemplate' as 'Subpackage3InnerTemplate_uint32." - }; + const std::vector warnings4 = { + "default_instantiation_warning.zs:20:5: " + " In instantiation of 'Subpackage3Template' required from here", + "default_instantiation_subpackage3.zs:10:5: " + "Default instantiation of 'Subpackage3InnerTemplate' as 'Subpackage3InnerTemplate_uint32."}; ASSERT_TRUE(zserioWarnings.isPresent(warnings4)); } diff --git a/test/warnings/unused_type_warning/cpp/UnusedTypeWarningTest.cpp b/test/warnings/unused_type_warning/cpp/UnusedTypeWarningTest.cpp index 638152c68..824fa704f 100644 --- a/test/warnings/unused_type_warning/cpp/UnusedTypeWarningTest.cpp +++ b/test/warnings/unused_type_warning/cpp/UnusedTypeWarningTest.cpp @@ -2,14 +2,13 @@ #include #include "gtest/gtest.h" - #include "test_utils/ZserioErrorOutput.h" class UnusedTypeWarningTest : public ::testing::Test { protected: - UnusedTypeWarningTest() - : zserioWarnings("warnings/unused_type_warning") + UnusedTypeWarningTest() : + zserioWarnings("warnings/unused_type_warning") {} const test_utils::ZserioErrorOutput zserioWarnings; @@ -17,42 +16,48 @@ class UnusedTypeWarningTest : public ::testing::Test TEST_F(UnusedTypeWarningTest, unusedEnumeration) { - const std::string warning = "unused_type_warning.zs:4:12: " + const std::string warning = + "unused_type_warning.zs:4:12: " "Type 'unused_type_warning.UnusedEnumeration' is not used."; ASSERT_TRUE(zserioWarnings.isPresent(warning)); } TEST_F(UnusedTypeWarningTest, unusedSubtype) { - const std::string warning = "unused_type_warning.zs:18:15: " + const std::string warning = + "unused_type_warning.zs:18:15: " "Type 'unused_type_warning.UnusedSubtype' is not used."; ASSERT_TRUE(zserioWarnings.isPresent(warning)); } TEST_F(UnusedTypeWarningTest, unusedChoice) { - const std::string warning = "unused_type_warning.zs:28:8: " + const std::string warning = + "unused_type_warning.zs:28:8: " "Type 'unused_type_warning.UnusedChoice' is not used."; ASSERT_TRUE(zserioWarnings.isPresent(warning)); } TEST_F(UnusedTypeWarningTest, unusedUnion) { - const std::string warning = "unused_type_warning.zs:48:7: " + const std::string warning = + "unused_type_warning.zs:48:7: " "Type 'unused_type_warning.UnusedUnion' is not used."; ASSERT_TRUE(zserioWarnings.isPresent(warning)); } TEST_F(UnusedTypeWarningTest, unusedStructure) { - const std::string warning = "unused_type_warning.zs:62:8: " + const std::string warning = + "unused_type_warning.zs:62:8: " "Type 'unused_type_warning.UnusedStructure' is not used."; ASSERT_TRUE(zserioWarnings.isPresent(warning)); } TEST_F(UnusedTypeWarningTest, unusedTable) { - const std::string warning = "unused_type_warning.zs:76:11: " + const std::string warning = + "unused_type_warning.zs:76:11: " "Type 'unused_type_warning.UnusedTable' is not used."; ASSERT_TRUE(zserioWarnings.isPresent(warning)); }