kamcheungting-db commented on code in PR #1198:
URL: https://github.com/apache/iceberg-cpp/pull/1198#discussion_r4752611202
##########
src/iceberg/test/puffin_format_test.cc:
##########
@@ -34,4 +102,63 @@ TEST(PuffinFormatTest, FlagSetAndCheck) {
EXPECT_TRUE(IsFlagSet(flags, PuffinFlag::kFooterPayloadCompressed));
}
+TEST(PuffinFormatTest, DecompressZstdRejectsInputThatIsNotAFrame) {
+ EXPECT_THAT(Decompress(PuffinCompressionCodec::kZstd, {}),
+ IsError(ErrorKind::kDecompressError));
+ EXPECT_THAT(Decompress(PuffinCompressionCodec::kZstd, ToBytes("not a zstd
frame")),
+ IsError(ErrorKind::kDecompressError));
+}
+
+TEST(PuffinFormatTest, DecompressZstdRejectsUnknownContentSize) {
+ EXPECT_THAT(
+ Decompress(PuffinCompressionCodec::kZstd,
ToBytes(kZstdFrameWithoutContentSize)),
+ IsError(ErrorKind::kDecompressError));
+}
+
+TEST(PuffinFormatTest, DecompressZstdRejectsTooLargeContentSize) {
+ EXPECT_THAT(Decompress(PuffinCompressionCodec::kZstd,
ToBytes(kZstdHeaderClaiming2GiB)),
+ IsError(ErrorKind::kDecompressError));
+}
+
+TEST(PuffinFormatTest, DecompressZstdRejectsChecksumMismatch) {
Review Comment:
Could we also cover truncated frames, declared content sizes smaller/larger
than the actual payload, and trailing garbage?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]