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

Unified Diff: trunk/src/base/mac/foundation_util_unittest.mm

Issue 192023002: Revert 255755 "Define print format macros for NSInteger & NSUInt..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: 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
« no previous file with comments | « trunk/src/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: trunk/src/base/mac/foundation_util_unittest.mm
===================================================================
--- trunk/src/base/mac/foundation_util_unittest.mm (revision 255780)
+++ trunk/src/base/mac/foundation_util_unittest.mm (working copy)
@@ -5,12 +5,9 @@
#include "base/mac/foundation_util.h"
#include "base/basictypes.h"
-#include "base/compiler_specific.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"
@@ -317,69 +314,5 @@
EXPECT_EQ(FilePath("/a/b"), NSStringToFilePath(@"/a/b"));
}
-TEST(StringNumberConversionsTest, FormatNSInteger) {
- // The PRI[dxu]NS macro assumes that NSInteger is a typedef to "int" on
- // 32-bit architecture and a typedef to "long" on 64-bit architecture
- // (respectively "unsigned int" and "unsigned long" for NSUInteger). Use
- // pointer incompatibility to validate this at compilation.
-#if defined(ARCH_CPU_64_BITS)
- typedef long FormatNSIntegerAsType;
- typedef unsigned long FormatNSUIntegerAsType;
-#else
- typedef int FormatNSIntegerAsType;
- typedef unsigned int FormatNSUIntegerAsType;
-#endif // defined(ARCH_CPU_64_BITS)
-
- NSInteger some_nsinteger;
- FormatNSIntegerAsType* pointer_to_some_nsinteger ALLOW_UNUSED =
- &some_nsinteger;
-
- NSUInteger some_nsuinteger;
- FormatNSUIntegerAsType* pointer_to_some_nsuinteger ALLOW_UNUSED =
- &some_nsuinteger;
-
- // Check that format specifier works correctly for NSInteger.
- const struct {
- NSInteger value;
- const char* expected;
- const char* expected_hex;
- } nsinteger_cases[] = {
- {12345678, "12345678", "bc614e"},
- {-12345678, "-12345678", "ff439eb2"},
-#if defined(ARCH_CPU_64_BITS)
- {137451299150l, "137451299150", "2000bc614e"},
- {-137451299150l, "-137451299150", "ffffffdfff439eb2"},
-#endif
- };
-
- for (size_t i = 0; i < arraysize(nsinteger_cases); ++i) {
- EXPECT_EQ(nsinteger_cases[i].expected,
- StringPrintf("%" PRIdNS, nsinteger_cases[i].value));
- EXPECT_EQ(nsinteger_cases[i].expected_hex,
- StringPrintf("%" PRIxNS, nsinteger_cases[i].value));
- }
-
- // Check that format specifier works correctly for NSUInteger.
- const struct {
- NSUInteger value;
- const char* expected;
- const char* expected_hex;
- } nsuinteger_cases[] = {
- {12345678u, "12345678", "bc614e"},
- {4282621618u, "4282621618", "ff439eb2"},
-#if defined(ARCH_CPU_64_BITS)
- {137451299150ul, "137451299150", "2000bc614e"},
- {18446743936258252466ul, "18446743936258252466", "ffffffdfff439eb2"},
-#endif
- };
-
- for (size_t i = 0; i < arraysize(nsuinteger_cases); ++i) {
- EXPECT_EQ(nsuinteger_cases[i].expected,
- StringPrintf("%" PRIuNS, nsuinteger_cases[i].value));
- EXPECT_EQ(nsuinteger_cases[i].expected_hex,
- StringPrintf("%" PRIxNS, nsuinteger_cases[i].value));
- }
-}
-
} // namespace mac
} // namespace base
« no previous file with comments | « trunk/src/base/format_macros.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698