// // Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // // Distributed under 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) // #ifndef BOOST_LOCALE_WITH_ICU #include int main() { std::cout << "ICU is not build... Skipping" << std::endl; } #else #include #include #include #include #include "test_locale.hpp" template void test_normc(std::basic_string orig,std::basic_string normal,boost::locale::norm_type type) { std::locale l = boost::locale::generator().generate("en_US.UTF-8"); TEST(normalize(orig,type,l)==normal); TEST(normalize(orig.c_str(),type,l)==normal); TEST(normalize(orig.c_str(),orig.c_str()+orig.size(),type,l)==normal); } void test_norm(std::string orig,std::string normal,boost::locale::norm_type type) { test_normc(orig,normal,type); test_normc(to(orig),to(normal),type); #ifdef BOOST_HAS_CHAR16_T test_normc(to(orig),to(normal),type); #endif #ifdef BOOST_HAS_CHAR32_T test_normc(to(orig),to(normal),type); #endif } #define TEST_A(Chr,how,source,dest) \ do { \ boost::locale::info const &inf=std::use_facet(std::locale()); \ std::cout <<"Testing " #how " for " #Chr ", lang="<(source_s),to(dest_s)); \ std::locale::global(tmp); \ } \ }while(0) TEST_ALL_CASES; #undef TEST_V #define TEST_V(how,source_s,dest_s) TEST_A(wchar_t,how,to(source_s),to(dest_s)) TEST_ALL_CASES; #undef TEST_V #ifdef BOOST_HAS_CHAR16_T #define TEST_V(how,source_s,dest_s) TEST_A(char16_t,how,to(source_s),to(dest_s)) TEST_ALL_CASES; #undef TEST_V #endif #ifdef BOOST_HAS_CHAR32_T #define TEST_V(how,source_s,dest_s) TEST_A(char32_t,how,to(source_s),to(dest_s)) TEST_ALL_CASES; #undef TEST_V #endif } catch(std::exception const &e) { std::cerr << "Failed " << e.what() << std::endl; return EXIT_FAILURE; } FINALIZE(); } #endif // NO ICU // vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 // boostinspect:noascii