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

Side by Side Diff: tests/Time.cpp

Issue 714633002: Fix SkTime::GetDateTime Posix implementation, add unit test. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: limit the year check in the test to the next 50 years Created 6 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 unified diff | Download patch
« no previous file with comments | « src/ports/SkTime_Unix.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2014 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "SkTime.h"
9 #include "Test.h"
10
11 // Sanity checks for the GetDateTime function.
12 DEF_TEST(Time_GetDateTime, r) {
13 SkTime::DateTime dateTime;
14 SkTime::GetDateTime(&dateTime);
15
16 // TODO(future generation): update these values.
17 const uint16_t kMinimumSaneYear = 2014;
18 const uint16_t kMaximumSaneYear = 2064;
19 REPORTER_ASSERT(r, dateTime.fYear >= kMinimumSaneYear);
20 REPORTER_ASSERT(r, dateTime.fYear <= kMaximumSaneYear);
21
22 REPORTER_ASSERT(r, dateTime.fMonth >= 1);
23 REPORTER_ASSERT(r, dateTime.fMonth <= 12);
24
25 REPORTER_ASSERT(r, dateTime.fDay >= 1);
26 REPORTER_ASSERT(r, dateTime.fDay <= 31);
27
28 REPORTER_ASSERT(r, dateTime.fHour <= 23);
29
30 REPORTER_ASSERT(r, dateTime.fMinute <= 59);
31
32 REPORTER_ASSERT(r, dateTime.fSecond <= 60); // leap seconds are 23:59:60
33 }
OLDNEW
« no previous file with comments | « src/ports/SkTime_Unix.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698