aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/ADT/TwineTest.cpp
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
commit9650f0678c8542eb77b043b92d093b3f9af2484d (patch)
tree33046b499d38b883c7fff324d059ad437409111b /llvm/unittests/ADT/TwineTest.cpp
parent73a9eb9f815896ac8d766101eeb7f3c32f77257d (diff)
downloadllvm-9650f0678c8542eb77b043b92d093b3f9af2484d.zip
llvm-9650f0678c8542eb77b043b92d093b3f9af2484d.tar.gz
llvm-9650f0678c8542eb77b043b92d093b3f9af2484d.tar.bz2
Add Twine support for characters, and switch twine to use a union internally
to eliminate some casting. llvm-svn: 135888
Diffstat (limited to 'llvm/unittests/ADT/TwineTest.cpp')
-rw-r--r--llvm/unittests/ADT/TwineTest.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/unittests/ADT/TwineTest.cpp b/llvm/unittests/ADT/TwineTest.cpp
index 57f54cb..e9cc41d 100644
--- a/llvm/unittests/ADT/TwineTest.cpp
+++ b/llvm/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.