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

Side by Side Diff: base/mac/foundation_util_unittest.mm

Issue 1467003002: Switch to static_assert in base/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: / Created 5 years 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 unified diff | Download patch
« no previous file with comments | « base/logging.h ('k') | base/macros.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/mac/foundation_util.h" 5 #include "base/mac/foundation_util.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/format_macros.h" 10 #include "base/format_macros.h"
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 ScopedCFTypeRef<CFNumberRef> cf_one( 274 ScopedCFTypeRef<CFNumberRef> cf_one(
275 CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &one)); 275 CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &one));
276 ScopedCFTypeRef<CFNumberRef> cf_two( 276 ScopedCFTypeRef<CFNumberRef> cf_two(
277 CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &two)); 277 CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &two));
278 ScopedCFTypeRef<CFNumberRef> cf_three( 278 ScopedCFTypeRef<CFNumberRef> cf_three(
279 CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &three)); 279 CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &three));
280 280
281 CFStringRef keys[] = { CFSTR("one"), CFSTR("two"), CFSTR("three") }; 281 CFStringRef keys[] = { CFSTR("one"), CFSTR("two"), CFSTR("three") };
282 CFNumberRef values[] = { cf_one, cf_two, cf_three }; 282 CFNumberRef values[] = { cf_one, cf_two, cf_three };
283 283
284 COMPILE_ASSERT(arraysize(keys) == arraysize(values), 284 static_assert(arraysize(keys) == arraysize(values),
285 keys_and_values_arraysizes_are_different); 285 "keys and values arrays must have the same size");
286 286
287 ScopedCFTypeRef<CFDictionaryRef> test_dict( 287 ScopedCFTypeRef<CFDictionaryRef> test_dict(
288 CFDictionaryCreate(kCFAllocatorDefault, 288 CFDictionaryCreate(kCFAllocatorDefault,
289 reinterpret_cast<const void**>(keys), 289 reinterpret_cast<const void**>(keys),
290 reinterpret_cast<const void**>(values), 290 reinterpret_cast<const void**>(values),
291 arraysize(values), 291 arraysize(values),
292 &kCFCopyStringDictionaryKeyCallBacks, 292 &kCFCopyStringDictionaryKeyCallBacks,
293 &kCFTypeDictionaryValueCallBacks)); 293 &kCFTypeDictionaryValueCallBacks));
294 294
295 // GetValueFromDictionary<>(_, _) should produce the correct 295 // GetValueFromDictionary<>(_, _) should produce the correct
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 for (size_t i = 0; i < arraysize(nsuinteger_cases); ++i) { 394 for (size_t i = 0; i < arraysize(nsuinteger_cases); ++i) {
395 EXPECT_EQ(nsuinteger_cases[i].expected, 395 EXPECT_EQ(nsuinteger_cases[i].expected,
396 StringPrintf("%" PRIuNS, nsuinteger_cases[i].value)); 396 StringPrintf("%" PRIuNS, nsuinteger_cases[i].value));
397 EXPECT_EQ(nsuinteger_cases[i].expected_hex, 397 EXPECT_EQ(nsuinteger_cases[i].expected_hex,
398 StringPrintf("%" PRIxNS, nsuinteger_cases[i].value)); 398 StringPrintf("%" PRIxNS, nsuinteger_cases[i].value));
399 } 399 }
400 } 400 }
401 401
402 } // namespace mac 402 } // namespace mac
403 } // namespace base 403 } // namespace base
OLDNEW
« no previous file with comments | « base/logging.h ('k') | base/macros.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698