From 3707fae3c229e3d2273e786f73d05ae5784bc62a Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 26 Dec 2020 14:58:07 +0100 Subject: [PATCH] WIP: more tests, debugging --- src/db/db/dbCompoundOperation.cc | 2 + src/db/unit_tests/dbCompoundOperationTests.cc | 73 +++++++++++++++++- testdata/drc/compound_4.gds | Bin 0 -> 576 bytes testdata/drc/compound_5.gds | Bin 0 -> 576 bytes testdata/drc/compound_au4.gds | Bin 0 -> 758 bytes testdata/drc/compound_au5.gds | Bin 0 -> 566 bytes 6 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 testdata/drc/compound_4.gds create mode 100644 testdata/drc/compound_5.gds create mode 100644 testdata/drc/compound_au4.gds create mode 100644 testdata/drc/compound_au5.gds diff --git a/src/db/db/dbCompoundOperation.cc b/src/db/db/dbCompoundOperation.cc index 0100e561b..65f3778cf 100644 --- a/src/db/db/dbCompoundOperation.cc +++ b/src/db/db/dbCompoundOperation.cc @@ -835,6 +835,7 @@ void compound_region_generic_operation_node::implement_compute_local const CompoundRegionOperationNode *self = child (0); std::vector > self_result; + self_result.push_back (std::unordered_set ()); shape_interactions self_interactions_heap; const shape_interactions &self_interactions = interactions_for_child (interactions, 0, self_interactions_heap); @@ -851,6 +852,7 @@ void compound_region_generic_operation_node::implement_compute_local const CompoundRegionOperationNode *intruder = child (ci); std::vector > intruder_result; + intruder_result.push_back (std::unordered_set ()); shape_interactions intruder_interactions_heap; const shape_interactions &intruder_interactions = interactions_for_child (interactions, ci, intruder_interactions_heap); diff --git a/src/db/unit_tests/dbCompoundOperationTests.cc b/src/db/unit_tests/dbCompoundOperationTests.cc index 0bc3ec42a..41363e795 100644 --- a/src/db/unit_tests/dbCompoundOperationTests.cc +++ b/src/db/unit_tests/dbCompoundOperationTests.cc @@ -137,9 +137,6 @@ TEST(3_BooleanOperations) reader.read (ly); } - db::RegionCheckOptions check_options; - check_options.metrics = db::Projection; - unsigned int l1 = ly.get_layer (db::LayerProperties (1, 0)); db::Region r (db::RecursiveShapeIterator (ly, ly.cell (*ly.begin_top_down ()), l1)); @@ -166,3 +163,73 @@ TEST(3_BooleanOperations) db::compare_layouts (_this, ly, tl::testsrc () + "/testdata/drc/compound_au3.gds"); } +TEST(4_SizeOperation) +{ + db::Layout ly; + { + std::string fn (tl::testsrc ()); + fn += "/testdata/drc/compound_4.gds"; + tl::InputStream stream (fn); + db::Reader reader (stream); + reader.read (ly); + } + + unsigned int l1 = ly.get_layer (db::LayerProperties (1, 0)); + db::Region r (db::RecursiveShapeIterator (ly, ly.cell (*ly.begin_top_down ()), l1)); + + unsigned int l2 = ly.get_layer (db::LayerProperties (2, 0)); + db::Region r2 (db::RecursiveShapeIterator (ly, ly.cell (*ly.begin_top_down ()), l2)); + + db::CompoundRegionOperationPrimaryNode *primary = new db::CompoundRegionOperationPrimaryNode (); + db::CompoundRegionSizeOperationNode geo_size (250, 250, 2, primary); + + db::Region res = r.cop_to_region (geo_size); + + unsigned int l1000 = ly.get_layer (db::LayerProperties (1000, 0)); + res.insert_into (&ly, *ly.begin_top_down (), l1000); + + db::CompoundRegionOperationSecondaryNode *secondary = new db::CompoundRegionOperationSecondaryNode (&r2); + db::CompoundRegionSizeOperationNode geo_size2 (-250, -250, 2, secondary); + + res = r.cop_to_region (geo_size2); + + unsigned int l1001 = ly.get_layer (db::LayerProperties (1001, 0)); + res.insert_into (&ly, *ly.begin_top_down (), l1001); + + CHECKPOINT(); + db::compare_layouts (_this, ly, tl::testsrc () + "/testdata/drc/compound_au4.gds"); +} + +TEST(5_InteractOperation) +{ + db::Layout ly; + { + std::string fn (tl::testsrc ()); + fn += "/testdata/drc/compound_5.gds"; + tl::InputStream stream (fn); + db::Reader reader (stream); + reader.read (ly); + } + + db::RegionCheckOptions check_options; + check_options.metrics = db::Projection; + + unsigned int l1 = ly.get_layer (db::LayerProperties (1, 0)); + db::Region r (db::RecursiveShapeIterator (ly, ly.cell (*ly.begin_top_down ()), l1)); + + unsigned int l2 = ly.get_layer (db::LayerProperties (2, 0)); + db::Region r2 (db::RecursiveShapeIterator (ly, ly.cell (*ly.begin_top_down ()), l2)); + + db::CompoundRegionOperationPrimaryNode *primary = new db::CompoundRegionOperationPrimaryNode (); + db::CompoundRegionOperationSecondaryNode *secondary = new db::CompoundRegionOperationSecondaryNode (&r2); + db::CompoundRegionInteractOperationNode interact (primary, secondary, 0, true, false); + + db::Region res = r.cop_to_region (interact); + + unsigned int l1000 = ly.get_layer (db::LayerProperties (1000, 0)); + res.insert_into (&ly, *ly.begin_top_down (), l1000); + + CHECKPOINT(); + db::compare_layouts (_this, ly, tl::testsrc () + "/testdata/drc/compound_au5.gds"); +} + diff --git a/testdata/drc/compound_4.gds b/testdata/drc/compound_4.gds new file mode 100644 index 0000000000000000000000000000000000000000..001eefe47e13e90090c534d99fd50afcbc3a9818 GIT binary patch literal 576 zcmb7>y-EZz6otRZB-wG9{Sz(JDJ=!D5*u;EW>IjFDa6VLv9$3SY^Kw~2k-&Jr?A{& zv05x`u9>)Df{3yya>7l%b1pYnl)9uyRA)-g23`8>#b+{Q&&J2FmYT!zZvXW4VSaG( zyj$O2RTSnA&e}IFCB;3Cofq@3$;XihOSS7CiaeRMMGucGD2~s9;dH>JoiDBrkXs qPu0A^$_q5wOmk4T8tP8t{2#o?^s(VZ=GV}BYBkiIdfxqt)_eg+?O5jk literal 0 HcmV?d00001 diff --git a/testdata/drc/compound_5.gds b/testdata/drc/compound_5.gds new file mode 100644 index 0000000000000000000000000000000000000000..001eefe47e13e90090c534d99fd50afcbc3a9818 GIT binary patch literal 576 zcmb7>y-EZz6otRZB-wG9{Sz(JDJ=!D5*u;EW>IjFDa6VLv9$3SY^Kw~2k-&Jr?A{& zv05x`u9>)Df{3yya>7l%b1pYnl)9uyRA)-g23`8>#b+{Q&&J2FmYT!zZvXW4VSaG( zyj$O2RTSnA&e}IFCB;3Cofq@3$;XihOSS7CiaeRMMGucGD2~s9;dH>JoiDBrkXs qPu0A^$_q5wOmk4T8tP8t{2#o?^s(VZ=GV}BYBkiIdfxqt)_eg+?O5jk literal 0 HcmV?d00001 diff --git a/testdata/drc/compound_au4.gds b/testdata/drc/compound_au4.gds new file mode 100644 index 0000000000000000000000000000000000000000..2869b05298309370eb4e3feec2cd0d07d9ecc141 GIT binary patch literal 758 zcmaiyu}T9$5QhKk-EGcrxtyXFlF~|qR3d^15gSo7$Q5E`GiH&&#Z4L{yu(GmB zB|d_cl|;zd7_`!6oZWNXH3q%nzU80&XJ&_igb>@PmqfXX2vdmBz?^$VDCGL;GBEB1 zOU>i?wY!V{!pcn}JKaf95B~5;*=la3@IydW1xk>y05F?){CB>I1HkJ6hEB*I1^hDp ztCMcF_+AAF$BLSfQ$y$Y9V2=^!jKrz$F%N1$APwQh2M`Gx!T z-~kx91r*hrYni3dnQr|7KT-Em`HA|wK=sPf=uF4Y)BT=3(fbS$Nkw3CU!4t&uC-zQ z#l$P_D{aPOXb&pCrZscVKE)t%B~mzoiEey39A;_L*ri}HB1y7VbAQ_xr1T`5wn)w1l{GoJTaq4PXw6UMs5 weE%=L$n@FqMdr8Ae@PhY7Bjw0H)MYlatZpK%b0n<