Skip to content

Commit

Permalink
Check
Browse files Browse the repository at this point in the history
  • Loading branch information
mikir committed Dec 16, 2024
1 parent 044d2a7 commit ca43be3
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions test/language/expressions/cpp/LengthOfOperatorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,18 @@ TEST(LengthOfOperatorTest, writeRead)
data.strArray = VectorType<StringType>{"text1", "text2", "text3", "text4"};
data.bytesArray = VectorType<BytesType>{{0x01, 0x02}, {0x03, 0x04}};

EXPECT_EQ(576, zserio::detail::bitSizeOf(zserio::View(data)))
zserio::View view(data);
zserio::BitSize endBitPosition = 0;
endBitPosition += zserio::detail::bitSizeOf(view.fixedArray(), endBitPosition);
endBitPosition += zserio::detail::bitSizeOf(view.numElements(), endBitPosition);
endBitPosition += zserio::detail::bitSizeOf(view.variableArray(), endBitPosition);
endBitPosition += zserio::detail::bitSizeOf(view.literalLengthField(), endBitPosition);
endBitPosition += zserio::detail::bitSizeOf(view.strField(), endBitPosition);
endBitPosition += zserio::detail::bitSizeOf(view.bytesField(), endBitPosition);
endBitPosition += zserio::detail::bitSizeOf(view.strArray(), endBitPosition);
endBitPosition += zserio::detail::bitSizeOf(view.bytesArray(), endBitPosition);

EXPECT_EQ(576, zserio::detail::bitSizeOf(zserio::View(data), 0))
<< "fixedArray[0]: " << data.fixedArray[0] << std::endl
<< "fixedArray.size: " << data.fixedArray.size() << std::endl
<< "numElements: " << static_cast<unsigned>(data.numElements) << std::endl
Expand All @@ -114,7 +125,8 @@ TEST(LengthOfOperatorTest, writeRead)
<< "strArray.size: " << data.strArray.size() << std::endl
<< "bytesArray[0][0]: " << static_cast<unsigned>(data.bytesArray[0][0]) << std::endl
<< "bytesArray[0].size: " << data.bytesArray[0].size() << std::endl
<< "bytesArray.size: " << data.bytesArray.size();
<< "bytesArray.size: " << data.bytesArray.size() << std::endl
<< "endBitPosition: " << endBitPosition;

test_utils::writeReadTest(data);
}
Expand Down

0 comments on commit ca43be3

Please sign in to comment.