<commit_before>#include "../utility_functions.hpp"

#include <algorithm>
#include <array>
#include <iostream>
#include <numeric>
#include <vector>

#include <gtest/gtest.h>

#include "../../test_helpers/gmock_wrapper.h"

class TestUtilityFunctions : public ::testing::Test {
 protected:
};

// TEST_F(TestUtilityFunctions, VectorTest) {
//   std::vector<double> numbers =
//       {0.01, 0.001, 0.0001, 0.000001, 0.00000000001};
//   double sum = bart::utility::PreciseSum(numbers);
//   EXPECT_FLOAT_EQ(sum, 0.011101);
// }

TEST_F(TestUtilityFunctions, VectorTest) {
  std::vector<double> numbers =
      {10e100, 1.0, -10e100, 1.0};
  double sum = bart::utility::PreciseSum(numbers);
  EXPECT_FLOAT_EQ(sum, 2);
}

TEST_F(TestUtilityFunctions, SecondVectorTest) {
  std::vector<double> numbers =
      {1.0, 10e100, 1.0, -10e100};
  double sum = bart::utility::PreciseSum(numbers);
  EXPECT_FLOAT_EQ(sum, 2);
}

TEST_F(TestUtilityFunctions, ArrayTest) {
  std::array<double, 5> numbers =
      {0.01, 0.001, 0.0001, 0.000001, 0.00000000001};
  double sum = bart::utility::PreciseSum(numbers);
  EXPECT_FLOAT_EQ(sum, 0.011101);
}



<commit_msg>Refactored tests for utility::PreciseSum.<commit_after>#include "utility/utility_functions.hpp"

#include <array>
#include <vector>

#include "test_helpers/gmock_wrapper.h"

namespace  {

TEST(TestUtilityFunctions, VectorTest) {
  std::vector<double> numbers = {10e100, 1.0, -10e100, 1.0};
  EXPECT_FLOAT_EQ(bart::utility::PreciseSum(numbers), 2);
}

TEST(TestUtilityFunctions, SecondVectorTest) {
  std::vector<double> numbers = {1.0, 10e100, 1.0, -10e100};
  EXPECT_FLOAT_EQ(bart::utility::PreciseSum(numbers), 2);
}

TEST(TestUtilityFunctions, ArrayTest) {
  std::array<double, 5> numbers = {0.01, 0.001, 0.0001, 0.000001, 0.00000000001};
  EXPECT_FLOAT_EQ(bart::utility::PreciseSum(numbers), 0.011101);
}

} // namespace






{'fraction_non_alphanumeric': 0.1668443496801706, 'fraction_numerical': 0.09381663113006397, 'mean_word_length': 5.11400651465798, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 3, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2356809', 'n_tokens_mistral': 842, 'n_tokens_neox': 706, 'n_words': 121}