Commit 568dba34 authored by zhujiashun's avatar zhujiashun

remove unnecessary comments & using DISABLE_* to disable corresponding UTs

parent 4233593d
...@@ -215,21 +215,6 @@ bool Time::FromStringInternal(const char* time_string, ...@@ -215,21 +215,6 @@ bool Time::FromStringInternal(const char* time_string,
// TODO(zhujiashun): after removing nspr, this function // TODO(zhujiashun): after removing nspr, this function
// is left unimplemented. // is left unimplemented.
return false; return false;
// DCHECK((time_string != NULL) && (parsed_time != NULL));
// if (time_string[0] == '\0')
// return false;
// PRTime result_time = 0;
// PRStatus result = PR_ParseTimeString(time_string,
// is_local ? PR_FALSE : PR_TRUE,
// &result_time);
// if (PR_SUCCESS != result)
// return false;
// result_time += kTimeTToMicrosecondsOffset;
// *parsed_time = Time(result_time);
// return true;
} }
// Local helper class to hold the conversion from Time to TickTime at the // Local helper class to hold the conversion from Time to TickTime at the
......
...@@ -162,203 +162,203 @@ TEST_F(TimeTest, LocalMidnight) { ...@@ -162,203 +162,203 @@ TEST_F(TimeTest, LocalMidnight) {
} }
// TODO(zhujiashun): Time::FromString is not implemented after removing nspr, // TODO(zhujiashun): Time::FromString is not implemented after removing nspr,
// so all tests related to this function is commented out. Uncomment those // so all tests using this function is disabled. Enable those tests once
// tests once Time::FromString is implemented. // Time::FromString is implemented.
// TEST_F(TimeTest, ParseTimeTest1) { TEST_F(TimeTest, DISABLED_ParseTimeTest1) {
// time_t current_time = 0; time_t current_time = 0;
// time(&current_time); time(&current_time);
//
// const int BUFFER_SIZE = 64; const int BUFFER_SIZE = 64;
// struct tm local_time; struct tm local_time;
// memset(&local_time, 0, sizeof(local_time)); memset(&local_time, 0, sizeof(local_time));
// char time_buf[BUFFER_SIZE] = {0}; char time_buf[BUFFER_SIZE] = {0};
// #if defined(OS_WIN) #if defined(OS_WIN)
// localtime_s(&local_time, &current_time); localtime_s(&local_time, &current_time);
// asctime_s(time_buf, arraysize(time_buf), &local_time); asctime_s(time_buf, arraysize(time_buf), &local_time);
// #elif defined(OS_POSIX) #elif defined(OS_POSIX)
// localtime_r(&current_time, &local_time); localtime_r(&current_time, &local_time);
// asctime_r(&local_time, time_buf); asctime_r(&local_time, time_buf);
// #endif #endif
//
// Time parsed_time; Time parsed_time;
// EXPECT_TRUE(Time::FromString(time_buf, &parsed_time)); EXPECT_TRUE(Time::FromString(time_buf, &parsed_time));
// EXPECT_EQ(current_time, parsed_time.ToTimeT()); EXPECT_EQ(current_time, parsed_time.ToTimeT());
// } }
//
// TEST_F(TimeTest, DayOfWeekSunday) { TEST_F(TimeTest, DISABLED_DayOfWeekSunday) {
// Time time; Time time;
// EXPECT_TRUE(Time::FromString("Sun, 06 May 2012 12:00:00 GMT", &time)); EXPECT_TRUE(Time::FromString("Sun, 06 May 2012 12:00:00 GMT", &time));
// Time::Exploded exploded; Time::Exploded exploded;
// time.UTCExplode(&exploded); time.UTCExplode(&exploded);
// EXPECT_EQ(0, exploded.day_of_week); EXPECT_EQ(0, exploded.day_of_week);
// } }
//
// TEST_F(TimeTest, DayOfWeekWednesday) { TEST_F(TimeTest, DISABLED_DayOfWeekWednesday) {
// Time time; Time time;
// EXPECT_TRUE(Time::FromString("Wed, 09 May 2012 12:00:00 GMT", &time)); EXPECT_TRUE(Time::FromString("Wed, 09 May 2012 12:00:00 GMT", &time));
// Time::Exploded exploded; Time::Exploded exploded;
// time.UTCExplode(&exploded); time.UTCExplode(&exploded);
// EXPECT_EQ(3, exploded.day_of_week); EXPECT_EQ(3, exploded.day_of_week);
// } }
//
// TEST_F(TimeTest, DayOfWeekSaturday) { TEST_F(TimeTest, DISABLED_DayOfWeekSaturday) {
// Time time; Time time;
// EXPECT_TRUE(Time::FromString("Sat, 12 May 2012 12:00:00 GMT", &time)); EXPECT_TRUE(Time::FromString("Sat, 12 May 2012 12:00:00 GMT", &time));
// Time::Exploded exploded; Time::Exploded exploded;
// time.UTCExplode(&exploded); time.UTCExplode(&exploded);
// EXPECT_EQ(6, exploded.day_of_week); EXPECT_EQ(6, exploded.day_of_week);
// } }
//
// TEST_F(TimeTest, ParseTimeTest2) { TEST_F(TimeTest, DISABLED_ParseTimeTest2) {
// Time parsed_time; Time parsed_time;
// EXPECT_TRUE(Time::FromString("Mon, 15 Oct 2007 19:45:00 GMT", &parsed_time)); EXPECT_TRUE(Time::FromString("Mon, 15 Oct 2007 19:45:00 GMT", &parsed_time));
// EXPECT_EQ(comparison_time_pdt_, parsed_time); EXPECT_EQ(comparison_time_pdt_, parsed_time);
// } }
//
// TEST_F(TimeTest, ParseTimeTest3) { TEST_F(TimeTest, DISABLED_ParseTimeTest3) {
// Time parsed_time; Time parsed_time;
// EXPECT_TRUE(Time::FromString("15 Oct 07 12:45:00", &parsed_time)); EXPECT_TRUE(Time::FromString("15 Oct 07 12:45:00", &parsed_time));
// EXPECT_EQ(comparison_time_local_, parsed_time); EXPECT_EQ(comparison_time_local_, parsed_time);
// } }
//
// TEST_F(TimeTest, ParseTimeTest4) { TEST_F(TimeTest, DISABLED_ParseTimeTest4) {
// Time parsed_time; Time parsed_time;
// EXPECT_TRUE(Time::FromString("15 Oct 07 19:45 GMT", &parsed_time)); EXPECT_TRUE(Time::FromString("15 Oct 07 19:45 GMT", &parsed_time));
// EXPECT_EQ(comparison_time_pdt_, parsed_time); EXPECT_EQ(comparison_time_pdt_, parsed_time);
// } }
//
// TEST_F(TimeTest, ParseTimeTest5) { TEST_F(TimeTest, DISABLED_ParseTimeTest5) {
// Time parsed_time; Time parsed_time;
// EXPECT_TRUE(Time::FromString("Mon Oct 15 12:45 PDT 2007", &parsed_time)); EXPECT_TRUE(Time::FromString("Mon Oct 15 12:45 PDT 2007", &parsed_time));
// EXPECT_EQ(comparison_time_pdt_, parsed_time); EXPECT_EQ(comparison_time_pdt_, parsed_time);
// } }
//
// TEST_F(TimeTest, ParseTimeTest6) { TEST_F(TimeTest, DISABLED_ParseTimeTest6) {
// Time parsed_time; Time parsed_time;
// EXPECT_TRUE(Time::FromString("Monday, Oct 15, 2007 12:45 PM", &parsed_time)); EXPECT_TRUE(Time::FromString("Monday, Oct 15, 2007 12:45 PM", &parsed_time));
// EXPECT_EQ(comparison_time_local_, parsed_time); EXPECT_EQ(comparison_time_local_, parsed_time);
// } }
//
// TEST_F(TimeTest, ParseTimeTest7) { TEST_F(TimeTest, DISABLED_ParseTimeTest7) {
// Time parsed_time; Time parsed_time;
// EXPECT_TRUE(Time::FromString("10/15/07 12:45:00 PM", &parsed_time)); EXPECT_TRUE(Time::FromString("10/15/07 12:45:00 PM", &parsed_time));
// EXPECT_EQ(comparison_time_local_, parsed_time); EXPECT_EQ(comparison_time_local_, parsed_time);
// } }
//
// TEST_F(TimeTest, ParseTimeTest8) { TEST_F(TimeTest, DISABLED_ParseTimeTest8) {
// Time parsed_time; Time parsed_time;
// EXPECT_TRUE(Time::FromString("15-OCT-2007 12:45pm", &parsed_time)); EXPECT_TRUE(Time::FromString("15-OCT-2007 12:45pm", &parsed_time));
// EXPECT_EQ(comparison_time_local_, parsed_time); EXPECT_EQ(comparison_time_local_, parsed_time);
// } }
//
// TEST_F(TimeTest, ParseTimeTest9) { TEST_F(TimeTest, DISABLED_ParseTimeTest9) {
// Time parsed_time; Time parsed_time;
// EXPECT_TRUE(Time::FromString("16 Oct 2007 4:45-JST (Tuesday)", &parsed_time)); EXPECT_TRUE(Time::FromString("16 Oct 2007 4:45-JST (Tuesday)", &parsed_time));
// EXPECT_EQ(comparison_time_pdt_, parsed_time); EXPECT_EQ(comparison_time_pdt_, parsed_time);
// } }
//
// TEST_F(TimeTest, ParseTimeTest10) { TEST_F(TimeTest, DISABLED_ParseTimeTest10) {
// Time parsed_time; Time parsed_time;
// EXPECT_TRUE(Time::FromString("15/10/07 12:45", &parsed_time)); EXPECT_TRUE(Time::FromString("15/10/07 12:45", &parsed_time));
// EXPECT_EQ(parsed_time, comparison_time_local_); EXPECT_EQ(parsed_time, comparison_time_local_);
// } }
//
// // Test some of edge cases around epoch, etc. // Test some of edge cases around epoch, etc.
// TEST_F(TimeTest, ParseTimeTestEpoch0) { TEST_F(TimeTest, DISABLED_ParseTimeTestEpoch0) {
// Time parsed_time; Time parsed_time;
//
// // time_t == epoch == 0 // time_t == epoch == 0
// EXPECT_TRUE(Time::FromString("Thu Jan 01 01:00:00 +0100 1970", EXPECT_TRUE(Time::FromString("Thu Jan 01 01:00:00 +0100 1970",
// &parsed_time)); &parsed_time));
// EXPECT_EQ(0, parsed_time.ToTimeT()); EXPECT_EQ(0, parsed_time.ToTimeT());
// EXPECT_TRUE(Time::FromString("Thu Jan 01 00:00:00 GMT 1970", EXPECT_TRUE(Time::FromString("Thu Jan 01 00:00:00 GMT 1970",
// &parsed_time)); &parsed_time));
// EXPECT_EQ(0, parsed_time.ToTimeT()); EXPECT_EQ(0, parsed_time.ToTimeT());
// } }
//
// TEST_F(TimeTest, ParseTimeTestEpoch1) { TEST_F(TimeTest, DISABLED_ParseTimeTestEpoch1) {
// Time parsed_time; Time parsed_time;
//
// // time_t == 1 second after epoch == 1 // time_t == 1 second after epoch == 1
// EXPECT_TRUE(Time::FromString("Thu Jan 01 01:00:01 +0100 1970", EXPECT_TRUE(Time::FromString("Thu Jan 01 01:00:01 +0100 1970",
// &parsed_time)); &parsed_time));
// EXPECT_EQ(1, parsed_time.ToTimeT()); EXPECT_EQ(1, parsed_time.ToTimeT());
// EXPECT_TRUE(Time::FromString("Thu Jan 01 00:00:01 GMT 1970", EXPECT_TRUE(Time::FromString("Thu Jan 01 00:00:01 GMT 1970",
// &parsed_time)); &parsed_time));
// EXPECT_EQ(1, parsed_time.ToTimeT()); EXPECT_EQ(1, parsed_time.ToTimeT());
// } }
//
// TEST_F(TimeTest, ParseTimeTestEpoch2) { TEST_F(TimeTest, DISABLED_ParseTimeTestEpoch2) {
// Time parsed_time; Time parsed_time;
//
// // time_t == 2 seconds after epoch == 2 // time_t == 2 seconds after epoch == 2
// EXPECT_TRUE(Time::FromString("Thu Jan 01 01:00:02 +0100 1970", EXPECT_TRUE(Time::FromString("Thu Jan 01 01:00:02 +0100 1970",
// &parsed_time)); &parsed_time));
// EXPECT_EQ(2, parsed_time.ToTimeT()); EXPECT_EQ(2, parsed_time.ToTimeT());
// EXPECT_TRUE(Time::FromString("Thu Jan 01 00:00:02 GMT 1970", EXPECT_TRUE(Time::FromString("Thu Jan 01 00:00:02 GMT 1970",
// &parsed_time)); &parsed_time));
// EXPECT_EQ(2, parsed_time.ToTimeT()); EXPECT_EQ(2, parsed_time.ToTimeT());
// } }
//
// TEST_F(TimeTest, ParseTimeTestEpochNeg1) { TEST_F(TimeTest, DISABLED_ParseTimeTestEpochNeg1) {
// Time parsed_time; Time parsed_time;
//
// // time_t == 1 second before epoch == -1 // time_t == 1 second before epoch == -1
// EXPECT_TRUE(Time::FromString("Thu Jan 01 00:59:59 +0100 1970", EXPECT_TRUE(Time::FromString("Thu Jan 01 00:59:59 +0100 1970",
// &parsed_time)); &parsed_time));
// EXPECT_EQ(-1, parsed_time.ToTimeT()); EXPECT_EQ(-1, parsed_time.ToTimeT());
// EXPECT_TRUE(Time::FromString("Wed Dec 31 23:59:59 GMT 1969", EXPECT_TRUE(Time::FromString("Wed Dec 31 23:59:59 GMT 1969",
// &parsed_time)); &parsed_time));
// EXPECT_EQ(-1, parsed_time.ToTimeT()); EXPECT_EQ(-1, parsed_time.ToTimeT());
// } }
//
// // If time_t is 32 bits, a date after year 2038 will overflow time_t and // If time_t is 32 bits, a date after year 2038 will overflow time_t and
// // cause timegm() to return -1. The parsed time should not be 1 second // cause timegm() to return -1. The parsed time should not be 1 second
// // before epoch. // before epoch.
// TEST_F(TimeTest, ParseTimeTestEpochNotNeg1) { TEST_F(TimeTest, DISABLED_ParseTimeTestEpochNotNeg1) {
// Time parsed_time; Time parsed_time;
//
// EXPECT_TRUE(Time::FromString("Wed Dec 31 23:59:59 GMT 2100", EXPECT_TRUE(Time::FromString("Wed Dec 31 23:59:59 GMT 2100",
// &parsed_time)); &parsed_time));
// EXPECT_NE(-1, parsed_time.ToTimeT()); EXPECT_NE(-1, parsed_time.ToTimeT());
// } }
//
// TEST_F(TimeTest, ParseTimeTestEpochNeg2) { TEST_F(TimeTest, DISABLED_ParseTimeTestEpochNeg2) {
// Time parsed_time; Time parsed_time;
//
// // time_t == 2 seconds before epoch == -2 // time_t == 2 seconds before epoch == -2
// EXPECT_TRUE(Time::FromString("Thu Jan 01 00:59:58 +0100 1970", EXPECT_TRUE(Time::FromString("Thu Jan 01 00:59:58 +0100 1970",
// &parsed_time)); &parsed_time));
// EXPECT_EQ(-2, parsed_time.ToTimeT()); EXPECT_EQ(-2, parsed_time.ToTimeT());
// EXPECT_TRUE(Time::FromString("Wed Dec 31 23:59:58 GMT 1969", EXPECT_TRUE(Time::FromString("Wed Dec 31 23:59:58 GMT 1969",
// &parsed_time)); &parsed_time));
// EXPECT_EQ(-2, parsed_time.ToTimeT()); EXPECT_EQ(-2, parsed_time.ToTimeT());
// } }
//
// TEST_F(TimeTest, ParseTimeTestEpoch1960) { TEST_F(TimeTest, DISABLED_ParseTimeTestEpoch1960) {
// Time parsed_time; Time parsed_time;
//
// // time_t before Epoch, in 1960 // time_t before Epoch, in 1960
// EXPECT_TRUE(Time::FromString("Wed Jun 29 19:40:01 +0100 1960", EXPECT_TRUE(Time::FromString("Wed Jun 29 19:40:01 +0100 1960",
// &parsed_time)); &parsed_time));
// EXPECT_EQ(-299999999, parsed_time.ToTimeT()); EXPECT_EQ(-299999999, parsed_time.ToTimeT());
// EXPECT_TRUE(Time::FromString("Wed Jun 29 18:40:01 GMT 1960", EXPECT_TRUE(Time::FromString("Wed Jun 29 18:40:01 GMT 1960",
// &parsed_time)); &parsed_time));
// EXPECT_EQ(-299999999, parsed_time.ToTimeT()); EXPECT_EQ(-299999999, parsed_time.ToTimeT());
// EXPECT_TRUE(Time::FromString("Wed Jun 29 17:40:01 GMT 1960", EXPECT_TRUE(Time::FromString("Wed Jun 29 17:40:01 GMT 1960",
// &parsed_time)); &parsed_time));
// EXPECT_EQ(-300003599, parsed_time.ToTimeT()); EXPECT_EQ(-300003599, parsed_time.ToTimeT());
// } }
//
// TEST_F(TimeTest, ParseTimeTestEmpty) { TEST_F(TimeTest, DISABLED_ParseTimeTestEmpty) {
// Time parsed_time; Time parsed_time;
// EXPECT_FALSE(Time::FromString("", &parsed_time)); EXPECT_FALSE(Time::FromString("", &parsed_time));
// } }
//
// TEST_F(TimeTest, ParseTimeTestInvalidString) { TEST_F(TimeTest, DISABLED_ParseTimeTestInvalidString) {
// Time parsed_time; Time parsed_time;
// EXPECT_FALSE(Time::FromString("Monday morning 2000", &parsed_time)); EXPECT_FALSE(Time::FromString("Monday morning 2000", &parsed_time));
// } }
TEST_F(TimeTest, ExplodeBeforeUnixEpoch) { TEST_F(TimeTest, ExplodeBeforeUnixEpoch) {
static const int kUnixEpochYear = 1970; // In case this changes (ha!). static const int kUnixEpochYear = 1970; // In case this changes (ha!).
......
Markdown is supported
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