pitrou commented on code in PR #55408:
URL: https://github.com/apache/arrow/pull/55408#discussion_r4663722108
##########
cpp/src/parquet/level_conversion_test.cc:
##########
@@ -113,6 +114,49 @@ TEST(GreaterThanBitmap, GeneratesExpectedBitmasks) {
}
#endif
+TEST(CountLevels, CountsMatchingLevels) {
+ const std::vector<int16_t> levels = {3, 1, 3, 0, 3, 2};
+ auto is_odd = [](int16_t level) { return level % 2 != 0; };
+
+ EXPECT_EQ(CountLevels(levels.data(), /*num_levels=*/0, 3), 0);
+ EXPECT_EQ(CountLevels(levels.data(), /*num_levels=*/6, 3), 3);
+ EXPECT_EQ(CountLevels(levels.data(), /*num_levels=*/6, 0), 1);
+ EXPECT_EQ(CountLevelsGreaterEqual(levels.data(), /*num_levels=*/6, 1), 5);
+ EXPECT_EQ(CountLevelsGreaterEqual(levels.data(), /*num_levels=*/6, 3), 3);
+ EXPECT_EQ(CountLevelsIf(levels.data(), /*num_levels=*/6, is_odd), 4);
+ EXPECT_EQ(CountLevelsIf(levels.data(), /*num_levels=*/6, [](int16_t) {
return false; }),
+ 0);
+
+ // Cross-check various prefix lengths across vector and scalar tail
boundaries.
Review Comment:
What's the point of this test? Do you not trust the compiler?
--
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]