Source

double-conversion / test / cctest / test-ieee.cc

The branch 'single' does not exist.
Diff from to

test/cctest/test-ieee.cc

   CHECK_EQ(4e-324, Double(0.0).NextDouble());
   CHECK_EQ(0.0, Double(-0.0).NextDouble());
   CHECK_EQ(-0.0, Double(-4e-324).NextDouble());
+  CHECK(Double(Double(-0.0).NextDouble()).Sign() > 0);
+  CHECK(Double(Double(-4e-324).NextDouble()).Sign() < 0);
   Double d0(-4e-324);
   Double d1(d0.NextDouble());
   Double d2(d1.NextDouble());
   CHECK_EQ(-0.0, d1.value());
+  CHECK(d1.Sign() < 0);
   CHECK_EQ(0.0, d2.value());
+  CHECK(d2.Sign() > 0);
   CHECK_EQ(4e-324, d2.NextDouble());
   CHECK_EQ(-1.7976931348623157e308, Double(-Double::Infinity()).NextDouble());
   CHECK_EQ(Double::Infinity(),
            Double(UINT64_2PART_C(0x7fefffff, ffffffff)).NextDouble());
 }
+
+
+TEST(PreviousDouble) {
+  CHECK_EQ(0.0, Double(4e-324).PreviousDouble());
+  CHECK_EQ(-0.0, Double(0.0).PreviousDouble());
+  CHECK(Double(Double(0.0).PreviousDouble()).Sign() < 0);
+  CHECK_EQ(-4e-324, Double(-0.0).PreviousDouble());
+  Double d0(4e-324);
+  Double d1(d0.PreviousDouble());
+  Double d2(d1.PreviousDouble());
+  CHECK_EQ(0.0, d1.value());
+  CHECK(d1.Sign() > 0);
+  CHECK_EQ(-0.0, d2.value());
+  CHECK(d2.Sign() < 0);
+  CHECK_EQ(-4e-324, d2.PreviousDouble());
+  CHECK_EQ(1.7976931348623157e308, Double(Double::Infinity()).PreviousDouble());
+  CHECK_EQ(-Double::Infinity(),
+           Double(UINT64_2PART_C(0xffefffff, ffffffff)).PreviousDouble());
+}