Fix bad locale test data when using the newest glibc

llvm-svn: 280608
This commit is contained in:
Eric Fiselier 2016-09-04 00:48:54 +00:00
parent 82216f0faa
commit f49fe8f2b6
2 changed files with 15 additions and 0 deletions

View File

@ -24,6 +24,7 @@
#include <limits> #include <limits>
#include <cassert> #include <cassert>
#include "test_macros.h"
#include "platform_support.h" // locale name macros #include "platform_support.h" // locale name macros
class Fnf class Fnf
@ -113,7 +114,14 @@ int main()
{ {
Fnf f(LOCALE_ru_RU_UTF_8, 1); Fnf f(LOCALE_ru_RU_UTF_8, 1);
// GLIBC <= 2.23 uses currency_symbol="<U0440><U0443><U0431>"
// GLIBC >= 2.24 uses currency_symbol="<U20BD>"
// See also: http://www.fileformat.info/info/unicode/char/20bd/index.htm
#if defined(TEST_GLIBC_PREREQ) && TEST_GLIBC_PREREQ(2, 24)
assert(f.curr_symbol() == " \xE2\x82\xBD");
#else
assert(f.curr_symbol() == " \xD1\x80\xD1\x83\xD0\xB1"); assert(f.curr_symbol() == " \xD1\x80\xD1\x83\xD0\xB1");
#endif
} }
{ {
Fnt f(LOCALE_ru_RU_UTF_8, 1); Fnt f(LOCALE_ru_RU_UTF_8, 1);

View File

@ -62,6 +62,13 @@
#endif #endif
#endif #endif
// Attempt to deduce GCC version
#if defined(_LIBCPP_VERSION) && __has_include(<features.h>)
#include <features.h>
#define TEST_HAS_GLIBC
#define TEST_GLIBC_PREREQ(major, minor) __GLIBC_PREREQ(major, minor)
#endif
/* Features that were introduced in C++14 */ /* Features that were introduced in C++14 */
#if TEST_STD_VER >= 14 #if TEST_STD_VER >= 14
#define TEST_HAS_EXTENDED_CONSTEXPR #define TEST_HAS_EXTENDED_CONSTEXPR