<commit_before>#include <boost/test/unit_test.hpp>
#include <silicium/memory_range.hpp>
#include <boost/array.hpp>
#include <boost/utility/string_ref.hpp>
#include <array>

BOOST_AUTO_TEST_CASE(make_memory_range_c_str_literal)
{
	Si::iterator_range<char const *> r = Si::make_memory_range("hello");
	std::array<char, 6> const expected
	{
		'h', 'e', 'l', 'l', 'o',
		//the terminating zero is expected because std::end("hello") points after \0, not at it
		'\0'
	};
	BOOST_CHECK_EQUAL_COLLECTIONS(expected.begin(), expected.end(), r.begin(), r.end());
}

BOOST_AUTO_TEST_CASE(make_memory_range_c_array)
{
	using std::begin;
	using std::end;
	char expected[3] = {1, 2, 3};
	Si::iterator_range<char *> r = Si::make_memory_range(expected);
	BOOST_CHECK_EQUAL_COLLECTIONS(begin(expected), end(expected), r.begin(), r.end());
}

BOOST_AUTO_TEST_CASE(make_memory_range_const_c_array)
{
	using std::begin;
	using std::end;
	char const expected[3] = {1, 2, 3};
	Si::iterator_range<char const *> r = Si::make_memory_range(expected);
	BOOST_CHECK_EQUAL_COLLECTIONS(begin(expected), end(expected), r.begin(), r.end());
}

BOOST_AUTO_TEST_CASE(make_memory_range_std_array)
{
	std::array<char, 3> expected{{1, 2, 3}};
	Si::iterator_range<char *> r = Si::make_memory_range(expected);
	BOOST_CHECK_EQUAL_COLLECTIONS(begin(expected), end(expected), r.begin(), r.end());
}

BOOST_AUTO_TEST_CASE(make_memory_range_const_std_array)
{
	std::array<char, 3> const expected{{1, 2, 3}};
	Si::iterator_range<char const *> r = Si::make_memory_range(expected);
	BOOST_CHECK_EQUAL_COLLECTIONS(begin(expected), end(expected), r.begin(), r.end());
}

BOOST_AUTO_TEST_CASE(make_memory_range_boost_array)
{
	using std::begin;
	using std::end;
	boost::array<char, 3> expected{{1, 2, 3}};
	Si::iterator_range<char *> r = Si::make_memory_range(expected);
	BOOST_CHECK_EQUAL_COLLECTIONS(begin(expected), end(expected), r.begin(), r.end());
}

BOOST_AUTO_TEST_CASE(make_memory_range_const_boost_array)
{
	using std::begin;
	using std::end;
	boost::array<char, 3> const expected{{1, 2, 3}};
	Si::iterator_range<char const *> r = Si::make_memory_range(expected);
	BOOST_CHECK_EQUAL_COLLECTIONS(begin(expected), end(expected), r.begin(), r.end());
}

BOOST_AUTO_TEST_CASE(make_memory_range_std_vector)
{
	std::vector<char> expected{1, 2, 3};
	Si::iterator_range<char *> r = Si::make_memory_range(expected);
	BOOST_CHECK_EQUAL_COLLECTIONS(begin(expected), end(expected), r.begin(), r.end());
}

BOOST_AUTO_TEST_CASE(make_memory_range_const_std_vector)
{
	std::vector<char> const expected{1, 2, 3};
	Si::iterator_range<char const *> r = Si::make_memory_range(expected);
	BOOST_CHECK_EQUAL_COLLECTIONS(begin(expected), end(expected), r.begin(), r.end());
}

BOOST_AUTO_TEST_CASE(make_memory_range_std_string)
{
	std::string expected = "123";
	Si::iterator_range<char *> r = Si::make_memory_range(expected);
	BOOST_CHECK_EQUAL_COLLECTIONS(begin(expected), end(expected), r.begin(), r.end());
}

BOOST_AUTO_TEST_CASE(make_memory_range_const_std_string)
{
	std::string const expected = "123";
	Si::iterator_range<char const *> r = Si::make_memory_range(expected);
	BOOST_CHECK_EQUAL_COLLECTIONS(begin(expected), end(expected), r.begin(), r.end());
}

BOOST_AUTO_TEST_CASE(make_memory_range_string_ref)
{
	boost::string_ref expected = "123";
	Si::iterator_range<char const *> r = Si::make_memory_range(expected);
	BOOST_CHECK_EQUAL_COLLECTIONS(begin(expected), end(expected), r.begin(), r.end());
}

BOOST_AUTO_TEST_CASE(make_memory_range_const_string_ref)
{
	boost::string_ref const expected = "123";
	Si::iterator_range<char const *> r = Si::make_memory_range(expected);
	BOOST_CHECK_EQUAL_COLLECTIONS(begin(expected), end(expected), r.begin(), r.end());
}

BOOST_AUTO_TEST_CASE(make_memory_range_from_pointers)
{
	std::vector<char> expected{1, 2, 3};
	Si::iterator_range<char *> r = Si::make_memory_range(expected.data(), expected.data() + expected.size());
	BOOST_CHECK_EQUAL_COLLECTIONS(begin(expected), end(expected), r.begin(), r.end());
}

BOOST_AUTO_TEST_CASE(make_memory_range_from_pointers_to_const)
{
	std::vector<char> const expected{1, 2, 3};
	Si::iterator_range<char const *> r = Si::make_memory_range(expected.data(), expected.data() + expected.size());
	BOOST_CHECK_EQUAL_COLLECTIONS(begin(expected), end(expected), r.begin(), r.end());
}
<commit_msg>fix warning by adding braces in std::array initialization<commit_after>#include <boost/test/unit_test.hpp>
#include <silicium/memory_range.hpp>
#include <boost/array.hpp>
#include <boost/utility/string_ref.hpp>
#include <array>

BOOST_AUTO_TEST_CASE(make_memory_range_c_str_literal)
{
	Si::iterator_range<char const *> r = Si::make_memory_range("hello");
	std::array<char, 6> const expected
	{{
		'h', 'e', 'l', 'l', 'o',
		//the terminating zero is expected because std::end("hello") points after \0, not at it
		'\0'
	}};
	BOOST_CHECK_EQUAL_COLLECTIONS(expected.begin(), expected.end(), r.begin(), r.end());
}

BOOST_AUTO_TEST_CASE(make_memory_range_c_array)
{
	using std::begin;
	using std::end;
	char expected[3] = {1, 2, 3};
	Si::iterator_range<char *> r = Si::make_memory_range(expected);
	BOOST_CHECK_EQUAL_COLLECTIONS(begin(expected), end(expected), r.begin(), r.end());
}

BOOST_AUTO_TEST_CASE(make_memory_range_const_c_array)
{
	using std::begin;
	using std::end;
	char const expected[3] = {1, 2, 3};
	Si::iterator_range<char const *> r = Si::make_memory_range(expected);
	BOOST_CHECK_EQUAL_COLLECTIONS(begin(expected), end(expected), r.begin(), r.end());
}

BOOST_AUTO_TEST_CASE(make_memory_range_std_array)
{
	std::array<char, 3> expected{{1, 2, 3}};
	Si::iterator_range<char *> r = Si::make_memory_range(expected);
	BOOST_CHECK_EQUAL_COLLECTIONS(begin(expected), end(expected), r.begin(), r.end());
}

BOOST_AUTO_TEST_CASE(make_memory_range_const_std_array)
{
	std::array<char, 3> const expected{{1, 2, 3}};
	Si::iterator_range<char const *> r = Si::make_memory_range(expected);
	BOOST_CHECK_EQUAL_COLLECTIONS(begin(expected), end(expected), r.begin(), r.end());
}

BOOST_AUTO_TEST_CASE(make_memory_range_boost_array)
{
	using std::begin;
	using std::end;
	boost::array<char, 3> expected{{1, 2, 3}};
	Si::iterator_range<char *> r = Si::make_memory_range(expected);
	BOOST_CHECK_EQUAL_COLLECTIONS(begin(expected), end(expected), r.begin(), r.end());
}

BOOST_AUTO_TEST_CASE(make_memory_range_const_boost_array)
{
	using std::begin;
	using std::end;
	boost::array<char, 3> const expected{{1, 2, 3}};
	Si::iterator_range<char const *> r = Si::make_memory_range(expected);
	BOOST_CHECK_EQUAL_COLLECTIONS(begin(expected), end(expected), r.begin(), r.end());
}

BOOST_AUTO_TEST_CASE(make_memory_range_std_vector)
{
	std::vector<char> expected{1, 2, 3};
	Si::iterator_range<char *> r = Si::make_memory_range(expected);
	BOOST_CHECK_EQUAL_COLLECTIONS(begin(expected), end(expected), r.begin(), r.end());
}

BOOST_AUTO_TEST_CASE(make_memory_range_const_std_vector)
{
	std::vector<char> const expected{1, 2, 3};
	Si::iterator_range<char const *> r = Si::make_memory_range(expected);
	BOOST_CHECK_EQUAL_COLLECTIONS(begin(expected), end(expected), r.begin(), r.end());
}

BOOST_AUTO_TEST_CASE(make_memory_range_std_string)
{
	std::string expected = "123";
	Si::iterator_range<char *> r = Si::make_memory_range(expected);
	BOOST_CHECK_EQUAL_COLLECTIONS(begin(expected), end(expected), r.begin(), r.end());
}

BOOST_AUTO_TEST_CASE(make_memory_range_const_std_string)
{
	std::string const expected = "123";
	Si::iterator_range<char const *> r = Si::make_memory_range(expected);
	BOOST_CHECK_EQUAL_COLLECTIONS(begin(expected), end(expected), r.begin(), r.end());
}

BOOST_AUTO_TEST_CASE(make_memory_range_string_ref)
{
	boost::string_ref expected = "123";
	Si::iterator_range<char const *> r = Si::make_memory_range(expected);
	BOOST_CHECK_EQUAL_COLLECTIONS(begin(expected), end(expected), r.begin(), r.end());
}

BOOST_AUTO_TEST_CASE(make_memory_range_const_string_ref)
{
	boost::string_ref const expected = "123";
	Si::iterator_range<char const *> r = Si::make_memory_range(expected);
	BOOST_CHECK_EQUAL_COLLECTIONS(begin(expected), end(expected), r.begin(), r.end());
}

BOOST_AUTO_TEST_CASE(make_memory_range_from_pointers)
{
	std::vector<char> expected{1, 2, 3};
	Si::iterator_range<char *> r = Si::make_memory_range(expected.data(), expected.data() + expected.size());
	BOOST_CHECK_EQUAL_COLLECTIONS(begin(expected), end(expected), r.begin(), r.end());
}

BOOST_AUTO_TEST_CASE(make_memory_range_from_pointers_to_const)
{
	std::vector<char> const expected{1, 2, 3};
	Si::iterator_range<char const *> r = Si::make_memory_range(expected.data(), expected.data() + expected.size());
	BOOST_CHECK_EQUAL_COLLECTIONS(begin(expected), end(expected), r.begin(), r.end());
}

{'fraction_non_alphanumeric': 0.162292817679558, 'fraction_numerical': 0.011740331491712707, 'mean_word_length': 8.675946547884188, 'pattern_counts': {'":': 0, '<': 61, '<?xml version=': 0, '>': 61, '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': '5793268', 'n_tokens_mistral': 3342, 'n_tokens_neox': 3207, 'n_words': 501}