Skip to content

Commit

Permalink
ARROW-17304: [C++][Compute] Print actual values when compare fails in…
Browse files Browse the repository at this point in the history
… aggregate test
  • Loading branch information
cyb70289 committed Aug 8, 2022
1 parent 0ffcc59 commit 2943422
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cpp/src/arrow/compute/kernels/aggregate_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2543,7 +2543,9 @@ void CheckModes(const Datum& array, const ModeOptions options,
for (int i = 0; i < out_array.length(); ++i) {
// equal or nan equal
ASSERT_TRUE((expected_modes[i] == out_modes[i]) ||
(expected_modes[i] != expected_modes[i] && out_modes[i] != out_modes[i]));
(expected_modes[i] != expected_modes[i] && out_modes[i] != out_modes[i]))
<< " Actual Value: " << out_modes[i] << "\n"
<< "Expected Value: " << expected_modes[i];
ASSERT_EQ(expected_counts[i], out_counts[i]);
}
}
Expand All @@ -2561,7 +2563,7 @@ void CheckModes<bool>(const Datum& array, const ModeOptions options,
const uint8_t* out_modes = out_array.field(0)->data()->GetValues<uint8_t>(1);
const int64_t* out_counts = out_array.field(1)->data()->GetValues<int64_t>(1);
for (int i = 0; i < out_array.length(); ++i) {
ASSERT_TRUE(expected_modes[i] == bit_util::GetBit(out_modes, i));
ASSERT_EQ(expected_modes[i], bit_util::GetBit(out_modes, i));
ASSERT_EQ(expected_counts[i], out_counts[i]);
}
}
Expand Down Expand Up @@ -3351,7 +3353,9 @@ class TestPrimitiveQuantileKernel : public ::testing::Test {
const auto& numeric_scalar =
checked_pointer_cast<DoubleScalar>(expected[j][i].scalar());
ASSERT_TRUE((quantiles[j] == numeric_scalar->value) ||
(std::isnan(quantiles[j]) && std::isnan(numeric_scalar->value)));
(std::isnan(quantiles[j]) && std::isnan(numeric_scalar->value)))
<< " Actual Value: " << quantiles[j] << "\n"
<< "Expected Value: " << numeric_scalar->value;
}
} else {
AssertTypeEqual(out_array->type(), type_singleton());
Expand Down

0 comments on commit 2943422

Please sign in to comment.