Added DRC unit tests.

This commit is contained in:
Matthias Koefferlein 2017-08-23 11:53:44 +02:00
parent a0d864f3b6
commit e5c6bd9e29
5 changed files with 59 additions and 11 deletions

View File

@ -21,10 +21,45 @@
*/
#include "utHead.h"
#include "rdbForceLink.h"
#include "dbReader.h"
#include "lymMacro.h"
TEST(1)
{
// @@@ TODO: add tests ..
std::string input = ut::testsrc ();
input += "/testdata/drc/drctest.gds";
std::string au = ut::testsrc ();
au += "/testdata/drc/drcBasicTests_au.gds";
std::string output = this->tmp_file ("tmp.gds");
lym::Macro drc;
drc.set_text (tl::sprintf (
"source(\"%s\", \"TOP\")\n"
"target(\"%s\", \"TOP\")\n"
"l1 = input(1, 0)\n"
"l2 = input(2, 0)\n"
"l3 = input(3, 0)\n"
"l1.output(1, 0)\n"
"l2.output(2, 0)\n"
"l3.output(3, 0)\n"
"l1.space(0.5, projection).output(10, 0)\n"
"(l2 & l3).output(11, 0)\n"
, input, output)
);
drc.set_interpreter (lym::Macro::DSLInterpreter);
drc.set_dsl_interpreter ("drc-dsl");
EXPECT_EQ (drc.run (), 0);
db::Layout layout;
{
tl::InputStream stream (output);
db::Reader reader (stream);
reader.read (layout);
}
this->compare_layouts (layout, au, ut::NoNormalization);
}

View File

@ -1139,15 +1139,8 @@ Application::run ()
}
// call "autorun" on all plugins that wish so
for (std::vector <lay::PluginDescriptor>::const_iterator p = m_native_plugins.begin (); p != m_native_plugins.end (); ++p) {
if (p->autorun) {
(*p->autorun) ();
}
}
// run all autorun macros
lym::MacroCollection::root ().autorun ();
// Run plugin and macro specific initializations
autorun ();
if (mp_mw) {
@ -1250,6 +1243,20 @@ Application::run ()
return result;
}
void
Application::autorun ()
{
// call "autorun" on all plugins that wish so
for (std::vector <lay::PluginDescriptor>::const_iterator p = m_native_plugins.begin (); p != m_native_plugins.end (); ++p) {
if (p->autorun) {
(*p->autorun) ();
}
}
// run all autorun macros
lym::MacroCollection::root ().autorun ();
}
void
Application::set_editable (bool e)
{

View File

@ -142,6 +142,11 @@ public:
return mp_mw;
}
/**
* @brief Runs plugin and macro specific initializations
*/
void autorun ();
/**
* @brief Run the application
*

View File

@ -905,6 +905,7 @@ main_cont (int argc, char **argv)
static char av3[] = "-rx"; // No mplicit macros
char *av[] = { av0, av1, av2, av3, 0 };
lay::Application app (ac, av, false);
app.autorun ();
#if QT_VERSION < 0x050000
QTextCodec::setCodecForTr (QTextCodec::codecForName ("utf8"));

BIN
testdata/drc/drcBasicTests_au.gds vendored Normal file

Binary file not shown.