summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support/raw_ostream_test.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2015-01-26 18:21:33 +0000
committerZachary Turner <zturner@google.com>2015-01-26 18:21:33 +0000
commit39571b37a38d289f0895ca060eb1d6f579300af6 (patch)
tree7110e3b78682eba2d4c67dc1864f8a4e9ddffd65 /llvm/unittests/Support/raw_ostream_test.cpp
parent6ffc9bf6bafcb129300cac7ba333940609bf87c3 (diff)
downloadbcm5719-llvm-39571b37a38d289f0895ca060eb1d6f579300af6.tar.gz
bcm5719-llvm-39571b37a38d289f0895ca060eb1d6f579300af6.zip
Teach raw_ostream to support hex formatting without a prefix '0x'.
Previously using format_hex() would always print a 0x prior to the hex characters. This allows this to be optional, so that one can choose to print (e.g.) 255 as either 0xFF or just FF. Differential Revision: http://reviews.llvm.org/D7151 llvm-svn: 227108
Diffstat (limited to 'llvm/unittests/Support/raw_ostream_test.cpp')
-rw-r--r--llvm/unittests/Support/raw_ostream_test.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/unittests/Support/raw_ostream_test.cpp b/llvm/unittests/Support/raw_ostream_test.cpp
index 39cfaf004c7..ff986025b2c 100644
--- a/llvm/unittests/Support/raw_ostream_test.cpp
+++ b/llvm/unittests/Support/raw_ostream_test.cpp
@@ -162,6 +162,8 @@ TEST(raw_ostreamTest, FormatHex) {
EXPECT_EQ("0x1", printToString(format_hex(1, 3), 3));
EXPECT_EQ("0x12", printToString(format_hex(0x12, 3), 4));
EXPECT_EQ("0x123", printToString(format_hex(0x123, 3), 5));
+ EXPECT_EQ("FF", printToString(format_hex_no_prefix(0xFF, 2, true), 4));
+ EXPECT_EQ("ABCD", printToString(format_hex_no_prefix(0xABCD, 2, true), 4));
EXPECT_EQ("0xffffffffffffffff",
printToString(format_hex(UINT64_MAX, 18), 18));
EXPECT_EQ("0x8000000000000000",
OpenPOWER on IntegriCloud