diff options
author | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2012-06-07 20:34:34 +0000 |
---|---|---|
committer | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2012-06-07 20:34:34 +0000 |
commit | 6b625a794e8a0e314f3ccc2f6a892f4a40a7e788 (patch) | |
tree | 617807532cbbd68ce8e684a570791231b1b9cd92 /test/gtest-port_test.cc | |
parent | aa3c420019cb0215b00013cb94658a917ec4f712 (diff) | |
download | googletest-6b625a794e8a0e314f3ccc2f6a892f4a40a7e788.tar.gz |
Improves gtest's failure messages. In particulars, char pointers and
char arrays are not escapped properly.
git-svn-id: http://googletest.googlecode.com/svn/trunk@616 861a406c-534a-0410-8894-cb66d6ee9925
Diffstat (limited to 'test/gtest-port_test.cc')
-rw-r--r-- | test/gtest-port_test.cc | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/gtest-port_test.cc b/test/gtest-port_test.cc index 75471c3..dfbf029 100644 --- a/test/gtest-port_test.cc +++ b/test/gtest-port_test.cc @@ -61,6 +61,43 @@ using std::pair; namespace testing { namespace internal { +TEST(IsXDigitTest, WorksForNarrowAscii) { + EXPECT_TRUE(IsXDigit('0')); + EXPECT_TRUE(IsXDigit('9')); + EXPECT_TRUE(IsXDigit('A')); + EXPECT_TRUE(IsXDigit('F')); + EXPECT_TRUE(IsXDigit('a')); + EXPECT_TRUE(IsXDigit('f')); + + EXPECT_FALSE(IsXDigit('-')); + EXPECT_FALSE(IsXDigit('g')); + EXPECT_FALSE(IsXDigit('G')); +} + +TEST(IsXDigitTest, ReturnsFalseForNarrowNonAscii) { + EXPECT_FALSE(IsXDigit(static_cast<char>(0x80))); + EXPECT_FALSE(IsXDigit(static_cast<char>('0' | 0x80))); +} + +TEST(IsXDigitTest, WorksForWideAscii) { + EXPECT_TRUE(IsXDigit(L'0')); + EXPECT_TRUE(IsXDigit(L'9')); + EXPECT_TRUE(IsXDigit(L'A')); + EXPECT_TRUE(IsXDigit(L'F')); + EXPECT_TRUE(IsXDigit(L'a')); + EXPECT_TRUE(IsXDigit(L'f')); + + EXPECT_FALSE(IsXDigit(L'-')); + EXPECT_FALSE(IsXDigit(L'g')); + EXPECT_FALSE(IsXDigit(L'G')); +} + +TEST(IsXDigitTest, ReturnsFalseForWideNonAscii) { + EXPECT_FALSE(IsXDigit(static_cast<wchar_t>(0x80))); + EXPECT_FALSE(IsXDigit(static_cast<wchar_t>(L'0' | 0x80))); + EXPECT_FALSE(IsXDigit(static_cast<wchar_t>(L'0' | 0x100))); +} + class Base { public: // Copy constructor and assignment operator do exactly what we need, so we |