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

Unified Diff: base/time/time_unittest.cc

Issue 2532243005: Fix more integer underflow cases in base::Time::FromExploded. (Closed)
Patch Set: Created 4 years, 1 month 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 | « base/time/time_posix.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/time/time_unittest.cc
diff --git a/base/time/time_unittest.cc b/base/time/time_unittest.cc
index a42d701f25a22d7c596888b5ad496b7851ba631b..2731a6272bbfc3297dafad3e794aed654024ba90 100644
--- a/base/time/time_unittest.cc
+++ b/base/time/time_unittest.cc
@@ -59,6 +59,11 @@ TEST(TimeTestOutOfBounds, FromExplodedOutOfBoundsTime) {
{{9840633, 1, 0, 1, 1, 1, 0, 0}, true},
// Underflow will fail as well.
{{-9840633, 1, 0, 1, 1, 1, 0, 0}, true},
+ // Test integer overflow and underflow cases for the values themselves.
+ {{std::numeric_limits<int>::min(), 1, 0, 1, 1, 1, 0, 0}, true},
+ {{std::numeric_limits<int>::max(), 1, 0, 1, 1, 1, 0, 0}, true},
+ {{2016, std::numeric_limits<int>::min(), 0, 1, 1, 1, 0, 0}, false},
+ {{2016, std::numeric_limits<int>::max(), 0, 1, 1, 1, 0, 0}, false},
};
for (const auto& test : kDateTestData) {
« no previous file with comments | « base/time/time_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698