Index: base/time/time_unittest.cc |
diff --git a/base/time/time_unittest.cc b/base/time/time_unittest.cc |
index 7402316c309052d62832652746fe0f769ae9b165..63c3a1ac7718fe1cc5f0912b4af78f8d24a60627 100644 |
--- a/base/time/time_unittest.cc |
+++ b/base/time/time_unittest.cc |
@@ -517,6 +517,12 @@ TEST_F(TimeTest, TimeDeltaMaxConversions) { |
t = TimeDelta::FromMilliseconds(std::numeric_limits<int64>::max()); |
EXPECT_TRUE(t.is_max()); |
+ t = TimeDelta::FromSecondsD(std::numeric_limits<double>::infinity()); |
+ EXPECT_TRUE(t.is_max()); |
+ |
+ t = TimeDelta::FromMillisecondsD(std::numeric_limits<double>::infinity()); |
+ EXPECT_TRUE(t.is_max()); |
+ |
t = TimeDelta::FromMicroseconds(std::numeric_limits<int64>::max()); |
EXPECT_TRUE(t.is_max()); |
} |
@@ -715,6 +721,10 @@ TEST(TimeDelta, FromAndIn) { |
EXPECT_TRUE(TimeDelta::FromSeconds(2) == TimeDelta::FromMilliseconds(2000)); |
EXPECT_TRUE(TimeDelta::FromMilliseconds(2) == |
TimeDelta::FromMicroseconds(2000)); |
+ EXPECT_TRUE(TimeDelta::FromSecondsD(2.3) == |
+ TimeDelta::FromMilliseconds(2300)); |
+ EXPECT_TRUE(TimeDelta::FromMillisecondsD(2.5) == |
+ TimeDelta::FromMicroseconds(2500)); |
EXPECT_EQ(13, TimeDelta::FromDays(13).InDays()); |
EXPECT_EQ(13, TimeDelta::FromHours(13).InHours()); |
EXPECT_EQ(13, TimeDelta::FromMinutes(13).InMinutes()); |
@@ -722,6 +732,10 @@ TEST(TimeDelta, FromAndIn) { |
EXPECT_EQ(13.0, TimeDelta::FromSeconds(13).InSecondsF()); |
EXPECT_EQ(13, TimeDelta::FromMilliseconds(13).InMilliseconds()); |
EXPECT_EQ(13.0, TimeDelta::FromMilliseconds(13).InMillisecondsF()); |
+ EXPECT_EQ(13, TimeDelta::FromSecondsD(13.1).InSeconds()); |
+ EXPECT_EQ(13.1, TimeDelta::FromSecondsD(13.1).InSecondsF()); |
+ EXPECT_EQ(13, TimeDelta::FromMillisecondsD(13.3).InMilliseconds()); |
+ EXPECT_EQ(13.3, TimeDelta::FromMillisecondsD(13.3).InMillisecondsF()); |
mithro-old
2014/04/22 07:05:12
Technically anything EXPECT_EQ with floating point
|
EXPECT_EQ(13, TimeDelta::FromMicroseconds(13).InMicroseconds()); |
} |