Repository: apache/arrow
File: cpp/src/arrow/array/statistics_test.cc (C++)

Code before:
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.

#include <limits>
#include <variant>

#include <gtest/gtest.h>

#include "arrow/array/statistics.h"
#include "arrow/compare.h"

namespace arrow {

TEST(TestArrayStatistics, NullCountExact) {
  ArrayStatistics statistics;
  ASSERT_FALSE(statistics.null_count.has_value());
  statistics.null_count = 29;
  ASSERT_TRUE(statistics.null_count.has_value());
  ASSERT_EQ(29, std::get<int64_t>(statistics.null_count.value()));
}

TEST(TestArrayStatistics, NullCountAprroximate) {
  ArrayStatistics statistics;
  ASSERT_FALSE(statistics.null_count.has_value());
  statistics.null_count = 29.0;
  ASSERT_TRUE(statistics.null_count.has_value());
  ASSERT_EQ(29.0, std::get<double>(statistics.null_count.value()));
}

TEST(TestArrayStatistics, DistinctCountExact) {
  ArrayStatistics statistics;
  ASSERT_FALSE(statistics.distinct_count.has_value());
  statistics.distinct_count = static_cast<int64_t>(29);
  ASSERT_TRUE(statistics.distinct_count.has_value());
  ASSERT_EQ(29, std::get<int64_t>(statistics.distinct_count.value()));
}

TEST(TestArrayStatistics, DistinctCountApproximate) {
  ArrayStatistics statistics;
  ASSERT_FALSE(statistics.distinct_count.has_value());
  statistics.distinct_count = 29.0;
  ASSERT_TRUE(statistics.distinct_count.has_value());
  ASSERT_DOUBLE_EQ(29.0, std::get<double>(statistics.distinct_count.value()));
}

TEST(TestArrayStatistics, MaxByteWidthExact) {
  ArrayStatistics statistics;

Review comment (suggestion):
Corrected spelling of 'Aprroximate' to 'Approximate' in test name.
```suggestion
TEST(TestArrayStatistics, NullCountApproximate) {
```

Code after:
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.

#include <limits>
#include <variant>

#include <gtest/gtest.h>

#include "arrow/array/statistics.h"
#include "arrow/compare.h"

namespace arrow {

TEST(TestArrayStatistics, NullCountExact) {
  ArrayStatistics statistics;
  ASSERT_FALSE(statistics.null_count.has_value());
  statistics.null_count = 29;
  ASSERT_TRUE(statistics.null_count.has_value());
  ASSERT_EQ(29, std::get<int64_t>(statistics.null_count.value()));
}

TEST(TestArrayStatistics, NullCountApproximate) {
  ArrayStatistics statistics;
  ASSERT_FALSE(statistics.null_count.has_value());
  statistics.null_count = 29.0;
  ASSERT_TRUE(statistics.null_count.has_value());
  ASSERT_DOUBLE_EQ(29.0, std::get<double>(statistics.null_count.value()));
}

TEST(TestArrayStatistics, DistinctCountExact) {
  ArrayStatistics statistics;
  ASSERT_FALSE(statistics.distinct_count.has_value());
  statistics.distinct_count = static_cast<int64_t>(29);
  ASSERT_TRUE(statistics.distinct_count.has_value());
  ASSERT_EQ(29, std::get<int64_t>(statistics.distinct_count.value()));
}

TEST(TestArrayStatistics, DistinctCountApproximate) {
  ArrayStatistics statistics;
  ASSERT_FALSE(statistics.distinct_count.has_value());
  statistics.distinct_count = 29.0;
  ASSERT_TRUE(statistics.distinct_count.has_value());
  ASSERT_DOUBLE_EQ(29.0, std::get<double>(statistics.distinct_count.value()));
}

TEST(TestArrayStatistics, MaxByteWidthExact) {
  ArrayStatistics statistics;