Index: tests/Time.cpp |
diff --git a/tests/Time.cpp b/tests/Time.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..65c01e26ffc2136e706fa941ceb57579cb85af30 |
--- /dev/null |
+++ b/tests/Time.cpp |
@@ -0,0 +1,33 @@ |
+/* |
+ * Copyright 2014 Google Inc. |
+ * |
+ * Use of this source code is governed by a BSD-style license that can be |
+ * found in the LICENSE file. |
+ */ |
+ |
+#include "SkTime.h" |
+#include "Test.h" |
+ |
+// Sanity checks for the GetDateTime function. |
+DEF_TEST(Time_GetDateTime, r) { |
+ SkTime::DateTime dateTime; |
+ SkTime::GetDateTime(&dateTime); |
+ |
+ // TODO(future generation): update these values. |
+ const uint16_t kMinimumSaneYear = 2014; |
+ const uint16_t kMaximumSaneYear = 2064; |
+ REPORTER_ASSERT(r, dateTime.fYear >= kMinimumSaneYear); |
+ REPORTER_ASSERT(r, dateTime.fYear <= kMaximumSaneYear); |
+ |
+ REPORTER_ASSERT(r, dateTime.fMonth >= 1); |
+ REPORTER_ASSERT(r, dateTime.fMonth <= 12); |
+ |
+ REPORTER_ASSERT(r, dateTime.fDay >= 1); |
+ REPORTER_ASSERT(r, dateTime.fDay <= 31); |
+ |
+ REPORTER_ASSERT(r, dateTime.fHour <= 23); |
+ |
+ REPORTER_ASSERT(r, dateTime.fMinute <= 59); |
+ |
+ REPORTER_ASSERT(r, dateTime.fSecond <= 60); // leap seconds are 23:59:60 |
+} |