Commit bd8392ff authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[trac61] a bit more cleanup for tests. made it more robust for y2038 prob.

parent f8f81b7f
......@@ -107,14 +107,16 @@ testGetTime() {
const uint64_t YEAR10K_EVE = 253402300799LL;
TEST_F(DNSSECTimeTest, toText) {
// Check a basic case with the default (normal) gettimeFunction
// based on the "real current time".
// Note: this will fail after year 2078, but at that point we won't use
// this program anyway:-)
EXPECT_EQ("20100311233000", timeToText32(1268350200));
// Set the current time to: Feb 18 09:04:14 UTC 2012 (an arbitrary choice
// in the range of the first half of uint32 since epoch).
dnssectime::detail::gettimeFunction = testGetTime<1329555854LL>;
// Check some basic cases
EXPECT_EQ("19700101000000", timeToText32(0));
EXPECT_EQ("20100311233000", timeToText32(1268350200));
// Test the "year 2038" problem.
// Check the result of toText() for "INT_MIN" in int32_t. It's in the
// 68-year range from the faked current time, so the result should be
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment