From ee178bfb794d16d6c5a35f424b28c8ebb83e1581 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Fri, 12 Jul 2013 11:25:20 -0700 Subject: [PATCH] Add a trivial gmtime(3) test. Change-Id: I849f200a455cd6971646fa45766ab22ba19fb866 --- tests/time_test.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/time_test.cpp b/tests/time_test.cpp index 9a5a70670..0ad4763a1 100644 --- a/tests/time_test.cpp +++ b/tests/time_test.cpp @@ -42,3 +42,15 @@ TEST(time, mktime_tz) { ASSERT_EQ(2678400, mktime_tz(&epoch, "PST")); } #endif + +TEST(time, gmtime) { + time_t t = 0; + tm* broken_down = gmtime(&t); + ASSERT_TRUE(broken_down != NULL); + ASSERT_EQ(0, broken_down->tm_sec); + ASSERT_EQ(0, broken_down->tm_min); + ASSERT_EQ(0, broken_down->tm_hour); + ASSERT_EQ(1, broken_down->tm_mday); + ASSERT_EQ(0, broken_down->tm_mon); + ASSERT_EQ(1970, broken_down->tm_year + 1900); +}