//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // REQUIRES: locale.ru_RU.UTF-8 // REQUIRES: locale.zh_CN.UTF-8 // // explicit locale(const char* std_name); #include #include #include #include "count_new.hpp" #include "platform_support.h" // locale name macros #include "test_macros.h" void check(const std::locale& loc) { assert(std::has_facet >(loc)); assert(std::has_facet >(loc)); assert(std::has_facet >(loc)); assert(std::has_facet >(loc)); assert((std::has_facet >(loc))); assert((std::has_facet >(loc))); assert((std::has_facet >(loc))); assert((std::has_facet >(loc))); assert((std::has_facet >(loc))); assert((std::has_facet >(loc))); assert((std::has_facet >(loc))); assert((std::has_facet >(loc))); assert((std::has_facet >(loc))); assert((std::has_facet >(loc))); assert((std::has_facet >(loc))); assert((std::has_facet >(loc))); assert((std::has_facet >(loc))); assert((std::has_facet >(loc))); assert((std::has_facet >(loc))); assert((std::has_facet >(loc))); assert((std::has_facet >(loc))); assert((std::has_facet >(loc))); assert((std::has_facet >(loc))); assert((std::has_facet >(loc))); assert((std::has_facet >(loc))); assert((std::has_facet >(loc))); } int main() { { std::locale loc(LOCALE_ru_RU_UTF_8); check(loc); std::locale loc2(LOCALE_ru_RU_UTF_8); check(loc2); assert(loc == loc2); std::locale loc3(LOCALE_zh_CN_UTF_8); check(loc3); assert(!(loc == loc3)); assert(loc != loc3); #ifndef TEST_HAS_NO_EXCEPTIONS try { std::locale((const char*)0); assert(false); } catch (std::runtime_error&) { } try { std::locale("spazbot"); assert(false); } catch (std::runtime_error&) { } #endif std::locale ok(""); } assert(globalMemCounter.checkOutstandingNewEq(0)); }