<commit_before>#include <type_traits>

#include "testing.t.hpp"
#include "util/flat_map.hpp"
#include "util/string_conversions.hpp"

namespace otto::test {

  using namespace util::view;

  TEST_CASE ("util::flat_map") {
    using StringIntMap = util::flat_map<std::string, int>;

    static_assert(std::is_same_v<StringIntMap::key_type, std::string>);
    static_assert(std::is_same_v<StringIntMap::mapped_type, int>);
    static_assert(std::is_same_v<StringIntMap::value_type, std::tuple<std::string, int>>);

    StringIntMap map;

    SECTION ("Upon construction, size() is zero") {
      REQUIRE(map.size() == 0);
    }

    SECTION ("Insertion of element increases size") {
      REQUIRE(map.insert("test", 5) == std::pair(map.begin(), true));
      REQUIRE(map.size() == 1);
    }

    SECTION ("Inserting existing element returns iterator to that and false") {
      REQUIRE(map.insert("test", 5) == std::pair(map.begin(), true));
      REQUIRE(map.insert("test", 5) == std::pair(map.begin(), false));
    }

    map.insert("0", 0);
    map.insert("1", 1);
    map.insert("2", 2);
    map.insert("3", 3);
    map.insert("4", 4);

    const auto& cmap = map;
<commit_msg>fix tests relying on order of evaluation<commit_after>#include <type_traits>

#include "testing.t.hpp"
#include "util/flat_map.hpp"
#include "util/string_conversions.hpp"

namespace otto::test {

  using namespace util::view;

  TEST_CASE ("util::flat_map") {
    using StringIntMap = util::flat_map<std::string, int>;

    static_assert(std::is_same_v<StringIntMap::key_type, std::string>);
    static_assert(std::is_same_v<StringIntMap::mapped_type, int>);
    static_assert(std::is_same_v<StringIntMap::value_type, std::tuple<std::string, int>>);

    StringIntMap map;

    SECTION ("Upon construction, size() is zero") {
      REQUIRE(map.size() == 0);
    }

    SECTION ("Insertion of element increases size") {
      auto res = map.insert("test", 5);
      REQUIRE(res == std::pair(map.begin(), true));
      REQUIRE(map.size() == 1);
    }

    SECTION ("Inserting existing element returns iterator to that and false") {
      auto res = map.insert("test", 5);
      REQUIRE(res == std::pair(map.begin(), true));
      res = map.insert("test", 5);
      REQUIRE(res == std::pair(map.begin(), false));
    }

    map.insert("0", 0);
    map.insert("1", 1);
    map.insert("2", 2);
    map.insert("3", 3);
    map.insert("4", 4);

    const auto& cmap = map;

{'fraction_non_alphanumeric': 0.1783960720130933, 'fraction_numerical': 0.012274959083469721, 'mean_word_length': 3.989795918367347, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, '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': '4406918', 'n_tokens_mistral': 889, 'n_tokens_neox': 837, 'n_words': 174}