diff --git a/src/drc/unit_tests/drcSimpleTests.cc b/src/drc/unit_tests/drcSimpleTests.cc index 07e4362ad..b0e38fe9f 100644 --- a/src/drc/unit_tests/drcSimpleTests.cc +++ b/src/drc/unit_tests/drcSimpleTests.cc @@ -619,3 +619,58 @@ TEST(13b_KissingCornersDeep) CHECKPOINT (); db::compare_layouts (_this, layout, au, db::NoNormalization); } + +TEST(14_SwitchingTargets) +{ + std::string rs = tl::testsrc (); + rs += "/testdata/drc/drcSimpleTests_14.drc"; + + std::string input = tl::testsrc (); + input += "/testdata/drc/drcSimpleTests_14.gds"; + + std::string au = tl::testsrc (); + au += "/testdata/drc/drcSimpleTests_au14.gds"; + + std::string au2 = tl::testsrc (); + au2 += "/testdata/drc/drcSimpleTests_au14_2.gds"; + + std::string output = this->tmp_file ("tmp.gds"); + std::string output2 = this->tmp_file ("tmp2.gds"); + + { + // Set some variables + lym::Macro config; + config.set_text (tl::sprintf ( + "$drc_test_source = '%s'\n" + "$drc_test_target = '%s'\n" + "$drc_test_target2 = '%s'\n" + , input, output, output2) + ); + 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); +} diff --git a/testdata/drc/drcSimpleTests_14.drc b/testdata/drc/drcSimpleTests_14.drc new file mode 100644 index 000000000..6a00d2003 --- /dev/null +++ b/testdata/drc/drcSimpleTests_14.drc @@ -0,0 +1,60 @@ + +source($drc_test_source, "TOP") + +ly = RBA::Layout::new +ly.create_cell("TOP") + +ly2 = RBA::Layout::new +ly2.create_cell("TOP") + +lr1 = input(10,0) +lr2 = input(61,0) +cut = lr1&lr2 +target(ly) +new = (lr1-cut) +new.output(10,0) + +lr1 = input(11,0) +lr2 = input(61,0) +cut = lr1&lr2 +new = lr1-cut +target(ly2) +new.output(11,0) + +lr1 = input(12,0) +lr2 = input(61,0) +cut = lr1&lr2 +new = lr1-cut +target(ly) +new.output(12,0) + +# 2. Boolean Operation (Difference CutOutLayer vs GreylinesLayer) +lr1 = input(120,0) +lr2 = layout($drc_test_source, "TOP").input(15,0) +target(ly2) +diff = lr2-lr1 +diff.output(150,0) + +# 3. Boolean Operation (Union Layer15(@1) und Layer15(@2) +lr1 = input(150,0) +lr2 = layout($drc_test_source2, "TOP").input(15,0) +target(ly) +align = lr1.or(lr2) +align.output(15,0) + +# 4. Size shapes with 1µm as parameter +lr1 = input(120,0) +lr2 = input(121,0) +lr3 = input(122,0) +lr4 = input(123,0) + +target(ly) +lr1.size(1.um).output(120,0) +lr2.size(1.um).output(121,0) +target(ly2) +lr3.size(1.um).output(122,0) +target(ly2) +lr4.size(1.um).output(123,0) + +ly.write($drc_test_target) +ly2.write($drc_test_target2) diff --git a/testdata/drc/drcSimpleTests_14.gds b/testdata/drc/drcSimpleTests_14.gds new file mode 100644 index 000000000..40d588e8d Binary files /dev/null and b/testdata/drc/drcSimpleTests_14.gds differ diff --git a/testdata/drc/drcSimpleTests_au14.gds b/testdata/drc/drcSimpleTests_au14.gds new file mode 100644 index 000000000..108b7cee4 Binary files /dev/null and b/testdata/drc/drcSimpleTests_au14.gds differ diff --git a/testdata/drc/drcSimpleTests_au14_2.gds b/testdata/drc/drcSimpleTests_au14_2.gds new file mode 100644 index 000000000..556b8258a Binary files /dev/null and b/testdata/drc/drcSimpleTests_au14_2.gds differ