diff --git a/src/db/unit_tests/dbTransTests.cc b/src/db/unit_tests/dbTransTests.cc index 85f9a51884..622b944285 100644 --- a/src/db/unit_tests/dbTransTests.cc +++ b/src/db/unit_tests/dbTransTests.cc @@ -353,9 +353,9 @@ TEST(11) EXPECT_EQ (x.try_read (tt2), true); EXPECT_EQ (x.test ("a"), true); EXPECT_EQ (tt2.to_string (), t2.to_string ()); - x = tl::Extractor ("m22.5 *0.55 12.4,-17 ++"); + x = tl::Extractor ("m22.5 *0.55 12.4,-17 ##"); EXPECT_EQ (x.try_read (tt2), true); - EXPECT_EQ (x.test ("++"), true); + EXPECT_EQ (x.test ("##"), true); EXPECT_EQ (tt2.to_string (), "m22.5 *0.55 12.4,-17"); EXPECT_EQ (tt2.to_string (), t3.to_string ()); } diff --git a/src/tl/tl/tlString.cc b/src/tl/tl/tlString.cc index ab327c00fe..8a0379e6e8 100644 --- a/src/tl/tl/tlString.cc +++ b/src/tl/tl/tlString.cc @@ -322,10 +322,8 @@ static double local_strtod (const char *cp, const char *&cp_new) if (*cp == '-') { s = -1.0; ++cp; - /* } else if (*cp == '+') { ++cp; - */ } // Extract upper digits diff --git a/src/tl/unit_tests/tlStringTests.cc b/src/tl/unit_tests/tlStringTests.cc index e6078ec3a1..aafab46e6a 100644 --- a/src/tl/unit_tests/tlStringTests.cc +++ b/src/tl/unit_tests/tlStringTests.cc @@ -305,6 +305,25 @@ TEST(6) EXPECT_EQ (x3.test (":"), true); } +TEST(6_double) +{ + Extractor x (" 5.5 -2.5 \n+0.125 (no number)"); + + EXPECT_EQ (x.at_end (), false); + + double d = 0.0; + + EXPECT_EQ (x.try_read (d), true); + EXPECT_EQ (d, 5.5); + + x.read (d); + EXPECT_EQ (d, -2.5); + x.read (d); + EXPECT_EQ (d, 0.125); + + x.expect ("("); +} + TEST(7) { EXPECT_EQ (tl::to_quoted_string ("a_word!"), "'a_word!'");