Skip to content

Commit

Permalink
refine lz4 testing params
Browse files Browse the repository at this point in the history
  • Loading branch information
marin-ma committed Dec 11, 2024
1 parent 91affb7 commit 6b3a419
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions velox/common/compression/tests/CompressionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,19 @@ struct TestParams {
codecOptions(std::move(codecOptions)) {}
};

std::vector<TestParams> generateLz4TestParams() {
std::vector<TestParams> params;
for (auto type :
{Lz4CodecOptions::kLz4Raw,
Lz4CodecOptions::kLz4Frame,
Lz4CodecOptions::kLz4Hadoop}) {
params.emplace_back(
CompressionKind::CompressionKind_LZ4,
std::make_shared<Lz4CodecOptions>(type));
}
return params;
}

std::vector<uint8_t> makeRandomData(size_t n) {
std::vector<uint8_t> data(n);
std::default_random_engine engine(42);
Expand Down Expand Up @@ -480,25 +493,9 @@ TEST_P(CodecTest, streamingDecompressorReuse) {
}

INSTANTIATE_TEST_SUITE_P(
TestLz4Frame,
TestLz4,
CodecTest,
::testing::Values(TestParams{
CompressionKind::CompressionKind_LZ4,
std::make_shared<Lz4CodecOptions>(Lz4CodecOptions::kLz4Frame)}));

INSTANTIATE_TEST_SUITE_P(
TestLz4Raw,
CodecTest,
::testing::Values(TestParams{
CompressionKind::CompressionKind_LZ4,
std::make_shared<Lz4CodecOptions>(Lz4CodecOptions::kLz4Raw)}));

INSTANTIATE_TEST_SUITE_P(
TestLz4Hadoop,
CodecTest,
::testing::Values(TestParams{
CompressionKind::CompressionKind_LZ4,
std::make_shared<Lz4CodecOptions>(Lz4CodecOptions::kLz4Hadoop)}));
::testing::ValuesIn(generateLz4TestParams()));

TEST(CodecLZ4HadoopTest, compatibility) {
// LZ4 Hadoop codec should be able to read back LZ4 raw blocks.
Expand Down

0 comments on commit 6b3a419

Please sign in to comment.