From 1bb04c711cfaedc363b9c16168bc1c7d38585e40 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 26 Dec 2020 19:55:42 +0100 Subject: [PATCH] WIP: more tests enabled for deep mode too. --- src/db/unit_tests/dbCompoundOperationTests.cc | 89 +++++++++++------- testdata/drc/compound_au10d.gds | Bin 0 -> 1014 bytes testdata/drc/compound_au11d.gds | Bin 0 -> 1430 bytes 3 files changed, 56 insertions(+), 33 deletions(-) create mode 100644 testdata/drc/compound_au10d.gds create mode 100644 testdata/drc/compound_au11d.gds diff --git a/src/db/unit_tests/dbCompoundOperationTests.cc b/src/db/unit_tests/dbCompoundOperationTests.cc index 28de97672..cd872df9d 100644 --- a/src/db/unit_tests/dbCompoundOperationTests.cc +++ b/src/db/unit_tests/dbCompoundOperationTests.cc @@ -37,6 +37,25 @@ #include +static void prep_layer (db::Layout &ly, int gds_layer, db::Region &r, db::DeepShapeStore &dss, bool deep) +{ + unsigned int li = ly.get_layer (db::LayerProperties (gds_layer, 0)); + if (deep) { + r = db::Region (db::RecursiveShapeIterator (ly, ly.cell (*ly.begin_top_down ()), li), dss); + } else { + r = db::Region (db::RecursiveShapeIterator (ly, ly.cell (*ly.begin_top_down ()), li)); + } +} + +static std::string make_au (const std::string &num, bool deep) +{ + if (deep) { + return tl::testsrc () + "/testdata/drc/compound_au" + num + "d.gds"; + } else { + return tl::testsrc () + "/testdata/drc/compound_au" + num + ".gds"; + } +} + TEST(1_Basic) { db::Layout ly; @@ -395,7 +414,7 @@ TEST(9_LogicalSelectOperation) db::compare_layouts (_this, ly, tl::testsrc () + "/testdata/drc/compound_au9.gds"); } -TEST(10_LogicalAndNotOperation) +void run_test10 (tl::TestBase *_this, bool deep) { db::Layout ly; { @@ -409,11 +428,11 @@ TEST(10_LogicalAndNotOperation) 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)); + db::DeepShapeStore dss; - unsigned int l2 = ly.get_layer (db::LayerProperties (2, 0)); - db::Region r2 (db::RecursiveShapeIterator (ly, ly.cell (*ly.begin_top_down ()), l2)); + db::Region r, r2; + prep_layer (ly, 1, r, dss, deep); + prep_layer (ly, 2, r2, dss, deep); db::CompoundRegionOperationPrimaryNode *primary = new db::CompoundRegionOperationPrimaryNode (); @@ -458,10 +477,20 @@ TEST(10_LogicalAndNotOperation) res.insert_into (&ly, *ly.begin_top_down (), l1003); CHECKPOINT(); - db::compare_layouts (_this, ly, tl::testsrc () + "/testdata/drc/compound_au10.gds"); + db::compare_layouts (_this, ly, make_au ("10", deep)); } -TEST(11_EdgeFilterOperation) +TEST(10_LogicalAndNotOperation) +{ + run_test10 (_this, false); +} + +TEST(10d_EdgeFilterOperation) +{ + run_test10 (_this, true); +} + +void run_test11 (tl::TestBase *_this, bool deep) { db::Layout ly; { @@ -475,11 +504,11 @@ TEST(11_EdgeFilterOperation) 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)); + db::DeepShapeStore dss; - unsigned int l2 = ly.get_layer (db::LayerProperties (2, 0)); - db::Region r2 (db::RecursiveShapeIterator (ly, ly.cell (*ly.begin_top_down ()), l2)); + db::Region r, r2; + prep_layer (ly, 1, r, dss, deep); + prep_layer (ly, 2, r2, dss, deep); db::CompoundRegionOperationPrimaryNode *primary = new db::CompoundRegionOperationPrimaryNode (); db::CompoundRegionToEdgeProcessingOperationNode *primary_edges = new db::CompoundRegionToEdgeProcessingOperationNode (new db::PolygonToEdgeProcessor (), primary, true); @@ -498,7 +527,17 @@ TEST(11_EdgeFilterOperation) res.insert_into (&ly, *ly.begin_top_down (), l1001); CHECKPOINT(); - db::compare_layouts (_this, ly, tl::testsrc () + "/testdata/drc/compound_au11.gds"); + db::compare_layouts (_this, ly, make_au ("11", deep)); +} + +TEST(11_EdgeFilterOperation) +{ + run_test11 (_this, false); +} + +TEST(11d_EdgeFilterOperation) +{ + run_test11 (_this, true); } void run_test12 (tl::TestBase *_this, bool deep) @@ -512,26 +551,14 @@ void run_test12 (tl::TestBase *_this, bool deep) reader.read (ly); } - db::DeepShapeStore dss; - db::RegionCheckOptions check_options; check_options.metrics = db::Projection; - unsigned int l1 = ly.get_layer (db::LayerProperties (1, 0)); - db::Region r; - if (deep) { - r = db::Region (db::RecursiveShapeIterator (ly, ly.cell (*ly.begin_top_down ()), l1), dss); - } else { - r = db::Region (db::RecursiveShapeIterator (ly, ly.cell (*ly.begin_top_down ()), l1)); - } + db::DeepShapeStore dss; - unsigned int l2 = ly.get_layer (db::LayerProperties (2, 0)); - db::Region r2; - if (deep) { - r2 = db::Region (db::RecursiveShapeIterator (ly, ly.cell (*ly.begin_top_down ()), l2), dss); - } else { - r2 = db::Region (db::RecursiveShapeIterator (ly, ly.cell (*ly.begin_top_down ()), l2)); - } + db::Region r, r2; + prep_layer (ly, 1, r, dss, deep); + prep_layer (ly, 2, r2, dss, deep); db::CompoundRegionOperationPrimaryNode *primary = new db::CompoundRegionOperationPrimaryNode (); db::CompoundRegionToEdgeProcessingOperationNode *primary_edges = new db::CompoundRegionToEdgeProcessingOperationNode (new db::PolygonToEdgeProcessor (), primary, true); @@ -575,11 +602,7 @@ void run_test12 (tl::TestBase *_this, bool deep) res.insert_into (&ly, *ly.begin_top_down (), l1005); CHECKPOINT(); - if (deep) { - db::compare_layouts (_this, ly, tl::testsrc () + "/testdata/drc/compound_au12d.gds"); - } else { - db::compare_layouts (_this, ly, tl::testsrc () + "/testdata/drc/compound_au12.gds"); - } + db::compare_layouts (_this, ly, make_au ("12", deep)); } TEST(12_EdgeBooleanOperations) diff --git a/testdata/drc/compound_au10d.gds b/testdata/drc/compound_au10d.gds new file mode 100644 index 0000000000000000000000000000000000000000..4f98d6044861d516abdfd33b263900089dfd58a5 GIT binary patch literal 1014 zcmb_bJxc>Y5PjLb?45cs@gt3-5iA9*6hVZDg`!}PE5ynllG4WCU~`=o{($@dvCa>$ zOp(MUh=o`_S0^Q#48+>vJW^6LeU%$#rUmG zcHGkErh#OhYoLIvws!w%Z+Gh!jnP7Z-aP(0|| z?w&s1Pxg)mTm8GM1g+v6o|N6rMS?H}WL2O5xhw!|)&uqL{F*%=7y}lat#AbhBP^Lo3jGIqm!PfM{|JL_>q+0nx`XV6oXF`rPJT z4BB(i(A3JkPkRxJwHD<8(R%{a`WY&XdfjSG`NH+G_yUxk07mw(*3ZzcD|GwG@rgzc z%r`w%A2YP;3N^o^vs7uBEM=P$jcX>+2D>xey&uc;==APY%Q(dj0a==HFi!N^95&^kn7ks23|gIevZFc{J$j lhCNO6UGewO%(9(b|5~Posipk%bc0!ZbKUQa`qqUZegF_P`pN(R literal 0 HcmV?d00001