From dc73b8145f54942b5c94af7b805485d90d540cc1 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Tue, 24 Dec 2024 17:13:01 +0100 Subject: [PATCH] WIP --- src/db/db/dbInstances.cc | 2 +- src/db/unit_tests/dbCellTests.cc | 388 +++++++++++------- src/db/unit_tests/dbDeepShapeStoreTests.cc | 2 +- src/db/unit_tests/dbLayoutDiffTests.cc | 6 +- src/db/unit_tests/dbLayoutQueryTests.cc | 58 +-- src/db/unit_tests/dbRegionTests.cc | 28 +- .../gds2/unit_tests/dbGDS2WriterTests.cc | 4 +- 7 files changed, 282 insertions(+), 206 deletions(-) diff --git a/src/db/db/dbInstances.cc b/src/db/db/dbInstances.cc index f5782d646..ceb5cc8cd 100644 --- a/src/db/db/dbInstances.cc +++ b/src/db/db/dbInstances.cc @@ -266,7 +266,7 @@ Instance::to_string (bool resolve_cell_name) const } if (has_prop_id ()) { - r += " prop_id=" + tl::to_string (prop_id ()); + r += std::string (" props=") + db::properties (prop_id ()).to_dict_var ().to_string (); } return r; diff --git a/src/db/unit_tests/dbCellTests.cc b/src/db/unit_tests/dbCellTests.cc index d99a9757a..591afd58a 100644 --- a/src/db/unit_tests/dbCellTests.cc +++ b/src/db/unit_tests/dbCellTests.cc @@ -110,7 +110,7 @@ std::string p2s (const db::Cell &c) if (! r.empty ()) { r += ","; } - r += tl::to_string (p->inst ().object ().cell_index ()) + "[" + p->inst ().complex_trans ().to_string () + "]" + "#" + tl::to_string (p->child_inst ().prop_id ()); + r += tl::to_string (p->inst ().object ().cell_index ()) + "[" + p->inst ().complex_trans ().to_string () + "]" + "#" + db::properties (p->child_inst ().prop_id ()).to_dict_var ().to_string (); } return r; } @@ -152,7 +152,7 @@ struct c2s_compare return p1->complex_trans () < p2->complex_trans (); } if (p1->prop_id () != p2->prop_id ()) { - return p1->prop_id () < p2->prop_id (); + return db::properties (p1->prop_id ()).to_map () < db::properties (p2->prop_id ()).to_map (); } return false; } @@ -171,7 +171,7 @@ std::string c2s (const db::Cell &c) if (! r.empty ()) { r += ","; } - r += tl::to_string (p->cell_index ()) + "[" + p->complex_trans ().to_string () + "]" + "#" + tl::to_string (p->prop_id ()); + r += tl::to_string (p->cell_index ()) + "[" + p->complex_trans ().to_string () + "]" + "#" + db::properties (p->prop_id ()).to_dict_var ().to_string (); } return r; } @@ -183,7 +183,7 @@ std::string c2s_unsorted (const db::Cell &c) if (! r.empty ()) { r += ","; } - r += tl::to_string (p->cell_index ()) + "[" + p->complex_trans ().to_string () + "]" + "#" + tl::to_string (p->prop_id ()); + r += tl::to_string (p->cell_index ()) + "[" + p->complex_trans ().to_string () + "]" + "#" + db::properties (p->prop_id ()).to_dict_var ().to_string (); } return r; } @@ -199,7 +199,7 @@ struct ct2s_compare return p1->complex_trans () < p2->complex_trans (); } if (p1->prop_id () != p2->prop_id ()) { - return p1->prop_id () < p2->prop_id (); + return db::properties (p1->prop_id ()).to_map () < db::properties (p2->prop_id ()).to_map (); } return false; } @@ -218,7 +218,7 @@ std::string ct2s (const db::Cell &c) if (! r.empty ()) { r += ","; } - r += tl::to_string (p->cell_index ()) + "[" + p->complex_trans ().to_string () + "]" + "#" + tl::to_string (p->prop_id ()); + r += tl::to_string (p->cell_index ()) + "[" + p->complex_trans ().to_string () + "]" + "#" + db::properties (p->prop_id ()).to_dict_var ().to_string (); } return r; } @@ -253,10 +253,13 @@ static unsigned int pi = 0; void insert_ci (db::Cell &c, size_t ci, const db::Trans &t) { + db::PropertiesSet props; + props.insert (tl::Variant ("id"), pi); + db::properties_id_type pid = db::properties_id (props); if (pi == 0) { c.insert (db::CellInstArray (db::CellInst (db::cell_index_type (ci)), t)); } else { - c.insert (db::CellInstArrayWithProperties (db::CellInstArray (db::CellInst (db::cell_index_type (ci)), t), pi)); + c.insert (db::CellInstArrayWithProperties (db::CellInstArray (db::CellInst (db::cell_index_type (ci)), t), pid)); } pi = (pi + 1) % 3; } @@ -265,6 +268,18 @@ TEST(2) { ::pi = 0; + db::PropertiesSet props; + props.insert (tl::Variant ("id"), 17); + db::properties_id_type pid17 = db::properties_id (props); + + props.clear (); + props.insert (tl::Variant ("id"), 11); + db::properties_id_type pid11 = db::properties_id (props); + + props.clear (); + props.insert (tl::Variant ("id"), 13); + db::properties_id_type pid13 = db::properties_id (props); + db::Manager m (true); db::Layout g (&m); db::Cell &c0 (g.cell (g.add_cell ())); @@ -290,28 +305,28 @@ TEST(2) insert_ci (c4, c5.cell_index (), t); EXPECT_EQ (p2s(c0), ""); - EXPECT_EQ (p2s(c1), "0[r0 *1 0,0]#0"); - EXPECT_EQ (p2s(c2), "1[r0 *1 0,0]#1"); - EXPECT_EQ (p2s(c3), "2[r0 *1 0,0]#2"); - EXPECT_EQ (p2s(c4), "3[r0 *1 0,0]#0"); - EXPECT_EQ (p2s(c5), "4[r0 *1 0,0]#1"); + EXPECT_EQ (p2s(c1), "0[r0 *1 0,0]#{}"); + EXPECT_EQ (p2s(c2), "1[r0 *1 0,0]#{id=>1}"); + EXPECT_EQ (p2s(c3), "2[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (p2s(c4), "3[r0 *1 0,0]#{}"); + EXPECT_EQ (p2s(c5), "4[r0 *1 0,0]#{id=>1}"); EXPECT_EQ (pc2s(c0), ""); EXPECT_EQ (pc2s(c1), "0"); EXPECT_EQ (pc2s(c2), "1"); EXPECT_EQ (pc2s(c3), "2"); EXPECT_EQ (pc2s(c4), "3"); EXPECT_EQ (pc2s(c5), "4"); - EXPECT_EQ (c2s(c0), "1[r0 *1 0,0]#0"); - EXPECT_EQ (c2s(c1), "2[r0 *1 0,0]#1"); - EXPECT_EQ (c2s(c2), "3[r0 *1 0,0]#2"); - EXPECT_EQ (c2s(c3), "4[r0 *1 0,0]#0"); - EXPECT_EQ (c2s(c4), "5[r0 *1 0,0]#1"); + EXPECT_EQ (c2s(c0), "1[r0 *1 0,0]#{}"); + EXPECT_EQ (c2s(c1), "2[r0 *1 0,0]#{id=>1}"); + EXPECT_EQ (c2s(c2), "3[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (c2s(c3), "4[r0 *1 0,0]#{}"); + EXPECT_EQ (c2s(c4), "5[r0 *1 0,0]#{id=>1}"); EXPECT_EQ (c2s(c5), ""); - EXPECT_EQ (ct2s(c0), "1[r0 *1 0,0]#0"); - EXPECT_EQ (ct2s(c1), "2[r0 *1 0,0]#1"); - EXPECT_EQ (ct2s(c2), "3[r0 *1 0,0]#2"); - EXPECT_EQ (ct2s(c3), "4[r0 *1 0,0]#0"); - EXPECT_EQ (ct2s(c4), "5[r0 *1 0,0]#1"); + EXPECT_EQ (ct2s(c0), "1[r0 *1 0,0]#{}"); + EXPECT_EQ (ct2s(c1), "2[r0 *1 0,0]#{id=>1}"); + EXPECT_EQ (ct2s(c2), "3[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (ct2s(c3), "4[r0 *1 0,0]#{}"); + EXPECT_EQ (ct2s(c4), "5[r0 *1 0,0]#{id=>1}"); EXPECT_EQ (ct2s(c5), ""); EXPECT_EQ (cc2s(c0), "1"); EXPECT_EQ (cc2s(c1), "2"); @@ -325,28 +340,28 @@ TEST(2) insert_ci (c2, c4.cell_index (), t); insert_ci (c3, c5.cell_index (), t); EXPECT_EQ (p2s(c0), ""); - EXPECT_EQ (p2s(c1), "0[r0 *1 0,0]#0"); - EXPECT_EQ (p2s(c2), "0[r0 *1 0,0]#2,1[r0 *1 0,0]#1"); - EXPECT_EQ (p2s(c3), "1[r0 *1 0,0]#0,2[r0 *1 0,0]#2"); - EXPECT_EQ (p2s(c4), "2[r0 *1 0,0]#1,3[r0 *1 0,0]#0"); - EXPECT_EQ (p2s(c5), "3[r0 *1 0,0]#2,4[r0 *1 0,0]#1"); + EXPECT_EQ (p2s(c1), "0[r0 *1 0,0]#{}"); + EXPECT_EQ (p2s(c2), "0[r0 *1 0,0]#{id=>2},1[r0 *1 0,0]#{id=>1}"); + EXPECT_EQ (p2s(c3), "1[r0 *1 0,0]#{},2[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (p2s(c4), "2[r0 *1 0,0]#{id=>1},3[r0 *1 0,0]#{}"); + EXPECT_EQ (p2s(c5), "3[r0 *1 0,0]#{id=>2},4[r0 *1 0,0]#{id=>1}"); EXPECT_EQ (pc2s(c0), ""); EXPECT_EQ (pc2s(c1), "0"); EXPECT_EQ (pc2s(c2), "0,1"); EXPECT_EQ (pc2s(c3), "1,2"); EXPECT_EQ (pc2s(c4), "2,3"); EXPECT_EQ (pc2s(c5), "3,4"); - EXPECT_EQ (c2s(c0), "1[r0 *1 0,0]#0,2[r0 *1 0,0]#2"); - EXPECT_EQ (c2s(c1), "2[r0 *1 0,0]#1,3[r0 *1 0,0]#0"); - EXPECT_EQ (c2s(c2), "3[r0 *1 0,0]#2,4[r0 *1 0,0]#1"); - EXPECT_EQ (c2s(c3), "4[r0 *1 0,0]#0,5[r0 *1 0,0]#2"); - EXPECT_EQ (c2s(c4), "5[r0 *1 0,0]#1"); + EXPECT_EQ (c2s(c0), "1[r0 *1 0,0]#{},2[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (c2s(c1), "2[r0 *1 0,0]#{id=>1},3[r0 *1 0,0]#{}"); + EXPECT_EQ (c2s(c2), "3[r0 *1 0,0]#{id=>2},4[r0 *1 0,0]#{id=>1}"); + EXPECT_EQ (c2s(c3), "4[r0 *1 0,0]#{},5[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (c2s(c4), "5[r0 *1 0,0]#{id=>1}"); EXPECT_EQ (c2s(c5), ""); - EXPECT_EQ (ct2s(c0), "1[r0 *1 0,0]#0,2[r0 *1 0,0]#2"); - EXPECT_EQ (ct2s(c1), "2[r0 *1 0,0]#1,3[r0 *1 0,0]#0"); - EXPECT_EQ (ct2s(c2), "3[r0 *1 0,0]#2,4[r0 *1 0,0]#1"); - EXPECT_EQ (ct2s(c3), "4[r0 *1 0,0]#0,5[r0 *1 0,0]#2"); - EXPECT_EQ (ct2s(c4), "5[r0 *1 0,0]#1"); + EXPECT_EQ (ct2s(c0), "1[r0 *1 0,0]#{},2[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (ct2s(c1), "2[r0 *1 0,0]#{id=>1},3[r0 *1 0,0]#{}"); + EXPECT_EQ (ct2s(c2), "3[r0 *1 0,0]#{id=>2},4[r0 *1 0,0]#{id=>1}"); + EXPECT_EQ (ct2s(c3), "4[r0 *1 0,0]#{},5[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (ct2s(c4), "5[r0 *1 0,0]#{id=>1}"); EXPECT_EQ (ct2s(c5), ""); EXPECT_EQ (cc2s(c0), "1,2"); EXPECT_EQ (cc2s(c1), "2,3"); @@ -359,28 +374,28 @@ TEST(2) insert_ci (c1, c4.cell_index (), t); insert_ci (c2, c5.cell_index (), t); EXPECT_EQ (p2s(c0), ""); - EXPECT_EQ (p2s(c1), "0[r0 *1 0,0]#0"); - EXPECT_EQ (p2s(c2), "0[r0 *1 0,0]#2,1[r0 *1 0,0]#1"); - EXPECT_EQ (p2s(c3), "0[r0 *1 0,0]#0,1[r0 *1 0,0]#0,2[r0 *1 0,0]#2"); - EXPECT_EQ (p2s(c4), "1[r0 *1 0,0]#1,2[r0 *1 0,0]#1,3[r0 *1 0,0]#0"); - EXPECT_EQ (p2s(c5), "2[r0 *1 0,0]#2,3[r0 *1 0,0]#2,4[r0 *1 0,0]#1"); + EXPECT_EQ (p2s(c1), "0[r0 *1 0,0]#{}"); + EXPECT_EQ (p2s(c2), "0[r0 *1 0,0]#{id=>2},1[r0 *1 0,0]#{id=>1}"); + EXPECT_EQ (p2s(c3), "0[r0 *1 0,0]#{},1[r0 *1 0,0]#{},2[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (p2s(c4), "1[r0 *1 0,0]#{id=>1},2[r0 *1 0,0]#{id=>1},3[r0 *1 0,0]#{}"); + EXPECT_EQ (p2s(c5), "2[r0 *1 0,0]#{id=>2},3[r0 *1 0,0]#{id=>2},4[r0 *1 0,0]#{id=>1}"); EXPECT_EQ (pc2s(c0), ""); EXPECT_EQ (pc2s(c1), "0"); EXPECT_EQ (pc2s(c2), "0,1"); EXPECT_EQ (pc2s(c3), "0,1,2"); EXPECT_EQ (pc2s(c4), "1,2,3"); EXPECT_EQ (pc2s(c5), "2,3,4"); - EXPECT_EQ (c2s(c0), "1[r0 *1 0,0]#0,2[r0 *1 0,0]#2,3[r0 *1 0,0]#0"); - EXPECT_EQ (c2s(c1), "2[r0 *1 0,0]#1,3[r0 *1 0,0]#0,4[r0 *1 0,0]#1"); - EXPECT_EQ (c2s(c2), "3[r0 *1 0,0]#2,4[r0 *1 0,0]#1,5[r0 *1 0,0]#2"); - EXPECT_EQ (c2s(c3), "4[r0 *1 0,0]#0,5[r0 *1 0,0]#2"); - EXPECT_EQ (c2s(c4), "5[r0 *1 0,0]#1"); + EXPECT_EQ (c2s(c0), "1[r0 *1 0,0]#{},2[r0 *1 0,0]#{id=>2},3[r0 *1 0,0]#{}"); + EXPECT_EQ (c2s(c1), "2[r0 *1 0,0]#{id=>1},3[r0 *1 0,0]#{},4[r0 *1 0,0]#{id=>1}"); + EXPECT_EQ (c2s(c2), "3[r0 *1 0,0]#{id=>2},4[r0 *1 0,0]#{id=>1},5[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (c2s(c3), "4[r0 *1 0,0]#{},5[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (c2s(c4), "5[r0 *1 0,0]#{id=>1}"); EXPECT_EQ (c2s(c5), ""); - EXPECT_EQ (ct2s(c0), "1[r0 *1 0,0]#0,2[r0 *1 0,0]#2,3[r0 *1 0,0]#0"); - EXPECT_EQ (ct2s(c1), "2[r0 *1 0,0]#1,3[r0 *1 0,0]#0,4[r0 *1 0,0]#1"); - EXPECT_EQ (ct2s(c2), "3[r0 *1 0,0]#2,4[r0 *1 0,0]#1,5[r0 *1 0,0]#2"); - EXPECT_EQ (ct2s(c3), "4[r0 *1 0,0]#0,5[r0 *1 0,0]#2"); - EXPECT_EQ (ct2s(c4), "5[r0 *1 0,0]#1"); + EXPECT_EQ (ct2s(c0), "1[r0 *1 0,0]#{},2[r0 *1 0,0]#{id=>2},3[r0 *1 0,0]#{}"); + EXPECT_EQ (ct2s(c1), "2[r0 *1 0,0]#{id=>1},3[r0 *1 0,0]#{},4[r0 *1 0,0]#{id=>1}"); + EXPECT_EQ (ct2s(c2), "3[r0 *1 0,0]#{id=>2},4[r0 *1 0,0]#{id=>1},5[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (ct2s(c3), "4[r0 *1 0,0]#{},5[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (ct2s(c4), "5[r0 *1 0,0]#{id=>1}"); EXPECT_EQ (ct2s(c5), ""); EXPECT_EQ (cc2s(c0), "1,2,3"); EXPECT_EQ (cc2s(c1), "2,3,4"); @@ -392,28 +407,28 @@ TEST(2) insert_ci (c0, c4.cell_index (), t); insert_ci (c1, c5.cell_index (), t); EXPECT_EQ (p2s(c0), ""); - EXPECT_EQ (p2s(c1), "0[r0 *1 0,0]#0"); - EXPECT_EQ (p2s(c2), "0[r0 *1 0,0]#2,1[r0 *1 0,0]#1"); - EXPECT_EQ (p2s(c3), "0[r0 *1 0,0]#0,1[r0 *1 0,0]#0,2[r0 *1 0,0]#2"); - EXPECT_EQ (p2s(c4), "0[r0 *1 0,0]#0,1[r0 *1 0,0]#1,2[r0 *1 0,0]#1,3[r0 *1 0,0]#0"); - EXPECT_EQ (p2s(c5), "1[r0 *1 0,0]#1,2[r0 *1 0,0]#2,3[r0 *1 0,0]#2,4[r0 *1 0,0]#1"); + EXPECT_EQ (p2s(c1), "0[r0 *1 0,0]#{}"); + EXPECT_EQ (p2s(c2), "0[r0 *1 0,0]#{id=>2},1[r0 *1 0,0]#{id=>1}"); + EXPECT_EQ (p2s(c3), "0[r0 *1 0,0]#{},1[r0 *1 0,0]#{},2[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (p2s(c4), "0[r0 *1 0,0]#{},1[r0 *1 0,0]#{id=>1},2[r0 *1 0,0]#{id=>1},3[r0 *1 0,0]#{}"); + EXPECT_EQ (p2s(c5), "1[r0 *1 0,0]#{id=>1},2[r0 *1 0,0]#{id=>2},3[r0 *1 0,0]#{id=>2},4[r0 *1 0,0]#{id=>1}"); EXPECT_EQ (pc2s(c0), ""); EXPECT_EQ (pc2s(c1), "0"); EXPECT_EQ (pc2s(c2), "0,1"); EXPECT_EQ (pc2s(c3), "0,1,2"); EXPECT_EQ (pc2s(c4), "0,1,2,3"); EXPECT_EQ (pc2s(c5), "1,2,3,4"); - EXPECT_EQ (c2s(c0), "1[r0 *1 0,0]#0,2[r0 *1 0,0]#2,3[r0 *1 0,0]#0,4[r0 *1 0,0]#0"); - EXPECT_EQ (c2s(c1), "2[r0 *1 0,0]#1,3[r0 *1 0,0]#0,4[r0 *1 0,0]#1,5[r0 *1 0,0]#1"); - EXPECT_EQ (c2s(c2), "3[r0 *1 0,0]#2,4[r0 *1 0,0]#1,5[r0 *1 0,0]#2"); - EXPECT_EQ (c2s(c3), "4[r0 *1 0,0]#0,5[r0 *1 0,0]#2"); - EXPECT_EQ (c2s(c4), "5[r0 *1 0,0]#1"); + EXPECT_EQ (c2s(c0), "1[r0 *1 0,0]#{},2[r0 *1 0,0]#{id=>2},3[r0 *1 0,0]#{},4[r0 *1 0,0]#{}"); + EXPECT_EQ (c2s(c1), "2[r0 *1 0,0]#{id=>1},3[r0 *1 0,0]#{},4[r0 *1 0,0]#{id=>1},5[r0 *1 0,0]#{id=>1}"); + EXPECT_EQ (c2s(c2), "3[r0 *1 0,0]#{id=>2},4[r0 *1 0,0]#{id=>1},5[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (c2s(c3), "4[r0 *1 0,0]#{},5[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (c2s(c4), "5[r0 *1 0,0]#{id=>1}"); EXPECT_EQ (c2s(c5), ""); - EXPECT_EQ (ct2s(c0), "1[r0 *1 0,0]#0,2[r0 *1 0,0]#2,3[r0 *1 0,0]#0,4[r0 *1 0,0]#0"); - EXPECT_EQ (ct2s(c1), "2[r0 *1 0,0]#1,3[r0 *1 0,0]#0,4[r0 *1 0,0]#1,5[r0 *1 0,0]#1"); - EXPECT_EQ (ct2s(c2), "3[r0 *1 0,0]#2,4[r0 *1 0,0]#1,5[r0 *1 0,0]#2"); - EXPECT_EQ (ct2s(c3), "4[r0 *1 0,0]#0,5[r0 *1 0,0]#2"); - EXPECT_EQ (ct2s(c4), "5[r0 *1 0,0]#1"); + EXPECT_EQ (ct2s(c0), "1[r0 *1 0,0]#{},2[r0 *1 0,0]#{id=>2},3[r0 *1 0,0]#{},4[r0 *1 0,0]#{}"); + EXPECT_EQ (ct2s(c1), "2[r0 *1 0,0]#{id=>1},3[r0 *1 0,0]#{},4[r0 *1 0,0]#{id=>1},5[r0 *1 0,0]#{id=>1}"); + EXPECT_EQ (ct2s(c2), "3[r0 *1 0,0]#{id=>2},4[r0 *1 0,0]#{id=>1},5[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (ct2s(c3), "4[r0 *1 0,0]#{},5[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (ct2s(c4), "5[r0 *1 0,0]#{id=>1}"); EXPECT_EQ (ct2s(c5), ""); EXPECT_EQ (cc2s(c0), "1,2,3,4"); EXPECT_EQ (cc2s(c1), "2,3,4,5"); @@ -424,28 +439,28 @@ TEST(2) insert_ci (c0, c5.cell_index (), t); EXPECT_EQ (p2s(c0), ""); - EXPECT_EQ (p2s(c1), "0[r0 *1 0,0]#0"); - EXPECT_EQ (p2s(c2), "0[r0 *1 0,0]#2,1[r0 *1 0,0]#1"); - EXPECT_EQ (p2s(c3), "0[r0 *1 0,0]#0,1[r0 *1 0,0]#0,2[r0 *1 0,0]#2"); - EXPECT_EQ (p2s(c4), "0[r0 *1 0,0]#0,1[r0 *1 0,0]#1,2[r0 *1 0,0]#1,3[r0 *1 0,0]#0"); - EXPECT_EQ (p2s(c5), "0[r0 *1 0,0]#2,1[r0 *1 0,0]#1,2[r0 *1 0,0]#2,3[r0 *1 0,0]#2,4[r0 *1 0,0]#1"); + EXPECT_EQ (p2s(c1), "0[r0 *1 0,0]#{}"); + EXPECT_EQ (p2s(c2), "0[r0 *1 0,0]#{id=>2},1[r0 *1 0,0]#{id=>1}"); + EXPECT_EQ (p2s(c3), "0[r0 *1 0,0]#{},1[r0 *1 0,0]#{},2[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (p2s(c4), "0[r0 *1 0,0]#{},1[r0 *1 0,0]#{id=>1},2[r0 *1 0,0]#{id=>1},3[r0 *1 0,0]#{}"); + EXPECT_EQ (p2s(c5), "0[r0 *1 0,0]#{id=>2},1[r0 *1 0,0]#{id=>1},2[r0 *1 0,0]#{id=>2},3[r0 *1 0,0]#{id=>2},4[r0 *1 0,0]#{id=>1}"); EXPECT_EQ (pc2s(c0), ""); EXPECT_EQ (pc2s(c1), "0"); EXPECT_EQ (pc2s(c2), "0,1"); EXPECT_EQ (pc2s(c3), "0,1,2"); EXPECT_EQ (pc2s(c4), "0,1,2,3"); EXPECT_EQ (pc2s(c5), "0,1,2,3,4"); - EXPECT_EQ (c2s(c0), "1[r0 *1 0,0]#0,2[r0 *1 0,0]#2,3[r0 *1 0,0]#0,4[r0 *1 0,0]#0,5[r0 *1 0,0]#2"); - EXPECT_EQ (c2s(c1), "2[r0 *1 0,0]#1,3[r0 *1 0,0]#0,4[r0 *1 0,0]#1,5[r0 *1 0,0]#1"); - EXPECT_EQ (c2s(c2), "3[r0 *1 0,0]#2,4[r0 *1 0,0]#1,5[r0 *1 0,0]#2"); - EXPECT_EQ (c2s(c3), "4[r0 *1 0,0]#0,5[r0 *1 0,0]#2"); - EXPECT_EQ (c2s(c4), "5[r0 *1 0,0]#1"); + EXPECT_EQ (c2s(c0), "1[r0 *1 0,0]#{},2[r0 *1 0,0]#{id=>2},3[r0 *1 0,0]#{},4[r0 *1 0,0]#{},5[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (c2s(c1), "2[r0 *1 0,0]#{id=>1},3[r0 *1 0,0]#{},4[r0 *1 0,0]#{id=>1},5[r0 *1 0,0]#{id=>1}"); + EXPECT_EQ (c2s(c2), "3[r0 *1 0,0]#{id=>2},4[r0 *1 0,0]#{id=>1},5[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (c2s(c3), "4[r0 *1 0,0]#{},5[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (c2s(c4), "5[r0 *1 0,0]#{id=>1}"); EXPECT_EQ (c2s(c5), ""); - EXPECT_EQ (ct2s(c0), "1[r0 *1 0,0]#0,2[r0 *1 0,0]#2,3[r0 *1 0,0]#0,4[r0 *1 0,0]#0,5[r0 *1 0,0]#2"); - EXPECT_EQ (ct2s(c1), "2[r0 *1 0,0]#1,3[r0 *1 0,0]#0,4[r0 *1 0,0]#1,5[r0 *1 0,0]#1"); - EXPECT_EQ (ct2s(c2), "3[r0 *1 0,0]#2,4[r0 *1 0,0]#1,5[r0 *1 0,0]#2"); - EXPECT_EQ (ct2s(c3), "4[r0 *1 0,0]#0,5[r0 *1 0,0]#2"); - EXPECT_EQ (ct2s(c4), "5[r0 *1 0,0]#1"); + EXPECT_EQ (ct2s(c0), "1[r0 *1 0,0]#{},2[r0 *1 0,0]#{id=>2},3[r0 *1 0,0]#{},4[r0 *1 0,0]#{},5[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (ct2s(c1), "2[r0 *1 0,0]#{id=>1},3[r0 *1 0,0]#{},4[r0 *1 0,0]#{id=>1},5[r0 *1 0,0]#{id=>1}"); + EXPECT_EQ (ct2s(c2), "3[r0 *1 0,0]#{id=>2},4[r0 *1 0,0]#{id=>1},5[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (ct2s(c3), "4[r0 *1 0,0]#{},5[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (ct2s(c4), "5[r0 *1 0,0]#{id=>1}"); EXPECT_EQ (ct2s(c5), ""); EXPECT_EQ (cc2s(c0), "1,2,3,4,5"); EXPECT_EQ (cc2s(c1), "2,3,4,5"); @@ -461,34 +476,34 @@ TEST(2) insert_ci (c3, c4.cell_index (), t); insert_ci (c4, c5.cell_index (), t); EXPECT_EQ (p2s(c0), ""); - EXPECT_EQ (p2s(c1), "0[r0 *1 0,0]#0,0[r0 *1 0,0]#1"); - EXPECT_EQ (p2s(c2), "0[r0 *1 0,0]#2,1[r0 *1 0,0]#1,1[r0 *1 0,0]#2"); - EXPECT_EQ (p2s(c3), "0[r0 *1 0,0]#0,1[r0 *1 0,0]#0,2[r0 *1 0,0]#0,2[r0 *1 0,0]#2"); - EXPECT_EQ (p2s(c4), "0[r0 *1 0,0]#0,1[r0 *1 0,0]#1,2[r0 *1 0,0]#1,3[r0 *1 0,0]#0,3[r0 *1 0,0]#1"); - EXPECT_EQ (p2s(c5), "0[r0 *1 0,0]#2,1[r0 *1 0,0]#1,2[r0 *1 0,0]#2,3[r0 *1 0,0]#2,4[r0 *1 0,0]#1,4[r0 *1 0,0]#2"); + EXPECT_EQ (p2s(c1), "0[r0 *1 0,0]#{},0[r0 *1 0,0]#{id=>1}"); + EXPECT_EQ (p2s(c2), "0[r0 *1 0,0]#{id=>2},1[r0 *1 0,0]#{id=>1},1[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (p2s(c3), "0[r0 *1 0,0]#{},1[r0 *1 0,0]#{},2[r0 *1 0,0]#{},2[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (p2s(c4), "0[r0 *1 0,0]#{},1[r0 *1 0,0]#{id=>1},2[r0 *1 0,0]#{id=>1},3[r0 *1 0,0]#{},3[r0 *1 0,0]#{id=>1}"); + EXPECT_EQ (p2s(c5), "0[r0 *1 0,0]#{id=>2},1[r0 *1 0,0]#{id=>1},2[r0 *1 0,0]#{id=>2},3[r0 *1 0,0]#{id=>2},4[r0 *1 0,0]#{id=>1},4[r0 *1 0,0]#{id=>2}"); EXPECT_EQ (pc2s(c0), ""); EXPECT_EQ (pc2s(c1), "0"); EXPECT_EQ (pc2s(c2), "0,1"); EXPECT_EQ (pc2s(c3), "0,1,2"); EXPECT_EQ (pc2s(c4), "0,1,2,3"); EXPECT_EQ (pc2s(c5), "0,1,2,3,4"); - EXPECT_EQ (c2s(c0), "1[r0 *1 0,0]#0,1[r0 *1 0,0]#1,2[r0 *1 0,0]#2,3[r0 *1 0,0]#0,4[r0 *1 0,0]#0,5[r0 *1 0,0]#2"); - EXPECT_EQ (c2s(c1), "2[r0 *1 0,0]#1,2[r0 *1 0,0]#2,3[r0 *1 0,0]#0,4[r0 *1 0,0]#1,5[r0 *1 0,0]#1"); - EXPECT_EQ (c2s(c2), "3[r0 *1 0,0]#0,3[r0 *1 0,0]#2,4[r0 *1 0,0]#1,5[r0 *1 0,0]#2"); - EXPECT_EQ (c2s(c3), "4[r0 *1 0,0]#0,4[r0 *1 0,0]#1,5[r0 *1 0,0]#2"); - EXPECT_EQ (c2s(c4), "5[r0 *1 0,0]#1,5[r0 *1 0,0]#2"); + EXPECT_EQ (c2s(c0), "1[r0 *1 0,0]#{},1[r0 *1 0,0]#{id=>1},2[r0 *1 0,0]#{id=>2},3[r0 *1 0,0]#{},4[r0 *1 0,0]#{},5[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (c2s(c1), "2[r0 *1 0,0]#{id=>1},2[r0 *1 0,0]#{id=>2},3[r0 *1 0,0]#{},4[r0 *1 0,0]#{id=>1},5[r0 *1 0,0]#{id=>1}"); + EXPECT_EQ (c2s(c2), "3[r0 *1 0,0]#{},3[r0 *1 0,0]#{id=>2},4[r0 *1 0,0]#{id=>1},5[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (c2s(c3), "4[r0 *1 0,0]#{},4[r0 *1 0,0]#{id=>1},5[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (c2s(c4), "5[r0 *1 0,0]#{id=>1},5[r0 *1 0,0]#{id=>2}"); EXPECT_EQ (c2s(c5), ""); - EXPECT_EQ (c2s_unsorted(c0), "1[r0 *1 0,0]#0,3[r0 *1 0,0]#0,4[r0 *1 0,0]#0,2[r0 *1 0,0]#2,5[r0 *1 0,0]#2,1[r0 *1 0,0]#1"); - EXPECT_EQ (c2s_unsorted(c1), "3[r0 *1 0,0]#0,2[r0 *1 0,0]#1,4[r0 *1 0,0]#1,5[r0 *1 0,0]#1,2[r0 *1 0,0]#2"); - EXPECT_EQ (c2s_unsorted(c2), "3[r0 *1 0,0]#0,3[r0 *1 0,0]#2,4[r0 *1 0,0]#1,5[r0 *1 0,0]#2"); - EXPECT_EQ (c2s_unsorted(c3), "4[r0 *1 0,0]#0,5[r0 *1 0,0]#2,4[r0 *1 0,0]#1"); - EXPECT_EQ (c2s_unsorted(c4), "5[r0 *1 0,0]#1,5[r0 *1 0,0]#2"); + EXPECT_EQ (c2s_unsorted(c0), "1[r0 *1 0,0]#{},3[r0 *1 0,0]#{},4[r0 *1 0,0]#{},2[r0 *1 0,0]#{id=>2},5[r0 *1 0,0]#{id=>2},1[r0 *1 0,0]#{id=>1}"); + EXPECT_EQ (c2s_unsorted(c1), "3[r0 *1 0,0]#{},2[r0 *1 0,0]#{id=>1},4[r0 *1 0,0]#{id=>1},5[r0 *1 0,0]#{id=>1},2[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (c2s_unsorted(c2), "3[r0 *1 0,0]#{},3[r0 *1 0,0]#{id=>2},4[r0 *1 0,0]#{id=>1},5[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (c2s_unsorted(c3), "4[r0 *1 0,0]#{},5[r0 *1 0,0]#{id=>2},4[r0 *1 0,0]#{id=>1}"); + EXPECT_EQ (c2s_unsorted(c4), "5[r0 *1 0,0]#{id=>1},5[r0 *1 0,0]#{id=>2}"); EXPECT_EQ (c2s_unsorted(c5), ""); - EXPECT_EQ (ct2s(c0), "1[r0 *1 0,0]#0,1[r0 *1 0,0]#1,2[r0 *1 0,0]#2,3[r0 *1 0,0]#0,4[r0 *1 0,0]#0,5[r0 *1 0,0]#2"); - EXPECT_EQ (ct2s(c1), "2[r0 *1 0,0]#1,2[r0 *1 0,0]#2,3[r0 *1 0,0]#0,4[r0 *1 0,0]#1,5[r0 *1 0,0]#1"); - EXPECT_EQ (ct2s(c2), "3[r0 *1 0,0]#0,3[r0 *1 0,0]#2,4[r0 *1 0,0]#1,5[r0 *1 0,0]#2"); - EXPECT_EQ (ct2s(c3), "4[r0 *1 0,0]#0,4[r0 *1 0,0]#1,5[r0 *1 0,0]#2"); - EXPECT_EQ (ct2s(c4), "5[r0 *1 0,0]#1,5[r0 *1 0,0]#2"); + EXPECT_EQ (ct2s(c0), "1[r0 *1 0,0]#{},1[r0 *1 0,0]#{id=>1},2[r0 *1 0,0]#{id=>2},3[r0 *1 0,0]#{},4[r0 *1 0,0]#{},5[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (ct2s(c1), "2[r0 *1 0,0]#{id=>1},2[r0 *1 0,0]#{id=>2},3[r0 *1 0,0]#{},4[r0 *1 0,0]#{id=>1},5[r0 *1 0,0]#{id=>1}"); + EXPECT_EQ (ct2s(c2), "3[r0 *1 0,0]#{},3[r0 *1 0,0]#{id=>2},4[r0 *1 0,0]#{id=>1},5[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (ct2s(c3), "4[r0 *1 0,0]#{},4[r0 *1 0,0]#{id=>1},5[r0 *1 0,0]#{id=>2}"); + EXPECT_EQ (ct2s(c4), "5[r0 *1 0,0]#{id=>1},5[r0 *1 0,0]#{id=>2}"); EXPECT_EQ (ct2s(c5), ""); EXPECT_EQ (cc2s(c0), "1,2,3,4,5"); EXPECT_EQ (cc2s(c1), "2,3,4,5"); @@ -498,22 +513,22 @@ TEST(2) EXPECT_EQ (cc2s(c5), ""); db::Cell::const_iterator inst = c0.begin (); - EXPECT_EQ (c2s_unsorted(c0), "1[r0 *1 0,0]#0,3[r0 *1 0,0]#0,4[r0 *1 0,0]#0,2[r0 *1 0,0]#2,5[r0 *1 0,0]#2,1[r0 *1 0,0]#1"); + EXPECT_EQ (c2s_unsorted(c0), "1[r0 *1 0,0]#{},3[r0 *1 0,0]#{},4[r0 *1 0,0]#{},2[r0 *1 0,0]#{id=>2},5[r0 *1 0,0]#{id=>2},1[r0 *1 0,0]#{id=>1}"); db::Trans t1 (1, db::Vector (100, -200)); c0.replace (*inst, db::CellInstArray (db::CellInst (c2.cell_index ()), t1)); - EXPECT_EQ (c2s_unsorted(c0), "2[r90 *1 100,-200]#0,3[r0 *1 0,0]#0,4[r0 *1 0,0]#0,2[r0 *1 0,0]#2,5[r0 *1 0,0]#2,1[r0 *1 0,0]#1"); + EXPECT_EQ (c2s_unsorted(c0), "2[r90 *1 100,-200]#{},3[r0 *1 0,0]#{},4[r0 *1 0,0]#{},2[r0 *1 0,0]#{id=>2},5[r0 *1 0,0]#{id=>2},1[r0 *1 0,0]#{id=>1}"); ++inst; ++inst; ++inst; - c0.replace (*inst, db::CellInstArrayWithProperties (db::CellInstArray (db::CellInst (c3.cell_index ()), t1), 17)); - EXPECT_EQ (c2s_unsorted(c0), "2[r90 *1 100,-200]#0,3[r0 *1 0,0]#0,4[r0 *1 0,0]#0,3[r90 *1 100,-200]#17,5[r0 *1 0,0]#2,1[r0 *1 0,0]#1"); - c0.replace_prop_id (*inst, 11); - EXPECT_EQ (c2s_unsorted(c0), "2[r90 *1 100,-200]#0,3[r0 *1 0,0]#0,4[r0 *1 0,0]#0,3[r90 *1 100,-200]#11,5[r0 *1 0,0]#2,1[r0 *1 0,0]#1"); + c0.replace (*inst, db::CellInstArrayWithProperties (db::CellInstArray (db::CellInst (c3.cell_index ()), t1), pid17)); + EXPECT_EQ (c2s_unsorted(c0), "2[r90 *1 100,-200]#{},3[r0 *1 0,0]#{},4[r0 *1 0,0]#{},3[r90 *1 100,-200]#{id=>17},5[r0 *1 0,0]#{id=>2},1[r0 *1 0,0]#{id=>1}"); + c0.replace_prop_id (*inst, pid11); + EXPECT_EQ (c2s_unsorted(c0), "2[r90 *1 100,-200]#{},3[r0 *1 0,0]#{},4[r0 *1 0,0]#{},3[r90 *1 100,-200]#{id=>11},5[r0 *1 0,0]#{id=>2},1[r0 *1 0,0]#{id=>1}"); inst = c0.begin (); // replace a non-property array with one with properties: - c0.replace (*inst, db::CellInstArrayWithProperties (db::CellInstArray (db::CellInst (c3.cell_index ()), db::Trans ()), 13)); - EXPECT_EQ (c2s_unsorted(c0), "3[r0 *1 0,0]#0,4[r0 *1 0,0]#0,3[r90 *1 100,-200]#11,5[r0 *1 0,0]#2,1[r0 *1 0,0]#1,3[r0 *1 0,0]#13"); + c0.replace (*inst, db::CellInstArrayWithProperties (db::CellInstArray (db::CellInst (c3.cell_index ()), db::Trans ()), pid13)); + EXPECT_EQ (c2s_unsorted(c0), "3[r0 *1 0,0]#{},4[r0 *1 0,0]#{},3[r90 *1 100,-200]#{id=>11},5[r0 *1 0,0]#{id=>2},1[r0 *1 0,0]#{id=>1},3[r0 *1 0,0]#{id=>13}"); db::Cell &cx = g.cell (g.add_cell (g.cell_name (c0.cell_index ()))); @@ -522,21 +537,21 @@ TEST(2) db::Instance i0 = *inst; c0.erase (inst); // HINT: doing a c2s_unsorted on c0 would disturb the index order of c0, because it uses a flat - // iterator. Therefore we make a copy in order to prevent that problem. See bug #120. + // iterator. Therefore we make a copy in order to prevent that problem. See bug #{id=>120}. cx = c0; - EXPECT_EQ (c2s_unsorted(cx), "4[r0 *1 0,0]#0,3[r90 *1 100,-200]#11,5[r0 *1 0,0]#2,1[r0 *1 0,0]#1,3[r0 *1 0,0]#13"); + EXPECT_EQ (c2s_unsorted(cx), "4[r0 *1 0,0]#{},3[r90 *1 100,-200]#{id=>11},5[r0 *1 0,0]#{id=>2},1[r0 *1 0,0]#{id=>1},3[r0 *1 0,0]#{id=>13}"); EXPECT_EQ (c0.cell_instances (), size_t (5)); // not yet: EXPECT_EQ (c0.empty (), false); inst = c0.begin (); db::Instance i1 = *inst; c0.erase (inst); cx = c0; - EXPECT_EQ (c2s_unsorted(cx), "3[r90 *1 100,-200]#11,5[r0 *1 0,0]#2,1[r0 *1 0,0]#1,3[r0 *1 0,0]#13"); + EXPECT_EQ (c2s_unsorted(cx), "3[r90 *1 100,-200]#{id=>11},5[r0 *1 0,0]#{id=>2},1[r0 *1 0,0]#{id=>1},3[r0 *1 0,0]#{id=>13}"); inst = c0.begin (); db::Instance i2 = *inst; c0.erase (inst); cx = c0; - EXPECT_EQ (c2s_unsorted(cx), "5[r0 *1 0,0]#2,1[r0 *1 0,0]#1,3[r0 *1 0,0]#13"); + EXPECT_EQ (c2s_unsorted(cx), "5[r0 *1 0,0]#{id=>2},1[r0 *1 0,0]#{id=>1},3[r0 *1 0,0]#{id=>13}"); inst = c0.begin (); db::Instance i3 = *inst; db::Instance i4 = *++inst; @@ -571,10 +586,10 @@ TEST(2) } c0.erase (i5); - EXPECT_EQ (c2s_unsorted(c0), "5[r0 *1 0,0]#2,1[r0 *1 0,0]#1"); + EXPECT_EQ (c2s_unsorted(c0), "5[r0 *1 0,0]#{id=>2},1[r0 *1 0,0]#{id=>1}"); EXPECT_EQ (c0.cell_instances (), size_t (2)); c0.erase (i4); - EXPECT_EQ (c2s_unsorted(c0), "5[r0 *1 0,0]#2"); + EXPECT_EQ (c2s_unsorted(c0), "5[r0 *1 0,0]#{id=>2}"); EXPECT_EQ (c0.cell_instances (), size_t (1)); // Not yet: EXPECT_EQ (c0.empty (), false); @@ -615,6 +630,26 @@ TEST(3) { ::pi = 0; + db::PropertiesSet props; + props.insert (tl::Variant ("id"), 17); + db::properties_id_type pid17 = db::properties_id (props); + + props.clear (); + props.insert (tl::Variant ("id"), 18); + db::properties_id_type pid18 = db::properties_id (props); + + props.clear (); + props.insert (tl::Variant ("id"), 21); + db::properties_id_type pid21 = db::properties_id (props); + + props.clear (); + props.insert (tl::Variant ("id"), 1); + db::properties_id_type pid1 = db::properties_id (props); + + props.clear (); + props.insert (tl::Variant ("id"), 10); + db::properties_id_type pid10 = db::properties_id (props); + db::Manager m (true); db::Layout g (&m); db::Cell &c0 (g.cell (g.add_cell ())); @@ -627,10 +662,10 @@ TEST(3) db::Trans t1; db::Trans t2 (db::Vector (100, -100)); c0.insert (db::CellInstArray (db::CellInst (c1.cell_index ()), t1)); - c0.insert (db::CellInstArrayWithProperties (db::CellInstArray (db::CellInst (c1.cell_index ()), t1), 1)); - c0.insert (db::CellInstArrayWithProperties (db::CellInstArray (db::CellInst (c1.cell_index ()), t2), 10)); + c0.insert (db::CellInstArrayWithProperties (db::CellInstArray (db::CellInst (c1.cell_index ()), t1), pid1)); + c0.insert (db::CellInstArrayWithProperties (db::CellInstArray (db::CellInst (c1.cell_index ()), t2), pid10)); - EXPECT_EQ (c2s_unsorted(c0), "1[r0 *1 0,0]#0,1[r0 *1 0,0]#1,1[r0 *1 100,-100]#10"); + EXPECT_EQ (c2s_unsorted(c0), "1[r0 *1 0,0]#{},1[r0 *1 0,0]#{id=>1},1[r0 *1 100,-100]#{id=>10}"); db::Cell::const_iterator i = c0.begin (); ++i; ++i; @@ -639,10 +674,10 @@ TEST(3) EXPECT_EQ (i.at_end (), true); c0.erase (i2); - EXPECT_EQ (c2s_unsorted(c0), "1[r0 *1 0,0]#0,1[r0 *1 0,0]#1"); + EXPECT_EQ (c2s_unsorted(c0), "1[r0 *1 0,0]#{},1[r0 *1 0,0]#{id=>1}"); - c0.insert (db::CellInstArrayWithProperties (db::CellInstArray (db::CellInst (c1.cell_index ()), t2), 17)); - EXPECT_EQ (c2s_unsorted(c0), "1[r0 *1 0,0]#0,1[r0 *1 0,0]#1,1[r0 *1 100,-100]#17"); + c0.insert (db::CellInstArrayWithProperties (db::CellInstArray (db::CellInst (c1.cell_index ()), t2), pid17)); + EXPECT_EQ (c2s_unsorted(c0), "1[r0 *1 0,0]#{},1[r0 *1 0,0]#{id=>1},1[r0 *1 100,-100]#{id=>17}"); i = c0.begin (); ++i; ++i; @@ -650,11 +685,11 @@ TEST(3) ++i; c0.erase (inst2); - EXPECT_EQ (c2s_unsorted(c0), "1[r0 *1 0,0]#0,1[r0 *1 0,0]#1"); + EXPECT_EQ (c2s_unsorted(c0), "1[r0 *1 0,0]#{},1[r0 *1 0,0]#{id=>1}"); - c0.insert (db::CellInstArrayWithProperties (db::CellInstArray (db::CellInst (c1.cell_index ()), t2), 18)); - c0.insert (db::CellInstArrayWithProperties (db::CellInstArray (db::CellInst (c1.cell_index ()), t2), 21)); - EXPECT_EQ (c2s_unsorted(c0), "1[r0 *1 0,0]#0,1[r0 *1 0,0]#1,1[r0 *1 100,-100]#18,1[r0 *1 100,-100]#21"); + c0.insert (db::CellInstArrayWithProperties (db::CellInstArray (db::CellInst (c1.cell_index ()), t2), pid18)); + c0.insert (db::CellInstArrayWithProperties (db::CellInstArray (db::CellInst (c1.cell_index ()), t2), pid21)); + EXPECT_EQ (c2s_unsorted(c0), "1[r0 *1 0,0]#{},1[r0 *1 0,0]#{id=>1},1[r0 *1 100,-100]#{id=>18},1[r0 *1 100,-100]#{id=>21}"); i = c0.begin (); std::vector insts; @@ -665,7 +700,7 @@ TEST(3) std::sort (insts.begin (), insts.end ()); c0.erase_insts (insts); - EXPECT_EQ (c2s_unsorted(c0), "1[r0 *1 0,0]#1,1[r0 *1 100,-100]#21"); + EXPECT_EQ (c2s_unsorted(c0), "1[r0 *1 0,0]#{id=>1},1[r0 *1 100,-100]#{id=>21}"); } TEST(3a) @@ -736,16 +771,24 @@ TEST(3b) { ::pi = 0; + db::PropertiesSet props; + props.insert (tl::Variant ("id"), 5); + db::properties_id_type pid5 = db::properties_id (props); + + props.clear (); + props.insert (tl::Variant ("id"), 17); + db::properties_id_type pid17 = db::properties_id (props); + db::Manager m (true); db::Layout g (&m); db::Cell &c0 (g.cell (g.add_cell ())); db::Cell &c1 (g.cell (g.add_cell ())); db::Trans t (db::Vector (100, -100)); - c0.insert (db::CellInstArrayWithProperties (db::CellInstArray (db::CellInst (c1.cell_index ()), t), 5)); + c0.insert (db::CellInstArrayWithProperties (db::CellInstArray (db::CellInst (c1.cell_index ()), t), pid5)); db::Box b (0, 100, 1000, 1200); - c0.shapes (0).insert (db::BoxWithProperties (b, 17)); + c0.shapes (0).insert (db::BoxWithProperties (b, pid17)); c1.shapes (1).insert (b); // Note: this requires editable mode since db::Shapes::erase is permitted in editable mode only @@ -758,42 +801,42 @@ TEST(3b) EXPECT_EQ (c1.cell_instances (), size_t (0)); EXPECT_EQ (c0.cell_instances (), size_t (1)); - EXPECT_EQ (c0.begin ()->to_string (), "cell_index=1 r0 250,-250 prop_id=5"); + EXPECT_EQ (c0.begin ()->to_string (), "cell_index=1 r0 250,-250 props={id=>5}"); EXPECT_EQ (c0.shapes (0).size (), size_t (1)); EXPECT_EQ (c0.shapes (1).size (), size_t (0)); EXPECT_EQ (c1.shapes (0).size (), size_t (0)); EXPECT_EQ (c1.shapes (1).size (), size_t (1)); - EXPECT_EQ (c0.shapes (0).begin (db::ShapeIterator::All)->to_string (), "box (0,250;2500,3000) prop_id=17"); + EXPECT_EQ (c0.shapes (0).begin (db::ShapeIterator::All)->to_string (), "box (0,250;2500,3000) props={id=>17}"); EXPECT_EQ (c1.shapes (1).begin (db::ShapeIterator::All)->to_string (), "box (0,250;2500,3000)"); m.undo (); EXPECT_EQ (c1.cell_instances (), size_t (0)); EXPECT_EQ (c0.cell_instances (), size_t (1)); - EXPECT_EQ (c0.begin ()->to_string (), "cell_index=1 r0 100,-100 prop_id=5"); + EXPECT_EQ (c0.begin ()->to_string (), "cell_index=1 r0 100,-100 props={id=>5}"); EXPECT_EQ (c0.shapes (0).size (), size_t (1)); EXPECT_EQ (c0.shapes (1).size (), size_t (0)); EXPECT_EQ (c1.shapes (0).size (), size_t (0)); EXPECT_EQ (c1.shapes (1).size (), size_t (1)); - EXPECT_EQ (c0.shapes (0).begin (db::ShapeIterator::All)->to_string (), "box (0,100;1000,1200) prop_id=17"); + EXPECT_EQ (c0.shapes (0).begin (db::ShapeIterator::All)->to_string (), "box (0,100;1000,1200) props={id=>17}"); EXPECT_EQ (c1.shapes (1).begin (db::ShapeIterator::All)->to_string (), "box (0,100;1000,1200)"); m.redo (); EXPECT_EQ (c1.cell_instances (), size_t (0)); EXPECT_EQ (c0.cell_instances (), size_t (1)); - EXPECT_EQ (c0.begin ()->to_string (), "cell_index=1 r0 250,-250 prop_id=5"); + EXPECT_EQ (c0.begin ()->to_string (), "cell_index=1 r0 250,-250 props={id=>5}"); EXPECT_EQ (c0.shapes (0).size (), size_t (1)); EXPECT_EQ (c0.shapes (1).size (), size_t (0)); EXPECT_EQ (c1.shapes (0).size (), size_t (0)); EXPECT_EQ (c1.shapes (1).size (), size_t (1)); - EXPECT_EQ (c0.shapes (0).begin (db::ShapeIterator::All)->to_string (), "box (0,250;2500,3000) prop_id=17"); + EXPECT_EQ (c0.shapes (0).begin (db::ShapeIterator::All)->to_string (), "box (0,250;2500,3000) props={id=>17}"); EXPECT_EQ (c1.shapes (1).begin (db::ShapeIterator::All)->to_string (), "box (0,250;2500,3000)"); } @@ -803,16 +846,24 @@ TEST(3c) { ::pi = 0; + db::PropertiesSet props; + props.insert (tl::Variant ("id"), 5); + db::properties_id_type pid5 = db::properties_id (props); + + props.clear (); + props.insert (tl::Variant ("id"), 17); + db::properties_id_type pid17 = db::properties_id (props); + db::Manager m (true); db::Layout g (&m); db::Cell &c0 (g.cell (g.add_cell ())); db::Cell &c1 (g.cell (g.add_cell ())); db::Trans t (db::Vector (100, -100)); - c0.insert (db::CellInstArrayWithProperties (db::CellInstArray (db::CellInst (c1.cell_index ()), t), 5)); + c0.insert (db::CellInstArrayWithProperties (db::CellInstArray (db::CellInst (c1.cell_index ()), t), pid5)); db::Box b (0, 100, 1000, 1200); - c0.shapes (0).insert (db::BoxWithProperties (b, 17)); + c0.shapes (0).insert (db::BoxWithProperties (b, pid17)); c1.shapes (1).insert (b); // Note: this requires editable mode since db::Shapes::erase is permitted in editable mode only @@ -825,42 +876,42 @@ TEST(3c) EXPECT_EQ (c1.cell_instances (), size_t (0)); EXPECT_EQ (c0.cell_instances (), size_t (1)); - EXPECT_EQ (c0.begin ()->to_string (), "cell_index=1 r0 *2.5 250,-250 prop_id=5"); + EXPECT_EQ (c0.begin ()->to_string (), "cell_index=1 r0 *2.5 250,-250 props={id=>5}"); EXPECT_EQ (c0.shapes (0).size (), size_t (1)); EXPECT_EQ (c0.shapes (1).size (), size_t (0)); EXPECT_EQ (c1.shapes (0).size (), size_t (0)); EXPECT_EQ (c1.shapes (1).size (), size_t (1)); - EXPECT_EQ (c0.shapes (0).begin (db::ShapeIterator::All)->to_string (), "box (0,250;2500,3000) prop_id=17"); + EXPECT_EQ (c0.shapes (0).begin (db::ShapeIterator::All)->to_string (), "box (0,250;2500,3000) props={id=>17}"); EXPECT_EQ (c1.shapes (1).begin (db::ShapeIterator::All)->to_string (), "box (0,100;1000,1200)"); m.undo (); EXPECT_EQ (c1.cell_instances (), size_t (0)); EXPECT_EQ (c0.cell_instances (), size_t (1)); - EXPECT_EQ (c0.begin ()->to_string (), "cell_index=1 r0 100,-100 prop_id=5"); + EXPECT_EQ (c0.begin ()->to_string (), "cell_index=1 r0 100,-100 props={id=>5}"); EXPECT_EQ (c0.shapes (0).size (), size_t (1)); EXPECT_EQ (c0.shapes (1).size (), size_t (0)); EXPECT_EQ (c1.shapes (0).size (), size_t (0)); EXPECT_EQ (c1.shapes (1).size (), size_t (1)); - EXPECT_EQ (c0.shapes (0).begin (db::ShapeIterator::All)->to_string (), "box (0,100;1000,1200) prop_id=17"); + EXPECT_EQ (c0.shapes (0).begin (db::ShapeIterator::All)->to_string (), "box (0,100;1000,1200) props={id=>17}"); EXPECT_EQ (c1.shapes (1).begin (db::ShapeIterator::All)->to_string (), "box (0,100;1000,1200)"); m.redo (); EXPECT_EQ (c1.cell_instances (), size_t (0)); EXPECT_EQ (c0.cell_instances (), size_t (1)); - EXPECT_EQ (c0.begin ()->to_string (), "cell_index=1 r0 *2.5 250,-250 prop_id=5"); + EXPECT_EQ (c0.begin ()->to_string (), "cell_index=1 r0 *2.5 250,-250 props={id=>5}"); EXPECT_EQ (c0.shapes (0).size (), size_t (1)); EXPECT_EQ (c0.shapes (1).size (), size_t (0)); EXPECT_EQ (c1.shapes (0).size (), size_t (0)); EXPECT_EQ (c1.shapes (1).size (), size_t (1)); - EXPECT_EQ (c0.shapes (0).begin (db::ShapeIterator::All)->to_string (), "box (0,250;2500,3000) prop_id=17"); + EXPECT_EQ (c0.shapes (0).begin (db::ShapeIterator::All)->to_string (), "box (0,250;2500,3000) props={id=>17}"); EXPECT_EQ (c1.shapes (1).begin (db::ShapeIterator::All)->to_string (), "box (0,100;1000,1200)"); } @@ -875,6 +926,14 @@ TEST(4) { ::pi = 0; + db::PropertiesSet props; + props.insert (tl::Variant ("id"), 1); + db::properties_id_type pid1 = db::properties_id (props); + + props.clear (); + props.insert (tl::Variant ("id"), 10); + db::properties_id_type pid10 = db::properties_id (props); + db::Manager m (true); db::Layout g (&m); db::Cell &c0 (g.cell (g.add_cell ())); @@ -889,23 +948,23 @@ TEST(4) db::Trans t1; db::Trans t2 (db::Vector (100, -100)); c0.insert (db::CellInstArray (db::CellInst (c1.cell_index ()), t1)); - c0.insert (db::CellInstArrayWithProperties (db::CellInstArray (db::CellInst (c1.cell_index ()), t1), 1)); - c0.insert (db::CellInstArrayWithProperties (db::CellInstArray (db::CellInst (c2.cell_index ()), t2), 10)); + c0.insert (db::CellInstArrayWithProperties (db::CellInstArray (db::CellInst (c1.cell_index ()), t1), pid1)); + c0.insert (db::CellInstArrayWithProperties (db::CellInstArray (db::CellInst (c2.cell_index ()), t2), pid10)); - EXPECT_EQ (c2s_unsorted(c0), "1[r0 *1 0,0]#0,1[r0 *1 0,0]#1,2[r0 *1 100,-100]#10"); + EXPECT_EQ (c2s_unsorted(c0), "1[r0 *1 0,0]#{},1[r0 *1 0,0]#{id=>1},2[r0 *1 100,-100]#{id=>10}"); db::Cell &c3 (g.cell (g.add_cell ())); for (db::Cell::const_iterator i = c0.begin (); ! i.at_end (); ++i) { c3.insert (*i); } - EXPECT_EQ (c2s_unsorted(c3), "1[r0 *1 0,0]#0,1[r0 *1 0,0]#1,2[r0 *1 100,-100]#10"); + EXPECT_EQ (c2s_unsorted(c3), "1[r0 *1 0,0]#{},1[r0 *1 0,0]#{id=>1},2[r0 *1 100,-100]#{id=>10}"); db::Cell &c4 (g.cell (g.add_cell ())); for (db::Cell::const_iterator i = c0.begin (); ! i.at_end (); ++i) { map1 m1; c4.insert (*i, m1); } - EXPECT_EQ (c2s_unsorted(c4), "2[r0 *1 0,0]#0,2[r0 *1 0,0]#1,1[r0 *1 100,-100]#10"); + EXPECT_EQ (c2s_unsorted(c4), "2[r0 *1 0,0]#{},2[r0 *1 0,0]#{id=>1},1[r0 *1 100,-100]#{id=>10}"); } @@ -937,6 +996,7 @@ TEST(5) if ((p % 17) == 0) { c0.insert (db::CellInstArray (db::CellInst (cells[(p * 23) % (sizeof (cells) / sizeof (cells [0]))]->cell_index ()), tt)); } else { + // NOTE: we don't use the properties ID, so they can be any number c0.insert (db::CellInstArrayWithProperties (db::CellInstArray (db::CellInst (cells[(p * 23) % (sizeof (cells) / sizeof (cells [0]))]->cell_index ()), tt), p % 17)); } tt *= trans[p % (sizeof (trans) / sizeof (trans [0]))]; @@ -957,6 +1017,22 @@ TEST(5) TEST(6) { + db::PropertiesSet props; + props.insert (tl::Variant ("id"), 1); + db::properties_id_type pid1 = db::properties_id (props); + + props.clear (); + props.insert (tl::Variant ("id"), 2); + db::properties_id_type pid2 = db::properties_id (props); + + props.clear (); + props.insert (tl::Variant ("id"), 3); + db::properties_id_type pid3 = db::properties_id (props); + + props.clear (); + props.insert (tl::Variant ("id"), 4); + db::properties_id_type pid4 = db::properties_id (props); + db::Manager m (true); db::Layout g (&m); db::Cell &c0 (g.cell (g.add_cell ())); @@ -969,8 +1045,8 @@ TEST(6) c0.insert (db::CellInstArray (db::CellInst (c2.cell_index ()), tt)); c0.insert (db::CellInstArray (db::CellInst (c3.cell_index ()), tt)); c0.insert (db::CellInstArrayWithProperties (db::CellInstArray (db::CellInst (c1.cell_index ()), tt), 0)); - c0.insert (db::CellInstArrayWithProperties (db::CellInstArray (db::CellInst (c2.cell_index ()), tt), 1)); - c0.insert (db::CellInstArrayWithProperties (db::CellInstArray (db::CellInst (c3.cell_index ()), tt), 2)); + c0.insert (db::CellInstArrayWithProperties (db::CellInstArray (db::CellInst (c2.cell_index ()), tt), pid1)); + c0.insert (db::CellInstArrayWithProperties (db::CellInstArray (db::CellInst (c3.cell_index ()), tt), pid2)); g.update (); @@ -982,12 +1058,12 @@ TEST(6) r += tl::to_string (*cc); } - EXPECT_EQ (c2s_unsorted(c0), "1[r0 *1 0,0]#0,2[r0 *1 0,0]#0,3[r0 *1 0,0]#0,1[r0 *1 0,0]#0,2[r0 *1 0,0]#1,3[r0 *1 0,0]#2"); + EXPECT_EQ (c2s_unsorted(c0), "1[r0 *1 0,0]#{},2[r0 *1 0,0]#{},3[r0 *1 0,0]#{},1[r0 *1 0,0]#{},2[r0 *1 0,0]#{id=>1},3[r0 *1 0,0]#{id=>2}"); db::Cell &cc (g.cell (g.add_cell ())); cc = c0; - EXPECT_EQ (c2s_unsorted(cc), "1[r0 *1 0,0]#0,2[r0 *1 0,0]#0,3[r0 *1 0,0]#0,1[r0 *1 0,0]#0,2[r0 *1 0,0]#1,3[r0 *1 0,0]#2"); + EXPECT_EQ (c2s_unsorted(cc), "1[r0 *1 0,0]#{},2[r0 *1 0,0]#{},3[r0 *1 0,0]#{},1[r0 *1 0,0]#{},2[r0 *1 0,0]#{id=>1},3[r0 *1 0,0]#{id=>2}"); // Note: iterating and replace does not work in non-editable mode if (db::default_editable_mode ()) { @@ -997,16 +1073,16 @@ TEST(6) insts.push_back (*i); } for (db::Cell::const_iterator i = cc.begin (); ! i.at_end (); ++i) { - cc.replace_prop_id (*i, i->prop_id () + 1); + cc.replace_prop_id (*i, pid3); } - EXPECT_EQ (c2s_unsorted(cc), "1[r0 *1 0,0]#1,2[r0 *1 0,0]#2,3[r0 *1 0,0]#3,1[r0 *1 0,0]#1,2[r0 *1 0,0]#1,3[r0 *1 0,0]#1"); + EXPECT_EQ (c2s_unsorted(cc), "1[r0 *1 0,0]#{id=>3},2[r0 *1 0,0]#{id=>3},3[r0 *1 0,0]#{id=>3},1[r0 *1 0,0]#{id=>3},2[r0 *1 0,0]#{id=>3},3[r0 *1 0,0]#{id=>3}"); for (db::Cell::const_iterator i = c0.begin (); ! i.at_end (); ++i) { - c0.replace (*i, db::CellInstArrayWithProperties (i->cell_inst (), i->prop_id () + 1)); + c0.replace (*i, db::CellInstArrayWithProperties (i->cell_inst (), pid4)); } - EXPECT_EQ (c2s_unsorted(c0), "1[r0 *1 0,0]#1,2[r0 *1 0,0]#2,3[r0 *1 0,0]#3,1[r0 *1 0,0]#1,2[r0 *1 0,0]#1,3[r0 *1 0,0]#1"); + EXPECT_EQ (c2s_unsorted(c0), "1[r0 *1 0,0]#{id=>4},2[r0 *1 0,0]#{id=>4},3[r0 *1 0,0]#{id=>4},1[r0 *1 0,0]#{id=>4},2[r0 *1 0,0]#{id=>4},3[r0 *1 0,0]#{id=>4}"); } diff --git a/src/db/unit_tests/dbDeepShapeStoreTests.cc b/src/db/unit_tests/dbDeepShapeStoreTests.cc index 061961b54..ec88f059b 100644 --- a/src/db/unit_tests/dbDeepShapeStoreTests.cc +++ b/src/db/unit_tests/dbDeepShapeStoreTests.cc @@ -179,7 +179,7 @@ TEST(3_TextTreatment) EXPECT_EQ (store.layouts (), (unsigned int) 1); EXPECT_EQ (dl1.initial_cell ().shapes (dl1.layer ()).size (), size_t (1)); - EXPECT_EQ (dl1.initial_cell ().shapes (dl1.layer ()).begin (db::ShapeIterator::All)->to_string (), "polygon (999,1999;999,2001;1001,2001;1001,1999) prop_id=1"); + EXPECT_EQ (dl1.initial_cell ().shapes (dl1.layer ()).begin (db::ShapeIterator::All)->to_string (), "polygon (999,1999;999,2001;1001,2001;1001,1999) props={text=>TEXT}"); } TEST(4_FlatAndEmptyInput) diff --git a/src/db/unit_tests/dbLayoutDiffTests.cc b/src/db/unit_tests/dbLayoutDiffTests.cc index b03a37d22..e5b5c1e78 100644 --- a/src/db/unit_tests/dbLayoutDiffTests.cc +++ b/src/db/unit_tests/dbLayoutDiffTests.cc @@ -716,9 +716,9 @@ TEST(2P) ps.insert (tl::Variant ("C"), tl::Variant ("c")); pi3 = db::properties_id (ps); - EXPECT_EQ (ps2string (pi1), "A:1"); - EXPECT_EQ (ps2string (pi2), "B:2"); - EXPECT_EQ (ps2string (pi3), "B:2,C:c"); + EXPECT_EQ (ps2string (pi1), "{A=>1}"); + EXPECT_EQ (ps2string (pi2), "{B=>2}"); + EXPECT_EQ (ps2string (pi3), "{B=>2,C=>c}"); } db::Layout h = g; diff --git a/src/db/unit_tests/dbLayoutQueryTests.cc b/src/db/unit_tests/dbLayoutQueryTests.cc index 85042b5da..81bbc03f0 100644 --- a/src/db/unit_tests/dbLayoutQueryTests.cc +++ b/src/db/unit_tests/dbLayoutQueryTests.cc @@ -256,9 +256,9 @@ TEST(1) s = q2s_var (iq, "parent_cell_name"); EXPECT_EQ (s, "nil"); s = q2s_var (iq, "path_names"); - EXPECT_EQ (s, "c2x"); + EXPECT_EQ (s, "(c2x)"); s = q2s_var (iq, "path"); - EXPECT_EQ (s, "1"); + EXPECT_EQ (s, "(1)"); s = q2s_var (iq, "hier_levels"); EXPECT_EQ (s, "0"); } @@ -294,7 +294,7 @@ TEST(1) s = q2s_expr (iq, "parent_cell.name"); EXPECT_EQ (s, "c2x,c2x,c2x"); s = q2s_var (iq, "path_names"); - EXPECT_EQ (s, "c2x,c1,c2x,c4,c2x,c5x"); + EXPECT_EQ (s, "(c2x,c1),(c2x,c4),(c2x,c5x)"); s = q2s_var (iq, "hier_levels"); EXPECT_EQ (s, "1,1,1"); } @@ -354,7 +354,7 @@ TEST(1) s = q2s_var (iq, "parent_cell_name"); EXPECT_EQ (s, "nil,c2x,c2x,c2x"); s = q2s_var (iq, "path_names"); - EXPECT_EQ (s, "c2x,c2x,c1,c2x,c4,c2x,c5x"); + EXPECT_EQ (s, "(c2x),(c2x,c1),(c2x,c4),(c2x,c5x)"); s = q2s_var (iq, "hier_levels"); EXPECT_EQ (s, "0,1,1,1"); } @@ -419,7 +419,7 @@ TEST(1) s = q2s_var (iq, "parent_cell_name"); EXPECT_EQ (s, "c2x,c3"); s = q2s_var (iq, "path_names"); - EXPECT_EQ (s, "c2x,c5x,c2x,c4,c3,c5x"); + EXPECT_EQ (s, "(c2x,c5x),(c2x,c4,c3,c5x)"); s = q2s_var (iq, "hier_levels"); EXPECT_EQ (s, "1,3"); } @@ -440,7 +440,7 @@ TEST(1) s = q2s_var (iq, "parent_cell_name"); EXPECT_EQ (s, "c2x,c4,c5x,c5x"); s = q2s_var (iq, "path_names"); - EXPECT_EQ (s, "c2x,c1,c2x,c4,c1,c2x,c4,c3,c5x,c1,c2x,c5x,c1"); + EXPECT_EQ (s, "(c2x,c1),(c2x,c4,c1),(c2x,c4,c3,c5x,c1),(c2x,c5x,c1)"); s = q2s_var (iq, "hier_levels"); EXPECT_EQ (s, "1,2,4,2"); s = q2s_var (iq, "references"); @@ -467,7 +467,7 @@ TEST(1) s = q2s_var (iq, "parent_cell_name"); EXPECT_EQ (s, "c2x,c4,c5x,c5x"); s = q2s_var (iq, "path_names"); - EXPECT_EQ (s, "c2x,c1,c2x,c4,c1,c2x,c4,c3,c5x,c1,c2x,c5x,c1"); + EXPECT_EQ (s, "(c2x,c1),(c2x,c4,c1),(c2x,c4,c3,c5x,c1),(c2x,c5x,c1)"); s = q2s_var (iq, "hier_levels"); EXPECT_EQ (s, "1,2,4,2"); s = q2s_var (iq, "references"); @@ -494,7 +494,7 @@ TEST(1) s = q2s_var (iq, "parent_cell_name"); EXPECT_EQ (s, "nil"); s = q2s_var (iq, "path_names"); - EXPECT_EQ (s, "c1"); + EXPECT_EQ (s, "(c1)"); s = q2s_var (iq, "hier_levels"); EXPECT_EQ (s, "0"); s = q2s_var (iq, "references"); @@ -1054,49 +1054,49 @@ TEST(4) db::LayoutQuery q ("select cell_name+'#'+cell_index from *"); db::LayoutQueryIterator iq (q, &g); std::string s = q2s_var (iq, "data"); - EXPECT_EQ (s, "c2x#1,c4#3,c3#2,c5x#4,c1#0"); + EXPECT_EQ (s, "(c2x#1),(c4#3),(c3#2),(c5x#4),(c1#0)"); } { db::LayoutQuery q ("select $1 from 'c(*)'"); db::LayoutQueryIterator iq (q, &g); std::string s = q2s_var (iq, "data"); - EXPECT_EQ (s, "2x,4,3,5x,1"); + EXPECT_EQ (s, "(2x),(4),(3),(5x),(1)"); } { db::LayoutQuery q ("select cell_index+'#'+cell_name from * sorted by cell_name"); db::LayoutQueryIterator iq (q, &g); std::string s = q2s_var (iq, "data"); - EXPECT_EQ (s, "0#c1,1#c2x,2#c3,3#c4,4#c5x"); + EXPECT_EQ (s, "(0#c1),(1#c2x),(2#c3),(3#c4),(4#c5x)"); } { db::LayoutQuery q ("select cell_index+'#'+cell_name from ..* sorted by cell_name"); db::LayoutQueryIterator iq (q, &g); std::string s = q2s_var (iq, "data"); - EXPECT_EQ (s, "0#c1,0#c1,0#c1,0#c1,1#c2x,2#c3,3#c4,4#c5x,4#c5x"); + EXPECT_EQ (s, "(0#c1),(0#c1),(0#c1),(0#c1),(1#c2x),(2#c3),(3#c4),(4#c5x),(4#c5x)"); } { db::LayoutQuery q ("select cell_index+'#'+cell_name from ..* sorted by cell_name unique"); db::LayoutQueryIterator iq (q, &g); std::string s = q2s_var (iq, "data"); - EXPECT_EQ (s, "0#c1,1#c2x,2#c3,3#c4,4#c5x"); + EXPECT_EQ (s, "(0#c1),(1#c2x),(2#c3),(3#c4),(4#c5x)"); } { db::LayoutQuery q ("select cell_index+'#'+cell_name from instances of ..* sorted by cell_name"); db::LayoutQueryIterator iq (q, &g); std::string s = q2s_var (iq, "data"); - EXPECT_EQ (s, "0#c1,0#c1,0#c1,0#c1,0#c1,0#c1,0#c1,0#c1,0#c1,0#c1,0#c1,0#c1,0#c1,0#c1,0#c1,0#c1,0#c1,0#c1,0#c1,0#c1,0#c1,0#c1,0#c1,0#c1,1#c2x,2#c3,2#c3,3#c4,3#c4,4#c5x,4#c5x,4#c5x,4#c5x,4#c5x,4#c5x,4#c5x,4#c5x"); + EXPECT_EQ (s, "(0#c1),(0#c1),(0#c1),(0#c1),(0#c1),(0#c1),(0#c1),(0#c1),(0#c1),(0#c1),(0#c1),(0#c1),(0#c1),(0#c1),(0#c1),(0#c1),(0#c1),(0#c1),(0#c1),(0#c1),(0#c1),(0#c1),(0#c1),(0#c1),(1#c2x),(2#c3),(2#c3),(3#c4),(3#c4),(4#c5x),(4#c5x),(4#c5x),(4#c5x),(4#c5x),(4#c5x),(4#c5x),(4#c5x)"); } { db::LayoutQuery q ("select cell_index+'#'+cell_name from instances of ..* sorted by cell_name unique"); db::LayoutQueryIterator iq (q, &g); std::string s = q2s_var (iq, "data"); - EXPECT_EQ (s, "0#c1,1#c2x,2#c3,3#c4,4#c5x"); + EXPECT_EQ (s, "(0#c1),(1#c2x),(2#c3),(3#c4),(4#c5x)"); } } @@ -1112,7 +1112,7 @@ TEST(51a) db::LayoutQuery q ("select cell_name+'#'+cell_index from *"); db::LayoutQueryIterator iq (q, &g); std::string s = q2s_var (iq, "data"); - EXPECT_EQ (s, "c4#3,c1#0,c3#2"); + EXPECT_EQ (s, "(c4#3),(c1#0),(c3#2)"); } { @@ -1246,10 +1246,10 @@ TEST(53) std::string s; db::LayoutQueryIterator iq (q, &g); s = q2s_var (iq, "path_names", ";"); - EXPECT_EQ (s, "c2x;c2x,c1;c2x,c4;c2x,c5x;c2x,c4,c1;c2x,c4,c3;c2x,c4,c3,c5x;c2x,c4,c3,c5x,c1;c2x,c5x,c1"); + EXPECT_EQ (s, "(c2x);(c2x,c1);(c2x,c4);(c2x,c5x);(c2x,c4,c1);(c2x,c4,c3);(c2x,c4,c3,c5x);(c2x,c4,c3,c5x,c1);(c2x,c5x,c1)"); db::LayoutQuery ("delete instances of *.c1").execute (g); s = q2s_var (iq, "path_names", ";"); - EXPECT_EQ (s, "c1;c2x;c2x,c4;c2x,c5x;c2x,c4,c3;c2x,c4,c3,c5x"); + EXPECT_EQ (s, "(c1);(c2x);(c2x,c4);(c2x,c5x);(c2x,c4,c3);(c2x,c4,c3,c5x)"); } init_layout (g); @@ -1259,7 +1259,7 @@ TEST(53) db::LayoutQuery q ("delete instances of *.c1 pass"); db::LayoutQueryIterator iq (q, &g); s = q2s_var (iq, "path_names", ";"); - EXPECT_EQ (s, "c2x,c1;c2x,c1;c4,c1;c4,c1;c5x,c1"); + EXPECT_EQ (s, "(c2x,c1);(c2x,c1);(c4,c1);(c4,c1);(c5x,c1)"); } init_layout (g); @@ -1269,10 +1269,10 @@ TEST(53) std::string s; db::LayoutQueryIterator iq (q, &g); s = q2s_var (iq, "path_names", ";"); - EXPECT_EQ (s, "c2x;c2x,c1;c2x,c4;c2x,c5x;c2x,c4,c1;c2x,c4,c3;c2x,c4,c3,c5x;c2x,c4,c3,c5x,c1;c2x,c5x,c1"); + EXPECT_EQ (s, "(c2x);(c2x,c1);(c2x,c4);(c2x,c5x);(c2x,c4,c1);(c2x,c4,c3);(c2x,c4,c3,c5x);(c2x,c4,c3,c5x,c1);(c2x,c5x,c1)"); db::LayoutQuery ("delete instances of c1").execute (g); s = q2s_var (iq, "path_names", ";"); - EXPECT_EQ (s, "c1;c2x;c2x,c4;c2x,c5x;c2x,c4,c3;c2x,c4,c3,c5x"); + EXPECT_EQ (s, "(c1);(c2x);(c2x,c4);(c2x,c5x);(c2x,c4,c3);(c2x,c4,c3,c5x)"); } init_layout (g); @@ -1282,10 +1282,10 @@ TEST(53) std::string s; db::LayoutQueryIterator iq (q, &g); s = q2s_var (iq, "path_names", ";"); - EXPECT_EQ (s, "c2x;c2x,c1;c2x,c4;c2x,c5x;c2x,c4,c1;c2x,c4,c3;c2x,c4,c3,c5x;c2x,c4,c3,c5x,c1;c2x,c5x,c1"); + EXPECT_EQ (s, "(c2x);(c2x,c1);(c2x,c4);(c2x,c5x);(c2x,c4,c1);(c2x,c4,c3);(c2x,c4,c3,c5x);(c2x,c4,c3,c5x,c1);(c2x,c5x,c1)"); db::LayoutQuery ("delete instances of *").execute (g); s = q2s_var (iq, "path_names", ";"); - EXPECT_EQ (s, "c1;c2x;c3;c4;c5x"); + EXPECT_EQ (s, "(c1);(c2x);(c3);(c4);(c5x)"); } init_layout (g); @@ -1297,7 +1297,7 @@ TEST(53) db::LayoutQuery q ("delete instances of ...c1 pass"); db::LayoutQueryIterator iq (q, &g); s = q2s_var (iq, "path_names", ";"); - EXPECT_EQ (s, "c2x,c1;c2x,c1;c2x,c4,c1;c2x,c4,c1;c2x,c4,c3,c5x,c1"); + EXPECT_EQ (s, "(c2x,c1);(c2x,c1);(c2x,c4,c1);(c2x,c4,c1);(c2x,c4,c3,c5x,c1)"); } } @@ -1516,21 +1516,21 @@ TEST(62) db::LayoutQuery q ("select inst.pcell_parameters_by_name[\"text\"] from instances of ...* where cell_name ~ \"Basic.*\""); db::LayoutQueryIterator iq (q, &g); std::string s = q2s_var (iq, "data"); - EXPECT_EQ (s, "T2,T1,T1"); + EXPECT_EQ (s, "(T2),(T1),(T1)"); } { db::LayoutQuery q ("select inst.pcell_parameter(\"text\") from instances of ...* where cell_name ~ \"Basic.*\""); db::LayoutQueryIterator iq (q, &g); std::string s = q2s_var (iq, "data"); - EXPECT_EQ (s, "T2,T1,T1"); + EXPECT_EQ (s, "(T2),(T1),(T1)"); } { db::LayoutQuery q ("select inst[\"text\"] from instances of ...* where cell_name ~ \"Basic.*\""); db::LayoutQueryIterator iq (q, &g); std::string s = q2s_var (iq, "data"); - EXPECT_EQ (s, "T2,T1,T1"); + EXPECT_EQ (s, "(T2),(T1),(T1)"); } { @@ -1568,13 +1568,13 @@ TEST(64) db::LayoutQuery q ("select inst.dtrans from instances of .*.*"); db::LayoutQueryIterator iq (q, &g); std::string s = q2s_var (iq, "data"); - EXPECT_EQ (s, "r0 0.01,-0.02,m45 -0.01,0.02,m45 -0.01,0.02,m45 -0.01,0.02,r0 0.01,-0.02,m45 -0.01,0.02"); + EXPECT_EQ (s, "(r0 0.01,-0.02),(m45 -0.01,0.02),(m45 -0.01,0.02),(m45 -0.01,0.02),(r0 0.01,-0.02),(m45 -0.01,0.02)"); } { db::LayoutQuery q ("select inst.dtrans.disp.x,inst.dtrans.disp.y from instances of .*.*"); db::LayoutQueryIterator iq (q, &g); std::string s = q2s_var (iq, "data"); - EXPECT_EQ (s, "0.01,-0.02,-0.01,0.02,-0.01,0.02,-0.01,0.02,0.01,-0.02,-0.01,0.02"); + EXPECT_EQ (s, "(0.01,-0.02),(-0.01,0.02),(-0.01,0.02),(-0.01,0.02),(0.01,-0.02),(-0.01,0.02)"); } } diff --git a/src/db/unit_tests/dbRegionTests.cc b/src/db/unit_tests/dbRegionTests.cc index 852660e01..c7b2fc888 100644 --- a/src/db/unit_tests/dbRegionTests.cc +++ b/src/db/unit_tests/dbRegionTests.cc @@ -2373,11 +2373,11 @@ TEST(53_PropertiesDeepFromLayout) EXPECT_EQ (s->to_string (), "(10,20;10,220;110,220;110,20)"); ++s; EXPECT_EQ (s.at_end (), false); - EXPECT_EQ (db::prop2string (s.prop_id ()), "VALUE=1"); + EXPECT_EQ (db::prop2string (s.prop_id ()), "{VALUE=>1}"); EXPECT_EQ (s->to_string (), "(1,2;1,202;101,202;101,2)"); ++s; EXPECT_EQ (s.at_end (), false); - EXPECT_EQ (db::prop2string (s.prop_id ()), "VALUE=42"); + EXPECT_EQ (db::prop2string (s.prop_id ()), "{VALUE=>42}"); EXPECT_EQ (s->to_string (), "(11,12;11,212;111,212;111,12)"); ++s; EXPECT_EQ (s.at_end (), true); @@ -2390,13 +2390,13 @@ TEST(53_PropertiesDeepFromLayout) ++s; EXPECT_EQ (s.at_end (), false); - EXPECT_EQ (db::prop2string (s.prop_id ()), "VALUE=1"); + EXPECT_EQ (db::prop2string (s.prop_id ()), "{VALUE=>1}"); // a single property #1 element EXPECT_EQ (s->to_string (), "(1,2;1,202;101,202;101,2)"); ++s; EXPECT_EQ (s.at_end (), false); - EXPECT_EQ (db::prop2string (s.prop_id ()), "VALUE=42"); + EXPECT_EQ (db::prop2string (s.prop_id ()), "{VALUE=>42}"); // a single property #42 element EXPECT_EQ (s->to_string (), "(11,12;11,212;111,212;111,12)"); ++s; @@ -2442,26 +2442,26 @@ TEST(54_PropertiesFilterDeep) db::Region::const_iterator s = rr.begin (); EXPECT_EQ (s.at_end (), false); - EXPECT_EQ (db::prop2string (s.prop_id ()), "1=100"); + EXPECT_EQ (db::prop2string (s.prop_id ()), "{1=>100}"); EXPECT_EQ (s->to_string (), "(1,2;1,202;101,202;101,2)"); ++s; EXPECT_EQ (s.at_end (), false); - EXPECT_EQ (db::prop2string (s.prop_id ()), "1=0"); + EXPECT_EQ (db::prop2string (s.prop_id ()), "{1=>0}"); EXPECT_EQ (s->to_string (), "(10,12;10,212;111,212;111,12)"); ++s; EXPECT_EQ (s.at_end (), false); - EXPECT_EQ (db::prop2string (s.prop_id ()), "1=100"); + EXPECT_EQ (db::prop2string (s.prop_id ()), "{1=>100}"); EXPECT_EQ (s->to_string (), "(20,22;20,222;121,222;121,22)"); ++s; EXPECT_EQ (s.at_end (), false); - EXPECT_EQ (db::prop2string (s.prop_id ()), "1=100"); + EXPECT_EQ (db::prop2string (s.prop_id ()), "{1=>100}"); EXPECT_EQ (s->to_string (), "(30,32;30,232;131,232;131,32)"); ++s; EXPECT_EQ (s.at_end (), true); s = r.begin (); EXPECT_EQ (s.at_end (), false); - EXPECT_EQ (db::prop2string (s.prop_id ()), "1=100\n2=101"); + EXPECT_EQ (db::prop2string (s.prop_id ()), "{1=>100,2=>101}"); EXPECT_EQ (s->to_string (), "(1,2;1,202;101,202;101,2)"); } @@ -2503,26 +2503,26 @@ TEST(55_PropertiesFilterFlat) db::Region::const_iterator s = rr.begin (); EXPECT_EQ (s.at_end (), false); - EXPECT_EQ (db::prop2string (s.prop_id ()), "1=100"); + EXPECT_EQ (db::prop2string (s.prop_id ()), "{1=>100}"); EXPECT_EQ (s->to_string (), "(1,2;1,202;101,202;101,2)"); ++s; EXPECT_EQ (s.at_end (), false); - EXPECT_EQ (db::prop2string (s.prop_id ()), "1=0"); + EXPECT_EQ (db::prop2string (s.prop_id ()), "{1=>0}"); EXPECT_EQ (s->to_string (), "(10,12;10,212;111,212;111,12)"); ++s; EXPECT_EQ (s.at_end (), false); - EXPECT_EQ (db::prop2string (s.prop_id ()), "1=100"); + EXPECT_EQ (db::prop2string (s.prop_id ()), "{1=>100}"); EXPECT_EQ (s->to_string (), "(20,22;20,222;121,222;121,22)"); ++s; EXPECT_EQ (s.at_end (), false); - EXPECT_EQ (db::prop2string (s.prop_id ()), "1=100"); + EXPECT_EQ (db::prop2string (s.prop_id ()), "{1=>100}"); EXPECT_EQ (s->to_string (), "(30,32;30,232;131,232;131,32)"); ++s; EXPECT_EQ (s.at_end (), true); s = r.begin (); EXPECT_EQ (s.at_end (), false); - EXPECT_EQ (db::prop2string (s.prop_id ()), "1=100\n2=101"); + EXPECT_EQ (db::prop2string (s.prop_id ()), "{1=>100,2=>101}"); EXPECT_EQ (s->to_string (), "(1,2;1,202;101,202;101,2)"); } diff --git a/src/plugins/streamers/gds2/unit_tests/dbGDS2WriterTests.cc b/src/plugins/streamers/gds2/unit_tests/dbGDS2WriterTests.cc index 4e62f3aa0..fd3db0521 100644 --- a/src/plugins/streamers/gds2/unit_tests/dbGDS2WriterTests.cc +++ b/src/plugins/streamers/gds2/unit_tests/dbGDS2WriterTests.cc @@ -1265,7 +1265,7 @@ TEST(130) EXPECT_EQ (layout_read.meta_info ("complex").value.is_list (), true); EXPECT_EQ (layout_read.meta_info ("complex").value.size (), size_t (2)); EXPECT_EQ (layout_read.meta_info ("complex").value.begin () [1].is_array (), true); - EXPECT_EQ (layout_read.meta_info ("complex").value.to_string (), "-1.5,x=>value_for_x,y=>(1.5,2.5;3.5,4.5)"); + EXPECT_EQ (layout_read.meta_info ("complex").value.to_string (), "(-1.5,{x=>value_for_x,y=>(1.5,2.5;3.5,4.5)})"); db::cell_index_type ci2 = layout_read.cell_by_name ("X").second; db::cell_index_type cil2 = layout_read.cell_by_name ("TEXT").second; @@ -1278,7 +1278,7 @@ TEST(130) EXPECT_EQ (layout_read.meta_info (ci2, "complex").value.is_list (), true); EXPECT_EQ (layout_read.meta_info (ci2, "complex").value.size (), size_t (2)); EXPECT_EQ (layout_read.meta_info (ci2, "complex").value.begin () [1].is_array (), true); - EXPECT_EQ (layout_read.meta_info (ci2, "complex").value.to_string (), "-1.5,x=>value_for_x,y=>(1.5,2.5;3.5,4.5)"); + EXPECT_EQ (layout_read.meta_info (ci2, "complex").value.to_string (), "(-1.5,{x=>value_for_x,y=>(1.5,2.5;3.5,4.5)})"); EXPECT_EQ (layout_read.meta_info (cil2, "x").value.to_string (), "42"); EXPECT_EQ (layout_read.meta_info (cil2, "y").value.to_string (), "-17");