From 848fd3e1bb993880a7c31848d1fbee0073e2d656 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Tue, 7 Jul 2020 21:21:33 +0200 Subject: [PATCH] Added testcase --- .../unit_tests/dbHierNetworkProcessorTests.cc | 67 ++++++++++++++++++ testdata/algo/issue-609.oas.gz | Bin 0 -> 418 bytes 2 files changed, 67 insertions(+) create mode 100644 testdata/algo/issue-609.oas.gz diff --git a/src/db/unit_tests/dbHierNetworkProcessorTests.cc b/src/db/unit_tests/dbHierNetworkProcessorTests.cc index 344101665..cbf29efde 100644 --- a/src/db/unit_tests/dbHierNetworkProcessorTests.cc +++ b/src/db/unit_tests/dbHierNetworkProcessorTests.cc @@ -1287,3 +1287,70 @@ TEST(120_HierClustersCombArrays) run_hc_test (_this, "comb2.gds", "comb2_au1.gds"); run_hc_test_with_backannotation (_this, "comb2.gds", "comb2_au2.gds"); } + +static size_t root_nets (const db::connected_clusters &cc) +{ + size_t n = 0; + for (db::connected_clusters::const_iterator c = cc.begin (); c != cc.end (); ++c) { + if (cc.is_root (c->id ())) { + ++n; + } + } + return n; +} + +// issue #609 +TEST(200_issue609) +{ + db::Layout ly; + unsigned int l1 = 0, l2 = 0; + + { + db::LayerProperties p; + db::LayerMap lmap; + + p.layer = 1; + p.datatype = 0; + lmap.map (db::LDPair (p.layer, p.datatype), l1 = ly.insert_layer ()); + ly.set_properties (l1, p); + + p.layer = 2; + p.datatype = 0; + lmap.map (db::LDPair (p.layer, p.datatype), l2 = ly.insert_layer ()); + ly.set_properties (l2, p); + + db::LoadLayoutOptions options; + options.get_options ().layer_map = lmap; + options.get_options ().create_other_layers = false; + + std::string fn (tl::testsrc ()); + fn += "/testdata/algo/issue-609.oas.gz"; + tl::InputStream stream (fn); + db::Reader reader (stream); + reader.read (ly, options); + } + + std::vector strings; + normalize_layer (ly, strings, l1); + normalize_layer (ly, strings, l2); + + // connect 1 to 1, 1 to 2 and 1 to 3, but *not* 2 to 3 + db::Connectivity conn; + conn.connect (l1, l1); + conn.connect (l2, l2); + conn.connect (l1, l2); + + db::hier_clusters hc; + hc.build (ly, ly.cell (*ly.begin_top_down ()), conn); + + std::vector > net_layers; + + db::Layout::top_down_const_iterator td = ly.begin_top_down (); + EXPECT_EQ (td != ly.end_top_down (), true); + + // result needs to be a single net + EXPECT_EQ (root_nets (hc.clusters_per_cell (*td)), size_t (1)); + for ( ; td != ly.end_top_down (); ++td) { + EXPECT_EQ (root_nets (hc.clusters_per_cell (*td)), size_t (0)); + } +} diff --git a/testdata/algo/issue-609.oas.gz b/testdata/algo/issue-609.oas.gz new file mode 100644 index 0000000000000000000000000000000000000000..c35964b7b96ff4592dc114ee6745e57a240868b5 GIT binary patch literal 418 zcmV;T0bTwdiwFP!0000015*ul_4U;CcMSFn=H+5!HqZ@2gEzO`uOlLI~!RrGdmla zf(SDZ0pc1NfCwWHVFDt+vc@3797I@x#0)_MNX!VV4Xh3%Yh=O8CQ{ABu;o6}j}Lmi zffI8??lQJWw*ny}OHPMbhZ!#`FAGS;hcB!fjxc@v!n*MY6E8C_6G-g94$C(;Sr6{8 ze0!6Xmywr&mq+j|+tvM6Ol*@@u?W6lz5CUQLGT6J%04C_#k%kYBZJ@@kUWFnO9(F) ztl}kD1<1e+YwbH);y13f?`(pif27w5&Xe;u~BX14Od1+h8GROD{i>*vWwhj zWI**DpWp#b!2=wE2e