<commit_before>#include "static_map/static_map.hpp"
#include "static_map/constexpr_string_view.hpp"

using std::make_pair;

constexpr const char *pear_str = "pear";
constexpr static_map::StaticMap<int, const char *, 7> cmap(make_pair(2, "apple"), make_pair(10, "banana"),
                                                           make_pair(5, pear_str), make_pair(6, "orange"),
                                                           make_pair(1, "watermelon"), make_pair(0, "peaches"),
                                                           make_pair(12, "strawberry"));
// 1.618 * 7 = 11, so 12 and 1 would face hash collision

__attribute__((noinline)) void test_int_key_constexpr()
{
    static_assert(cmap[5] == pear_str);
}

__attribute__((noinline)) void test_int_key_nonconstexpr()
{
    const char *t = cmap[6];
    if(strcmp(t, "orange"))
        abort();

    if(strcmp(cmap[12], "strawberry"))
        abort();
}
<commit_msg>test: add message for static_assert since this is c++1z extension<commit_after>#include "static_map/static_map.hpp"
#include "static_map/constexpr_string_view.hpp"

using std::make_pair;

constexpr const char *pear_str = "pear";
constexpr static_map::StaticMap<int, const char *, 7> cmap(make_pair(2, "apple"), make_pair(10, "banana"),
                                                           make_pair(5, pear_str), make_pair(6, "orange"),
                                                           make_pair(1, "watermelon"), make_pair(0, "peaches"),
                                                           make_pair(12, "strawberry"));
// 1.618 * 7 = 11, so 12 and 1 would face hash collision

__attribute__((noinline)) void test_int_key_constexpr()
{
    static_assert(cmap[5] == pear_str, "cmap[5] should be pear");
}

__attribute__((noinline)) void test_int_key_nonconstexpr()
{
    const char *t = cmap[6];
    if(strcmp(t, "orange"))
        abort();

    if(strcmp(cmap[12], "strawberry"))
        abort();
}

{'fraction_non_alphanumeric': 0.13211382113821138, 'fraction_numerical': 0.02540650406504065, 'mean_word_length': 2.303691275167785, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3264137', 'n_tokens_mistral': 628, 'n_tokens_neox': 603, 'n_words': 131}