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

Side by Side Diff: base/numerics/safe_numerics_unittest.cc

Issue 1553623002: Remove random lonely semicolons. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix formatting Created 4 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <limits> 8 #include <limits>
9 #include <type_traits> 9 #include <type_traits>
10 10
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 // Not floating to integral and... 343 // Not floating to integral and...
344 (!(DstLimits::is_integer && SrcLimits::is_iec559) && 344 (!(DstLimits::is_integer && SrcLimits::is_iec559) &&
345 // Same sign, same numeric, source is narrower or same. 345 // Same sign, same numeric, source is narrower or same.
346 ((SrcLimits::is_signed == DstLimits::is_signed && 346 ((SrcLimits::is_signed == DstLimits::is_signed &&
347 sizeof(Dst) >= sizeof(Src)) || 347 sizeof(Dst) >= sizeof(Src)) ||
348 // Or signed destination and source is smaller 348 // Or signed destination and source is smaller
349 (DstLimits::is_signed && sizeof(Dst) > sizeof(Src)))), 349 (DstLimits::is_signed && sizeof(Dst) > sizeof(Src)))),
350 "Comparison must be sign preserving and value preserving"); 350 "Comparison must be sign preserving and value preserving");
351 351
352 const CheckedNumeric<Dst> checked_dst = SrcLimits::max(); 352 const CheckedNumeric<Dst> checked_dst = SrcLimits::max();
353 ;
354 TEST_EXPECTED_VALIDITY(RANGE_VALID, checked_dst); 353 TEST_EXPECTED_VALIDITY(RANGE_VALID, checked_dst);
355 if (MaxExponent<Dst>::value > MaxExponent<Src>::value) { 354 if (MaxExponent<Dst>::value > MaxExponent<Src>::value) {
356 if (MaxExponent<Dst>::value >= MaxExponent<Src>::value * 2 - 1) { 355 if (MaxExponent<Dst>::value >= MaxExponent<Src>::value * 2 - 1) {
357 // At least twice larger type. 356 // At least twice larger type.
358 TEST_EXPECTED_VALIDITY(RANGE_VALID, SrcLimits::max() * checked_dst); 357 TEST_EXPECTED_VALIDITY(RANGE_VALID, SrcLimits::max() * checked_dst);
359 358
360 } else { // Larger, but not at least twice as large. 359 } else { // Larger, but not at least twice as large.
361 TEST_EXPECTED_VALIDITY(RANGE_OVERFLOW, SrcLimits::max() * checked_dst); 360 TEST_EXPECTED_VALIDITY(RANGE_OVERFLOW, SrcLimits::max() * checked_dst);
362 TEST_EXPECTED_VALIDITY(RANGE_VALID, checked_dst + 1); 361 TEST_EXPECTED_VALIDITY(RANGE_VALID, checked_dst + 1);
363 } 362 }
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 776
778 CheckedNumeric<int> too_large = std::numeric_limits<int>::max(); 777 CheckedNumeric<int> too_large = std::numeric_limits<int>::max();
779 EXPECT_TRUE(too_large.IsValid()); 778 EXPECT_TRUE(too_large.IsValid());
780 too_large += d; 779 too_large += d;
781 EXPECT_FALSE(too_large.IsValid()); 780 EXPECT_FALSE(too_large.IsValid());
782 too_large -= d; 781 too_large -= d;
783 EXPECT_FALSE(too_large.IsValid()); 782 EXPECT_FALSE(too_large.IsValid());
784 too_large /= d; 783 too_large /= d;
785 EXPECT_FALSE(too_large.IsValid()); 784 EXPECT_FALSE(too_large.IsValid());
786 } 785 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/libgtk2ui/gtk2_ui.cc » ('j') | remoting/host/it2me/it2me_native_messaging_host.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698