mirror of https://github.com/KLayout/klayout.git
[consider merging] OASIS Reader: error on duplicate CELLNAMEs
This commit is contained in:
parent
58032a5d5a
commit
5d74a5e8c6
|
|
@ -154,6 +154,10 @@ CommonReaderBase::rename_cell (db::Layout &layout, size_t id, const std::string
|
|||
common_reader_error (tl::sprintf (tl::to_string (tr ("Cell named %s with ID %ld was already given name %s")), cn, id, iid->second.first));
|
||||
}
|
||||
|
||||
if (iname != m_name_map.end () && iname->second.first != null_id && iname->second.first != id) {
|
||||
common_reader_error (tl::sprintf (tl::to_string (tr ("Same cell name %s, but different IDs: %ld and %ld")), cn, id, iname->second.first));
|
||||
}
|
||||
|
||||
if (iid != m_id_map.end () && iname != m_name_map.end ()) {
|
||||
|
||||
if (iname->second.second != iid->second.second) {
|
||||
|
|
|
|||
|
|
@ -599,3 +599,21 @@ TEST(Bug_1474)
|
|||
EXPECT_EQ (ex.msg (), "Cell named ADDHX2 with ID 4 was already given name SEDFFTRX2 (position=763169, cell=)");
|
||||
}
|
||||
}
|
||||
|
||||
TEST(DuplicateCellname)
|
||||
{
|
||||
db::Manager m (false);
|
||||
db::Layout layout (&m);
|
||||
|
||||
try {
|
||||
tl::InputStream file (tl::testdata () + "/oasis/duplicate_cellname.oas");
|
||||
db::OASISReader reader (file);
|
||||
reader.read (layout);
|
||||
EXPECT_EQ (false, true);
|
||||
} catch (tl::CancelException &ex) {
|
||||
// Seen when private test data is not installed
|
||||
throw;
|
||||
} catch (tl::Exception &ex) {
|
||||
EXPECT_EQ (ex.msg (), "Same cell name TOP, but different IDs: 3 and 0 (position=1070, cell=)");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in New Issue