Merge pull request #1659 from KLayout/issue-1656

Issue 1656
This commit is contained in:
Matthias Köfferlein 2024-03-29 08:57:26 +01:00 committed by GitHub
commit f6ad535761
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 21 additions and 4 deletions

View File

@ -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 ());
}

View File

@ -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

View File

@ -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!'");