Twines: Support numeric conversion directly (uitostr, etc).
 - Provides static constructors for doing number to string conversions without
   using temporaries.

 - There are several ways to do this, I think given the Twine constraints this
   is the simplest one.

 - One FIXME for fast number -> hex conversion.

 - Added another comment on one last major bit of perf work Twines need, which
   is to make raw_svector_ostream more efficient.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77445 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/unittests/ADT/TwineTest.cpp b/unittests/ADT/TwineTest.cpp
index 50fdd2e..dae5fa0 100644
--- a/unittests/ADT/TwineTest.cpp
+++ b/unittests/ADT/TwineTest.cpp
@@ -30,6 +30,18 @@
   EXPECT_EQ("hi", Twine(StringRef("hithere", 2)).str());
 }
 
+TEST(TwineTest, Numbers) {
+  EXPECT_EQ("123", Twine::utostr(123).str());
+  EXPECT_EQ("-123", Twine::itostr(-123).str());
+  EXPECT_EQ("123", Twine::utostr(123).str());
+  EXPECT_EQ("-123", Twine::itostr(-123).str());
+  EXPECT_EQ("123", Twine::utostr((char) 123).str());
+  EXPECT_EQ("-123", Twine::itostr((char) -123).str());
+
+  EXPECT_EQ("7B", Twine::utohexstr(123).str());
+  EXPECT_EQ("FFFFFFFFFFFFFF85", Twine::itohexstr(-123).str());
+}
+
 TEST(TwineTest, Concat) {
   // Check verse repr, since we care about the actual representation not just
   // the result.