forked from boostorg/regex
Added object cache - internal state to traits classes is now cached.
Added first start to Unicode support. Enabled external template instance support. Fixed VC6 support. [SVN r25914]
This commit is contained in:
1 parent
70508f307a
commit
c05af49444
35 files changed
+3942
-2590
No files matched your search
@@ -25,6 +25,9 @@ test_replace.cpp
|
||||
test_sets.cpp
|
||||
test_simple_repeats.cpp
|
||||
test_tricky_cases.cpp
|
||||
test_icu.cpp
|
||||
test_overloads.cpp
|
||||
test_operators.cpp
|
||||
;
|
||||
|
||||
#
|
||||
@@ -165,3 +168,6 @@ test-suite regex
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+12
-2
@@ -26,7 +26,7 @@
|
||||
// store information about the test we are about to conduct:
|
||||
//
|
||||
template <class charT>
|
||||
class test_info
|
||||
class test_info_base
|
||||
{
|
||||
public:
|
||||
typedef std::basic_string<charT> string_type;
|
||||
@@ -51,7 +51,7 @@ private:
|
||||
return d;
|
||||
}
|
||||
public:
|
||||
test_info(){};
|
||||
test_info_base(){};
|
||||
static void set_info(
|
||||
const char* file,
|
||||
int line,
|
||||
@@ -130,6 +130,16 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct test_info
|
||||
: public test_info_base<wchar_t>
|
||||
{};
|
||||
|
||||
template<>
|
||||
struct test_info<char>
|
||||
: public test_info_base<char>
|
||||
{};
|
||||
|
||||
template <class charT>
|
||||
std::ostream& operator<<(std::ostream& os, const test_info<charT>&)
|
||||
{
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
* DESCRIPTION: entry point for test program.
|
||||
*/
|
||||
|
||||
#define BOOST_REGEX_TEST_INSTANCES
|
||||
#include "test.hpp"
|
||||
#include "test_locale.hpp"
|
||||
#include <stdarg.h>
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "test_regex_replace.hpp"
|
||||
#include "test_deprecated.hpp"
|
||||
#include "test_mfc.hpp"
|
||||
#include "test_icu.hpp"
|
||||
#include "test_locale.hpp"
|
||||
|
||||
|
||||
@@ -69,6 +70,9 @@ void test(const charT& c, const tagT& tag)
|
||||
&& (test_locale::c_locale_state() == test_locale::test_no_locale)
|
||||
&&(test_locale::cpp_locale_state() == test_locale::test_no_locale))
|
||||
test_mfc(c, tag);
|
||||
// test ICU code:
|
||||
test_info<charT>::set_typename("ICU interfaces");
|
||||
test_icu(c, tag);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -212,4 +216,27 @@ void test_emacs();
|
||||
void test_operators();
|
||||
void test_overloads();
|
||||
|
||||
//
|
||||
// template instances:
|
||||
// we pretty much have to instantiate these separately
|
||||
// otherwise compilation times are really excessive...
|
||||
//
|
||||
#ifndef BOOST_REGEX_TEST_INSTANCES
|
||||
#define template template<>
|
||||
#endif
|
||||
|
||||
template void test<char, test_regex_replace_tag>(const char&, const test_regex_replace_tag&);
|
||||
template void test<char, test_regex_search_tag>(const char&, const test_regex_search_tag&);
|
||||
template void test<char, test_invalid_regex_tag>(const char&, const test_invalid_regex_tag&);
|
||||
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
template void test<wchar_t, test_regex_replace_tag>(const wchar_t&, const test_regex_replace_tag&);
|
||||
template void test<wchar_t, test_regex_search_tag>(const wchar_t&, const test_regex_search_tag&);
|
||||
template void test<wchar_t, test_invalid_regex_tag>(const wchar_t&, const test_invalid_regex_tag&);
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_REGEX_TEST_INSTANCES
|
||||
#undef template
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,203 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2004
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE test_icu.cpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Test code for Unicode regexes with ICU support.
|
||||
*/
|
||||
|
||||
//
|
||||
// We can only build this if we have ICU support:
|
||||
//
|
||||
#ifdef TEST_ICU
|
||||
|
||||
#include <boost/regex/icu.hpp>
|
||||
#include "test.hpp"
|
||||
|
||||
|
||||
void test_icu(const wchar_t&, const test_regex_search_tag& )
|
||||
{
|
||||
typedef boost::u16_to_u32_iterator<std::wstring::const_iterator, ::UChar32> conv_iterator;
|
||||
boost::u32regex r;
|
||||
if(*test_locale::c_str())
|
||||
{
|
||||
::Locale l(test_locale::c_str());
|
||||
if(l.isBogus())
|
||||
return;
|
||||
r.imbue(l);
|
||||
}
|
||||
|
||||
const std::wstring& expression = test_info<wchar_t>::expression();
|
||||
boost::regex_constants::syntax_option_type syntax_options = test_info<UChar32>::syntax_options();
|
||||
try{
|
||||
r.assign(conv_iterator(expression.begin()), conv_iterator(expression.end()), syntax_options);
|
||||
if(r.status())
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done, error code = " << r.status(), UChar32);
|
||||
}
|
||||
const std::wstring& search_text = test_info<wchar_t>::search_text();
|
||||
boost::regex_constants::match_flag_type opts = test_info<wchar_t>::match_options();
|
||||
const int* answer_table = test_info<wchar_t>::answer_table();
|
||||
boost::match_results<conv_iterator> what;
|
||||
if(boost::regex_search(
|
||||
conv_iterator(search_text.begin()),
|
||||
conv_iterator(search_text.end()),
|
||||
what,
|
||||
r,
|
||||
opts))
|
||||
{
|
||||
test_result(what, conv_iterator(search_text.begin()), answer_table);
|
||||
}
|
||||
else if(answer_table[0] >= 0)
|
||||
{
|
||||
// we should have had a match but didn't:
|
||||
BOOST_REGEX_TEST_ERROR("Expected match was not found.", UChar32);
|
||||
}
|
||||
}
|
||||
catch(const boost::bad_expression& e)
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done: " << e.what(), UChar32);
|
||||
}
|
||||
catch(const std::runtime_error& r)
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR("Received an unexpected std::runtime_error: " << r.what(), UChar32);
|
||||
}
|
||||
catch(const std::exception& r)
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR("Received an unexpected std::exception: " << r.what(), UChar32);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR("Received an unexpected exception of unknown type", UChar32);
|
||||
}
|
||||
}
|
||||
|
||||
void test_icu(const wchar_t&, const test_invalid_regex_tag&)
|
||||
{
|
||||
typedef boost::u16_to_u32_iterator<std::wstring::const_iterator, ::UChar32> conv_iterator;
|
||||
const std::wstring& expression = test_info<wchar_t>::expression();
|
||||
boost::regex_constants::syntax_option_type syntax_options = test_info<wchar_t>::syntax_options();
|
||||
boost::u32regex r;
|
||||
if(*test_locale::c_str())
|
||||
{
|
||||
::Locale l(test_locale::c_str());
|
||||
if(l.isBogus())
|
||||
return;
|
||||
r.imbue(l);
|
||||
}
|
||||
//
|
||||
// try it with exceptions disabled first:
|
||||
//
|
||||
try
|
||||
{
|
||||
if(0 == r.assign(conv_iterator(expression.begin()), conv_iterator(expression.end()), syntax_options | boost::regex_constants::no_except).status())
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR("Expression compiled when it should not have done so.", wchar_t);
|
||||
}
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR("Unexpected exception thrown.", wchar_t);
|
||||
}
|
||||
//
|
||||
// now try again with exceptions:
|
||||
//
|
||||
bool have_catch = false;
|
||||
try{
|
||||
r.assign(conv_iterator(expression.begin()), conv_iterator(expression.end()), syntax_options);
|
||||
#ifdef BOOST_NO_EXCEPTIONS
|
||||
if(r.status())
|
||||
have_catch = true;
|
||||
#endif
|
||||
}
|
||||
catch(const boost::bad_expression&)
|
||||
{
|
||||
have_catch = true;
|
||||
}
|
||||
catch(const std::runtime_error& r)
|
||||
{
|
||||
have_catch = true;
|
||||
BOOST_REGEX_TEST_ERROR("Expected a bad_expression exception, but a std::runtime_error instead: " << r.what(), wchar_t);
|
||||
}
|
||||
catch(const std::exception& r)
|
||||
{
|
||||
have_catch = true;
|
||||
BOOST_REGEX_TEST_ERROR("Expected a bad_expression exception, but a std::exception instead: " << r.what(), wchar_t);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
have_catch = true;
|
||||
BOOST_REGEX_TEST_ERROR("Expected a bad_expression exception, but got an exception of unknown type instead", wchar_t);
|
||||
}
|
||||
if(!have_catch)
|
||||
{
|
||||
// oops expected exception was not thrown:
|
||||
BOOST_REGEX_TEST_ERROR("Expected an exception, but didn't find one.", wchar_t);
|
||||
}
|
||||
}
|
||||
|
||||
void test_icu(const wchar_t&, const test_regex_replace_tag&)
|
||||
{
|
||||
const std::wstring& expression = test_info<wchar_t>::expression();
|
||||
boost::regex_constants::syntax_option_type syntax_options = test_info<UChar32>::syntax_options();
|
||||
boost::u32regex r;
|
||||
try{
|
||||
r.assign(expression.begin(), expression.end(), syntax_options);
|
||||
if(r.status())
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done, error code = " << r.status(), UChar32);
|
||||
}
|
||||
typedef std::vector<UChar32> string_type;
|
||||
string_type search_text;
|
||||
search_text.assign(test_info<UChar32>::search_text().begin(), test_info<UChar32>::search_text().end());
|
||||
boost::regex_constants::match_flag_type opts = test_info<UChar32>::match_options();
|
||||
string_type format_string;
|
||||
format_string.assign(test_info<UChar32>::format_string().begin(), test_info<UChar32>::format_string().end());
|
||||
format_string.push_back(0);
|
||||
string_type result_string;
|
||||
result_string.assign(test_info<UChar32>::result_string().begin(), test_info<UChar32>::result_string().end());
|
||||
string_type result;
|
||||
|
||||
boost::regex_replace(std::back_inserter(result), search_text.begin(), search_text.end(), r, &*format_string.begin(), opts);
|
||||
if(result != result_string)
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR("regex_replace generated an incorrect string result", UChar32);
|
||||
}
|
||||
}
|
||||
catch(const boost::bad_expression& e)
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done: " << e.what(), UChar32);
|
||||
}
|
||||
catch(const std::runtime_error& r)
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR("Received an unexpected std::runtime_error: " << r.what(), UChar32);
|
||||
}
|
||||
catch(const std::exception& r)
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR("Received an unexpected std::exception: " << r.what(), UChar32);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR("Received an unexpected exception of unknown type", UChar32);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include "test.hpp"
|
||||
|
||||
void test_icu(const wchar_t&, const test_regex_search_tag&){}
|
||||
void test_icu(const wchar_t&, const test_invalid_regex_tag&){}
|
||||
void test_icu(const wchar_t&, const test_regex_replace_tag&){}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2004
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE test_icu.hpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: MFC/ATL test handlers.
|
||||
*/
|
||||
|
||||
#ifndef TEST_ICU_HPP
|
||||
#define TEST_ICU_HPP
|
||||
|
||||
template <class charT, class Tag>
|
||||
void test_icu(const charT&, const Tag&)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
void test_icu(const wchar_t&, const test_regex_search_tag&);
|
||||
void test_icu(const wchar_t&, const test_invalid_regex_tag&);
|
||||
void test_icu(const wchar_t&, const test_regex_replace_tag&);
|
||||
|
||||
|
||||
#endif
|
||||
@@ -26,6 +26,9 @@ namespace std{ using ::setlocale; }
|
||||
|
||||
test_locale::test_locale(const char* c_name, boost::uint32_t lcid)
|
||||
{
|
||||
// store the name:
|
||||
m_old_name = m_name;
|
||||
m_name = c_name;
|
||||
// back up C locale and then set it's new name:
|
||||
m_old_c_locale = std::setlocale(LC_ALL, 0);
|
||||
m_old_c_state = s_c_locale;
|
||||
@@ -108,6 +111,7 @@ test_locale::~test_locale()
|
||||
s_cpp_locale = m_old_cpp_state;
|
||||
s_win_locale_inst = m_old_win_locale;
|
||||
s_win_locale = m_old_win_state;
|
||||
m_name = m_old_name;
|
||||
}
|
||||
|
||||
int test_locale::s_c_locale = test_no_locale;
|
||||
@@ -117,6 +121,7 @@ int test_locale::s_win_locale = test_no_locale;
|
||||
std::locale test_locale::s_cpp_locale_inst;
|
||||
#endif
|
||||
boost::uint32_t test_locale::s_win_locale_inst = 0;
|
||||
std::string test_locale::m_name;
|
||||
|
||||
|
||||
void test_en_locale(const char* name, boost::uint32_t lcid)
|
||||
@@ -126,9 +131,9 @@ void test_en_locale(const char* name, boost::uint32_t lcid)
|
||||
test_locale l(name, lcid);
|
||||
TEST_REGEX_SEARCH_L("[[:lower:]]+", perl, "渤珀矣粤肄蓍裨跋鈿韵鴦��巐鄕��", match_default, make_array(1, 32, -2, -2));
|
||||
TEST_REGEX_SEARCH_L("[[:upper:]]+", perl, "神疎団兎波品北洋椀冫嘖孛慵无槿渤", match_default, make_array(1, 31, -2, -2));
|
||||
TEST_REGEX_SEARCH_L("[[:punct:]]+", perl, "、�ウЖ��⑭�渦慨偽係杭纂従神", match_default, make_array(0, 31, -2, -2));
|
||||
TEST_REGEX_SEARCH_L("[[:print:]]+", perl, "、�ウЖ��⑭�渦慨偽係杭纂従神疎団兎波品北洋椀冫嘖孛忤掣桀毳烙痰邃繙艾蜉謖邇關髓齡��巐鄕�", match_default, make_array(0, 94, -2, -2));
|
||||
TEST_REGEX_SEARCH_L("[[:graph:]]+", perl, "、�ウЖ��⑭�渦慨偽係杭纂従神疎団兎波品北洋椀冫嘖孛忤掣桀毳烙痰邃繙艾蜉謖邇關髓齡��巐鄕�", match_default, make_array(0, 94, -2, -2));
|
||||
// TEST_REGEX_SEARCH_L("[[:punct:]]+", perl, "、�ウЖ��⑭�渦慨偽係杭纂従神", match_default, make_array(0, 31, -2, -2));
|
||||
TEST_REGEX_SEARCH_L("[[:print:]]+", perl, "、�ウЖ���葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦���凞'�", match_default, make_array(0, 93, -2, -2));
|
||||
TEST_REGEX_SEARCH_L("[[:graph:]]+", perl, "、�ウЖ���葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦���凞'�", match_default, make_array(0, 93, -2, -2));
|
||||
TEST_REGEX_SEARCH_L("[[:word:]]+", perl, "請唾津毒班碧麺力佰厶壞嶷掣桀毳烙痰邃繙艾蜉謖邇關髓齡��凞'�", match_default, make_array(0, 61, -2, -2));
|
||||
// collation sensitive ranges:
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, < 0x600)
|
||||
|
||||
@@ -46,6 +46,10 @@ public:
|
||||
{
|
||||
return s_win_locale;
|
||||
}
|
||||
static const char* c_str()
|
||||
{
|
||||
return m_name.c_str();
|
||||
}
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
static std::locale cpp_locale()
|
||||
{
|
||||
@@ -67,9 +71,11 @@ private:
|
||||
static std::locale s_cpp_locale_inst;
|
||||
#endif
|
||||
static boost::uint32_t s_win_locale_inst;
|
||||
static std::string m_name;
|
||||
|
||||
// backed up versions of the previous locales and their action state:
|
||||
std::string m_old_c_locale;
|
||||
std::string m_old_name;
|
||||
int m_old_c_state;
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
std::locale m_old_cpp_locale;
|
||||
|
||||
@@ -29,6 +29,7 @@ void test_replace()
|
||||
TEST_REGEX_REPLACE("[[:digit:]]*", perl, "123ab", match_default|format_no_copy, "<$0>", "<123><><><>");
|
||||
TEST_REGEX_REPLACE("[[:digit:]]*", perl, "123ab1", match_default|format_no_copy, "<$0>", "<123><><><1><>");
|
||||
TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$`$", "...$");
|
||||
TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "(?1x:y)", "(?1x:y)");
|
||||
// and now escapes:
|
||||
TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "$x", "$x");
|
||||
TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_no_copy, "\\a", "\a");
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2004
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE unicode_iterator_test.cpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Simple test suite for Unicode interconversions.
|
||||
*/
|
||||
|
||||
#include <boost/regex/pending/unicode_iterator.hpp>
|
||||
#include <boost/test/included/test_exec_monitor.hpp>
|
||||
#include <vector>
|
||||
#include <iterator>
|
||||
#include <algorithm>
|
||||
|
||||
void spot_checks()
|
||||
{
|
||||
// test specific values ripped straight out of the Unicode standard
|
||||
// to verify that our encoding is the same as theirs, as well as
|
||||
// self-consistent:
|
||||
::boost::uint32_t spot16[] = { 0x10302u, };
|
||||
typedef boost::u32_to_u16_iterator<const ::boost::uint32_t*> u32to16type;
|
||||
|
||||
u32to16type it(spot16);
|
||||
BOOST_CHECK_EQUAL(*it++, 0xD800u);
|
||||
BOOST_CHECK_EQUAL(*it++, 0xDF02u);
|
||||
BOOST_CHECK_EQUAL(*--it, 0xDF02u);
|
||||
BOOST_CHECK_EQUAL(*--it, 0xD800u);
|
||||
|
||||
}
|
||||
|
||||
void test(const std::vector< ::boost::uint32_t>& v)
|
||||
{
|
||||
typedef std::vector< ::boost::uint32_t> vector32_type;
|
||||
typedef std::vector< ::boost::uint16_t> vector16_type;
|
||||
typedef boost::u32_to_u16_iterator<vector32_type::const_iterator, ::boost::uint16_t> u32to16type;
|
||||
typedef boost::u16_to_u32_iterator<vector16_type::const_iterator, ::boost::uint32_t> u16to32type;
|
||||
typedef std::reverse_iterator<u32to16type> ru32to16type;
|
||||
typedef std::reverse_iterator<u16to32type> ru16to32type;
|
||||
vector16_type v16;
|
||||
vector32_type v32;
|
||||
vector32_type::const_iterator i, j, k;
|
||||
//
|
||||
// begin by testing forward iteration, of 32-16 bit interconversions:
|
||||
//
|
||||
v16.assign(u32to16type(v.begin()), u32to16type(v.end()));
|
||||
BOOST_CHECK_EQUAL(std::distance(u32to16type(v.begin()), u32to16type(v.end())), v16.size());
|
||||
v32.assign(u16to32type(v16.begin()), u16to32type(v16.end()));
|
||||
BOOST_CHECK_EQUAL(std::distance(u16to32type(v16.begin()), u16to32type(v16.end())), v32.size());
|
||||
BOOST_CHECK_EQUAL(v.size(), v32.size());
|
||||
i = v.begin();
|
||||
j = i;
|
||||
std::advance(j, (std::min)(v.size(), v32.size()));
|
||||
k = v32.begin();
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(
|
||||
i,
|
||||
j,
|
||||
k);
|
||||
//
|
||||
// test backward iteration, of 32-16 bit interconversions:
|
||||
//
|
||||
v16.assign(ru32to16type(u32to16type(v.end())), ru32to16type(u32to16type(v.begin())));
|
||||
BOOST_CHECK_EQUAL(std::distance(ru32to16type(u32to16type(v.end())), ru32to16type(u32to16type(v.begin()))), v16.size());
|
||||
std::reverse(v16.begin(), v16.end());
|
||||
v32.assign(ru16to32type(u16to32type(v16.end())), ru16to32type(u16to32type(v16.begin())));
|
||||
BOOST_CHECK_EQUAL(std::distance(ru16to32type(u16to32type(v16.end())), ru16to32type(u16to32type(v16.begin()))), v32.size());
|
||||
BOOST_CHECK_EQUAL(v.size(), v32.size());
|
||||
std::reverse(v32.begin(), v32.end());
|
||||
i = v.begin();
|
||||
j = i;
|
||||
std::advance(j, (std::min)(v.size(), v32.size()));
|
||||
k = v32.begin();
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(
|
||||
i,
|
||||
j,
|
||||
k);
|
||||
}
|
||||
|
||||
int test_main( int, char* [] )
|
||||
{
|
||||
// test specific value points from the standard:
|
||||
spot_checks();
|
||||
// now test a bunch of values for self-consistency and round-tripping:
|
||||
std::vector< ::boost::uint32_t> v;
|
||||
// start with boundary conditions:
|
||||
v.push_back(0);
|
||||
v.push_back(0xD7FF);
|
||||
v.push_back(0xE000);
|
||||
v.push_back(0xFFFF);
|
||||
v.push_back(0x10000);
|
||||
v.push_back(0x10FFFF);
|
||||
test(v);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user