wchar_test.cpp: fix error between comparison signed and unsigned integer

when compile the cts package with aarch64 gcc4.9, will get following error:
bionic/tests/wchar_test.cpp:253:3: required from here
external/gtest/include/gtest/gtest.h:1448:16:
    error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]

this change fix it by using static_cast<wchar_t> as suggested by Calin Juravle

Change-Id: I7fb9506e7b84b8a12b9d003458d4f0e78554c3cd
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
This commit is contained in:
Yongqin Liu 2014-05-08 23:21:01 +08:00
parent 100168abff
commit a5c6b2ecb5

View File

@ -250,13 +250,13 @@ TEST(wchar, mbrtowc) {
ASSERT_EQ(L'a', out[0]);
// 2-byte UTF-8.
ASSERT_EQ(2U, mbrtowc(out, "\xc2\xa2" "cdef", 6, NULL));
ASSERT_EQ(0x00a2, out[0]);
ASSERT_EQ(static_cast<wchar_t>(0x00a2), out[0]);
// 3-byte UTF-8.
ASSERT_EQ(3U, mbrtowc(out, "\xe2\x82\xac" "def", 6, NULL));
ASSERT_EQ(0x20ac, out[0]);
ASSERT_EQ(static_cast<wchar_t>(0x20ac), out[0]);
// 4-byte UTF-8.
ASSERT_EQ(4U, mbrtowc(out, "\xf0\xa4\xad\xa2" "ef", 6, NULL));
ASSERT_EQ(0x24b62, out[0]);
ASSERT_EQ(static_cast<wchar_t>(0x24b62), out[0]);
#if __BIONIC__ // glibc allows this.
// Illegal 5-byte UTF-8.
ASSERT_EQ(static_cast<size_t>(-1), mbrtowc(out, "\xf8\xa1\xa2\xa3\xa4" "f", 6, NULL));