Skip to content

Commit

Permalink
Merge pull request #1659 from KLayout/issue-1656
Browse files Browse the repository at this point in the history
Issue 1656
  • Loading branch information
klayoutmatthias authored Mar 29, 2024
2 parents 467c8c7 + 76345e2 commit f6ad535
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/db/unit_tests/dbTransTests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 ());
}
Expand Down
2 changes: 0 additions & 2 deletions src/tl/tl/tlString.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions src/tl/unit_tests/tlStringTests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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!'");
Expand Down

0 comments on commit f6ad535

Please sign in to comment.