From 2e33cf1442f0f9a5da1e6da190f66b587c2420c2 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 28 May 2023 23:14:07 +0200 Subject: [PATCH] Added unit tests for new features --- src/drc/unit_tests/drcSimpleTests.cc | 69 +++++++++++++++++ testdata/drc/drcSimpleTests_14b.drc | 24 ++++++ testdata/drc/drcSimpleTests_14b.gds | Bin 0 -> 362 bytes testdata/drc/drcSimpleTests_au14b.gds | Bin 0 -> 298 bytes testdata/drc/drcSimpleTests_au14b.lyrdb | 88 ++++++++++++++++++++++ testdata/drc/drcSimpleTests_au14b_2.gds | Bin 0 -> 362 bytes testdata/drc/drcSimpleTests_au14b_2.lyrdb | 49 ++++++++++++ 7 files changed, 230 insertions(+) create mode 100644 testdata/drc/drcSimpleTests_14b.drc create mode 100644 testdata/drc/drcSimpleTests_14b.gds create mode 100644 testdata/drc/drcSimpleTests_au14b.gds create mode 100644 testdata/drc/drcSimpleTests_au14b.lyrdb create mode 100644 testdata/drc/drcSimpleTests_au14b_2.gds create mode 100644 testdata/drc/drcSimpleTests_au14b_2.lyrdb diff --git a/src/drc/unit_tests/drcSimpleTests.cc b/src/drc/unit_tests/drcSimpleTests.cc index 8b24c918d..c0825e751 100644 --- a/src/drc/unit_tests/drcSimpleTests.cc +++ b/src/drc/unit_tests/drcSimpleTests.cc @@ -731,6 +731,75 @@ TEST(14_SwitchingTargets) db::compare_layouts (_this, layout2, au2, db::NoNormalization); } +TEST(14b_SideTargetsAndReports) +{ + std::string rs = tl::testdata (); + rs += "/drc/drcSimpleTests_14b.drc"; + + std::string input = tl::testdata (); + input += "/drc/drcSimpleTests_14b.gds"; + + std::string au = tl::testdata (); + au += "/drc/drcSimpleTests_au14b.gds"; + + std::string au2 = tl::testdata (); + au2 += "/drc/drcSimpleTests_au14b_2.gds"; + + std::string au_report = tl::testdata (); + au_report += "/drc/drcSimpleTests_au14b.lyrdb"; + + std::string au_report2 = tl::testdata (); + au_report2 += "/drc/drcSimpleTests_au14b_2.lyrdb"; + + std::string output = this->tmp_file ("tmp.gds"); + std::string output2 = this->tmp_file ("tmp2.gds"); + std::string report = this->tmp_file ("tmp.lydrc"); + std::string report2 = this->tmp_file ("tmp2.lydrc"); + + { + // Set some variables + lym::Macro config; + config.set_text (tl::sprintf ( + "$drc_force_gc = true\n" + "$drc_test_source = '%s'\n" + "$drc_test_target = '%s'\n" + "$drc_test_target2 = '%s'\n" + "$drc_test_report = '%s'\n" + "$drc_test_report2 = '%s'\n" + , input, output, output2, report, report2) + ); + config.set_interpreter (lym::Macro::Ruby); + EXPECT_EQ (config.run (), 0); + } + + lym::Macro drc; + drc.load_from (rs); + EXPECT_EQ (drc.run (), 0); + + db::Layout layout; + + { + tl::InputStream stream (output); + db::Reader reader (stream); + reader.read (layout); + } + + db::compare_layouts (_this, layout, au, db::NoNormalization); + + db::Layout layout2; + + { + tl::InputStream stream (output2); + db::Reader reader (stream); + reader.read (layout2); + } + + db::compare_layouts (_this, layout2, au2, db::NoNormalization); + + compare_text_files (report, au_report); + compare_text_files (report2, au_report2); +} + TEST(15_issue548) { std::string rs = tl::testdata (); diff --git a/testdata/drc/drcSimpleTests_14b.drc b/testdata/drc/drcSimpleTests_14b.drc new file mode 100644 index 000000000..0d4daa56a --- /dev/null +++ b/testdata/drc/drcSimpleTests_14b.drc @@ -0,0 +1,24 @@ + +source($drc_test_source) + +target($drc_test_target) + +l1 = input(1, 0) +l2 = input(2, 0) + +tcopy = new_target($drc_test_target2) +rcopy = new_report("Report 2", $drc_test_report2) + +l1.output(tcopy, 101, 0) +l2.output(tcopy, 102, 0) + +l1.output(1, 0) +l1.space(1.0.um).output(100, 0) + +report("Report 1", $drc_test_report) + +l2.space(1.0.um).output("l2 space < 1µm") +l1.width(1.0.um).output("l1 width < 1µm") + +l1.sep(l2, 1.0.um).output(rcopy, "l1 sep l2 < 1µm") + diff --git a/testdata/drc/drcSimpleTests_14b.gds b/testdata/drc/drcSimpleTests_14b.gds new file mode 100644 index 0000000000000000000000000000000000000000..c43c2fae914f32d78e4fd74761d87f3a5a5ee24c GIT binary patch literal 362 zcmZQzV_;&6V31*CVt>xS${@oa!eGUqhRkN*U}E#}bYfr-VP>^+>@@d2w)}&o%MSeo zv!g;7WLWX&V`B^P4`5(m;b353<7HxCWMJcCVqjp<5nu+ANPxM8fq_wnfdNJ%NwEmx z(9iexS${@oa&cMbXgv@5(U}E#}bYfr-VP>^+>@@d2w)}&o%MSeo zv!g;7WLWX&V`B^P4`5(m;b353<7HxCWMJcCVqjp<5nu+ANPxM8fq_wnfdNJ%NwEmx z(9ie + + Report 1 + + drc: script='.drc' + TOP + + + + + l2 space < 1µm + + + + + + l1 width < 1µm + + + + + + + + TOP + + + + + + + + + 'l2 space < 1\302\265m' + TOP + false + 1 + + + edge-pair: (-0.2,0.7;1,0.7)|(1,1.1;-0.2,1.1) + + + + + 'l1 width < 1\302\265m' + TOP + false + 1 + + + edge-pair: (0,0;0,0.9)|(0.3,0.9;0.3,0) + + + + + 'l1 width < 1\302\265m' + TOP + false + 1 + + + edge-pair: (0.3,0;0,0)|(0,0.9;0.3,0.9) + + + + + 'l1 width < 1\302\265m' + TOP + false + 1 + + + edge-pair: (0.5,0;0.5,0.9)|(0.8,0.9;0.8,0) + + + + + 'l1 width < 1\302\265m' + TOP + false + 1 + + + edge-pair: (0.8,0;0.5,0)|(0.5,0.9;0.8,0.9) + + + + diff --git a/testdata/drc/drcSimpleTests_au14b_2.gds b/testdata/drc/drcSimpleTests_au14b_2.gds new file mode 100644 index 0000000000000000000000000000000000000000..b3a5126453d1b6ef03b105c8500bf45480ee142d GIT binary patch literal 362 zcmZQzV_;&6V31*CVt>xS${@oa&cMbXgv@5(U}E#}bYfr-VP>^+>@@d2w)}&o%MSeo zv!g;7WLWX&V`B^P4`5(m;b353<7HwsP5=M^ literal 0 HcmV?d00001 diff --git a/testdata/drc/drcSimpleTests_au14b_2.lyrdb b/testdata/drc/drcSimpleTests_au14b_2.lyrdb new file mode 100644 index 000000000..f3430532f --- /dev/null +++ b/testdata/drc/drcSimpleTests_au14b_2.lyrdb @@ -0,0 +1,49 @@ + + + Report 2 + + drc: script='.drc' + TOP + + + + + l1 sep l2 < 1µm + + + + + + + + TOP + + + + + + + + + 'l1 sep l2 < 1\302\265m' + TOP + false + 1 + + + edge-pair: (0,0.9;0.3,0.9)/(1,1.1;-0.2,1.1) + + + + + 'l1 sep l2 < 1\302\265m' + TOP + false + 1 + + + edge-pair: (0.5,0.9;0.8,0.9)/(1,1.1;-0.2,1.1) + + + +