1 #include "g_libntptest.h"
6 class humandateTest : public libntptest {
9 TEST_F(humandateTest, RegularTime) {
10 time_t sample = 1276601278;
11 std::ostringstream expected;
14 time = localtime(&sample);
15 ASSERT_TRUE(time != NULL);
17 expected << std::setfill('0')
18 << std::setw(2) << time->tm_hour << ":"
19 << std::setw(2) << time->tm_min << ":"
20 << std::setw(2) << time->tm_sec;
22 EXPECT_STREQ(expected.str().c_str(), humantime(sample));
25 TEST_F(humandateTest, CurrentTime) {
27 std::ostringstream expected;
32 time = localtime(&sample);
33 ASSERT_TRUE(time != NULL);
35 expected << std::setfill('0')
36 << std::setw(2) << time->tm_hour << ":"
37 << std::setw(2) << time->tm_min << ":"
38 << std::setw(2) << time->tm_sec;
40 EXPECT_STREQ(expected.str().c_str(), humantime(sample));