mirror of
https://github.com/KLayout/klayout.git
synced 2026-09-05 00:53:00 +02:00
WIP: introduced expanded net name
This commit is contained in:
@@ -405,20 +405,9 @@ private:
|
||||
hier_clusters_type m_net_clusters;
|
||||
};
|
||||
|
||||
// @@@ TODO: move this somewhere else
|
||||
static std::string net_name (const db::Net *net)
|
||||
{
|
||||
if (! net) {
|
||||
return "(null)";
|
||||
} else if (net->name ().empty ()) {
|
||||
if (net->cluster_id () > std::numeric_limits<size_t>::max () / 2) {
|
||||
return "$I" + tl::to_string ((std::numeric_limits<size_t>::max () - net->cluster_id ()) + 1);
|
||||
} else {
|
||||
return "$" + tl::to_string (net->cluster_id ());
|
||||
}
|
||||
} else {
|
||||
return net->name ();
|
||||
}
|
||||
return net ? net->expanded_name () : "(null)";
|
||||
}
|
||||
|
||||
static std::string device_name (const db::Device &device)
|
||||
|
||||
@@ -547,6 +547,11 @@ TEST(6_Net)
|
||||
n2 = n;
|
||||
EXPECT_EQ (n2.name (), "n");
|
||||
EXPECT_EQ (int (n2.cluster_id ()), 17);
|
||||
EXPECT_EQ (n2.expanded_name (), "n");
|
||||
n2.set_name ("");
|
||||
EXPECT_EQ (n2.expanded_name (), "$17");
|
||||
n2.set_cluster_id (std::numeric_limits<size_t>::max () - 2);
|
||||
EXPECT_EQ (n2.expanded_name (), "$I3");
|
||||
|
||||
n.clear ();
|
||||
EXPECT_EQ (n.name (), "");
|
||||
|
||||
Reference in New Issue
Block a user