Added unit tests for new features

This commit is contained in:
Matthias Koefferlein 2023-05-28 23:14:07 +02:00
parent 78dbabcde1
commit 2e33cf1442
7 changed files with 230 additions and 0 deletions

View File

@ -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 ();

24
testdata/drc/drcSimpleTests_14b.drc vendored Normal file
View File

@ -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")

BIN
testdata/drc/drcSimpleTests_14b.gds vendored Normal file

Binary file not shown.

BIN
testdata/drc/drcSimpleTests_au14b.gds vendored Normal file

Binary file not shown.

88
testdata/drc/drcSimpleTests_au14b.lyrdb vendored Normal file
View File

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<report-database>
<description>Report 1</description>
<original-file/>
<generator>drc: script='.drc'</generator>
<top-cell>TOP</top-cell>
<tags>
</tags>
<categories>
<category>
<name>l2 space &lt; 1µm</name>
<description/>
<categories>
</categories>
</category>
<category>
<name>l1 width &lt; 1µm</name>
<description/>
<categories>
</categories>
</category>
</categories>
<cells>
<cell>
<name>TOP</name>
<variant/>
<references>
</references>
</cell>
</cells>
<items>
<item>
<tags/>
<category>'l2 space &lt; 1\302\265m'</category>
<cell>TOP</cell>
<visited>false</visited>
<multiplicity>1</multiplicity>
<image/>
<values>
<value>edge-pair: (-0.2,0.7;1,0.7)|(1,1.1;-0.2,1.1)</value>
</values>
</item>
<item>
<tags/>
<category>'l1 width &lt; 1\302\265m'</category>
<cell>TOP</cell>
<visited>false</visited>
<multiplicity>1</multiplicity>
<image/>
<values>
<value>edge-pair: (0,0;0,0.9)|(0.3,0.9;0.3,0)</value>
</values>
</item>
<item>
<tags/>
<category>'l1 width &lt; 1\302\265m'</category>
<cell>TOP</cell>
<visited>false</visited>
<multiplicity>1</multiplicity>
<image/>
<values>
<value>edge-pair: (0.3,0;0,0)|(0,0.9;0.3,0.9)</value>
</values>
</item>
<item>
<tags/>
<category>'l1 width &lt; 1\302\265m'</category>
<cell>TOP</cell>
<visited>false</visited>
<multiplicity>1</multiplicity>
<image/>
<values>
<value>edge-pair: (0.5,0;0.5,0.9)|(0.8,0.9;0.8,0)</value>
</values>
</item>
<item>
<tags/>
<category>'l1 width &lt; 1\302\265m'</category>
<cell>TOP</cell>
<visited>false</visited>
<multiplicity>1</multiplicity>
<image/>
<values>
<value>edge-pair: (0.8,0;0.5,0)|(0.5,0.9;0.8,0.9)</value>
</values>
</item>
</items>
</report-database>

BIN
testdata/drc/drcSimpleTests_au14b_2.gds vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<report-database>
<description>Report 2</description>
<original-file/>
<generator>drc: script='.drc'</generator>
<top-cell>TOP</top-cell>
<tags>
</tags>
<categories>
<category>
<name>l1 sep l2 &lt; 1µm</name>
<description/>
<categories>
</categories>
</category>
</categories>
<cells>
<cell>
<name>TOP</name>
<variant/>
<references>
</references>
</cell>
</cells>
<items>
<item>
<tags/>
<category>'l1 sep l2 &lt; 1\302\265m'</category>
<cell>TOP</cell>
<visited>false</visited>
<multiplicity>1</multiplicity>
<image/>
<values>
<value>edge-pair: (0,0.9;0.3,0.9)/(1,1.1;-0.2,1.1)</value>
</values>
</item>
<item>
<tags/>
<category>'l1 sep l2 &lt; 1\302\265m'</category>
<cell>TOP</cell>
<visited>false</visited>
<multiplicity>1</multiplicity>
<image/>
<values>
<value>edge-pair: (0.5,0.9;0.8,0.9)/(1,1.1;-0.2,1.1)</value>
</values>
</item>
</items>
</report-database>