Skip to content

Commit

Permalink
Minor test tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
benibus committed Jun 18, 2023
1 parent 6f0ba4f commit 13fe904
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions cpp/src/parquet/statistics_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,10 @@ class TestFloatStatistics : public ::testing::Test {
using c_type = typename ParquetType::c_type;

void Init();
void SetUp() override { this->Init(); }
void SetUp() override {
this->Init();
ASSERT_NE(EncodeValue(negative_zero_), EncodeValue(positive_zero_));
}

bool signbit(c_type val);
void CheckEq(const c_type& l, const c_type& r);
Expand All @@ -1177,9 +1180,11 @@ class TestFloatStatistics : public ::testing::Test {

this->CheckEq(stats->min(), positive_zero_);
ASSERT_TRUE(this->signbit(stats->min()));
ASSERT_EQ(stats->EncodeMin(), EncodeValue(negative_zero_));

this->CheckEq(stats->max(), positive_zero_);
ASSERT_FALSE(this->signbit(stats->max()));
ASSERT_EQ(stats->EncodeMax(), EncodeValue(positive_zero_));
}

// ARROW-5562: Ensure that -0.0f and 0.0f values are properly handled like in
Expand Down Expand Up @@ -1221,9 +1226,9 @@ class TestFloatStatistics : public ::testing::Test {
auto some_nan_stats = MakeStatistics<ParquetType>(descr);
// Ingesting only nans should not yield valid min max
AssertUnsetMinMax(some_nan_stats, all_nans);
// Ingesting a mix of NaNs and non-NaNs should not yield valid min max.
// Ingesting a mix of NaNs and non-NaNs should yield a valid min max.
AssertMinMaxAre(some_nan_stats, some_nans, min, max);
// Ingesting only nans after a valid min/max, should have not effect
// Ingesting only nans after a valid min/max, should have no effect
AssertMinMaxAre(some_nan_stats, all_nans, min, max);

some_nan_stats = MakeStatistics<ParquetType>(descr);
Expand Down

0 comments on commit 13fe904

Please sign in to comment.