<commit_before>#define BOOST_TEST_MODULE "test_acceptor"
#ifdef UNITTEST_FRAMEWORK_LIBRARY_EXIST
#include <boost/test/unit_test.hpp>
#else
#define BOOST_TEST_NO_LIB
#include <boost/test/included/unit_test.hpp>
#endif
#include <toml/acceptor.hpp>
#include <iostream>

BOOST_AUTO_TEST_CASE(test_conditions)
{
    {
        const std::string tmp(" ");
        const std::string dummy("dummy");
        BOOST_CHECK(toml::is_space<char>::invoke(tmp.begin(), tmp.end())     == tmp.end());
        BOOST_CHECK(toml::is_space<char>::invoke(dummy.begin(), dummy.end()) == dummy.begin());
    }

    {
        const std::string tmp("\t");
        const std::string dummy("dummy");
        BOOST_CHECK(toml::is_tab<char>::invoke(tmp.begin(), tmp.end())     == tmp.end());
        BOOST_CHECK(toml::is_tab<char>::invoke(dummy.begin(), dummy.end()) == dummy.begin());
    }

    {
        const std::string tmp("0123456789");
        const std::string dummy("dummy");
        BOOST_CHECK(toml::is_number<char>::invoke(tmp.begin(), tmp.end())     == tmp.end());
        BOOST_CHECK(toml::is_number<char>::invoke(dummy.begin(), dummy.end()) == dummy.begin());
    }

    {
        const std::string tmp("abcdefghijklmnopqrstuvwxyz");
        const std::string dummy("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
        BOOST_CHECK(toml::is_lowercase<char>::invoke(tmp.begin(), tmp.end())     == tmp.end());
        BOOST_CHECK(toml::is_lowercase<char>::invoke(dummy.begin(), dummy.end()) == dummy.begin());
    }
    {
        const std::string tmp("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
        const std::string dummy("abcdefghijklmnopqrstuvwxyz");
        BOOST_CHECK(toml::is_uppercase<char>::invoke(tmp.begin(), tmp.end())     == tmp.end());
        BOOST_CHECK(toml::is_uppercase<char>::invoke(dummy.begin(), dummy.end()) == dummy.begin());
    }
    {
        const std::string tmp("  \t ");
        const std::string dummy("abcdefghijklmnopqrstuvwxyz");
        BOOST_CHECK(toml::is_whitespace<char>::invoke(tmp.begin(), tmp.end())     == tmp.end());
        BOOST_CHECK(toml::is_whitespace<char>::invoke(dummy.begin(), dummy.end()) == dummy.begin());
    }
    {
        const std::string tmp("hoge1-piyo2_fuga3");
        const std::string dummy(" \t");
        BOOST_CHECK(toml::is_barekey<char>::invoke(tmp.begin(), tmp.end())     == tmp.end());
        BOOST_CHECK(toml::is_barekey<char>::invoke(dummy.begin(), dummy.end()) == dummy.begin());
    }
}

BOOST_AUTO_TEST_CASE(test_basic_inline_string)
{
    using is_valid = toml::is_basic_inline_string<char>;
    {
        const std::string simple("\"hoge1-piyo2_fuga3\"");
        BOOST_CHECK(is_valid::invoke(simple.cbegin(), simple.cend()) == simple.cend());
    }
    {
        const std::string quote("\"hoge1-\\\"piyo2\\\"_fuga3\"");
        BOOST_CHECK(is_valid::invoke(quote.cbegin(), quote.cend()) == quote.cend());
    }
    {
        const std::string escape("\"I'm a string. \\\"You can quote me\\\". Name\\tJos\\u00E9\\nLocation\\tSF.\"");
        BOOST_CHECK(is_valid::invoke(escape.cbegin(), escape.cend()) == escape.cend());
    }
    {
        const std::string empty("\"\"");
        BOOST_CHECK(is_valid::invoke(empty.cbegin(), empty.cend()) == empty.cend());
    }

    {
        const std::string newline("\"newline\r\nhoge\"");
        BOOST_CHECK(is_valid::invoke(newline.cbegin(), newline.cend()) == newline.cbegin());<commit_msg>fix test code<commit_after>#define BOOST_TEST_MODULE "test_acceptor"
#ifdef UNITTEST_FRAMEWORK_LIBRARY_EXIST
#include <boost/test/unit_test.hpp>
#else
#define BOOST_TEST_NO_LIB
#include <boost/test/included/unit_test.hpp>
#endif
#include <toml/acceptor.hpp>
#include <locale>
#include <iostream>

BOOST_AUTO_TEST_CASE(test_conditions)
{
    {
        const std::string tmp(" ");
        const std::string dummy("dummy");
        BOOST_CHECK(toml::is_space<char>::invoke(tmp.begin(), tmp.end())     == tmp.end());
        BOOST_CHECK(toml::is_space<char>::invoke(dummy.begin(), dummy.end()) == dummy.begin());
    }

    {
        const std::string tmp("\t");
        const std::string dummy("dummy");
        BOOST_CHECK(toml::is_tab<char>::invoke(tmp.begin(), tmp.end())     == tmp.end());
        BOOST_CHECK(toml::is_tab<char>::invoke(dummy.begin(), dummy.end()) == dummy.begin());
    }

    {
        for(int i=0; i<10; ++i)
        {
            const std::string tmp = std::to_string(i);
            const std::string dummy("dummy");
            BOOST_CHECK(toml::is_number<char>::invoke(tmp.begin(), tmp.end())     == tmp.end());
            BOOST_CHECK(toml::is_number<char>::invoke(dummy.begin(), dummy.end()) == dummy.begin());
        }
    }

    {
        for(char c='a'; c <= 'z'; ++c)
        {
            const std::string tmp(1, c);
            const std::string dummy(1, std::toupper(c));
            BOOST_CHECK(toml::is_lowercase<char>::invoke(tmp.begin(), tmp.end())     == tmp.end());
            BOOST_CHECK(toml::is_lowercase<char>::invoke(dummy.begin(), dummy.end()) == dummy.begin());
        }
    }
    {
        for(char c='A'; c <= 'Z'; ++c)
        {
            const std::string tmp(1, c);
            const std::string dummy(1, std::tolower(c));
            BOOST_CHECK(toml::is_uppercase<char>::invoke(tmp.begin(), tmp.end())     == tmp.end());
            BOOST_CHECK(toml::is_uppercase<char>::invoke(dummy.begin(), dummy.end()) == dummy.begin());
        }
    }
    {
        const std::string tmp(" ");
        const std::string dummy("a");
        BOOST_CHECK(toml::is_whitespace<char>::invoke(tmp.begin(), tmp.end())     == tmp.end());
        BOOST_CHECK(toml::is_whitespace<char>::invoke(dummy.begin(), dummy.end()) == dummy.begin());
    }
    {
        const std::string tmp("\t");
        const std::string dummy("a");
        BOOST_CHECK(toml::is_whitespace<char>::invoke(tmp.begin(), tmp.end())     == tmp.end());
        BOOST_CHECK(toml::is_whitespace<char>::invoke(dummy.begin(), dummy.end()) == dummy.begin());
    }
    {
        const std::string tmp("hoge1-piyo2_fuga3");
        const std::string dummy(" \t");
        BOOST_CHECK(toml::is_barekey<char>::invoke(tmp.begin(), tmp.end())     != tmp.begin());
        BOOST_CHECK(toml::is_barekey<char>::invoke(dummy.begin(), dummy.end()) == dummy.begin());
    }
}

BOOST_AUTO_TEST_CASE(test_basic_inline_string)
{
    using is_valid = toml::is_basic_inline_string<char>;
    {
        const std::string simple("\"hoge1-piyo2_fuga3\"");
        BOOST_CHECK(is_valid::invoke(simple.cbegin(), simple.cend()) == simple.cend());
    }
    {
        const std::string quote("\"hoge1-\\\"piyo2\\\"_fuga3\"");
        BOOST_CHECK(is_valid::invoke(quote.cbegin(), quote.cend()) == quote.cend());
    }
    {
        const std::string escape("\"I'm a string. \\\"You can quote me\\\". Name\\tJos\\u00E9\\nLocation\\tSF.\"");
        BOOST_CHECK(is_valid::invoke(escape.cbegin(), escape.cend()) == escape.cend());
    }
    {
        const std::string empty("\"\"");
        BOOST_CHECK(is_valid::invoke(empty.cbegin(), empty.cend()) == empty.cend());
    }

    {
        const std::string newline("\"newline\r\nhoge\"");
        BOOST_CHECK(is_valid::invoke(newline.cbegin(), newline.cend()) == newline.cbegin());
{'fraction_non_alphanumeric': 0.20250347705146035, 'fraction_numerical': 0.005702364394993046, 'mean_word_length': 3.2676557863501485, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 44, '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': '5751508', 'n_tokens_mistral': 2497, 'n_tokens_neox': 2408, 'n_words': 323}