summaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-07-24 20:44:30 +0000
committerChris Lattner <sabre@nondot.org>2011-07-24 20:44:30 +0000
commit3f25ee080ca7c92ff735df29c78e7cfbd62c8cb6 (patch)
tree1ce36f8ed1dd65ad62ed8d42137704321f80dc23 /unittests
parent81d686edbe6effe624add9394673bd571d89bfb7 (diff)
downloadllvm-3f25ee080ca7c92ff735df29c78e7cfbd62c8cb6.tar.gz
llvm-3f25ee080ca7c92ff735df29c78e7cfbd62c8cb6.tar.bz2
llvm-3f25ee080ca7c92ff735df29c78e7cfbd62c8cb6.tar.xz
Add Twine support for characters, and switch twine to use a union internally
to eliminate some casting. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135888 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/ADT/TwineTest.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/unittests/ADT/TwineTest.cpp b/unittests/ADT/TwineTest.cpp
index 57f54cb006..e9cc41d13f 100644
--- a/unittests/ADT/TwineTest.cpp
+++ b/unittests/ADT/TwineTest.cpp
@@ -37,12 +37,16 @@ TEST(TwineTest, Numbers) {
EXPECT_EQ("-123", Twine(-123).str());
EXPECT_EQ("123", Twine(123).str());
EXPECT_EQ("-123", Twine(-123).str());
- EXPECT_EQ("123", Twine((char) 123).str());
- EXPECT_EQ("-123", Twine((signed char) -123).str());
EXPECT_EQ("7b", Twine::utohexstr(123).str());
}
+TEST(TwineTest, Characters) {
+ EXPECT_EQ("x", Twine('x').str());
+ EXPECT_EQ("x", Twine(static_cast<unsigned char>('x')).str());
+ EXPECT_EQ("x", Twine(static_cast<signed char>('x')).str());
+}
+
TEST(TwineTest, Concat) {
// Check verse repr, since we care about the actual representation not just
// the result.