Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(593)

Unified Diff: base/mac/foundation_util_unittest.mm

Issue 187793003: Define print format macros for NSInteger & NSUInteger (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re-upload Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« base/format_macros.h ('K') | « base/format_macros.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/mac/foundation_util_unittest.mm
diff --git a/base/mac/foundation_util_unittest.mm b/base/mac/foundation_util_unittest.mm
index 3b72b1225a84e1ab78c9ccd7d27f63004274e297..28a1c264a9b97e23a3cf9230dd2aef57a14149c1 100644
--- a/base/mac/foundation_util_unittest.mm
+++ b/base/mac/foundation_util_unittest.mm
@@ -6,8 +6,10 @@
#include "base/basictypes.h"
#include "base/files/file_path.h"
+#include "base/format_macros.h"
#include "base/mac/scoped_cftyperef.h"
#include "base/mac/scoped_nsautorelease_pool.h"
+#include "base/strings/stringprintf.h"
#include "testing/gtest/include/gtest/gtest.h"
#import "testing/gtest_mac.h"
@@ -314,5 +316,13 @@ TEST(FoundationUtilTest, NSStringToFilePath) {
EXPECT_EQ(FilePath("/a/b"), NSStringToFilePath(@"/a/b"));
}
+TEST(StringNumberConversionsTest, FormatNSInteger) {
+ const NSInteger kNSInteger = 12345678;
+ const NSUInteger kNSUInteger = 12345678u;
+ EXPECT_EQ("12345678", StringPrintf("%" PRIdNS, kNSInteger));
Mark Mentovai 2014/03/06 14:44:57 Test that PRIdNS formats negative signed numbers p
sdefresne 2014/03/06 16:27:05 Done.
+ EXPECT_EQ("12345678", StringPrintf("%" PRIuNS, kNSUInteger));
+ EXPECT_EQ("bc614e", StringPrintf("%" PRIxNS, kNSInteger));
+}
Mark Mentovai 2014/03/06 14:44:57 #ifdef __LP64__, do a couple of tests with things
sdefresne 2014/03/06 16:27:05 Done.
+
} // namespace mac
} // namespace base
« base/format_macros.h ('K') | « base/format_macros.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698