test: wchar_t might be "unsigned short" for Win32 targets.

This commit is contained in:
NAKAMURA Takumi
2011-04-25 16:00:30 +09:00
parent 79356f49bd
commit ae185c2977
4 changed files with 18 additions and 0 deletions

View File

@@ -30,7 +30,11 @@ int main()
test<char, std::numeric_limits<char>::is_signed ? 7 : 8>();
test<signed char, 7>();
test<unsigned char, 8>();
#if _WIN32
test<wchar_t, 16>();
#else
test<wchar_t, std::numeric_limits<wchar_t>::is_signed ? 31 : 32>();
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t, 16>();
test<char32_t, 32>();

View File

@@ -34,7 +34,11 @@ int main()
test<char, 2>();
test<signed char, 2>();
test<unsigned char, 2>();
#ifdef _WIN32
test<wchar_t, 4>();
#else
test<wchar_t, 9>();
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t, 4>();
test<char32_t, 9>();

View File

@@ -34,8 +34,13 @@ int main()
static_assert((std::is_same<std::make_signed<unsigned long>::type, long>::value), "");
static_assert((std::is_same<std::make_signed<long long>::type, signed long long>::value), "");
static_assert((std::is_same<std::make_signed<unsigned long long>::type, signed long long>::value), "");
#if _WIN32
static_assert((std::is_same<std::make_signed<wchar_t>::type, short>::value), "");
static_assert((std::is_same<std::make_signed<const wchar_t>::type, const short>::value), "");
#else
static_assert((std::is_same<std::make_signed<wchar_t>::type, int>::value), "");
static_assert((std::is_same<std::make_signed<const wchar_t>::type, const int>::value), "");
#endif
static_assert((std::is_same<std::make_signed<const Enum>::type, const int>::value), "");
static_assert((std::is_same<std::make_signed<BigEnum>::type,
std::conditional<sizeof(long) == 4, long long, long>::type>::value), "");

View File

@@ -34,8 +34,13 @@ int main()
static_assert((std::is_same<std::make_unsigned<unsigned long>::type, unsigned long>::value), "");
static_assert((std::is_same<std::make_unsigned<long long>::type, unsigned long long>::value), "");
static_assert((std::is_same<std::make_unsigned<unsigned long long>::type, unsigned long long>::value), "");
#if _WIN32
static_assert((std::is_same<std::make_unsigned<wchar_t>::type, unsigned short>::value), "");
static_assert((std::is_same<std::make_unsigned<const wchar_t>::type, const unsigned short>::value), "");
#else
static_assert((std::is_same<std::make_unsigned<wchar_t>::type, unsigned int>::value), "");
static_assert((std::is_same<std::make_unsigned<const wchar_t>::type, const unsigned int>::value), "");
#endif
static_assert((std::is_same<std::make_unsigned<const Enum>::type, const unsigned int>::value), "");
static_assert((std::is_same<std::make_unsigned<BigEnum>::type,
std::conditional<sizeof(long) == 4, unsigned long long, unsigned long>::type>::value), "");