void test_char()
{
    boost::locale::generator gen;

    std::cout << "- Testing at least C" << std::endl;

    std::locale l = gen("en_US.UTF-8");

    test_one<CharType>(l,"Hello World i","hello world i","HELLO WORLD I");

    std::string name;

    name = get_std_name("en_US.UTF-8");
    if(!name.empty()) {
        std::cout << "- Testing " << name << std::endl;
        std::locale l=gen(name);
        test_one<CharType>(l,"Façade","façade","FAÇADE");
    }
    else {
        std::cout << "- en_US.UTF-8 is not supported, skipping" << std::endl;
    }

    name = get_std_name("en_US.ISO8859-1");
    if(!name.empty()) {
        std::cout << "Testing " << name << std::endl;
        std::locale l=gen(name);
        test_one<CharType>(l,"Hello World","hello world","HELLO WORLD");
        test_one<CharType>(l,"Façade","façade","FAÇADE");
    }
    else {
        std::cout << "- en_US.ISO8859-1 is not supported, skipping" << std::endl;
    }
    std::string real_name;
    name = get_std_name("tr_TR.UTF-8",&real_name);
    if(!name.empty()) {
        std::cout << "Testing " << name << std::endl;
        if(std::use_facet<std::ctype<wchar_t> >(std::locale(real_name.c_str())).toupper(L'i')!=L'I') {
            std::locale l=gen(name);
            test_one<CharType>(l,"i","i","İ");
        }
        else {
            std::cout << "Standard library does not support this locale's case conversion correctly" << std::endl;
        }
    }
    else 
    {
        std::cout << "- tr_TR.UTF-8 is not supported, skipping" << std::endl;
    }
}
Exemple #2
0
void test_char()
{
    booster::locale::generator gen;

    std::cout << "- Testing at least C" << std::endl;

    std::locale l = gen("en_US.UTF-8");

    test_one<CharType>(l,"a","b",-1);
    test_one<CharType>(l,"a","a",0);

    std::string name;

    std::string names[] = { "en_US.UTF-8", "en_US.ISO8859-1" };
    for(unsigned i=0; i<sizeof(names)/sizeof(names[0]); i++) {
        name = get_std_name(names[i]);
        if(!name.empty()) {
            std::cout << "- Testing " << name << std::endl;
            std::locale l=gen(name);
            test_one<CharType>(l,"a","ç",-1);
            test_one<CharType>(l,"ç","d",-1);
        }
        else {
            std::cout << "- " << names[i] << " not supported, skipping" << std::endl;
        }
    }
}
void test_char()
{
    booster::locale::generator gen;
    
    std::cout << "- Testing at least C" << std::endl;

    std::locale l = gen("en_US.UTF-8");

    test_one<CharType>(l,"a","b",-1);
    test_one<CharType>(l,"a","a",0);

    std::string name;

    #if defined(_LIBCPP_VERSION) && (defined(__APPLE__) || defined(__FreeBSD__))
    std::cout << "- Collation is broken on this OS's standard C++ library, skipping" << std::endl;
    #else
    std::string names[] = { "en_US.UTF-8", "en_US.ISO8859-1" };
    for(unsigned i=0;i<sizeof(names)/sizeof(names[0]);i++) {
        name = get_std_name(names[i]);
        if(!name.empty()) {
            std::cout << "- Testing " << name << std::endl;
            std::locale l=gen(name);
            test_one<CharType>(l,"a","ç",-1);
            test_one<CharType>(l,"ç","d",-1);
        }
        else {
            std::cout << "- " << names[i] << " not supported, skipping" << std::endl;
        }
    }
    #endif
}