diff --git a/src/ant/unit_tests/antBasicTests.cc b/src/ant/unit_tests/antBasicTests.cc index f21540f05..6f38f746b 100644 --- a/src/ant/unit_tests/antBasicTests.cc +++ b/src/ant/unit_tests/antBasicTests.cc @@ -21,7 +21,7 @@ */ -#include "utHead.h" +#include "tlUnitTest.h" #include "antObject.h" #include "antTemplate.h" diff --git a/src/ant/unit_tests/unit_tests.pro b/src/ant/unit_tests/unit_tests.pro index 5e12e7a9c..84f7d1bdc 100644 --- a/src/ant/unit_tests/unit_tests.pro +++ b/src/ant/unit_tests/unit_tests.pro @@ -9,8 +9,8 @@ include($$PWD/../../lib_ut.pri) SOURCES = \ antBasicTests.cc \ -INCLUDEPATH += $$ANT_INC $$TL_INC $$LAYBASIC_INC $$DB_INC $$GSI_INC $$UT_INC -DEPENDPATH += $$ANT_INC $$TL_INC $$LAYBASIC_INC $$DB_INC $$GSI_INC $$UT_INC +INCLUDEPATH += $$ANT_INC $$TL_INC $$LAYBASIC_INC $$DB_INC $$GSI_INC +DEPENDPATH += $$ANT_INC $$TL_INC $$LAYBASIC_INC $$DB_INC $$GSI_INC -LIBS += -L$$DESTDIR_UT -lklayout_ant -lklayout_laybasic -lklayout_db -lklayout_tl -lklayout_gsi -lklayout_ut +LIBS += -L$$DESTDIR_UT -lklayout_ant -lklayout_laybasic -lklayout_db -lklayout_tl -lklayout_gsi diff --git a/src/buddies/unit_tests/bdBasicTests.cc b/src/buddies/unit_tests/bdBasicTests.cc index 001a6ceeb..251bed38f 100644 --- a/src/buddies/unit_tests/bdBasicTests.cc +++ b/src/buddies/unit_tests/bdBasicTests.cc @@ -23,11 +23,10 @@ #include "bdWriterOptions.h" #include "bdReaderOptions.h" #include "tlCommandLineParser.h" +#include "tlUnitTest.h" #include "dbLayout.h" #include "dbCell.h" -#include "utHead.h" - // Testing writer options TEST(1) { diff --git a/src/buddies/unit_tests/bdConverterTests.cc b/src/buddies/unit_tests/bdConverterTests.cc index 2cc322e8f..b3b9eede6 100644 --- a/src/buddies/unit_tests/bdConverterTests.cc +++ b/src/buddies/unit_tests/bdConverterTests.cc @@ -20,18 +20,19 @@ */ -#include "utHead.h" #include "bdConverterMain.h" #include "dbCIFReader.h" #include "dbDXFReader.h" #include "dbOASISReader.h" #include "dbGDS2Reader.h" +#include "dbTestSupport.h" #include "contrib/dbGDS2TextReader.h" +#include "tlUnitTest.h" // Testing the converter main implementation (CIF) TEST(1) { - std::string input = ut::testsrc (); + std::string input = tl::testsrc (); input += "/testdata/gds/t10.gds"; std::string output = this->tmp_file (); @@ -48,13 +49,13 @@ TEST(1) reader.read (layout, db::LoadLayoutOptions ()); } - this->compare_layouts (layout, input, ut::NoNormalization); + db::compare_layouts (this, layout, input, db::NoNormalization); } // Testing the converter main implementation (DXF) TEST(2) { - std::string input = ut::testsrc (); + std::string input = tl::testsrc (); input += "/testdata/gds/t10.gds"; std::string output = this->tmp_file (); @@ -77,13 +78,13 @@ TEST(2) layout.rename_cell (top.second, "RINGO"); // Use GDS2 normalization to solve the box vs. polygon issue - this->compare_layouts (layout, input, ut::WriteGDS2); + db::compare_layouts (this, layout, input, db::WriteGDS2); } // Testing the converter main implementation (GDS2) TEST(3) { - std::string input = ut::testsrc (); + std::string input = tl::testsrc (); input += "/testdata/gds/t10.gds"; std::string output = this->tmp_file (); @@ -100,13 +101,13 @@ TEST(3) reader.read (layout, db::LoadLayoutOptions ()); } - this->compare_layouts (layout, input, ut::NoNormalization); + db::compare_layouts (this, layout, input, db::NoNormalization); } // Testing the converter main implementation (GDS2Text) TEST(4) { - std::string input = ut::testsrc (); + std::string input = tl::testsrc (); input += "/testdata/gds/t10.gds"; std::string output = this->tmp_file (); @@ -123,13 +124,13 @@ TEST(4) reader.read (layout, db::LoadLayoutOptions ()); } - this->compare_layouts (layout, input, ut::NoNormalization); + db::compare_layouts (this, layout, input, db::NoNormalization); } // Testing the converter main implementation (OASIS) TEST(5) { - std::string input = ut::testsrc (); + std::string input = tl::testsrc (); input += "/testdata/gds/t10.gds"; std::string output = this->tmp_file (); @@ -146,6 +147,6 @@ TEST(5) reader.read (layout, db::LoadLayoutOptions ()); } - this->compare_layouts (layout, input, ut::NoNormalization); + db::compare_layouts (this, layout, input, db::NoNormalization); } diff --git a/src/buddies/unit_tests/bdStrm2txtTests.cc b/src/buddies/unit_tests/bdStrm2txtTests.cc index a8f58afcf..4aa0068c9 100644 --- a/src/buddies/unit_tests/bdStrm2txtTests.cc +++ b/src/buddies/unit_tests/bdStrm2txtTests.cc @@ -20,17 +20,17 @@ */ -#include "utHead.h" +#include "tlUnitTest.h" #include "bdCommon.h" BD_PUBLIC int strm2txt (int argc, char *argv[]); TEST(1) { - std::string input = ut::testsrc (); + std::string input = tl::testsrc (); input += "/testdata/gds/t10.gds"; - std::string au = ut::testsrc (); + std::string au = tl::testsrc (); au += "/testdata/bd/strm2txt_au.txt"; std::string output = this->tmp_file (); diff --git a/src/buddies/unit_tests/bdStrmclipTests.cc b/src/buddies/unit_tests/bdStrmclipTests.cc index e2cf1168b..222033e25 100644 --- a/src/buddies/unit_tests/bdStrmclipTests.cc +++ b/src/buddies/unit_tests/bdStrmclipTests.cc @@ -20,18 +20,19 @@ */ -#include "utHead.h" #include "bdCommon.h" #include "dbReader.h" +#include "dbTestSupport.h" +#include "tlUnitTest.h" BD_PUBLIC int strmclip (int argc, char *argv[]); TEST(1A) { - std::string input = ut::testsrc (); + std::string input = tl::testsrc (); input += "/testdata/bd/strm2clip_in.gds"; - std::string au = ut::testsrc (); + std::string au = tl::testsrc (); au += "/testdata/bd/strm2clip_au1.gds"; std::string output = this->tmp_file (); @@ -48,15 +49,15 @@ TEST(1A) reader.read (layout); } - this->compare_layouts (layout, au, ut::NoNormalization); + db::compare_layouts (this, layout, au, db::NoNormalization); } TEST(1B) { - std::string input = ut::testsrc (); + std::string input = tl::testsrc (); input += "/testdata/bd/strm2clip_in.gds"; - std::string au = ut::testsrc (); + std::string au = tl::testsrc (); au += "/testdata/bd/strm2clip_au1.gds"; std::string output = this->tmp_file (); @@ -73,15 +74,15 @@ TEST(1B) reader.read (layout); } - this->compare_layouts (layout, au, ut::NoNormalization); + db::compare_layouts (this, layout, au, db::NoNormalization); } TEST(2) { - std::string input = ut::testsrc (); + std::string input = tl::testsrc (); input += "/testdata/bd/strm2clip_in.gds"; - std::string au = ut::testsrc (); + std::string au = tl::testsrc (); au += "/testdata/bd/strm2clip_au2.gds"; std::string output = this->tmp_file (); @@ -98,6 +99,6 @@ TEST(2) reader.read (layout); } - this->compare_layouts (layout, au, ut::NoNormalization); + db::compare_layouts (this, layout, au, db::NoNormalization); } diff --git a/src/buddies/unit_tests/bdStrmcmpTests.cc b/src/buddies/unit_tests/bdStrmcmpTests.cc index d8554849c..6f442f7ad 100644 --- a/src/buddies/unit_tests/bdStrmcmpTests.cc +++ b/src/buddies/unit_tests/bdStrmcmpTests.cc @@ -20,9 +20,9 @@ */ -#include "utHead.h" #include "bdCommon.h" #include "dbReader.h" +#include "tlUnitTest.h" #include "tlLog.h" #include @@ -32,17 +32,17 @@ BD_PUBLIC int strmcmp (int argc, char *argv[]); TEST(1) { - ut::CaptureChannel cap; + tl::CaptureChannel cap; tl::info << "Self test"; EXPECT_EQ (cap.captured_text (), "Self test\n"); cap.clear (); EXPECT_EQ (cap.captured_text (), ""); - std::string input_a = ut::testsrc (); + std::string input_a = tl::testsrc (); input_a += "/testdata/bd/strmcmp_in.gds"; - std::string input_b = ut::testsrc (); + std::string input_b = tl::testsrc (); input_b += "/testdata/bd/strmcmp_ref1.gds"; const char *argv[] = { "x", input_a.c_str (), input_b.c_str () }; @@ -54,12 +54,12 @@ TEST(1) TEST(2A) { - ut::CaptureChannel cap; + tl::CaptureChannel cap; - std::string input_a = ut::testsrc (); + std::string input_a = tl::testsrc (); input_a += "/testdata/bd/strmcmp_in.gds"; - std::string input_b = ut::testsrc (); + std::string input_b = tl::testsrc (); input_b += "/testdata/bd/strmcmp_ref2.gds"; const char *argv[] = { "x", input_a.c_str (), input_b.c_str () }; @@ -83,12 +83,12 @@ TEST(2A) TEST(2B) { - ut::CaptureChannel cap; + tl::CaptureChannel cap; - std::string input_a = ut::testsrc (); + std::string input_a = tl::testsrc (); input_a += "/testdata/bd/strmcmp_in.gds"; - std::string input_b = ut::testsrc (); + std::string input_b = tl::testsrc (); input_b += "/testdata/bd/strmcmp_ref2.gds"; const char *argv[] = { "x", "-s", input_a.c_str (), input_b.c_str () }; @@ -100,12 +100,12 @@ TEST(2B) TEST(2C) { - ut::CaptureChannel cap; + tl::CaptureChannel cap; - std::string input_a = ut::testsrc (); + std::string input_a = tl::testsrc (); input_a += "/testdata/bd/strmcmp_in.gds"; - std::string input_b = ut::testsrc (); + std::string input_b = tl::testsrc (); input_b += "/testdata/bd/strmcmp_ref2.gds"; const char *argv[] = { "x", "-am=8/0", "-as", "-bm=8/0", "-bs", input_a.c_str (), input_b.c_str () }; @@ -124,12 +124,12 @@ TEST(2C) TEST(2D) { - ut::CaptureChannel cap; + tl::CaptureChannel cap; - std::string input_a = ut::testsrc (); + std::string input_a = tl::testsrc (); input_a += "/testdata/bd/strmcmp_in.gds"; - std::string input_b = ut::testsrc (); + std::string input_b = tl::testsrc (); input_b += "/testdata/bd/strmcmp_ref2.gds"; const char *argv[] = { "x", "-m=1", input_a.c_str (), input_b.c_str () }; @@ -145,12 +145,12 @@ TEST(2D) TEST(2E) { - ut::CaptureChannel cap; + tl::CaptureChannel cap; - std::string input_a = ut::testsrc (); + std::string input_a = tl::testsrc (); input_a += "/testdata/bd/strmcmp_in.gds"; - std::string input_b = ut::testsrc (); + std::string input_b = tl::testsrc (); input_b += "/testdata/bd/strmcmp_ref2.gds"; const char *argv[] = { "x", "-ta=INV2", "-tb=INV2", input_a.c_str (), input_b.c_str () }; @@ -160,12 +160,12 @@ TEST(2E) TEST(2F) { - ut::CaptureChannel cap; + tl::CaptureChannel cap; - std::string input_a = ut::testsrc (); + std::string input_a = tl::testsrc (); input_a += "/testdata/bd/strmcmp_in.gds"; - std::string input_b = ut::testsrc (); + std::string input_b = tl::testsrc (); input_b += "/testdata/bd/strmcmp_ref2.gds"; const char *argv[] = { "x", "-u", input_a.c_str (), input_b.c_str () }; @@ -183,12 +183,12 @@ TEST(2F) TEST(3A) { - ut::CaptureChannel cap; + tl::CaptureChannel cap; - std::string input_a = ut::testsrc (); + std::string input_a = tl::testsrc (); input_a += "/testdata/bd/strmcmp_in.gds"; - std::string input_b = ut::testsrc (); + std::string input_b = tl::testsrc (); input_b += "/testdata/bd/strmcmp_ref3.gds"; const char *argv[] = { "x", input_a.c_str (), input_b.c_str () }; @@ -207,12 +207,12 @@ TEST(3A) TEST(3B) { - ut::CaptureChannel cap; + tl::CaptureChannel cap; - std::string input_a = ut::testsrc (); + std::string input_a = tl::testsrc (); input_a += "/testdata/bd/strmcmp_in.gds"; - std::string input_b = ut::testsrc (); + std::string input_b = tl::testsrc (); input_b += "/testdata/bd/strmcmp_ref3.gds"; const char *argv[] = { "x", "-t=0.001", input_a.c_str (), input_b.c_str () }; @@ -222,12 +222,12 @@ TEST(3B) TEST(4A) { - ut::CaptureChannel cap; + tl::CaptureChannel cap; - std::string input_a = ut::testsrc (); + std::string input_a = tl::testsrc (); input_a += "/testdata/bd/strmcmp_in.gds"; - std::string input_b = ut::testsrc (); + std::string input_b = tl::testsrc (); input_b += "/testdata/bd/strmcmp_ref4.gds"; const char *argv[] = { "x", input_a.c_str (), input_b.c_str () }; @@ -249,12 +249,12 @@ TEST(4A) TEST(4B) { - ut::CaptureChannel cap; + tl::CaptureChannel cap; - std::string input_a = ut::testsrc (); + std::string input_a = tl::testsrc (); input_a += "/testdata/bd/strmcmp_in.gds"; - std::string input_b = ut::testsrc (); + std::string input_b = tl::testsrc (); input_b += "/testdata/bd/strmcmp_ref4.gds"; const char *argv[] = { "x", "-p", input_a.c_str (), input_b.c_str () }; @@ -264,12 +264,12 @@ TEST(4B) TEST(5A) { - ut::CaptureChannel cap; + tl::CaptureChannel cap; - std::string input_a = ut::testsrc (); + std::string input_a = tl::testsrc (); input_a += "/testdata/bd/strmcmp_in.gds"; - std::string input_b = ut::testsrc (); + std::string input_b = tl::testsrc (); input_b += "/testdata/bd/strmcmp_ref5.gds"; const char *argv[] = { "x", "-u", input_a.c_str (), input_b.c_str () }; @@ -284,12 +284,12 @@ TEST(5A) TEST(5B) { - ut::CaptureChannel cap; + tl::CaptureChannel cap; - std::string input_a = ut::testsrc (); + std::string input_a = tl::testsrc (); input_a += "/testdata/bd/strmcmp_in.gds"; - std::string input_b = ut::testsrc (); + std::string input_b = tl::testsrc (); input_b += "/testdata/bd/strmcmp_ref5.gds"; const char *argv[] = { "x", "--expand-arrays", input_a.c_str (), input_b.c_str () }; @@ -299,12 +299,12 @@ TEST(5B) TEST(6A) { - ut::CaptureChannel cap; + tl::CaptureChannel cap; - std::string input_a = ut::testsrc (); + std::string input_a = tl::testsrc (); input_a += "/testdata/bd/strmcmp_in.gds"; - std::string input_b = ut::testsrc (); + std::string input_b = tl::testsrc (); input_b += "/testdata/bd/strmcmp_ref6.gds"; const char *argv[] = { "x", "-r", input_a.c_str (), input_b.c_str () }; @@ -323,12 +323,12 @@ TEST(6A) TEST(6B) { - ut::CaptureChannel cap; + tl::CaptureChannel cap; - std::string input_a = ut::testsrc (); + std::string input_a = tl::testsrc (); input_a += "/testdata/bd/strmcmp_in.gds"; - std::string input_b = ut::testsrc (); + std::string input_b = tl::testsrc (); input_b += "/testdata/bd/strmcmp_ref6.gds"; const char *argv[] = { "x", "-np", input_a.c_str (), input_b.c_str () }; @@ -338,12 +338,12 @@ TEST(6B) TEST(7A) { - ut::CaptureChannel cap; + tl::CaptureChannel cap; - std::string input_a = ut::testsrc (); + std::string input_a = tl::testsrc (); input_a += "/testdata/bd/strmcmp_in.gds"; - std::string input_b = ut::testsrc (); + std::string input_b = tl::testsrc (); input_b += "/testdata/bd/strmcmp_ref7.oas"; const char *argv[] = { "x", input_a.c_str (), input_b.c_str () }; @@ -358,12 +358,12 @@ TEST(7A) TEST(7B) { - ut::CaptureChannel cap; + tl::CaptureChannel cap; - std::string input_a = ut::testsrc (); + std::string input_a = tl::testsrc (); input_a += "/testdata/bd/strmcmp_in.gds"; - std::string input_b = ut::testsrc (); + std::string input_b = tl::testsrc (); input_b += "/testdata/bd/strmcmp_ref7.oas"; const char *argv[] = { "x", "-nl", input_a.c_str (), input_b.c_str () }; @@ -373,12 +373,12 @@ TEST(7B) TEST(8A) { - ut::CaptureChannel cap; + tl::CaptureChannel cap; - std::string input_a = ut::testsrc (); + std::string input_a = tl::testsrc (); input_a += "/testdata/bd/strmcmp_in.gds"; - std::string input_b = ut::testsrc (); + std::string input_b = tl::testsrc (); input_b += "/testdata/bd/strmcmp_ref8.gds"; const char *argv[] = { "x", input_a.c_str (), input_b.c_str () }; @@ -405,12 +405,12 @@ TEST(8A) TEST(8B) { - ut::CaptureChannel cap; + tl::CaptureChannel cap; - std::string input_a = ut::testsrc (); + std::string input_a = tl::testsrc (); input_a += "/testdata/bd/strmcmp_in.gds"; - std::string input_b = ut::testsrc (); + std::string input_b = tl::testsrc (); input_b += "/testdata/bd/strmcmp_ref8.gds"; const char *argv[] = { "x", "-c", input_a.c_str (), input_b.c_str () }; @@ -424,12 +424,12 @@ TEST(8B) TEST(9A) { - ut::CaptureChannel cap; + tl::CaptureChannel cap; - std::string input_a = ut::testsrc (); + std::string input_a = tl::testsrc (); input_a += "/testdata/bd/strmcmp_in.gds"; - std::string input_b = ut::testsrc (); + std::string input_b = tl::testsrc (); input_b += "/testdata/bd/strmcmp_ref9.gds"; const char *argv[] = { "x", input_a.c_str (), input_b.c_str () }; @@ -444,12 +444,12 @@ TEST(9A) TEST(9B) { - ut::CaptureChannel cap; + tl::CaptureChannel cap; - std::string input_a = ut::testsrc (); + std::string input_a = tl::testsrc (); input_a += "/testdata/bd/strmcmp_in.gds"; - std::string input_b = ut::testsrc (); + std::string input_b = tl::testsrc (); input_b += "/testdata/bd/strmcmp_ref9.gds"; const char *argv[] = { "x", "-l", input_a.c_str (), input_b.c_str () }; diff --git a/src/buddies/unit_tests/bdStrmxorTests.cc b/src/buddies/unit_tests/bdStrmxorTests.cc index 67eb6475c..f43c69bdc 100644 --- a/src/buddies/unit_tests/bdStrmxorTests.cc +++ b/src/buddies/unit_tests/bdStrmxorTests.cc @@ -20,10 +20,11 @@ */ -#include "utHead.h" #include "bdCommon.h" #include "dbReader.h" +#include "dbTestSupport.h" #include "tlLog.h" +#include "tlUnitTest.h" #include @@ -31,12 +32,12 @@ BD_PUBLIC int strmxor (int argc, char *argv[]); TEST(0) { - ut::CaptureChannel cap; + tl::CaptureChannel cap; - std::string input_a = ut::testsrc (); + std::string input_a = tl::testsrc (); input_a += "/testdata/bd/strmxor_in1.gds"; - std::string input_b = ut::testsrc (); + std::string input_b = tl::testsrc (); input_b += "/testdata/bd/strmxor_in1.gds"; std::string output = this->tmp_file ("tmp.oas"); @@ -52,15 +53,15 @@ TEST(0) TEST(1A) { - ut::CaptureChannel cap; + tl::CaptureChannel cap; - std::string input_a = ut::testsrc (); + std::string input_a = tl::testsrc (); input_a += "/testdata/bd/strmxor_in1.gds"; - std::string input_b = ut::testsrc (); + std::string input_b = tl::testsrc (); input_b += "/testdata/bd/strmxor_in2.gds"; - std::string au = ut::testsrc (); + std::string au = tl::testsrc (); au += "/testdata/bd/strmxor_au1.oas"; std::string output = this->tmp_file ("tmp.oas"); @@ -77,7 +78,7 @@ TEST(1A) reader.read (layout); } - this->compare_layouts (layout, au, ut::NoNormalization); + db::compare_layouts (this, layout, au, db::NoNormalization); EXPECT_EQ (cap.captured_text (), "Layer 10/0 is not present in first layout, but in second\n" "Result summary (layers without differences are not shown):\n" @@ -94,12 +95,12 @@ TEST(1A) TEST(1B) { - ut::CaptureChannel cap; + tl::CaptureChannel cap; - std::string input_a = ut::testsrc (); + std::string input_a = tl::testsrc (); input_a += "/testdata/bd/strmxor_in1.gds"; - std::string input_b = ut::testsrc (); + std::string input_b = tl::testsrc (); input_b += "/testdata/bd/strmxor_in2.gds"; std::string output = this->tmp_file ("tmp.oas"); @@ -124,12 +125,12 @@ TEST(1B) TEST(1C) { - ut::CaptureChannel cap; + tl::CaptureChannel cap; - std::string input_a = ut::testsrc (); + std::string input_a = tl::testsrc (); input_a += "/testdata/bd/strmxor_in1.gds"; - std::string input_b = ut::testsrc (); + std::string input_b = tl::testsrc (); input_b += "/testdata/bd/strmxor_in2.gds"; std::string output = this->tmp_file ("tmp.oas"); @@ -145,12 +146,12 @@ TEST(1C) TEST(1D) { - ut::CaptureChannel cap; + tl::CaptureChannel cap; - std::string input_a = ut::testsrc (); + std::string input_a = tl::testsrc (); input_a += "/testdata/bd/strmxor_in1.gds"; - std::string input_b = ut::testsrc (); + std::string input_b = tl::testsrc (); input_b += "/testdata/bd/strmxor_in2.gds"; std::string output = this->tmp_file ("tmp.oas"); @@ -163,15 +164,15 @@ TEST(1D) TEST(2) { - ut::CaptureChannel cap; + tl::CaptureChannel cap; - std::string input_a = ut::testsrc (); + std::string input_a = tl::testsrc (); input_a += "/testdata/bd/strmxor_in1.gds"; - std::string input_b = ut::testsrc (); + std::string input_b = tl::testsrc (); input_b += "/testdata/bd/strmxor_in2.gds"; - std::string au = ut::testsrc (); + std::string au = tl::testsrc (); au += "/testdata/bd/strmxor_au2.oas"; std::string output = this->tmp_file ("tmp.oas"); @@ -188,7 +189,7 @@ TEST(2) reader.read (layout); } - this->compare_layouts (layout, au, ut::NoNormalization); + db::compare_layouts (this, layout, au, db::NoNormalization); EXPECT_EQ (cap.captured_text (), "" ); @@ -196,15 +197,15 @@ TEST(2) TEST(3) { - ut::CaptureChannel cap; + tl::CaptureChannel cap; - std::string input_a = ut::testsrc (); + std::string input_a = tl::testsrc (); input_a += "/testdata/bd/strmxor_in1.gds"; - std::string input_b = ut::testsrc (); + std::string input_b = tl::testsrc (); input_b += "/testdata/bd/strmxor_in2.gds"; - std::string au = ut::testsrc (); + std::string au = tl::testsrc (); au += "/testdata/bd/strmxor_au3.oas"; std::string output = this->tmp_file ("tmp.oas"); @@ -221,7 +222,7 @@ TEST(3) reader.read (layout); } - this->compare_layouts (layout, au, ut::NoNormalization); + db::compare_layouts (this, layout, au, db::NoNormalization); EXPECT_EQ (cap.captured_text (), "Layer 10/0 is not present in first layout, but in second\n" ); @@ -229,15 +230,15 @@ TEST(3) TEST(4) { - ut::CaptureChannel cap; + tl::CaptureChannel cap; - std::string input_a = ut::testsrc (); + std::string input_a = tl::testsrc (); input_a += "/testdata/bd/strmxor_in1.gds"; - std::string input_b = ut::testsrc (); + std::string input_b = tl::testsrc (); input_b += "/testdata/bd/strmxor_in2.gds"; - std::string au = ut::testsrc (); + std::string au = tl::testsrc (); au += "/testdata/bd/strmxor_au4.oas"; std::string output = this->tmp_file ("tmp.oas"); @@ -254,7 +255,7 @@ TEST(4) reader.read (layout); } - this->compare_layouts (layout, au, ut::NoNormalization); + db::compare_layouts (this, layout, au, db::NoNormalization); EXPECT_EQ (cap.captured_text (), "Layer 10/0 is not present in first layout, but in second\n" ); @@ -262,15 +263,15 @@ TEST(4) TEST(5) { - ut::CaptureChannel cap; + tl::CaptureChannel cap; - std::string input_a = ut::testsrc (); + std::string input_a = tl::testsrc (); input_a += "/testdata/bd/strmxor_in1.gds"; - std::string input_b = ut::testsrc (); + std::string input_b = tl::testsrc (); input_b += "/testdata/bd/strmxor_in2.gds"; - std::string au = ut::testsrc (); + std::string au = tl::testsrc (); au += "/testdata/bd/strmxor_au5.oas"; std::string output = this->tmp_file ("tmp.oas"); @@ -287,7 +288,7 @@ TEST(5) reader.read (layout); } - this->compare_layouts (layout, au, ut::NoNormalization); + db::compare_layouts (this, layout, au, db::NoNormalization); EXPECT_EQ (cap.captured_text (), "Layer 10/0 is not present in first layout, but in second\n" ); @@ -295,15 +296,15 @@ TEST(5) TEST(6) { - ut::CaptureChannel cap; + tl::CaptureChannel cap; - std::string input_a = ut::testsrc (); + std::string input_a = tl::testsrc (); input_a += "/testdata/bd/strmxor_in1.gds"; - std::string input_b = ut::testsrc (); + std::string input_b = tl::testsrc (); input_b += "/testdata/bd/strmxor_in2.gds"; - std::string au = ut::testsrc (); + std::string au = tl::testsrc (); au += "/testdata/bd/strmxor_au6.oas"; std::string output = this->tmp_file ("tmp.oas"); @@ -320,7 +321,7 @@ TEST(6) reader.read (layout); } - this->compare_layouts (layout, au, ut::NoNormalization); + db::compare_layouts (this, layout, au, db::NoNormalization); EXPECT_EQ (cap.captured_text (), "Layer 10/0 is not present in first layout, but in second\n" ); diff --git a/src/buddies/unit_tests/unit_tests.pro b/src/buddies/unit_tests/unit_tests.pro index 9a0205b85..928ae46a3 100644 --- a/src/buddies/unit_tests/unit_tests.pro +++ b/src/buddies/unit_tests/unit_tests.pro @@ -16,7 +16,7 @@ SOURCES = \ bdStrmxorTests.cc \ -INCLUDEPATH += $$BD_INC $$DB_INC $$TL_INC $$GSI_INC $$UT_INC -DEPENDPATH += $$BD_INC $$DB_INC $$TL_INC $$GSI_INC $$UT_INC +INCLUDEPATH += $$BD_INC $$DB_INC $$TL_INC $$GSI_INC +DEPENDPATH += $$BD_INC $$DB_INC $$TL_INC $$GSI_INC -LIBS += -L$$DESTDIR_UT -lklayout_bd -lklayout_db -lklayout_tl -lklayout_gsi -lklayout_ut +LIBS += -L$$DESTDIR_UT -lklayout_bd -lklayout_db -lklayout_tl -lklayout_gsi diff --git a/src/db/db/db.pro b/src/db/db/db.pro index 3c860a336..83209ee29 100644 --- a/src/db/db/db.pro +++ b/src/db/db/db.pro @@ -85,6 +85,7 @@ SOURCES = \ dbStatic.cc \ dbStream.cc \ dbStreamLayers.cc \ + dbTestSupport.cc \ dbText.cc \ dbTextWriter.cc \ dbTilingProcessor.cc \ @@ -211,6 +212,7 @@ HEADERS = \ dbStatic.h \ dbStream.h \ dbStreamLayers.h \ + dbTestSupport.h \ dbText.h \ dbTextWriter.h \ dbTilingProcessor.h \ diff --git a/src/db/db/dbCell.h b/src/db/db/dbCell.h index 00b6683b0..b6e6eb9fa 100644 --- a/src/db/db/dbCell.h +++ b/src/db/db/dbCell.h @@ -20,8 +20,6 @@ */ - - #ifndef HDR_dbCell #define HDR_dbCell diff --git a/src/db/db/dbLayout.h b/src/db/db/dbLayout.h index 0fd6f91d9..30bf84507 100644 --- a/src/db/db/dbLayout.h +++ b/src/db/db/dbLayout.h @@ -34,6 +34,7 @@ #include "dbLayoutStateModel.h" #include "dbLayerProperties.h" #include "dbMetaInfo.h" +#include "dbCellInst.h" #include "tlException.h" #include "tlVector.h" #include "tlString.h" diff --git a/src/db/db/dbTestSupport.cc b/src/db/db/dbTestSupport.cc new file mode 100644 index 000000000..d825ccdd2 --- /dev/null +++ b/src/db/db/dbTestSupport.cc @@ -0,0 +1,154 @@ + +/* + + KLayout Layout Viewer + Copyright (C) 2006-2017 Matthias Koefferlein + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include "dbTestSupport.h" +#include "dbStreamLayers.h" +#include "dbReader.h" +#include "dbWriter.h" +#include "dbGDS2Writer.h" +#include "dbOASISWriter.h" +#include "dbCommonReader.h" +#include "dbCell.h" +#include "dbCellInst.h" +#include "dbLayoutDiff.h" + +#include "tlUnitTest.h" + +#include + +namespace db +{ + +void compare_layouts (tl::TestBase *_this, const db::Layout &layout, const std::string &au_file, NormalizationMode norm, db::Coord tolerance) +{ + compare_layouts (_this, layout, au_file, db::LayerMap (), true, norm, tolerance); +} + +void compare_layouts (tl::TestBase *_this, const db::Layout &layout, const std::string &au_file, const db::LayerMap &lm, bool read_other_layers, NormalizationMode norm, db::Coord tolerance) +{ + // normalize the layout by writing to GDS and reading from .. + + // generate a "unique" name ... + unsigned int hash = 0; + for (const char *cp = au_file.c_str (); *cp; ++cp) { + hash = (hash << 4) ^ (hash >> 4) ^ ((unsigned int) *cp); + } + + std::string tmp_file; + + if (norm == WriteGDS2) { + + tmp_file = _this->tmp_file (tl::sprintf ("tmp_%x.gds", hash)); + + tl::OutputStream stream (tmp_file.c_str ()); + db::GDS2Writer writer; + db::SaveLayoutOptions options; + writer.write (const_cast (layout), stream, options); + + } else { + + tmp_file = _this->tmp_file (tl::sprintf ("tmp_%x.oas", hash)); + + tl::OutputStream stream (tmp_file.c_str ()); + db::OASISWriter writer; + db::SaveLayoutOptions options; + writer.write (const_cast (layout), stream, options); + + } + + const db::Layout *subject = 0; + db::Layout layout2; + + if (norm != NoNormalization) { + + // read all layers from the original layout, so the layer table is the same + for (db::Layout::layer_iterator l = layout.begin_layers (); l != layout.end_layers (); ++l) { + layout2.insert_layer ((*l).first, *(*l).second); + } + + tl::InputStream stream (tmp_file); + db::Reader reader (stream); + reader.read (layout2); + + subject = &layout2; + + } else { + subject = &layout; + } + + bool equal = false; + bool any = false; + + int n = 0; + for ( ; ! equal; ++n) { + + db::Layout layout_au; + + // read all layers from the original layout, so the layer table is the same + for (db::Layout::layer_iterator l = layout.begin_layers (); l != layout.end_layers (); ++l) { + layout_au.insert_layer ((*l).first, *(*l).second); + } + + db::LoadLayoutOptions options; + options.get_options ().layer_map = lm; + options.get_options ().create_other_layers = read_other_layers; + + std::string fn = au_file; + if (n > 0) { + fn += tl::sprintf (".%d", n); + } + + if (QFileInfo (tl::to_qstring (fn)).exists ()) { + + if (n == 1 && any) { + throw tl::Exception (tl::sprintf ("Inconsistent reference variants for %s: there can be either variants (.1,.2,... suffix) or a single file (without suffix)", au_file)); + } + + any = true; + + tl::InputStream stream (fn); + db::Reader reader (stream); + reader.read (layout_au, options); + + equal = db::compare_layouts (*subject, layout_au, (n > 0 ? db::layout_diff::f_silent : db::layout_diff::f_verbose) | db::layout_diff::f_flatten_array_insts /*| db::layout_diff::f_no_text_details | db::layout_diff::f_no_text_orientation*/, tolerance, 100 /*max diff lines*/); + if (equal && n > 0) { + tl::info << tl::sprintf ("Found match on golden reference variant %s", fn); + } + + } else if (n > 0) { + if (! any) { + tl::warn << tl::sprintf ("No golden data found (%s)", au_file); + } + break; + } + + } + + if (! equal) { + _this->raise (tl::sprintf ("Compare failed - see\n actual: %s\n golden: %s%s", + tl::to_string (QFileInfo (tl::to_qstring (tmp_file)).absoluteFilePath ()), + tl::to_string (QFileInfo (tl::to_qstring (au_file)).absoluteFilePath ()), + (n > 1 ? "\nand variants" : ""))); + } +} + +} diff --git a/src/db/db/dbTestSupport.h b/src/db/db/dbTestSupport.h new file mode 100644 index 000000000..365d7e602 --- /dev/null +++ b/src/db/db/dbTestSupport.h @@ -0,0 +1,77 @@ + +/* + + KLayout Layout Viewer + Copyright (C) 2006-2017 Matthias Koefferlein + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#ifndef HDR_dbTestSupport +#define HDR_dbTestSupport + +#include "dbCommon.h" +#include "dbTypes.h" + +#include + +namespace tl +{ + class TestBase; +} + +namespace db +{ + +class Layout; +class Cell; +class LayerMap; + +/** + * @brief Specifies the normalization mode for compare_layouts + */ +enum NormalizationMode +{ + NoNormalization, // no normalization - take the test subject as it is + WriteGDS2, // normalize subject by writing to GDS2 and reading back + WriteOAS // normalize subject by writing to OASIS and reading back +}; + +/** + * @brief Compares a layout with a golden layout file + * @param layout The layout to compare + * @param au_file The golden file path + * @param norm The normalization mode (see NormalizationMode) + * @param tolerance A tolerance applied when comparing shapes in database units + * The layout is normalized by writing to a file and reading back + */ +void compare_layouts (tl::TestBase *_this, const db::Layout &layout, const std::string &au_file, NormalizationMode norm = WriteGDS2, db::Coord tolerance = 0); + +/** + * @brief Compares a layout with a golden layout file with layer mapping + * @param layout The layout to compare + * @param au_file The golden file path + * @param lmap The layer mapping object + * @param read_all_others If true, all other layers will be read too + * @param norm The normalization mode (see NormalizationMode) + * @param tolerance A tolerance applied when comparing shapes in database units + * The layout is normalized by writing to a file and reading back + */ +void compare_layouts (tl::TestBase *_this, const db::Layout &layout, const std::string &au_file, const db::LayerMap &lmap, bool read_all_others, NormalizationMode norm = WriteGDS2, db::Coord tolerance = 0); + +} + +#endif diff --git a/src/db/unit_tests/dbArray.cc b/src/db/unit_tests/dbArray.cc index fa6b7ec2e..877d9a26e 100644 --- a/src/db/unit_tests/dbArray.cc +++ b/src/db/unit_tests/dbArray.cc @@ -23,7 +23,7 @@ #include "dbArray.h" #include "dbBoxConvert.h" -#include "utHead.h" +#include "tlUnitTest.h" typedef db::array BoxArray; diff --git a/src/db/unit_tests/dbBox.cc b/src/db/unit_tests/dbBox.cc index 69270bae4..be5229966 100644 --- a/src/db/unit_tests/dbBox.cc +++ b/src/db/unit_tests/dbBox.cc @@ -22,7 +22,7 @@ #include "dbBox.h" -#include "utHead.h" +#include "tlUnitTest.h" TEST(1) diff --git a/src/db/unit_tests/dbBoxScanner.cc b/src/db/unit_tests/dbBoxScanner.cc index 35604d1fa..3cc2b0160 100644 --- a/src/db/unit_tests/dbBoxScanner.cc +++ b/src/db/unit_tests/dbBoxScanner.cc @@ -24,7 +24,7 @@ #include "dbBoxScanner.h" #include "dbShapeProcessor.h" #include "dbRecursiveShapeIterator.h" -#include "utHead.h" +#include "tlUnitTest.h" #include "tlTimer.h" #include "tlLog.h" @@ -196,7 +196,7 @@ TEST(1f) EXPECT_EQ (tr.str, ""); } -void run_test2 (ut::TestBase *_this, size_t n, double ff, db::Coord spread, bool touch = true) +void run_test2 (tl::TestBase *_this, size_t n, double ff, db::Coord spread, bool touch = true) { std::vector bb; for (size_t i = 0; i < n; ++i) { @@ -469,7 +469,7 @@ TEST(10e) EXPECT_EQ (cl2s (clusters), "(0,1)"); } -void run_test11 (ut::TestBase *_this, size_t n, double ff, db::Coord spread, bool touch = true) +void run_test11 (tl::TestBase *_this, size_t n, double ff, db::Coord spread, bool touch = true) { std::vector bb; for (size_t i = 0; i < n; ++i) { @@ -678,7 +678,7 @@ struct BooleanAndInteractionClusterCollector TEST(100) { - std::string fn (ut::testsrc_private ()); + std::string fn (tl::testsrc_private ()); fn += "/testdata/other/"; fn += "bs100.oas.gz"; diff --git a/src/db/unit_tests/dbBoxTree.cc b/src/db/unit_tests/dbBoxTree.cc index 1f9470507..0f3bb02b1 100644 --- a/src/db/unit_tests/dbBoxTree.cc +++ b/src/db/unit_tests/dbBoxTree.cc @@ -23,7 +23,7 @@ #include "dbBoxTree.h" #include "dbBoxConvert.h" -#include "utHead.h" +#include "tlUnitTest.h" #include "tlTimer.h" #include "tlLog.h" @@ -148,11 +148,11 @@ typedef db::unstable_box_tree UnstableTestTreeL; typedef db::unstable_box_tree UnstableTestTreeCmplxL; template -static void test_tree_overlap (ut::TestBase *_this, const Tree &t, const Box &b, BoxConv conv) +static void test_tree_overlap (tl::TestBase *_this, const Tree &t, const Box &b, BoxConv conv) { typedef typename Tree::object_type value_type; - if (ut::verbose ()) { + if (tl::verbose ()) { std::cout << "Testing vs. " << b << " overlapping" << std::endl; } @@ -163,7 +163,7 @@ static void test_tree_overlap (ut::TestBase *_this, const Tree &t, const Box &b, } } - if (ut::verbose ()) { + if (tl::verbose ()) { for (typename Tree::const_iterator e = t.begin (); e != t.end (); ++e) { std::cout << " v=" << *e << std::endl; } @@ -176,7 +176,7 @@ static void test_tree_overlap (ut::TestBase *_this, const Tree &t, const Box &b, } else { good_idx.erase (&*i); } - if (ut::verbose ()) { + if (tl::verbose ()) { std::cout << *i << std::endl; } ++i; @@ -186,11 +186,11 @@ static void test_tree_overlap (ut::TestBase *_this, const Tree &t, const Box &b, } template -static void test_tree_touching (ut::TestBase *_this, const Tree &t, const Box &b, BoxConv conv) +static void test_tree_touching (tl::TestBase *_this, const Tree &t, const Box &b, BoxConv conv) { typedef typename Tree::object_type value_type; - if (ut::verbose ()) { + if (tl::verbose ()) { std::cout << "Testing vs. " << b << " touching" << std::endl; } @@ -201,7 +201,7 @@ static void test_tree_touching (ut::TestBase *_this, const Tree &t, const Box &b } } - if (ut::verbose ()) { + if (tl::verbose ()) { for (typename Tree::const_iterator e = t.begin (); e != t.end (); ++e) { std::cout << " v=" << *e << std::endl; } @@ -214,7 +214,7 @@ static void test_tree_touching (ut::TestBase *_this, const Tree &t, const Box &b } else { good_idx.erase (&*i); } - if (ut::verbose ()) { + if (tl::verbose ()) { std::cout << *i << std::endl; } ++i; diff --git a/src/db/unit_tests/dbCIFReader.cc b/src/db/unit_tests/dbCIFReader.cc index 129617cfb..65b7de45e 100644 --- a/src/db/unit_tests/dbCIFReader.cc +++ b/src/db/unit_tests/dbCIFReader.cc @@ -26,12 +26,12 @@ #include "dbWriter.h" #include "dbCIFWriter.h" #include "dbGDS2Writer.h" -#include "utHead.h" +#include "tlUnitTest.h" #include #include -static void run_test (ut::TestBase *_this, const char *file, const char *file_au, const char *map = 0, double dbu = 0.001, bool dummy_calls = false, bool blank_sep = false) +static void run_test (tl::TestBase *_this, const char *file, const char *file_au, const char *map = 0, double dbu = 0.001, bool dummy_calls = false, bool blank_sep = false) { db::CIFReaderOptions *opt = new db::CIFReaderOptions(); opt->dbu = dbu; @@ -60,7 +60,7 @@ static void run_test (ut::TestBase *_this, const char *file, const char *file_au db::Layout layout (&m), layout2 (&m), layout2_cif (&m), layout_au (&m); { - std::string fn (ut::testsrc_private ()); + std::string fn (tl::testsrc_private ()); fn += "/testdata/cif/"; fn += file; tl::InputStream stream (fn); @@ -120,7 +120,7 @@ static void run_test (ut::TestBase *_this, const char *file, const char *file_au } { - std::string fn (ut::testsrc_private ()); + std::string fn (tl::testsrc_private ()); fn += "/testdata/cif/"; fn += file_au; tl::InputStream stream (fn); diff --git a/src/db/unit_tests/dbCell.cc b/src/db/unit_tests/dbCell.cc index fd250483c..4461dd7ae 100644 --- a/src/db/unit_tests/dbCell.cc +++ b/src/db/unit_tests/dbCell.cc @@ -24,7 +24,7 @@ #include "dbLayout.h" #include "tlString.h" -#include "utHead.h" +#include "tlUnitTest.h" TEST(1) { diff --git a/src/db/unit_tests/dbCellGraphUtils.cc b/src/db/unit_tests/dbCellGraphUtils.cc index 6b16e8308..817685d89 100644 --- a/src/db/unit_tests/dbCellGraphUtils.cc +++ b/src/db/unit_tests/dbCellGraphUtils.cc @@ -25,7 +25,7 @@ #include "dbMatrix.h" #include "dbRecursiveShapeIterator.h" #include "tlString.h" -#include "utHead.h" +#include "tlUnitTest.h" TEST(1) { diff --git a/src/db/unit_tests/dbCellHullGenerator.cc b/src/db/unit_tests/dbCellHullGenerator.cc index 7dd4f53e7..2a65de209 100644 --- a/src/db/unit_tests/dbCellHullGenerator.cc +++ b/src/db/unit_tests/dbCellHullGenerator.cc @@ -24,7 +24,7 @@ #include "dbCellHullGenerator.h" #include "dbEdgeProcessor.h" #include "tlString.h" -#include "utHead.h" +#include "tlUnitTest.h" static std::string h2s (const std::vector &hull) { diff --git a/src/db/unit_tests/dbCellMapping.cc b/src/db/unit_tests/dbCellMapping.cc index 3cb441d63..2797b089a 100644 --- a/src/db/unit_tests/dbCellMapping.cc +++ b/src/db/unit_tests/dbCellMapping.cc @@ -25,7 +25,7 @@ #include "dbLayout.h" #include "dbCellMapping.h" #include "tlString.h" -#include "utHead.h" +#include "tlUnitTest.h" std::string nc2s (const std::vector &nc, const db::Layout &a) { diff --git a/src/db/unit_tests/dbClip.cc b/src/db/unit_tests/dbClip.cc index 549bc4c61..8ffe014a4 100644 --- a/src/db/unit_tests/dbClip.cc +++ b/src/db/unit_tests/dbClip.cc @@ -24,7 +24,7 @@ #include "dbClip.h" #include "dbEdgeProcessor.h" -#include "utHead.h" +#include "tlUnitTest.h" #include "tlTimer.h" TEST(1) diff --git a/src/db/unit_tests/dbDXFReader.cc b/src/db/unit_tests/dbDXFReader.cc index 4feff8080..a9a6d5d01 100644 --- a/src/db/unit_tests/dbDXFReader.cc +++ b/src/db/unit_tests/dbDXFReader.cc @@ -22,12 +22,12 @@ #include "dbDXFReader.h" - -#include +#include "dbTestSupport.h" +#include "tlUnitTest.h" #include -static void run_test (ut::TestBase *_this, const char *file, const char *file_au, const char *map = 0, double dbu = 0.001, double dxf_unit = 1, int mode = 0, int ncircle = 100, double acircle = 0.0) +static void run_test (tl::TestBase *_this, const char *file, const char *file_au, const char *map = 0, double dbu = 0.001, double dxf_unit = 1, int mode = 0, int ncircle = 100, double acircle = 0.0) { db::DXFReaderOptions *opt = new db::DXFReaderOptions(); opt->dbu = dbu; @@ -59,7 +59,7 @@ static void run_test (ut::TestBase *_this, const char *file, const char *file_au db::Layout layout; { - std::string fn (ut::testsrc_private ()); + std::string fn (tl::testsrc_private ()); fn += "/testdata/dxf/"; fn += file; tl::InputStream stream (fn); @@ -67,7 +67,7 @@ static void run_test (ut::TestBase *_this, const char *file, const char *file_au reader.read (layout, options); } - _this->compare_layouts (layout, ut::testsrc_private () + std::string ("/testdata/dxf/") + file_au, ut::WriteGDS2, 1); + db::compare_layouts (_this, layout, tl::testsrc_private () + std::string ("/testdata/dxf/") + file_au, db::WriteGDS2, 1); } TEST(1a) diff --git a/src/db/unit_tests/dbEdge.cc b/src/db/unit_tests/dbEdge.cc index dd063ca5b..425289513 100644 --- a/src/db/unit_tests/dbEdge.cc +++ b/src/db/unit_tests/dbEdge.cc @@ -23,7 +23,7 @@ #include "dbEdge.h" -#include "utHead.h" +#include "tlUnitTest.h" TEST(1) diff --git a/src/db/unit_tests/dbEdgePair.cc b/src/db/unit_tests/dbEdgePair.cc index ebccd89bd..e633c0da3 100644 --- a/src/db/unit_tests/dbEdgePair.cc +++ b/src/db/unit_tests/dbEdgePair.cc @@ -23,7 +23,7 @@ #include "dbEdgePair.h" -#include "utHead.h" +#include "tlUnitTest.h" TEST(1) { diff --git a/src/db/unit_tests/dbEdgePairRelations.cc b/src/db/unit_tests/dbEdgePairRelations.cc index 13071ebc0..b2fe089db 100644 --- a/src/db/unit_tests/dbEdgePairRelations.cc +++ b/src/db/unit_tests/dbEdgePairRelations.cc @@ -21,7 +21,7 @@ */ -#include "utHead.h" +#include "tlUnitTest.h" #include "dbEdgePairRelations.h" diff --git a/src/db/unit_tests/dbEdgePairs.cc b/src/db/unit_tests/dbEdgePairs.cc index 086913743..9a9986174 100644 --- a/src/db/unit_tests/dbEdgePairs.cc +++ b/src/db/unit_tests/dbEdgePairs.cc @@ -21,7 +21,7 @@ */ -#include "utHead.h" +#include "tlUnitTest.h" #include "dbEdgePairs.h" #include "dbEdges.h" diff --git a/src/db/unit_tests/dbEdgeProcessor.cc b/src/db/unit_tests/dbEdgeProcessor.cc index 4905b1bfd..19fada960 100644 --- a/src/db/unit_tests/dbEdgeProcessor.cc +++ b/src/db/unit_tests/dbEdgeProcessor.cc @@ -21,7 +21,7 @@ */ -#include "utHead.h" +#include "tlUnitTest.h" #include "dbShapeProcessor.h" #include "dbPolygon.h" @@ -31,6 +31,7 @@ #include "dbLayoutDiff.h" #include "dbGDS2Writer.h" #include "dbGDS2Writer.h" +#include "dbTestSupport.h" #include "tlStream.h" #include "tlTimer.h" @@ -39,12 +40,12 @@ #include -void run_test_bool (ut::TestBase *_this, const char *file, int mode, bool min_coherence = true, const char *au_file1 = 0, const char *au_file2 = 0, const char *au_file3 = 0) +void run_test_bool (tl::TestBase *_this, const char *file, int mode, bool min_coherence = true, const char *au_file1 = 0, const char *au_file2 = 0, const char *au_file3 = 0) { db::Layout layout_org; { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/bool/"; fn += file; tl::InputStream stream (fn); @@ -75,11 +76,11 @@ void run_test_bool (ut::TestBase *_this, const char *file, int mode, bool min_co reader.read (layout_org, options); } - std::string au_fn1 (ut::testsrc ()); + std::string au_fn1 (tl::testsrc ()); au_fn1 += "/testdata/bool/"; au_fn1 += au_file1 ? au_file1 : file; - std::string au_fn2 (ut::testsrc ()); + std::string au_fn2 (tl::testsrc ()); au_fn2 += "/testdata/bool/"; au_fn2 += au_file2 ? au_file2 : (au_file1 ? au_file1 : file); @@ -146,7 +147,7 @@ void run_test_bool (ut::TestBase *_this, const char *file, int mode, bool min_co lmap.map (db::LDPair (2, 0), 1001); lmap.map (db::LDPair (100, 0), 1002); - _this->compare_layouts (layout_org, au_fn1, lmap, false /*skip other layers*/, ut::WriteOAS); + db::compare_layouts (_this, layout_org, au_fn1, lmap, false /*skip other layers*/, db::WriteOAS); layout_org.cell (*layout_org.begin_top_down ()).shapes (lr).clear (); @@ -161,12 +162,12 @@ void run_test_bool (ut::TestBase *_this, const char *file, int mode, bool min_co proc.merge (layout_org, layout_org.cell (*layout_org.begin_top_down ()), lr2, layout_org.cell (*layout_org.begin_top_down ()).shapes (lr), true /*hierarchical*/, 0 /*all polygons*/, true /*resolve holes*/, min_coherence); - _this->compare_layouts (layout_org, au_fn2, lmap, false /*skip other layers*/, ut::WriteOAS); + db::compare_layouts (_this, layout_org, au_fn2, lmap, false /*skip other layers*/, db::WriteOAS); // Use this opportunity to test trapezoid decomposition if (au_file3) { - std::string au_fn3 (ut::testsrc ()); + std::string au_fn3 (tl::testsrc ()); au_fn3 += "/testdata/bool/"; au_fn3 += au_file3; @@ -181,7 +182,7 @@ void run_test_bool (ut::TestBase *_this, const char *file, int mode, bool min_co db::TrapezoidGenerator out (sg); ep.process (out, op); - _this->compare_layouts (layout_org, au_fn3, lmap, false /*skip other layers*/, ut::WriteOAS); + db::compare_layouts (_this, layout_org, au_fn3, lmap, false /*skip other layers*/, db::WriteOAS); } } @@ -413,7 +414,7 @@ TEST(3special) run_test_bool (_this, "special3.oas", db::BooleanOp::Or, true, "special3_au5.oas"); } -void run_test_size (ut::TestBase *_this, const char *file, const char *au_file, int mode, db::Coord dx, db::Coord dy, bool min_coherence = true, bool flat = true) +void run_test_size (tl::TestBase *_this, const char *file, const char *au_file, int mode, db::Coord dx, db::Coord dy, bool min_coherence = true, bool flat = true) { db::Manager m; @@ -421,7 +422,7 @@ void run_test_size (ut::TestBase *_this, const char *file, const char *au_file, db::Layout layout_au (&m); { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/bool/"; fn += file; tl::InputStream stream (fn); @@ -447,7 +448,7 @@ void run_test_size (ut::TestBase *_this, const char *file, const char *au_file, reader.read (layout_org, options); } - std::string au_fn (ut::testsrc ()); + std::string au_fn (tl::testsrc ()); au_fn += "/testdata/bool/"; au_fn += au_file; @@ -494,7 +495,7 @@ void run_test_size (ut::TestBase *_this, const char *file, const char *au_file, lmap.map (db::LDPair (1, 0), 1); lmap.map (db::LDPair (100, 0), 2); - _this->compare_layouts (layout_org, au_fn, lmap, false /*skip other layers*/, ut::WriteOAS); + db::compare_layouts (_this, layout_org, au_fn, lmap, false /*skip other layers*/, db::WriteOAS); } @@ -2137,7 +2138,7 @@ TEST(100) unsigned int l2_l1d0 = 0, l2_l2d0 = 0; { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/bool/"; fn += "sp1.gds"; tl::InputStream stream (fn); @@ -2163,7 +2164,7 @@ TEST(100) } { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/bool/"; fn += "sp2.gds"; tl::InputStream stream (fn); @@ -2236,10 +2237,10 @@ TEST(100) proc.merge (layout_1, layout_1.cell (*layout_1.begin_top_down ()), l1_l1d0, lr_top->shapes (lr_l123d0), false /*hierarchical*/, 1, true /*resolve holes*/, true /*min coherence*/); - std::string au_fn (ut::testsrc ()); + std::string au_fn (tl::testsrc ()); au_fn += "/testdata/bool/"; au_fn += "sp_au.gds"; - _this->compare_layouts (lr, au_fn); + db::compare_layouts (_this, lr, au_fn); } diff --git a/src/db/unit_tests/dbEdges.cc b/src/db/unit_tests/dbEdges.cc index 7a1345651..19feac6c3 100644 --- a/src/db/unit_tests/dbEdges.cc +++ b/src/db/unit_tests/dbEdges.cc @@ -21,7 +21,7 @@ */ -#include "utHead.h" +#include "tlUnitTest.h" #include "dbEdges.h" #include "dbPolygonTools.h" diff --git a/src/db/unit_tests/dbEdgesToContours.cc b/src/db/unit_tests/dbEdgesToContours.cc index 4adcf2232..60d8d6275 100644 --- a/src/db/unit_tests/dbEdgesToContours.cc +++ b/src/db/unit_tests/dbEdgesToContours.cc @@ -22,7 +22,7 @@ #include "dbEdgesToContours.h" -#include "utHead.h" +#include "tlUnitTest.h" static std::string c2s (const std::vector &c) { diff --git a/src/db/unit_tests/dbGDS2Reader.cc b/src/db/unit_tests/dbGDS2Reader.cc index 5d4835cce..c05bbd8d0 100644 --- a/src/db/unit_tests/dbGDS2Reader.cc +++ b/src/db/unit_tests/dbGDS2Reader.cc @@ -24,7 +24,7 @@ #include "dbGDS2Reader.h" #include "dbLayoutDiff.h" -#include "utHead.h" +#include "tlUnitTest.h" #include diff --git a/src/db/unit_tests/dbGDS2Writer.cc b/src/db/unit_tests/dbGDS2Writer.cc index 987d55179..42e33dc86 100644 --- a/src/db/unit_tests/dbGDS2Writer.cc +++ b/src/db/unit_tests/dbGDS2Writer.cc @@ -27,17 +27,17 @@ #include "dbShapeProcessor.h" #include "dbWriter.h" #include "dbTextWriter.h" -#include "utHead.h" +#include "tlUnitTest.h" #include #include -void run_test (ut::TestBase *_this, const char *file, const char *file_ref) +void run_test (tl::TestBase *_this, const char *file, const char *file_ref) { db::Manager m; db::Layout layout_org (&m); { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/gds/"; fn += file; tl::InputStream stream (fn); @@ -47,7 +47,7 @@ void run_test (ut::TestBase *_this, const char *file, const char *file_ref) db::Layout layout_ref (&m); { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/gds/"; fn += file_ref; tl::InputStream stream (fn); @@ -103,7 +103,7 @@ TEST(2) poly.assign_hull (pts.begin (), pts.end ()); layout_org.cell (cid).shapes (lid).insert (poly); - std::string tmp_file = ut::TestBase::tmp_file ("tmp_GDS2Writer_2.gds"); + std::string tmp_file = tl::TestBase::tmp_file ("tmp_GDS2Writer_2.gds"); { tl::OutputStream stream (tmp_file); @@ -133,14 +133,14 @@ TEST(3) db::Manager m; db::Layout layout_org (&m); { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/other/d1.oas.gz"; tl::InputStream stream (fn); db::Reader reader (stream); reader.read (layout_org); } - std::string tmp_file = ut::TestBase::tmp_file ("tmp_GDS2Writer_3.gds"); + std::string tmp_file = tl::TestBase::tmp_file ("tmp_GDS2Writer_3.gds"); { tl::OutputStream stream (tmp_file); @@ -192,7 +192,7 @@ TEST(4) db::Manager m; db::Layout layout_org (&m); { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/other/d1.oas.gz"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -206,7 +206,7 @@ TEST(4) } } - std::string tmp_file = ut::TestBase::tmp_file ("tmp_GDS2Writer_4.gds"); + std::string tmp_file = tl::TestBase::tmp_file ("tmp_GDS2Writer_4.gds"); { tl::OutputStream stream (tmp_file); @@ -285,7 +285,7 @@ TEST(100) c2.insert (db::array (db::CellInst (c3.cell_index ()), t)); c3.insert (db::array (db::CellInst (c4.cell_index ()), t)); - std::string tmp_file = ut::TestBase::tmp_file ("tmp_GDS2Writer_100.gds"); + std::string tmp_file = tl::TestBase::tmp_file ("tmp_GDS2Writer_100.gds"); { tl::OutputStream out (tmp_file); @@ -367,7 +367,7 @@ TEST(101) c2.insert (db::array (db::CellInst (c3.cell_index ()), t)); c3.insert (db::array (db::CellInst (c4.cell_index ()), t)); - std::string tmp_file = ut::TestBase::tmp_file ("tmp_GDS2Writer_101.gds"); + std::string tmp_file = tl::TestBase::tmp_file ("tmp_GDS2Writer_101.gds"); { tl::OutputStream out (tmp_file); @@ -439,7 +439,7 @@ TEST(102) c2.insert (db::array (db::CellInst (c3.cell_index ()), t)); c3.insert (db::array (db::CellInst (c4.cell_index ()), t)); - std::string tmp_file = ut::TestBase::tmp_file ("tmp_GDS2Writer_102.gds"); + std::string tmp_file = tl::TestBase::tmp_file ("tmp_GDS2Writer_102.gds"); { tl::OutputStream out (tmp_file); @@ -519,7 +519,7 @@ TEST(103) c2.insert (db::array (db::CellInst (c3.cell_index ()), t)); c3.insert (db::array (db::CellInst (c4.cell_index ()), t)); - std::string tmp_file = ut::TestBase::tmp_file ("tmp_GDS2Writer_103.gds"); + std::string tmp_file = tl::TestBase::tmp_file ("tmp_GDS2Writer_103.gds"); { tl::OutputStream out (tmp_file); @@ -592,7 +592,7 @@ TEST(110) c2.insert (db::array (db::CellInst (c3.cell_index ()), t)); c3.insert (db::array (db::CellInst (c4.cell_index ()), t)); - std::string tmp_file = ut::TestBase::tmp_file ("tmp_GDS2Writer_110.gds"); + std::string tmp_file = tl::TestBase::tmp_file ("tmp_GDS2Writer_110.gds"); { tl::OutputStream out (tmp_file); @@ -668,7 +668,7 @@ TEST(111) c2.insert (db::array (db::CellInst (c3.cell_index ()), t)); c3.insert (db::array (db::CellInst (c4.cell_index ()), t)); - std::string tmp_file = ut::TestBase::tmp_file ("tmp_GDS2Writer_111.gds"); + std::string tmp_file = tl::TestBase::tmp_file ("tmp_GDS2Writer_111.gds"); { tl::OutputStream out (tmp_file); @@ -741,7 +741,7 @@ TEST(112) c2.insert (db::array (db::CellInst (c3.cell_index ()), t)); c3.insert (db::array (db::CellInst (c4.cell_index ()), t)); - std::string tmp_file = ut::TestBase::tmp_file ("tmp_GDS2Writer_112.gds"); + std::string tmp_file = tl::TestBase::tmp_file ("tmp_GDS2Writer_112.gds"); { tl::OutputStream out (tmp_file); @@ -818,7 +818,7 @@ TEST(113) c2.insert (db::array (db::CellInst (c3.cell_index ()), t)); c3.insert (db::array (db::CellInst (c4.cell_index ()), t)); - std::string tmp_file = ut::TestBase::tmp_file ("tmp_GDS2Writer_113.gds"); + std::string tmp_file = tl::TestBase::tmp_file ("tmp_GDS2Writer_113.gds"); { tl::OutputStream out (tmp_file); @@ -872,7 +872,7 @@ TEST(114) c1.shapes (0).insert (db::Text (db::Trans (1, false, db::Vector (100, 200)), 1000, db::Font (7), db::HAlignCenter, db::VAlignBottom)); c1.shapes (0).insert (db::Text (db::Trans (1, false, db::Vector (100, 200)), 1000, db::Font (7), db::HAlignLeft, db::VAlignCenter)); - std::string tmp_file = ut::TestBase::tmp_file ("tmp_GDS2Writer_114.gds"); + std::string tmp_file = tl::TestBase::tmp_file ("tmp_GDS2Writer_114.gds"); { tl::OutputStream out (tmp_file); @@ -974,7 +974,7 @@ TEST(115) ps.transform (db::FTrans (db::FTrans::r90), false); c1.shapes (0).insert (ps); - std::string tmp_file = ut::TestBase::tmp_file ("tmp_GDS2Writer_115.gds"); + std::string tmp_file = tl::TestBase::tmp_file ("tmp_GDS2Writer_115.gds"); { tl::OutputStream out (tmp_file); diff --git a/src/db/unit_tests/dbLayer.cc b/src/db/unit_tests/dbLayer.cc index 367bcc3a7..1927158a7 100644 --- a/src/db/unit_tests/dbLayer.cc +++ b/src/db/unit_tests/dbLayer.cc @@ -22,7 +22,7 @@ #include "dbLayer.h" -#include "utHead.h" +#include "tlUnitTest.h" TEST(1) diff --git a/src/db/unit_tests/dbLayerMapping.cc b/src/db/unit_tests/dbLayerMapping.cc index 0f9d051fe..ceff31c25 100644 --- a/src/db/unit_tests/dbLayerMapping.cc +++ b/src/db/unit_tests/dbLayerMapping.cc @@ -24,7 +24,7 @@ #include "dbLayout.h" #include "dbLayerMapping.h" #include "tlString.h" -#include "utHead.h" +#include "tlUnitTest.h" std::string nl2s (const std::vector &nl, const db::Layout &a) { diff --git a/src/db/unit_tests/dbLayout.cc b/src/db/unit_tests/dbLayout.cc index bc90c89bb..dea946924 100644 --- a/src/db/unit_tests/dbLayout.cc +++ b/src/db/unit_tests/dbLayout.cc @@ -24,7 +24,7 @@ #include "dbLayout.h" #include "tlString.h" -#include "utHead.h" +#include "tlUnitTest.h" std::string set2string (const std::set &set) { diff --git a/src/db/unit_tests/dbLayoutDiff.cc b/src/db/unit_tests/dbLayoutDiff.cc index 0c394b5ca..bcb13601d 100644 --- a/src/db/unit_tests/dbLayoutDiff.cc +++ b/src/db/unit_tests/dbLayoutDiff.cc @@ -21,7 +21,7 @@ */ -#include "utHead.h" +#include "tlUnitTest.h" #include "dbLayoutDiff.h" #include "dbLayerProperties.h" #include "dbLayout.h" diff --git a/src/db/unit_tests/dbLayoutQuery.cc b/src/db/unit_tests/dbLayoutQuery.cc index a092cce3c..6b2a28678 100644 --- a/src/db/unit_tests/dbLayoutQuery.cc +++ b/src/db/unit_tests/dbLayoutQuery.cc @@ -21,7 +21,7 @@ */ -#include "utHead.h" +#include "tlUnitTest.h" #include "dbLayoutQuery.h" #include "gsiExpression.h" diff --git a/src/db/unit_tests/dbLayoutUtils.cc b/src/db/unit_tests/dbLayoutUtils.cc index b09633e8d..65381d802 100644 --- a/src/db/unit_tests/dbLayoutUtils.cc +++ b/src/db/unit_tests/dbLayoutUtils.cc @@ -23,9 +23,10 @@ #include "dbLayoutUtils.h" #include "dbLayerMapping.h" #include "dbCellMapping.h" +#include "dbTestSupport.h" #include "dbReader.h" #include "tlString.h" -#include "utHead.h" +#include "tlUnitTest.h" unsigned int find_layer (const db::Layout &l, int ly, int dt) { @@ -41,7 +42,7 @@ TEST(1) { db::Layout l1; { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/algo/layout_utils_l1.gds"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -50,7 +51,7 @@ TEST(1) db::Layout l2; { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/algo/layout_utils_l2.gds"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -96,7 +97,7 @@ TEST(2) { db::Layout l1; { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/algo/layout_utils_l1.gds"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -105,7 +106,7 @@ TEST(2) db::Layout l2; { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/algo/layout_utils_l2.gds"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -128,7 +129,7 @@ TEST(2) db::merge_layouts (l2, l1, db::ICplxTrans (), src, cm.table (), lm.table (), &fm); CHECKPOINT(); - compare_layouts (l2, ut::testsrc () + "/testdata/algo/layout_utils_au2.gds"); + db::compare_layouts (_this, l2, tl::testsrc () + "/testdata/algo/layout_utils_au2.gds"); EXPECT_EQ (fm.find (l1.cell_by_name ("TOP").second) != fm.end (), true); EXPECT_EQ (l2.cell_name (fm.find (l1.cell_by_name ("TOP").second)->second), "TOP$1"); @@ -145,7 +146,7 @@ TEST(3) { db::Layout l1; { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/algo/layout_utils_l1.gds"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -154,7 +155,7 @@ TEST(3) db::Layout l2; { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/algo/layout_utils_l2.gds"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -178,7 +179,7 @@ TEST(3) db::merge_layouts (l2, l1, db::ICplxTrans (), src, cm.table (), lm.table (), &fm); CHECKPOINT(); - compare_layouts (l2, ut::testsrc () + "/testdata/algo/layout_utils_au3.gds"); + db::compare_layouts (_this, l2, tl::testsrc () + "/testdata/algo/layout_utils_au3.gds"); EXPECT_EQ (fm.find (l1.cell_by_name ("TOP").second) != fm.end (), true); EXPECT_EQ (l2.cell_name (fm.find (l1.cell_by_name ("TOP").second)->second), "TOPTOP"); @@ -195,7 +196,7 @@ TEST(4) { db::Layout l1; { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/algo/layout_utils_l1.gds"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -204,7 +205,7 @@ TEST(4) db::Layout l2; { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/algo/layout_utils_l2.gds"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -228,7 +229,7 @@ TEST(4) db::merge_layouts (l2, l1, db::ICplxTrans (), src, cm.table (), lm.table (), &fm); CHECKPOINT(); - compare_layouts (l2, ut::testsrc () + "/testdata/algo/layout_utils_au4.gds"); + db::compare_layouts (_this, l2, tl::testsrc () + "/testdata/algo/layout_utils_au4.gds"); EXPECT_EQ (fm.find (l1.cell_by_name ("TOP").second) != fm.end (), true); EXPECT_EQ (l2.cell_name (fm.find (l1.cell_by_name ("TOP").second)->second), "TOP"); @@ -245,7 +246,7 @@ TEST(5) { db::Layout l1; { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/algo/layout_utils_l1.gds"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -254,7 +255,7 @@ TEST(5) db::Layout l2; { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/algo/layout_utils_l2.gds"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -278,7 +279,7 @@ TEST(5) db::merge_layouts (l2, l1, db::ICplxTrans (), src, cm.table (), lm.table (), &fm); CHECKPOINT(); - compare_layouts (l2, ut::testsrc () + "/testdata/algo/layout_utils_au5.gds"); + db::compare_layouts (_this, l2, tl::testsrc () + "/testdata/algo/layout_utils_au5.gds"); EXPECT_EQ (fm.find (l1.cell_by_name ("TOP").second) != fm.end (), true); EXPECT_EQ (l2.cell_name (fm.find (l1.cell_by_name ("TOP").second)->second), "TOP"); @@ -295,7 +296,7 @@ TEST(6) { db::Layout l1; { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/algo/layout_utils_l1.gds"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -304,7 +305,7 @@ TEST(6) db::Layout l2; { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/algo/layout_utils_l2.gds"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -331,7 +332,7 @@ TEST(6) db::merge_layouts (l2, l1, db::ICplxTrans (), src, cm.table (), lm.table (), &fm); CHECKPOINT(); - compare_layouts (l2, ut::testsrc () + "/testdata/algo/layout_utils_au6.gds"); + db::compare_layouts (_this, l2, tl::testsrc () + "/testdata/algo/layout_utils_au6.gds"); EXPECT_EQ (fm.find (l1.cell_by_name ("TOP").second) != fm.end (), true); EXPECT_EQ (l2.cell_name (fm.find (l1.cell_by_name ("TOP").second)->second), "TOP"); @@ -347,7 +348,7 @@ TEST(7) { db::Layout l1; { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/algo/layout_utils_l1.gds"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -356,7 +357,7 @@ TEST(7) db::Layout l2; { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/algo/layout_utils_l3.gds"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -383,7 +384,7 @@ TEST(7) db::merge_layouts (l2, l1, db::ICplxTrans (4.0), src, cm.table (), lm.table (), &fm); CHECKPOINT(); - compare_layouts (l2, ut::testsrc () + "/testdata/algo/layout_utils_au7.gds"); + db::compare_layouts (_this, l2, tl::testsrc () + "/testdata/algo/layout_utils_au7.gds"); EXPECT_EQ (fm.find (l1.cell_by_name ("TOP").second) != fm.end (), true); EXPECT_EQ (l2.cell_name (fm.find (l1.cell_by_name ("TOP").second)->second), "TOP"); @@ -398,7 +399,7 @@ TEST(7) db::merge_layouts (l2copy, l1, db::ICplxTrans (4.0), src, cm.table (), lm.table ()); CHECKPOINT(); - compare_layouts (l2copy, ut::testsrc () + "/testdata/algo/layout_utils_au7.gds"); + db::compare_layouts (_this, l2copy, tl::testsrc () + "/testdata/algo/layout_utils_au7.gds"); } // Tests copy_shapes with no specific mapping (flattening) @@ -406,7 +407,7 @@ TEST(12) { db::Layout l1; { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/algo/layout_utils_l1.gds"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -415,7 +416,7 @@ TEST(12) db::Layout l2; { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/algo/layout_utils_l2.gds"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -439,7 +440,7 @@ TEST(12) db::copy_shapes (l2, l1, db::ICplxTrans (), src, cm.table (), lm.table ()); CHECKPOINT(); - compare_layouts (l2, ut::testsrc () + "/testdata/algo/layout_utils_au12.gds"); + db::compare_layouts (_this, l2, tl::testsrc () + "/testdata/algo/layout_utils_au12.gds"); } // Tests copy_shapes with full name mapping @@ -447,7 +448,7 @@ TEST(13) { db::Layout l1; { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/algo/layout_utils_l1.gds"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -456,7 +457,7 @@ TEST(13) db::Layout l2; { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/algo/layout_utils_l2.gds"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -479,7 +480,7 @@ TEST(13) db::copy_shapes (l2, l1, db::ICplxTrans (), src, cm.table (), lm.table ()); CHECKPOINT(); - compare_layouts (l2, ut::testsrc () + "/testdata/algo/layout_utils_au13.gds"); + db::compare_layouts (_this, l2, tl::testsrc () + "/testdata/algo/layout_utils_au13.gds"); } // Tests copy_shapes with geo mapping @@ -487,7 +488,7 @@ TEST(14) { db::Layout l1; { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/algo/layout_utils_l1.gds"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -496,7 +497,7 @@ TEST(14) db::Layout l2; { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/algo/layout_utils_l2.gds"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -519,7 +520,7 @@ TEST(14) db::copy_shapes (l2, l1, db::ICplxTrans (), src, cm.table (), lm.table ()); CHECKPOINT(); - compare_layouts (l2, ut::testsrc () + "/testdata/algo/layout_utils_au14.gds"); + db::compare_layouts (_this, l2, tl::testsrc () + "/testdata/algo/layout_utils_au14.gds"); } // Tests copy_shapes with flattening minus one cell @@ -527,7 +528,7 @@ TEST(15) { db::Layout l1; { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/algo/layout_utils_l1.gds"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -536,7 +537,7 @@ TEST(15) db::Layout l2; { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/algo/layout_utils_l2.gds"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -560,7 +561,7 @@ TEST(15) db::copy_shapes (l2, l1, db::ICplxTrans (), src, cm.table (), lm.table ()); CHECKPOINT(); - compare_layouts (l2, ut::testsrc () + "/testdata/algo/layout_utils_au15.gds"); + db::compare_layouts (_this, l2, tl::testsrc () + "/testdata/algo/layout_utils_au15.gds"); } // Tests copy_shapes/move_shapes with no specific mapping (flattening) @@ -568,7 +569,7 @@ TEST(16) { db::Layout l1; { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/algo/layout_utils_l1.gds"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -577,7 +578,7 @@ TEST(16) db::Layout l2; { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/algo/layout_utils_l3.gds"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -603,14 +604,14 @@ TEST(16) db::copy_shapes (l2, l1, db::ICplxTrans (4.0), src, cm.table (), lm.table ()); CHECKPOINT(); - compare_layouts (l2, ut::testsrc () + "/testdata/algo/layout_utils_au16.gds"); + db::compare_layouts (_this, l2, tl::testsrc () + "/testdata/algo/layout_utils_au16.gds"); // ... and one test for move: db::move_shapes (l2copy, l1, db::ICplxTrans (4.0), src, cm.table (), lm.table ()); CHECKPOINT(); - compare_layouts (l2copy, ut::testsrc () + "/testdata/algo/layout_utils_au16.gds"); - compare_layouts (l1, ut::testsrc () + "/testdata/algo/layout_utils_au16b.gds"); + db::compare_layouts (_this, l2copy, tl::testsrc () + "/testdata/algo/layout_utils_au16.gds"); + db::compare_layouts (_this, l1, tl::testsrc () + "/testdata/algo/layout_utils_au16b.gds"); } diff --git a/src/db/unit_tests/dbLibraries.cc b/src/db/unit_tests/dbLibraries.cc index 684ac9f95..d367870ae 100644 --- a/src/db/unit_tests/dbLibraries.cc +++ b/src/db/unit_tests/dbLibraries.cc @@ -33,7 +33,7 @@ #include "dbLayoutDiff.h" #include "tlStream.h" #include "tlStaticObjects.h" -#include "utHead.h" +#include "tlUnitTest.h" #include #include @@ -100,7 +100,7 @@ class LIBT_L : public db::Library { public: - LIBT_L (ut::TestBase *_this) + LIBT_L (tl::TestBase *_this) : Library () { set_name("L"); @@ -227,11 +227,11 @@ public: } }; -static bool compare_vs_au (const ut::TestBase *tb, const db::Layout &layout, const std::string &filename) +static bool compare_vs_au (const tl::TestBase *tb, const db::Layout &layout, const std::string &filename) { db::Layout layout_au; - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/gds/"; fn += filename; tl::InputStream stream (fn); @@ -491,7 +491,7 @@ TEST(2) EXPECT_EQ (layout.basic_name (lp2), "PD"); EXPECT_EQ (layout.display_name (lp2), "L.PD*"); - std::string tmp_file = ut::TestBase::tmp_file (tl::sprintf ("tmp_dbLibraries2.gds")); + std::string tmp_file = tl::TestBase::tmp_file (tl::sprintf ("tmp_dbLibraries2.gds")); { tl::OutputStream stream (tmp_file); @@ -582,7 +582,7 @@ TEST(3) db::cell_index_type lp = layout.get_lib_proxy (lib_b, lib_bb); db::Instance i1 = top.insert (db::CellInstArray (db::CellInst (lp), db::Trans (db::Vector (0, 0)))); - std::string tmp_file = ut::TestBase::tmp_file (tl::sprintf ("tmp_dbLibraries3.gds")); + std::string tmp_file = tl::TestBase::tmp_file (tl::sprintf ("tmp_dbLibraries3.gds")); { db::Writer writer = db::Writer (db::SaveLayoutOptions ()); diff --git a/src/db/unit_tests/dbMatrix.cc b/src/db/unit_tests/dbMatrix.cc index 7d6546560..3dbafffdf 100644 --- a/src/db/unit_tests/dbMatrix.cc +++ b/src/db/unit_tests/dbMatrix.cc @@ -23,7 +23,7 @@ #include "dbMatrix.h" #include "dbTrans.h" -#include "utHead.h" +#include "tlUnitTest.h" TEST(1) { diff --git a/src/db/unit_tests/dbOASISReader.cc b/src/db/unit_tests/dbOASISReader.cc index 23a4e7839..2609526f3 100644 --- a/src/db/unit_tests/dbOASISReader.cc +++ b/src/db/unit_tests/dbOASISReader.cc @@ -24,7 +24,7 @@ #include "dbOASISReader.h" #include "dbTextWriter.h" #include "tlLog.h" -#include "utHead.h" +#include "tlUnitTest.h" #include @@ -37,7 +37,7 @@ TEST(1_1) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t1.1.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -68,7 +68,7 @@ TEST(1_2) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t1.2.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -99,7 +99,7 @@ TEST(1_3) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t1.3.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -130,7 +130,7 @@ TEST(1_4) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t1.4.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -161,7 +161,7 @@ TEST(1_5) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t1.5.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -219,7 +219,7 @@ TEST(10_1) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t10.1.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -285,7 +285,7 @@ TEST(11_1) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t11.1.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -516,7 +516,7 @@ TEST(11_2) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t11.2.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -582,7 +582,7 @@ TEST(11_3) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t11.3.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -682,7 +682,7 @@ TEST(11_4) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t11.4.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -913,7 +913,7 @@ TEST(11_5) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t11.5.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -1014,7 +1014,7 @@ TEST(11_6) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t11.6.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -1057,7 +1057,7 @@ TEST(11_7) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t11.7.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -1083,7 +1083,7 @@ TEST(11_8) { db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t11.8.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -1105,7 +1105,7 @@ TEST(11_9) { db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t11.9.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -1151,7 +1151,7 @@ TEST(12_1) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t12.1.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -1200,7 +1200,7 @@ TEST(13_1) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t13.1.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -1250,7 +1250,7 @@ TEST(13_2) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t13.2.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -1316,7 +1316,7 @@ TEST(13_3) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t13.3.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -1382,7 +1382,7 @@ TEST(13_4) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t13.4.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -1426,7 +1426,7 @@ TEST(14_1) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t14.1.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -1459,7 +1459,7 @@ TEST(2_1) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t2.1.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -1494,7 +1494,7 @@ TEST(2_2) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t2.2.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -1520,7 +1520,7 @@ TEST(2_3) { db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t2.3.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -1551,7 +1551,7 @@ TEST(2_4) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t2.4.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -1577,7 +1577,7 @@ TEST(2_5) { db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t2.5.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -1608,7 +1608,7 @@ TEST(2_6) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t2.6.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -1859,7 +1859,7 @@ TEST(3_1) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t3.1.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -1893,7 +1893,7 @@ TEST(3_10) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t3.10.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -1919,7 +1919,7 @@ TEST(3_11) { db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t3.11.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -2166,7 +2166,7 @@ TEST(3_12) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t3.12.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -2417,7 +2417,7 @@ TEST(3_2) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t3.2.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -2443,7 +2443,7 @@ TEST(3_3) { db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t3.3.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -2465,7 +2465,7 @@ TEST(3_4) { db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t3.4.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -2712,7 +2712,7 @@ TEST(3_5) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t3.5.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -2738,7 +2738,7 @@ TEST(3_6) { db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t3.6.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -2760,7 +2760,7 @@ TEST(3_7) { db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t3.7.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -2782,7 +2782,7 @@ TEST(3_8) { db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t3.8.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -2812,7 +2812,7 @@ TEST(3_9) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t3.9.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -2869,7 +2869,7 @@ TEST(4_1) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t4.1.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -2998,7 +2998,7 @@ TEST(4_2) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t4.2.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -3067,7 +3067,7 @@ TEST(5_1) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t5.1.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -3103,7 +3103,7 @@ TEST(5_2) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t5.2.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -3281,7 +3281,7 @@ TEST(5_3) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t5.3.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -3344,7 +3344,7 @@ TEST(6_1) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t6.1.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -3478,7 +3478,7 @@ TEST(7_1) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t7.1.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -3530,7 +3530,7 @@ TEST(8_1) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t8.1.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -3573,7 +3573,7 @@ TEST(8_2) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t8.2.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -3616,7 +3616,7 @@ TEST(8_3) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t8.3.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -3659,7 +3659,7 @@ TEST(8_4) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t8.4.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -3702,7 +3702,7 @@ TEST(8_5) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t8.5.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -3749,7 +3749,7 @@ TEST(8_6) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t8.6.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -3792,7 +3792,7 @@ TEST(8_7) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t8.7.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -3835,7 +3835,7 @@ TEST(8_8) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t8.8.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -3935,7 +3935,7 @@ TEST(9_1) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t9.1.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -3974,7 +3974,7 @@ TEST(9_2) db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t9.2.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -4026,7 +4026,7 @@ TEST(99) db::Layout layout (&m); { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t9.2.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -4043,7 +4043,7 @@ TEST(99) } { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/t8.7.oas"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -4109,7 +4109,7 @@ TEST(100) db::Layout layout (&m); { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/xgeometry_test.oas"; tl::InputStream stream (fn); db::Reader reader (stream); diff --git a/src/db/unit_tests/dbOASISWriter.cc b/src/db/unit_tests/dbOASISWriter.cc index b1f292b9d..b970ae051 100644 --- a/src/db/unit_tests/dbOASISWriter.cc +++ b/src/db/unit_tests/dbOASISWriter.cc @@ -29,17 +29,17 @@ #include "dbWriter.h" #include "dbTextWriter.h" -#include "utHead.h" +#include "tlUnitTest.h" #include #include -void run_test (ut::TestBase *_this, const char *file, bool scaling_test, int compr, bool recompress) +void run_test (tl::TestBase *_this, const char *file, bool scaling_test, int compr, bool recompress) { { db::Manager m; db::Layout layout_org (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/"; fn += file; tl::InputStream stream (fn); @@ -84,7 +84,7 @@ void run_test (ut::TestBase *_this, const char *file, bool scaling_test, int com { db::Manager m; db::Layout layout_org (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/"; fn += file; tl::InputStream stream (fn); @@ -140,7 +140,7 @@ void run_test (ut::TestBase *_this, const char *file, bool scaling_test, int com { db::Manager m; db::Layout layout_org (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/"; fn += file; tl::InputStream stream (fn); @@ -189,7 +189,7 @@ void run_test (ut::TestBase *_this, const char *file, bool scaling_test, int com { db::Manager m; db::Layout layout_org (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/"; fn += file; tl::InputStream stream (fn); @@ -240,7 +240,7 @@ void run_test (ut::TestBase *_this, const char *file, bool scaling_test, int com db::Manager m; db::Layout layout (&m); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/oasis/"; fn += file; tl::InputStream stream (fn); @@ -299,7 +299,7 @@ void run_test (ut::TestBase *_this, const char *file, bool scaling_test, int com } } -void run_test (ut::TestBase *_this, const char *file, bool scaling_test = true) +void run_test (tl::TestBase *_this, const char *file, bool scaling_test = true) { for (int recompress = 0; recompress < 2; ++recompress) { run_test (_this, file, scaling_test, 0, recompress); @@ -551,7 +551,7 @@ TEST(100) c2.insert (db::array (db::CellInst (c3.cell_index ()), t)); c3.insert (db::array (db::CellInst (c4.cell_index ()), t)); - std::string tmp_file = ut::TestBase::tmp_file (tl::sprintf ("tmp_dbOASISWriter100.gds")); + std::string tmp_file = tl::TestBase::tmp_file (tl::sprintf ("tmp_dbOASISWriter100.gds")); { tl::OutputStream out (tmp_file); @@ -634,7 +634,7 @@ TEST(101) c2.insert (db::array (db::CellInst (c3.cell_index ()), t)); c3.insert (db::array (db::CellInst (c4.cell_index ()), t)); - std::string tmp_file = ut::TestBase::tmp_file (tl::sprintf ("tmp_dbOASISWriter101.gds")); + std::string tmp_file = tl::TestBase::tmp_file (tl::sprintf ("tmp_dbOASISWriter101.gds")); { tl::OutputStream out (tmp_file); @@ -707,7 +707,7 @@ TEST(102) c2.insert (db::array (db::CellInst (c3.cell_index ()), t)); c3.insert (db::array (db::CellInst (c4.cell_index ()), t)); - std::string tmp_file = ut::TestBase::tmp_file (tl::sprintf ("tmp_dbOASISWriter102.gds")); + std::string tmp_file = tl::TestBase::tmp_file (tl::sprintf ("tmp_dbOASISWriter102.gds")); { tl::OutputStream out (tmp_file); @@ -788,7 +788,7 @@ TEST(103) c2.insert (db::array (db::CellInst (c3.cell_index ()), t)); c3.insert (db::array (db::CellInst (c4.cell_index ()), t)); - std::string tmp_file = ut::TestBase::tmp_file (tl::sprintf ("tmp_dbOASISWriter103.gds")); + std::string tmp_file = tl::TestBase::tmp_file (tl::sprintf ("tmp_dbOASISWriter103.gds")); { tl::OutputStream out (tmp_file); @@ -862,7 +862,7 @@ TEST(110) c2.insert (db::array (db::CellInst (c3.cell_index ()), t)); c3.insert (db::array (db::CellInst (c4.cell_index ()), t)); - std::string tmp_file = ut::TestBase::tmp_file (tl::sprintf ("tmp_dbOASISWriter110.gds")); + std::string tmp_file = tl::TestBase::tmp_file (tl::sprintf ("tmp_dbOASISWriter110.gds")); { tl::OutputStream out (tmp_file); @@ -939,7 +939,7 @@ TEST(111) c2.insert (db::array (db::CellInst (c3.cell_index ()), t)); c3.insert (db::array (db::CellInst (c4.cell_index ()), t)); - std::string tmp_file = ut::TestBase::tmp_file (tl::sprintf ("tmp_dbOASISWriter111.gds")); + std::string tmp_file = tl::TestBase::tmp_file (tl::sprintf ("tmp_dbOASISWriter111.gds")); { tl::OutputStream out (tmp_file); @@ -1013,7 +1013,7 @@ TEST(112) c2.insert (db::array (db::CellInst (c3.cell_index ()), t)); c3.insert (db::array (db::CellInst (c4.cell_index ()), t)); - std::string tmp_file = ut::TestBase::tmp_file (tl::sprintf ("tmp_dbOASISWriter112.gds")); + std::string tmp_file = tl::TestBase::tmp_file (tl::sprintf ("tmp_dbOASISWriter112.gds")); { tl::OutputStream out (tmp_file); @@ -1091,7 +1091,7 @@ TEST(113) c2.insert (db::array (db::CellInst (c3.cell_index ()), t)); c3.insert (db::array (db::CellInst (c4.cell_index ()), t)); - std::string tmp_file = ut::TestBase::tmp_file (tl::sprintf ("tmp_dbOASISWriter113.gds")); + std::string tmp_file = tl::TestBase::tmp_file (tl::sprintf ("tmp_dbOASISWriter113.gds")); { tl::OutputStream out (tmp_file); @@ -1146,7 +1146,7 @@ TEST(114) db::Edge e3 (0, 1200, 1000, 1200); c1.shapes (1).insert (e3); - std::string tmp_file = ut::TestBase::tmp_file (tl::sprintf ("tmp_dbOASISWriter114.gds")); + std::string tmp_file = tl::TestBase::tmp_file (tl::sprintf ("tmp_dbOASISWriter114.gds")); { tl::OutputStream out (tmp_file); @@ -1219,7 +1219,7 @@ TEST(115) db::Edge e3 (0, 1200, 1000, 1200); c1.shapes (1).insert (e3); - std::string tmp_file = ut::TestBase::tmp_file (tl::sprintf ("tmp_dbOASISWriter115.gds")); + std::string tmp_file = tl::TestBase::tmp_file (tl::sprintf ("tmp_dbOASISWriter115.gds")); { tl::OutputStream out (tmp_file); @@ -1279,7 +1279,7 @@ TEST(118) c2.insert (db::array (db::CellInst (c1.cell_index ()), db::Trans (), db::Vector (0, 1), db::Vector (1, 0), 1, 1)); c2.insert (db::array (db::CellInst (c1.cell_index ()), db::Trans (db::Vector (17, -42)), db::Vector (0, 1), db::Vector (1, 0), 1, 1)); - std::string tmp_file = ut::TestBase::tmp_file ("tmp.oas"); + std::string tmp_file = tl::TestBase::tmp_file ("tmp.oas"); { tl::OutputStream out (tmp_file); @@ -1351,7 +1351,7 @@ TEST(116) db::Cell &c2 (g.cell (g.add_cell ())); { - std::string tmp_file = ut::TestBase::tmp_file (tl::sprintf ("tmp_dbOASISWriter116a.gds")); + std::string tmp_file = tl::TestBase::tmp_file (tl::sprintf ("tmp_dbOASISWriter116a.gds")); { tl::OutputStream out (tmp_file); @@ -1400,7 +1400,7 @@ TEST(116) } { - std::string tmp_file = ut::TestBase::tmp_file (tl::sprintf ("tmp_dbOASISWriter116b.gds")); + std::string tmp_file = tl::TestBase::tmp_file (tl::sprintf ("tmp_dbOASISWriter116b.gds")); { tl::OutputStream out (tmp_file); @@ -1449,7 +1449,7 @@ TEST(116) } { - std::string tmp_file = ut::TestBase::tmp_file (tl::sprintf ("tmp_dbOASISWriter116c.gds")); + std::string tmp_file = tl::TestBase::tmp_file (tl::sprintf ("tmp_dbOASISWriter116c.gds")); { tl::OutputStream out (tmp_file); @@ -1507,7 +1507,7 @@ TEST(116) } { - std::string tmp_file = ut::TestBase::tmp_file ("tmp_dbOASISWriter116d.gds"); + std::string tmp_file = tl::TestBase::tmp_file ("tmp_dbOASISWriter116d.gds"); { tl::OutputStream out (tmp_file); @@ -1570,7 +1570,7 @@ TEST(116) c1.insert (db::CellInstArray (c2.cell_index (), db::Trans ())); { - std::string tmp_file = ut::TestBase::tmp_file ("tmp_dbOASISWriter116e.gds"); + std::string tmp_file = tl::TestBase::tmp_file ("tmp_dbOASISWriter116e.gds"); { tl::OutputStream out (tmp_file); @@ -1619,7 +1619,7 @@ TEST(116) } { - std::string tmp_file = ut::TestBase::tmp_file ("tmp_dbOASISWriter116f.gds"); + std::string tmp_file = tl::TestBase::tmp_file ("tmp_dbOASISWriter116f.gds"); { tl::OutputStream out (tmp_file); @@ -1695,7 +1695,7 @@ TEST(117) ps.transform (db::FTrans (db::FTrans::r90), false); c1.shapes (0).insert (ps); - std::string tmp_file = ut::TestBase::tmp_file (tl::sprintf ("tmp_dbOASISWriter117.gds")); + std::string tmp_file = tl::TestBase::tmp_file (tl::sprintf ("tmp_dbOASISWriter117.gds")); { tl::OutputStream out (tmp_file); diff --git a/src/db/unit_tests/dbOASISWriter2.cc b/src/db/unit_tests/dbOASISWriter2.cc index 9fc772577..c9a11e5da 100644 --- a/src/db/unit_tests/dbOASISWriter2.cc +++ b/src/db/unit_tests/dbOASISWriter2.cc @@ -25,7 +25,7 @@ #include "dbOASISWriter.h" #include "dbShapeProcessor.h" -#include "utHead.h" +#include "tlUnitTest.h" #include #include @@ -38,7 +38,7 @@ TEST(1) db::Manager m; db::Layout layout_org (&m); { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/other/d1.oas.gz"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -52,7 +52,7 @@ TEST(1) } } - std::string tmp_file = ut::TestBase::tmp_file ("tmp_OASISWriter2.gds"); + std::string tmp_file = tl::TestBase::tmp_file ("tmp_OASISWriter2.gds"); { tl::OutputStream stream (tmp_file); diff --git a/src/db/unit_tests/dbObject.cc b/src/db/unit_tests/dbObject.cc index 7fff0b88f..b613ba0e9 100644 --- a/src/db/unit_tests/dbObject.cc +++ b/src/db/unit_tests/dbObject.cc @@ -22,7 +22,7 @@ #include "dbObject.h" -#include "utHead.h" +#include "tlUnitTest.h" namespace { diff --git a/src/db/unit_tests/dbPCells.cc b/src/db/unit_tests/dbPCells.cc index 52b73d1cb..1e7136eed 100644 --- a/src/db/unit_tests/dbPCells.cc +++ b/src/db/unit_tests/dbPCells.cc @@ -28,8 +28,9 @@ #include "dbWriter.h" #include "dbReader.h" #include "dbLayoutDiff.h" +#include "dbTestSupport.h" #include "tlStream.h" -#include "utHead.h" +#include "tlUnitTest.h" #include @@ -102,7 +103,7 @@ TEST(0) // Note: this sample requires the BASIC lib { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/gds/pcell_test_0.gds"; tl::InputStream stream (fn); db::Reader reader (stream); @@ -110,7 +111,7 @@ TEST(0) } CHECKPOINT (); - _this->compare_layouts (layout, ut::testsrc () + "/testdata/gds/pcell_test_0_au.gds", ut::NoNormalization); + db::compare_layouts (_this, layout, tl::testsrc () + "/testdata/gds/pcell_test_0_au.gds", db::NoNormalization); } TEST(1) @@ -174,7 +175,7 @@ TEST(1) EXPECT_EQ (layout.get_properties(2).to_string (), "24/0"); CHECKPOINT (); - _this->compare_layouts (layout, ut::testsrc () + "/testdata/gds/pcell_test.gds", ut::NoNormalization); + db::compare_layouts (_this, layout, tl::testsrc () + "/testdata/gds/pcell_test.gds", db::NoNormalization); // if not in editable mode, we could have lost the reference to the second instance if (db::default_editable_mode ()) { @@ -186,7 +187,7 @@ TEST(1) EXPECT_NE (i2.cell_index (), pd1); CHECKPOINT (); - _this->compare_layouts (layout, ut::testsrc () + "/testdata/gds/pcell_test2.gds", ut::NoNormalization); + db::compare_layouts (_this, layout, tl::testsrc () + "/testdata/gds/pcell_test2.gds", db::NoNormalization); width = 1.0; i1 = top.change_pcell_parameters (i1, parameters); @@ -194,34 +195,34 @@ TEST(1) EXPECT_NE (i1.cell_index (), pd1); CHECKPOINT (); - _this->compare_layouts (layout, ut::testsrc () + "/testdata/gds/pcell_test3.gds", ut::WriteGDS2); + db::compare_layouts (_this, layout, tl::testsrc () + "/testdata/gds/pcell_test3.gds", db::WriteGDS2); CHECKPOINT (); - _this->compare_layouts (layout, ut::testsrc () + "/testdata/gds/pcell_test3.gds", ut::WriteOAS); + db::compare_layouts (_this, layout, tl::testsrc () + "/testdata/gds/pcell_test3.gds", db::WriteOAS); m.commit (); m.undo (); CHECKPOINT (); - _this->compare_layouts (layout, ut::testsrc () + "/testdata/gds/pcell_test.gds", ut::NoNormalization); + db::compare_layouts (_this, layout, tl::testsrc () + "/testdata/gds/pcell_test.gds", db::NoNormalization); m.redo (); CHECKPOINT (); - _this->compare_layouts (layout, ut::testsrc () + "/testdata/gds/pcell_test3.gds", ut::WriteGDS2); + db::compare_layouts (_this, layout, tl::testsrc () + "/testdata/gds/pcell_test3.gds", db::WriteGDS2); CHECKPOINT (); - _this->compare_layouts (layout, ut::testsrc () + "/testdata/gds/pcell_test3.gds", ut::WriteOAS); + db::compare_layouts (_this, layout, tl::testsrc () + "/testdata/gds/pcell_test3.gds", db::WriteOAS); m.undo (); // test the ability to destroy things stored in the transaction CHECKPOINT (); - _this->compare_layouts (layout, ut::testsrc () + "/testdata/gds/pcell_test.gds", ut::NoNormalization); + db::compare_layouts (_this, layout, tl::testsrc () + "/testdata/gds/pcell_test.gds", db::NoNormalization); // Test the ability to copy things and change PCell parameters then db::Layout copy (layout); CHECKPOINT (); - _this->compare_layouts (copy, ut::testsrc () + "/testdata/gds/pcell_test.gds", ut::NoNormalization); + db::compare_layouts (_this, copy, tl::testsrc () + "/testdata/gds/pcell_test.gds", db::NoNormalization); db::Cell ©_top = copy.cell (top.cell_index ()); @@ -246,9 +247,9 @@ TEST(1) i1_copy = copy_top.change_pcell_parameters (i1_copy, parameters); CHECKPOINT (); - _this->compare_layouts (copy, ut::testsrc () + "/testdata/gds/pcell_test4.gds", ut::WriteGDS2); + db::compare_layouts (_this, copy, tl::testsrc () + "/testdata/gds/pcell_test4.gds", db::WriteGDS2); CHECKPOINT (); - _this->compare_layouts (copy, ut::testsrc () + "/testdata/gds/pcell_test4.gds", ut::WriteOAS); + db::compare_layouts (_this, copy, tl::testsrc () + "/testdata/gds/pcell_test4.gds", db::WriteOAS); } } diff --git a/src/db/unit_tests/dbPath.cc b/src/db/unit_tests/dbPath.cc index 5c7751a42..d6b5fc243 100644 --- a/src/db/unit_tests/dbPath.cc +++ b/src/db/unit_tests/dbPath.cc @@ -24,7 +24,7 @@ #include "dbPath.h" #include "tlVector.h" #include "tlReuseVector.h" -#include "utHead.h" +#include "tlUnitTest.h" #include diff --git a/src/db/unit_tests/dbPoint.cc b/src/db/unit_tests/dbPoint.cc index b9a09f563..6376964b4 100644 --- a/src/db/unit_tests/dbPoint.cc +++ b/src/db/unit_tests/dbPoint.cc @@ -24,7 +24,7 @@ #include "dbPoint.h" #include "dbVector.h" #include "tlString.h" -#include "utHead.h" +#include "tlUnitTest.h" TEST(1) { diff --git a/src/db/unit_tests/dbPolygon.cc b/src/db/unit_tests/dbPolygon.cc index 77495a6b2..8cf0908ab 100644 --- a/src/db/unit_tests/dbPolygon.cc +++ b/src/db/unit_tests/dbPolygon.cc @@ -29,7 +29,7 @@ #include "dbText.h" #include "dbShapeRepository.h" #include "tlReuseVector.h" -#include "utHead.h" +#include "tlUnitTest.h" #include diff --git a/src/db/unit_tests/dbPolygonTools.cc b/src/db/unit_tests/dbPolygonTools.cc index a8a144586..2c1ed0345 100644 --- a/src/db/unit_tests/dbPolygonTools.cc +++ b/src/db/unit_tests/dbPolygonTools.cc @@ -26,7 +26,7 @@ #include "dbPolygonTools.h" #include "dbEdgeProcessor.h" #include "dbPolygonGenerators.h" -#include "utHead.h" +#include "tlUnitTest.h" TEST(1) { diff --git a/src/db/unit_tests/dbPropertiesRepository.cc b/src/db/unit_tests/dbPropertiesRepository.cc index 23e489d2a..9adcba6c2 100644 --- a/src/db/unit_tests/dbPropertiesRepository.cc +++ b/src/db/unit_tests/dbPropertiesRepository.cc @@ -23,7 +23,7 @@ #include "dbPropertiesRepository.h" #include "tlString.h" -#include "utHead.h" +#include "tlUnitTest.h" TEST(1) diff --git a/src/db/unit_tests/dbRecursiveShapeIterator.cc b/src/db/unit_tests/dbRecursiveShapeIterator.cc index f5dd5532d..a1d162e79 100644 --- a/src/db/unit_tests/dbRecursiveShapeIterator.cc +++ b/src/db/unit_tests/dbRecursiveShapeIterator.cc @@ -25,7 +25,7 @@ #include "dbRegion.h" #include "dbLayoutDiff.h" #include "tlString.h" -#include "utHead.h" +#include "tlUnitTest.h" #include diff --git a/src/db/unit_tests/dbRegion.cc b/src/db/unit_tests/dbRegion.cc index f94829e7e..d295517ec 100644 --- a/src/db/unit_tests/dbRegion.cc +++ b/src/db/unit_tests/dbRegion.cc @@ -21,7 +21,7 @@ */ -#include "utHead.h" +#include "tlUnitTest.h" #include "dbRegion.h" #include "dbBoxScanner.h" diff --git a/src/db/unit_tests/dbShape.cc b/src/db/unit_tests/dbShape.cc index 17fde1b1a..86624f1ee 100644 --- a/src/db/unit_tests/dbShape.cc +++ b/src/db/unit_tests/dbShape.cc @@ -27,7 +27,7 @@ #include "dbObjectWithProperties.h" #include "dbPropertiesRepository.h" #include "dbLayout.h" -#include "utHead.h" +#include "tlUnitTest.h" TEST(1) diff --git a/src/db/unit_tests/dbShapeArray.cc b/src/db/unit_tests/dbShapeArray.cc index b038ee5bf..cf3a5bf1b 100644 --- a/src/db/unit_tests/dbShapeArray.cc +++ b/src/db/unit_tests/dbShapeArray.cc @@ -26,7 +26,7 @@ #include "dbObjectWithProperties.h" #include "dbPropertiesRepository.h" #include "dbLayout.h" -#include "utHead.h" +#include "tlUnitTest.h" TEST(1) { diff --git a/src/db/unit_tests/dbShapeRepository.cc b/src/db/unit_tests/dbShapeRepository.cc index 7c5f07773..483106429 100644 --- a/src/db/unit_tests/dbShapeRepository.cc +++ b/src/db/unit_tests/dbShapeRepository.cc @@ -31,7 +31,7 @@ #include "dbText.h" #include "dbEdge.h" #include "dbUserObject.h" -#include "utHead.h" +#include "tlUnitTest.h" TEST(1) diff --git a/src/db/unit_tests/dbShapes.cc b/src/db/unit_tests/dbShapes.cc index 3e206b4c8..17935c4c1 100644 --- a/src/db/unit_tests/dbShapes.cc +++ b/src/db/unit_tests/dbShapes.cc @@ -24,7 +24,7 @@ #include "dbLayout.h" #include "tlTimer.h" -#include "utHead.h" +#include "tlUnitTest.h" #include "dbOASISReader.h" #include "dbStatic.h" @@ -111,7 +111,7 @@ TEST(1b) EXPECT_EQ (s2.bbox (), db::Box (-100, -200, 1000, 1200)); } -std::string shapes_to_string_norm (ut::TestBase *_this, const db::Shapes &shapes, const db::ICplxTrans &trans) +std::string shapes_to_string_norm (tl::TestBase *_this, const db::Shapes &shapes, const db::ICplxTrans &trans) { std::vector strings; for (db::Shapes::shape_iterator shape = shapes.begin (db::Shapes::shape_iterator::All); ! shape.at_end (); ++shape) { @@ -155,7 +155,7 @@ std::string shapes_to_string_norm (ut::TestBase *_this, const db::Shapes &shapes return r; } -std::string shapes_to_string_norm (ut::TestBase *_this, const db::Shapes &shapes) +std::string shapes_to_string_norm (tl::TestBase *_this, const db::Shapes &shapes) { std::vector strings; for (db::Shapes::shape_iterator shape = shapes.begin (db::Shapes::shape_iterator::All); ! shape.at_end (); ++shape) { @@ -199,7 +199,7 @@ std::string shapes_to_string_norm (ut::TestBase *_this, const db::Shapes &shapes return r; } -std::string shapes_to_string (ut::TestBase *_this, const db::Shapes &shapes) +std::string shapes_to_string (tl::TestBase *_this, const db::Shapes &shapes) { std::string r; for (db::Shapes::shape_iterator shape = shapes.begin (db::Shapes::shape_iterator::All); ! shape.at_end (); ++shape) { diff --git a/src/db/unit_tests/dbStreamLayers.cc b/src/db/unit_tests/dbStreamLayers.cc index 284da16d0..d7c85d61f 100644 --- a/src/db/unit_tests/dbStreamLayers.cc +++ b/src/db/unit_tests/dbStreamLayers.cc @@ -23,7 +23,7 @@ #include "dbStreamLayers.h" -#include "utHead.h" +#include "tlUnitTest.h" TEST(1) { diff --git a/src/db/unit_tests/dbText.cc b/src/db/unit_tests/dbText.cc index e5bef0d0a..07166a1c1 100644 --- a/src/db/unit_tests/dbText.cc +++ b/src/db/unit_tests/dbText.cc @@ -23,7 +23,7 @@ #include "dbText.h" #include "dbLayout.h" -#include "utHead.h" +#include "tlUnitTest.h" TEST(1) { diff --git a/src/db/unit_tests/dbTilingProcessor.cc b/src/db/unit_tests/dbTilingProcessor.cc index 362905144..752703651 100644 --- a/src/db/unit_tests/dbTilingProcessor.cc +++ b/src/db/unit_tests/dbTilingProcessor.cc @@ -21,7 +21,7 @@ */ -#include "utHead.h" +#include "tlUnitTest.h" #include "dbTilingProcessor.h" #include "dbTextWriter.h" diff --git a/src/db/unit_tests/dbTrans.cc b/src/db/unit_tests/dbTrans.cc index 503d371fd..53c5f7ea8 100644 --- a/src/db/unit_tests/dbTrans.cc +++ b/src/db/unit_tests/dbTrans.cc @@ -22,7 +22,7 @@ #include "dbTrans.h" -#include "utHead.h" +#include "tlUnitTest.h" TEST(1) { diff --git a/src/db/unit_tests/dbVector.cc b/src/db/unit_tests/dbVector.cc index 0b6c0038d..5ed918d48 100644 --- a/src/db/unit_tests/dbVector.cc +++ b/src/db/unit_tests/dbVector.cc @@ -26,7 +26,7 @@ #include "dbPoint.h" #include "dbTrans.h" #include "tlString.h" -#include "utHead.h" +#include "tlUnitTest.h" TEST(1) { diff --git a/src/db/unit_tests/dbWriterTools.cc b/src/db/unit_tests/dbWriterTools.cc index 7f014b0c8..63fa10dd7 100644 --- a/src/db/unit_tests/dbWriterTools.cc +++ b/src/db/unit_tests/dbWriterTools.cc @@ -22,7 +22,7 @@ #include "dbWriterTools.h" -#include "utHead.h" +#include "tlUnitTest.h" TEST(1) { diff --git a/src/db/unit_tests/unit_tests.pro b/src/db/unit_tests/unit_tests.pro index c167b1056..2baaf0d73 100644 --- a/src/db/unit_tests/unit_tests.pro +++ b/src/db/unit_tests/unit_tests.pro @@ -58,8 +58,8 @@ SOURCES = \ dbVector.cc \ dbWriterTools.cc \ -INCLUDEPATH += $$TL_INC $$DB_INC $$GSI_INC $$UT_INC -DEPENDPATH += $$TL_INC $$DB_INC $$GSI_INC $$UT_INC +INCLUDEPATH += $$TL_INC $$DB_INC $$GSI_INC +DEPENDPATH += $$TL_INC $$DB_INC $$GSI_INC -LIBS += -L$$DESTDIR_UT -lklayout_db -lklayout_tl -lklayout_gsi -lklayout_ut +LIBS += -L$$DESTDIR_UT -lklayout_db -lklayout_tl -lklayout_gsi diff --git a/src/drc/unit_tests/drcBasicTests.cc b/src/drc/unit_tests/drcBasicTests.cc index 5ea3343e9..a89d48cdc 100644 --- a/src/drc/unit_tests/drcBasicTests.cc +++ b/src/drc/unit_tests/drcBasicTests.cc @@ -20,15 +20,16 @@ */ -#include "utHead.h" +#include "tlUnitTest.h" #include "dbReader.h" +#include "dbTestSupport.h" #include "lymMacro.h" TEST(1) { - std::string input = ut::testsrc (); + std::string input = tl::testsrc (); input += "/testdata/drc/drctest.gds"; - std::string au = ut::testsrc (); + std::string au = tl::testsrc (); au += "/testdata/drc/drcBasicTests_au.gds"; std::string output = this->tmp_file ("tmp.gds"); @@ -60,7 +61,7 @@ TEST(1) reader.read (layout); } - this->compare_layouts (layout, au, ut::NoNormalization); + db::compare_layouts (_this, layout, au, db::NoNormalization); } TEST(2) diff --git a/src/drc/unit_tests/drcSimpleTests.cc b/src/drc/unit_tests/drcSimpleTests.cc index 6beda7b00..21730d503 100644 --- a/src/drc/unit_tests/drcSimpleTests.cc +++ b/src/drc/unit_tests/drcSimpleTests.cc @@ -20,16 +20,17 @@ */ -#include "utHead.h" +#include "tlUnitTest.h" #include "dbReader.h" +#include "dbTestSupport.h" #include "lymMacro.h" TEST(1) { - std::string rs = ut::testsrc (); + std::string rs = tl::testsrc (); rs += "/testdata/drc/drcSimpleTests_1.drc"; - std::string au = ut::testsrc (); + std::string au = tl::testsrc (); au += "/testdata/drc/drcSimpleTests_au1.gds"; std::string output = this->tmp_file ("tmp.gds"); @@ -58,18 +59,18 @@ TEST(1) reader.read (layout); } - this->compare_layouts (layout, au, ut::NoNormalization); + db::compare_layouts (_this, layout, au, db::NoNormalization); } TEST(2) { - std::string rs = ut::testsrc (); + std::string rs = tl::testsrc (); rs += "/testdata/drc/drcSimpleTests_2.drc"; - std::string input = ut::testsrc (); + std::string input = tl::testsrc (); input += "/testdata/drc/drctest.gds"; - std::string au = ut::testsrc (); + std::string au = tl::testsrc (); au += "/testdata/drc/drcSimpleTests_au2.gds"; std::string output = this->tmp_file ("tmp.gds"); @@ -98,18 +99,18 @@ TEST(2) reader.read (layout); } - this->compare_layouts (layout, au, ut::NoNormalization); + db::compare_layouts (_this, layout, au, db::NoNormalization); } TEST(3) { - std::string rs = ut::testsrc (); + std::string rs = tl::testsrc (); rs += "/testdata/drc/drcSimpleTests_3.drc"; - std::string input = ut::testsrc (); + std::string input = tl::testsrc (); input += "/testdata/drc/drctest.gds"; - std::string au = ut::testsrc (); + std::string au = tl::testsrc (); au += "/testdata/drc/drcSimpleTests_au3.gds"; std::string output = this->tmp_file ("tmp.gds"); @@ -138,5 +139,5 @@ TEST(3) reader.read (layout); } - this->compare_layouts (layout, au, ut::NoNormalization); + db::compare_layouts (_this, layout, au, db::NoNormalization); } diff --git a/src/drc/unit_tests/drcSuiteTests.cc b/src/drc/unit_tests/drcSuiteTests.cc index 10c5a1ab4..74d5d47b9 100644 --- a/src/drc/unit_tests/drcSuiteTests.cc +++ b/src/drc/unit_tests/drcSuiteTests.cc @@ -20,19 +20,20 @@ */ -#include "utHead.h" +#include "tlUnitTest.h" #include "dbReader.h" +#include "dbTestSupport.h" #include "lymMacro.h" -void runtest (ut::TestBase *_this, int mode) +void runtest (tl::TestBase *_this, int mode) { - std::string rs = ut::testsrc (); + std::string rs = tl::testsrc (); rs += "/testdata/drc/drcSuiteTests.drc"; - std::string input = ut::testsrc (); + std::string input = tl::testsrc (); input += "/testdata/drc/drctest.gds"; - std::string au = ut::testsrc (); + std::string au = tl::testsrc (); au += "/testdata/drc/drcSuiteTests_au"; au += tl::to_string (mode); au += ".gds"; @@ -64,7 +65,7 @@ void runtest (ut::TestBase *_this, int mode) reader.read (layout); } - _this->compare_layouts (layout, au, ut::NoNormalization); + db::compare_layouts (_this, layout, au, db::NoNormalization); } TEST(1) diff --git a/src/drc/unit_tests/unit_tests.pro b/src/drc/unit_tests/unit_tests.pro index f491ba223..1acc6688f 100644 --- a/src/drc/unit_tests/unit_tests.pro +++ b/src/drc/unit_tests/unit_tests.pro @@ -11,7 +11,7 @@ SOURCES = \ drcSimpleTests.cc \ drcSuiteTests.cc \ -INCLUDEPATH += $$DRC_INC $$TL_INC $$RDB_INC $$DB_INC $$GSI_INC $$LYM_INC $$UT_INC -DEPENDPATH += $$DRC_INC $$TL_INC $$RDB_INC $$DB_INC $$GSI_INC $$LYM_INC $$UT_INC +INCLUDEPATH += $$DRC_INC $$TL_INC $$RDB_INC $$DB_INC $$GSI_INC $$LYM_INC +DEPENDPATH += $$DRC_INC $$TL_INC $$RDB_INC $$DB_INC $$GSI_INC $$LYM_INC -LIBS += -L$$DESTDIR_UT -lklayout_drc -lklayout_rdb -lklayout_db -lklayout_tl -lklayout_gsi -lklayout_lym -lklayout_ut +LIBS += -L$$DESTDIR_UT -lklayout_drc -lklayout_rdb -lklayout_db -lklayout_tl -lklayout_gsi -lklayout_lym diff --git a/src/edt/unit_tests/edtBasicTests.cc b/src/edt/unit_tests/edtBasicTests.cc index a0717c951..f93317f2a 100644 --- a/src/edt/unit_tests/edtBasicTests.cc +++ b/src/edt/unit_tests/edtBasicTests.cc @@ -21,7 +21,7 @@ */ -#include "utHead.h" +#include "tlUnitTest.h" TEST(1) { diff --git a/src/edt/unit_tests/unit_tests.pro b/src/edt/unit_tests/unit_tests.pro index 525df220c..630f1cd9b 100644 --- a/src/edt/unit_tests/unit_tests.pro +++ b/src/edt/unit_tests/unit_tests.pro @@ -9,8 +9,8 @@ include($$PWD/../../lib_ut.pri) SOURCES = \ edtBasicTests.cc \ -INCLUDEPATH += $$EDT_INC $$TL_INC $$LAYBASIC_INC $$DB_INC $$GSI_INC $$UT_INC -DEPENDPATH += $$EDT_INC $$TL_INC $$LAYBASIC_INC $$DB_INC $$GSI_INC $$UT_INC +INCLUDEPATH += $$EDT_INC $$TL_INC $$LAYBASIC_INC $$DB_INC $$GSI_INC +DEPENDPATH += $$EDT_INC $$TL_INC $$LAYBASIC_INC $$DB_INC $$GSI_INC -LIBS += -L$$DESTDIR_UT -lklayout_edt -lklayout_laybasic -lklayout_db -lklayout_tl -lklayout_gsi -lklayout_ut +LIBS += -L$$DESTDIR_UT -lklayout_edt -lklayout_laybasic -lklayout_db -lklayout_tl -lklayout_gsi diff --git a/src/ext/unit_tests/extGerberImport.cc b/src/ext/unit_tests/extGerberImport.cc index 267aa15b5..65a11a987 100644 --- a/src/ext/unit_tests/extGerberImport.cc +++ b/src/ext/unit_tests/extGerberImport.cc @@ -26,19 +26,20 @@ #include "dbOASISWriter.h" #include "dbLoadLayoutOptions.h" #include "dbReader.h" +#include "dbTestSupport.h" -#include +#include "tlUnitTest.h" #include -static void run_test (ut::TestBase *_this, const char *dir) +static void run_test (tl::TestBase *_this, const char *dir) { db::LoadLayoutOptions options; db::Layout layout; { - std::string fn (ut::testsrc_private ()); + std::string fn (tl::testsrc_private ()); fn += "/testdata/pcb/"; fn += dir; fn += "/import.pcb"; @@ -47,7 +48,7 @@ static void run_test (ut::TestBase *_this, const char *dir) reader.read (layout, options); } - _this->compare_layouts (layout, ut::testsrc_private () + "/testdata/pcb/" + dir + "/au.oas.gz", ut::WriteOAS, 1); + db::compare_layouts (_this, layout, tl::testsrc_private () + "/testdata/pcb/" + dir + "/au.oas.gz", db::WriteOAS, 1); } TEST(1) diff --git a/src/ext/unit_tests/extLEFDEFImport.cc b/src/ext/unit_tests/extLEFDEFImport.cc index 5796ad3b2..197eecf28 100644 --- a/src/ext/unit_tests/extLEFDEFImport.cc +++ b/src/ext/unit_tests/extLEFDEFImport.cc @@ -28,12 +28,12 @@ #include "extDEFImporter.h" #include "extLEFImporter.h" -#include "utHead.h" +#include "tlUnitTest.h" #include #include -static void run_test (ut::TestBase *_this, const char *lef_dir, const char *filename, const char *au) +static void run_test (tl::TestBase *_this, const char *lef_dir, const char *filename, const char *au) { ext::LEFDEFReaderOptions tc; tc.set_via_geometry_datatype (0); @@ -63,7 +63,7 @@ static void run_test (ut::TestBase *_this, const char *lef_dir, const char *file if (ex.test ("def:")) { - std::string fn (ut::testsrc_private ()); + std::string fn (tl::testsrc_private ()); fn += "/testdata/lefdef/"; fn += lef_dir; fn += "/"; @@ -76,7 +76,7 @@ static void run_test (ut::TestBase *_this, const char *lef_dir, const char *file } else if (ex.test ("lef:")) { - std::string fn (ut::testsrc_private ()); + std::string fn (tl::testsrc_private ()); fn += "/testdata/lefdef/"; fn += lef_dir; fn += "/"; @@ -120,7 +120,7 @@ static void run_test (ut::TestBase *_this, const char *lef_dir, const char *file if (au) { - std::string fn (ut::testsrc_private ()); + std::string fn (tl::testsrc_private ()); fn += "/testdata/lefdef/"; fn += lef_dir; fn += "/"; diff --git a/src/ext/unit_tests/extNetTracer.cc b/src/ext/unit_tests/extNetTracer.cc index 701ecbcbd..fbe69f836 100644 --- a/src/ext/unit_tests/extNetTracer.cc +++ b/src/ext/unit_tests/extNetTracer.cc @@ -21,13 +21,14 @@ */ -#include "utHead.h" +#include "tlUnitTest.h" #include "extNetTracerDialog.h" #include "extNetTracerIO.h" #include "extNetTracer.h" #include "dbRecursiveShapeIterator.h" #include "dbLayoutDiff.h" +#include "dbTestSupport.h" #include "dbWriter.h" static ext::NetTracerConnectionInfo connection (const std::string &a, const std::string &v, const std::string &b) @@ -89,13 +90,13 @@ static ext::Net trace (ext::NetTracer &tracer, const db::Layout &layout, const d return ext::Net (tracer, db::ICplxTrans (), layout, cell.cell_index (), std::string (), std::string (), tracer_data); } -void run_test (ut::TestBase *_this, const std::string &file, const ext::NetTracerTechnologyComponent &tc, const db::LayerProperties &lp_start, const db::Point &p_start, const std::string &file_au, const char *net_name = 0) +void run_test (tl::TestBase *_this, const std::string &file, const ext::NetTracerTechnologyComponent &tc, const db::LayerProperties &lp_start, const db::Point &p_start, const std::string &file_au, const char *net_name = 0) { db::Manager m; db::Layout layout_org (&m); { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/net_tracer/"; fn += file; tl::InputStream stream (fn); @@ -115,21 +116,21 @@ void run_test (ut::TestBase *_this, const std::string &file, const ext::NetTrace db::Layout layout_net; net.export_net (layout_net, layout_net.cell (layout_net.add_cell ("NET"))); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/net_tracer/"; fn += file_au; CHECKPOINT (); - _this->compare_layouts (layout_net, fn, ut::WriteOAS); + db::compare_layouts (_this, layout_net, fn, db::WriteOAS); } -void run_test2 (ut::TestBase *_this, const std::string &file, const ext::NetTracerTechnologyComponent &tc, const db::LayerProperties &lp_start, const db::Point &p_start, const db::LayerProperties &lp_stop, const db::Point &p_stop, const std::string &file_au, const char *net_name = 0) +void run_test2 (tl::TestBase *_this, const std::string &file, const ext::NetTracerTechnologyComponent &tc, const db::LayerProperties &lp_start, const db::Point &p_start, const db::LayerProperties &lp_stop, const db::Point &p_stop, const std::string &file_au, const char *net_name = 0) { db::Manager m; db::Layout layout_org (&m); { - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/net_tracer/"; fn += file; tl::InputStream stream (fn); @@ -149,12 +150,12 @@ void run_test2 (ut::TestBase *_this, const std::string &file, const ext::NetTrac db::Layout layout_net; net.export_net (layout_net, layout_net.cell (layout_net.add_cell ("NET"))); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/net_tracer/"; fn += file_au; CHECKPOINT (); - _this->compare_layouts (layout_net, fn, ut::WriteOAS); + db::compare_layouts (_this, layout_net, fn, db::WriteOAS); } TEST(1) diff --git a/src/ext/unit_tests/unit_tests.pro b/src/ext/unit_tests/unit_tests.pro index 8983972d8..3d97ace1a 100644 --- a/src/ext/unit_tests/unit_tests.pro +++ b/src/ext/unit_tests/unit_tests.pro @@ -11,15 +11,15 @@ SOURCES = \ extLEFDEFImport.cc \ extNetTracer.cc \ -INCLUDEPATH += $$EXT_INC $$TL_INC $$LAYBASIC_INC $$DB_INC $$GSI_INC $$UT_INC -DEPENDPATH += $$EXT_INC $$TL_INC $$LAYBASIC_INC $$DB_INC $$GSI_INC $$UT_INC +INCLUDEPATH += $$EXT_INC $$TL_INC $$LAYBASIC_INC $$DB_INC $$GSI_INC +DEPENDPATH += $$EXT_INC $$TL_INC $$LAYBASIC_INC $$DB_INC $$GSI_INC # Note: this accounts for UI-generated headers placed into the output folders in # shadow builds: INCLUDEPATH += $$DESTDIR_UT/ext/ext $$DESTDIR_UT/laybasic/laybasic DEPENDPATH += $$DESTDIR_UT/ext/ext $$DESTDIR_UT/laybasic/laybasic -LIBS += -L$$DESTDIR_UT -lklayout_ext -lklayout_laybasic -lklayout_db -lklayout_tl -lklayout_gsi -lklayout_ut +LIBS += -L$$DESTDIR_UT -lklayout_ext -lklayout_laybasic -lklayout_db -lklayout_tl -lklayout_gsi # TODO: ideally this should not be there: INCLUDEPATH += $$DESTDIR_UT/lay/lay diff --git a/src/gsi/unit_tests/gsiExpression.cc b/src/gsi/unit_tests/gsiExpression.cc index b9d53999b..a1a36f2fe 100644 --- a/src/gsi/unit_tests/gsiExpression.cc +++ b/src/gsi/unit_tests/gsiExpression.cc @@ -27,7 +27,7 @@ #include "dbBox.h" #include "dbEdge.h" -#include "utHead.h" +#include "tlUnitTest.h" #include #include diff --git a/src/gsi/unit_tests/unit_tests.pro b/src/gsi/unit_tests/unit_tests.pro index 1c5c51f8f..ef7b7770c 100644 --- a/src/gsi/unit_tests/unit_tests.pro +++ b/src/gsi/unit_tests/unit_tests.pro @@ -9,8 +9,8 @@ include($$PWD/../../lib_ut.pri) SOURCES = \ gsiExpression.cc \ -INCLUDEPATH += $$TL_INC $$GSI_INC $$GSI_TEST_INC $$UT_INC $$DB_INC -DEPENDPATH += $$TL_INC $$GSI_INC $$GSI_TEST_INC $$UT_INC $$DB_INC +INCLUDEPATH += $$TL_INC $$GSI_INC $$GSI_TEST_INC $$DB_INC +DEPENDPATH += $$TL_INC $$GSI_INC $$GSI_TEST_INC $$DB_INC -LIBS += -L$$DESTDIR_UT -lklayout_tl -lklayout_gsi -lgsi_test -lklayout_ut -lklayout_db +LIBS += -L$$DESTDIR_UT -lklayout_tl -lklayout_gsi -lgsi_test -lklayout_db diff --git a/src/img/unit_tests/imgObject.cc b/src/img/unit_tests/imgObject.cc index 8cb32a053..e794b770f 100644 --- a/src/img/unit_tests/imgObject.cc +++ b/src/img/unit_tests/imgObject.cc @@ -23,7 +23,7 @@ #include "imgObject.h" -#include "utHead.h" +#include "tlUnitTest.h" TEST(1) { diff --git a/src/img/unit_tests/unit_tests.pro b/src/img/unit_tests/unit_tests.pro index bbdef297c..fec02cec1 100644 --- a/src/img/unit_tests/unit_tests.pro +++ b/src/img/unit_tests/unit_tests.pro @@ -9,8 +9,8 @@ include($$PWD/../../lib_ut.pri) SOURCES = \ imgObject.cc \ -INCLUDEPATH += $$IMG_INC $$DB_INC $$TL_INC $$LAYBASIC_INC $$GSI_INC $$UT_INC -DEPENDPATH += $$IMG_INC $$DB_INC $$TL_INC $$LAYBASIC_INC $$GSI_INC $$UT_INC +INCLUDEPATH += $$IMG_INC $$DB_INC $$TL_INC $$LAYBASIC_INC $$GSI_INC +DEPENDPATH += $$IMG_INC $$DB_INC $$TL_INC $$LAYBASIC_INC $$GSI_INC -LIBS += -L$$DESTDIR_UT -lklayout_img -lklayout_laybasic -lklayout_db -lklayout_tl -lklayout_gsi -lklayout_ut +LIBS += -L$$DESTDIR_UT -lklayout_img -lklayout_laybasic -lklayout_db -lklayout_tl -lklayout_gsi diff --git a/src/klayout.pro b/src/klayout.pro index bf1012df2..9ef1f9a5d 100644 --- a/src/klayout.pro +++ b/src/klayout.pro @@ -6,13 +6,11 @@ TEMPLATE = subdirs SUBDIRS = \ klayout_main \ unit_tests \ - tl/tl \ - tl/unit_tests \ + tl \ gsi/gsi \ gsi/gsi_test \ gsi/unit_tests \ - db/db \ - db/unit_tests \ + db \ rdb \ lym \ laybasic \ @@ -22,7 +20,6 @@ SUBDIRS = \ edt \ ext \ lib \ - ut \ plugins \ buddies \ drc \ @@ -30,10 +27,9 @@ SUBDIRS = \ LANG_DEPENDS = equals(HAVE_RUBY, "1") { - SUBDIRS += rba/rba rba/unit_tests - rba-rba.depends += gsi/gsi - LANG_DEPENDS += rba/rba - rba-unit_tests.depends += ut gsi/gsi_test + SUBDIRS += rba + LANG_DEPENDS += rba + rba.depends += gsi/gsi gsi/gsi_test } else { SUBDIRS += rbastub rbastub.depends += gsi/gsi @@ -41,32 +37,30 @@ equals(HAVE_RUBY, "1") { } equals(HAVE_PYTHON, "1") { - SUBDIRS += pya/pya pya/unit_tests - pya-pya.depends += gsi/gsi - LANG_DEPENDS += pya/pya - pya-unit_tests.depends += ut gsi/gsi_test + SUBDIRS += pya + LANG_DEPENDS += pya + pya-unit_tests.depends += gsi/gsi gsi/gsi_test } else { SUBDIRS += pyastub pyastub.depends += gsi/gsi LANG_DEPENDS += pyastub } -gsi-gsi.depends += tl/tl -gsi-gsi_test.depends += tl/tl gsi/gsi -db-db.depends += gsi/gsi -rdb.depends += db/db ut +gsi-gsi.depends += tl +gsi-gsi_test.depends += tl gsi/gsi +db.depends += gsi/gsi +rdb.depends += db laybasic.depends += rdb ant.depends += laybasic img.depends += laybasic edt.depends += laybasic drc.depends += rdb lym -lym.depends += gsi/gsi ut $$LANG_DEPENDS +lym.depends += gsi/gsi $$LANG_DEPENDS lay.depends += laybasic ant img edt lym ext.depends += lay -lib.depends += db/db ut -buddies.depends += db/db ut -ut.depends += db/db $$LANG_DEPENDS +lib.depends += db +buddies.depends += db equals(HAVE_QTBINDINGS, "1") { SUBDIRS += gsiqt @@ -74,12 +68,10 @@ equals(HAVE_QTBINDINGS, "1") { laybasic.depends += gsiqt } -# YES. It's tl-unit_tests (for tl/unit_tests) -tl-unit_tests.depends += ut -gsi-unit_tests.depends += ut gsi/gsi_test -db-unit_tests.depends += ut +# YES. It's gsi-unit_tests (for gsi/unit_tests) +gsi-unit_tests.depends += gsi/gsi_test -plugins.depends += lay ext lib ut +plugins.depends += lay ext lib klayout_main.depends += plugins drc unit_tests.depends += plugins drc @@ -87,4 +79,3 @@ unit_tests.depends += plugins drc RESOURCES += \ laybasic/layResources.qrc \ ant/layResources.qrc - diff --git a/src/lay/unit_tests/laySalt.cc b/src/lay/unit_tests/laySalt.cc index 7c5e6eb81..7e91b7fd8 100644 --- a/src/lay/unit_tests/laySalt.cc +++ b/src/lay/unit_tests/laySalt.cc @@ -25,7 +25,7 @@ #include "laySaltGrains.h" #include "laySalt.h" #include "tlFileUtils.h" -#include "utHead.h" +#include "tlUnitTest.h" #include #include diff --git a/src/lay/unit_tests/unit_tests.pro b/src/lay/unit_tests/unit_tests.pro index 48f722767..3591a4a7f 100644 --- a/src/lay/unit_tests/unit_tests.pro +++ b/src/lay/unit_tests/unit_tests.pro @@ -9,8 +9,8 @@ include($$PWD/../../lib_ut.pri) SOURCES = \ laySalt.cc \ -INCLUDEPATH += $$LAY_INC $$TL_INC $$LAYBASIC_INC $$DB_INC $$GSI_INC $$UT_INC -DEPENDPATH += $$LAY_INC $$TL_INC $$LAYBASIC_INC $$DB_INC $$GSI_INC $$UT_INC +INCLUDEPATH += $$LAY_INC $$TL_INC $$LAYBASIC_INC $$DB_INC $$GSI_INC +DEPENDPATH += $$LAY_INC $$TL_INC $$LAYBASIC_INC $$DB_INC $$GSI_INC -LIBS += -L$$DESTDIR_UT -lklayout_lay -lklayout_laybasic -lklayout_db -lklayout_tl -lklayout_gsi -lklayout_ut +LIBS += -L$$DESTDIR_UT -lklayout_lay -lklayout_laybasic -lklayout_db -lklayout_tl -lklayout_gsi diff --git a/src/laybasic/unit_tests/layAnnotationShapes.cc b/src/laybasic/unit_tests/layAnnotationShapes.cc index 0c951eb41..4573da4a0 100644 --- a/src/laybasic/unit_tests/layAnnotationShapes.cc +++ b/src/laybasic/unit_tests/layAnnotationShapes.cc @@ -22,7 +22,7 @@ -#include "utHead.h" +#include "tlUnitTest.h" #include "layAnnotationShapes.h" #include "dbBox.h" #include "dbEdge.h" diff --git a/src/laybasic/unit_tests/layBitmap.cc b/src/laybasic/unit_tests/layBitmap.cc index 9ad89b758..bc52f6a65 100644 --- a/src/laybasic/unit_tests/layBitmap.cc +++ b/src/laybasic/unit_tests/layBitmap.cc @@ -24,7 +24,7 @@ #include "layBitmap.h" -#include "utHead.h" +#include "tlUnitTest.h" static std::string to_string (const lay::Bitmap &bm) diff --git a/src/laybasic/unit_tests/layBitmapsToImage.cc b/src/laybasic/unit_tests/layBitmapsToImage.cc index 70f3aa4ff..5fb93b61c 100644 --- a/src/laybasic/unit_tests/layBitmapsToImage.cc +++ b/src/laybasic/unit_tests/layBitmapsToImage.cc @@ -25,13 +25,12 @@ #include "layBitmap.h" #include "layDitherPattern.h" #include "layLineStyles.h" +#include "tlUnitTest.h" #include #include #include -#include - std::string to_string (const QImage &img, unsigned int mask) { diff --git a/src/laybasic/unit_tests/layLayerProperties.cc b/src/laybasic/unit_tests/layLayerProperties.cc index 8a5e3f12f..bd2570100 100644 --- a/src/laybasic/unit_tests/layLayerProperties.cc +++ b/src/laybasic/unit_tests/layLayerProperties.cc @@ -25,10 +25,9 @@ #include "layLayerProperties.h" #include "layLayoutView.h" #include "tlXMLParser.h" +#include "tlUnitTest.h" #include "dbLayout.h" -#include - #include #include @@ -1070,7 +1069,7 @@ TEST (11) } void -test_list (ut::TestBase *_this, lay::LayerPropertiesConstIterator &iter) +test_list (tl::TestBase *_this, lay::LayerPropertiesConstIterator &iter) { lay::LayerPropertiesConstIterator i0 (iter); size_t nc = 0; diff --git a/src/laybasic/unit_tests/layParsedLayerSource.cc b/src/laybasic/unit_tests/layParsedLayerSource.cc index 372ab37b0..78d617a70 100644 --- a/src/laybasic/unit_tests/layParsedLayerSource.cc +++ b/src/laybasic/unit_tests/layParsedLayerSource.cc @@ -24,7 +24,7 @@ #include "layParsedLayerSource.h" #include "dbLayout.h" #include "dbCell.h" -#include "utHead.h" +#include "tlUnitTest.h" TEST (1) { diff --git a/src/laybasic/unit_tests/layRenderer.cc b/src/laybasic/unit_tests/layRenderer.cc index 5aa45762b..f20e0519a 100644 --- a/src/laybasic/unit_tests/layRenderer.cc +++ b/src/laybasic/unit_tests/layRenderer.cc @@ -25,7 +25,7 @@ #include "layRenderer.h" #include "layBitmapRenderer.h" #include "layBitmap.h" -#include "utHead.h" +#include "tlUnitTest.h" static std::string to_string (const lay::Bitmap &bm) diff --git a/src/laybasic/unit_tests/laySnap.cc b/src/laybasic/unit_tests/laySnap.cc index 757eb5287..996e1673a 100644 --- a/src/laybasic/unit_tests/laySnap.cc +++ b/src/laybasic/unit_tests/laySnap.cc @@ -23,7 +23,7 @@ #include "laySnap.h" #include "layLayoutView.h" -#include "utHead.h" +#include "tlUnitTest.h" TEST(1) { diff --git a/src/laybasic/unit_tests/unit_tests.pro b/src/laybasic/unit_tests/unit_tests.pro index f7b7cc8b4..ae6a63189 100644 --- a/src/laybasic/unit_tests/unit_tests.pro +++ b/src/laybasic/unit_tests/unit_tests.pro @@ -15,8 +15,8 @@ SOURCES = \ layRenderer.cc \ laySnap.cc \ -INCLUDEPATH += $$TL_INC $$LAYBASIC_INC $$DB_INC $$GSI_INC $$UT_INC -DEPENDPATH += $$TL_INC $$LAYBASIC_INC $$DB_INC $$GSI_INC $$UT_INC +INCLUDEPATH += $$TL_INC $$LAYBASIC_INC $$DB_INC $$GSI_INC +DEPENDPATH += $$TL_INC $$LAYBASIC_INC $$DB_INC $$GSI_INC -LIBS += -L$$DESTDIR_UT -lklayout_laybasic -lklayout_db -lklayout_tl -lklayout_gsi -lklayout_ut +LIBS += -L$$DESTDIR_UT -lklayout_laybasic -lklayout_db -lklayout_tl -lklayout_gsi diff --git a/src/lib/unit_tests/libBasicTests.cc b/src/lib/unit_tests/libBasicTests.cc index b83cb3e62..786257b61 100644 --- a/src/lib/unit_tests/libBasicTests.cc +++ b/src/lib/unit_tests/libBasicTests.cc @@ -21,7 +21,7 @@ */ -#include "utHead.h" +#include "tlUnitTest.h" TEST(1) { diff --git a/src/lib/unit_tests/unit_tests.pro b/src/lib/unit_tests/unit_tests.pro index 58f765bca..973f66fbd 100644 --- a/src/lib/unit_tests/unit_tests.pro +++ b/src/lib/unit_tests/unit_tests.pro @@ -9,8 +9,8 @@ include($$PWD/../../lib_ut.pri) SOURCES = \ libBasicTests.cc \ -INCLUDEPATH += $$LIB_INC $$TL_INC $$DB_INC $$GSI_INC $$UT_INC -DEPENDPATH += $$LIB_INC $$TL_INC $$DB_INC $$GSI_INC $$UT_INC +INCLUDEPATH += $$LIB_INC $$TL_INC $$DB_INC $$GSI_INC +DEPENDPATH += $$LIB_INC $$TL_INC $$DB_INC $$GSI_INC -LIBS += -L$$DESTDIR_UT -lklayout_lib -lklayout_db -lklayout_tl -lklayout_gsi -lklayout_ut +LIBS += -L$$DESTDIR_UT -lklayout_lib -lklayout_db -lklayout_tl -lklayout_gsi diff --git a/src/lym/unit_tests/lymBasicTests.cc b/src/lym/unit_tests/lymBasicTests.cc index 23215669a..7c8e36dbb 100644 --- a/src/lym/unit_tests/lymBasicTests.cc +++ b/src/lym/unit_tests/lymBasicTests.cc @@ -21,7 +21,7 @@ */ -#include "utHead.h" +#include "tlUnitTest.h" TEST(1) { diff --git a/src/lym/unit_tests/unit_tests.pro b/src/lym/unit_tests/unit_tests.pro index 293675fc6..01415fef6 100644 --- a/src/lym/unit_tests/unit_tests.pro +++ b/src/lym/unit_tests/unit_tests.pro @@ -9,8 +9,8 @@ include($$PWD/../../lib_ut.pri) SOURCES = \ lymBasicTests.cc \ -INCLUDEPATH += $$LYM_INC $$TL_INC $$DB_INC $$GSI_INC $$UT_INC -DEPENDPATH += $$LYM_INC $$TL_INC $$DB_INC $$GSI_INC $$UT_INC +INCLUDEPATH += $$LYM_INC $$TL_INC $$DB_INC $$GSI_INC +DEPENDPATH += $$LYM_INC $$TL_INC $$DB_INC $$GSI_INC -LIBS += -L$$DESTDIR_UT -lklayout_lym -lklayout_tl -lklayout_db -lklayout_gsi -lklayout_ut +LIBS += -L$$DESTDIR_UT -lklayout_lym -lklayout_tl -lklayout_db -lklayout_gsi diff --git a/src/pya/unit_tests/pya.cc b/src/pya/unit_tests/pya.cc index ed975d137..577d3546b 100644 --- a/src/pya/unit_tests/pya.cc +++ b/src/pya/unit_tests/pya.cc @@ -26,9 +26,9 @@ #include "pya.h" #include "gsiTest.h" -#include "utHead.h" +#include "tlUnitTest.h" -static void run_pythontest (ut::TestBase *_this, const std::string &fn); +static void run_pythontest (tl::TestBase *_this, const std::string &fn); TEST (1) { @@ -39,9 +39,11 @@ TEST (1) EXPECT_EQ (gsi::has_class ("QApplication"), true); #endif + tl_assert (pya::PythonInterpreter::instance ()); + bool err = false; try { - ut::python_interpreter ()->eval_string ("raise Exception(\"an error\")"); + pya::PythonInterpreter::instance ()->eval_string ("raise Exception(\"an error\")"); } catch (tl::ScriptError &ex) { EXPECT_EQ (ex.basic_msg (), std::string ("an error")); EXPECT_EQ (ex.cls () == std::string ("exceptions.Exception") || ex.cls () == std::string ("Exception"), true); @@ -52,7 +54,7 @@ TEST (1) err = false; try { - ut::python_interpreter ()->eval_string ("Quatsch"); + pya::PythonInterpreter::instance ()->eval_string ("Quatsch"); } catch (tl::ScriptError &ex) { EXPECT_EQ (ex.basic_msg (), std::string ("name 'Quatsch' is not defined")); EXPECT_EQ (ex.cls () == std::string ("exceptions.NameError") || ex.cls () == std::string ("NameError"), true); @@ -61,10 +63,10 @@ TEST (1) EXPECT_EQ (err, true); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/python/basic.py"; try { - ut::python_interpreter ()->load_file (fn.c_str ()); + pya::PythonInterpreter::instance ()->load_file (fn.c_str ()); gsi_test::E::reset_inst (); } catch (tl::ExitException &ex) { gsi_test::E::reset_inst (); @@ -75,13 +77,15 @@ TEST (1) } } -void run_pythontest (ut::TestBase *_this, const std::string &fn) +void run_pythontest (tl::TestBase *_this, const std::string &fn) { - std::string fp (ut::testsrc ()); + tl_assert (pya::PythonInterpreter::instance ()); + + std::string fp (tl::testsrc ()); fp += "/testdata/python/"; fp += fn; try { - ut::python_interpreter ()->load_file (fp.c_str ()); + pya::PythonInterpreter::instance ()->load_file (fp.c_str ()); } catch (tl::ExitException &ex) { EXPECT_EQ (ex.status (), 0); } catch (...) { diff --git a/src/pya/unit_tests/unit_tests.pro b/src/pya/unit_tests/unit_tests.pro index 2343cd481..cadfe9a40 100644 --- a/src/pya/unit_tests/unit_tests.pro +++ b/src/pya/unit_tests/unit_tests.pro @@ -9,8 +9,8 @@ include($$PWD/../../lib_ut.pri) SOURCES = \ pya.cc -INCLUDEPATH += $$GSI_TEST_INC $$PYA_INC $$DB_INC $$TL_INC $$GSI_INC $$UT_INC -DEPENDPATH += $$GSI_TEST_INC $$PYA_INC $$DB_INC $$TL_INC $$GSI_INC $$UT_INC +INCLUDEPATH += $$GSI_TEST_INC $$PYA_INC $$DB_INC $$TL_INC $$GSI_INC +DEPENDPATH += $$GSI_TEST_INC $$PYA_INC $$DB_INC $$TL_INC $$GSI_INC -LIBS += -L$$DESTDIR_UT -lgsi_test -lklayout_db -lklayout_tl -lklayout_gsi -lklayout_ut +LIBS += -L$$DESTDIR_UT -lgsi_test -lklayout_db -lklayout_tl -lklayout_gsi diff --git a/src/rba/unit_tests/rba.cc b/src/rba/unit_tests/rba.cc index 9aa35b4da..fe7bf698c 100644 --- a/src/rba/unit_tests/rba.cc +++ b/src/rba/unit_tests/rba.cc @@ -28,7 +28,7 @@ // On Windows, ruby.h is not compatible with windows.h which is included by utHead - at least not if // windows.h is included before ruby.h ... -#include "utHead.h" +#include "tlUnitTest.h" TEST (1) { @@ -39,9 +39,11 @@ TEST (1) EXPECT_EQ (gsi::has_class ("QApplication"), true); #endif + tl_assert (rba::RubyInterpreter::instance ()); + bool err = false; try { - ut::ruby_interpreter ()->eval_string ("raise \"an error\""); + rba::RubyInterpreter::instance ()->eval_string ("raise \"an error\""); } catch (tl::Exception &ex) { EXPECT_EQ (std::string (ex.msg (), 0, 8), std::string ("an error")); err = true; @@ -49,10 +51,10 @@ TEST (1) EXPECT_EQ (err, true); - ut::ruby_interpreter ()->eval_string ("puts 'Special chars: <&>'"); + rba::RubyInterpreter::instance ()->eval_string ("puts 'Special chars: <&>'"); err = false; try { - ut::ruby_interpreter ()->eval_string ("Quatsch"); + rba::RubyInterpreter::instance ()->eval_string ("Quatsch"); } catch (tl::Exception &ex) { EXPECT_EQ (std::string (ex.msg (), 0, 30) == std::string ("uninitialized constant Quatsch") || std::string (ex.msg (), 0, 38) == std::string ("uninitialized constant Object::Quatsch"), @@ -62,10 +64,10 @@ TEST (1) EXPECT_EQ (err, true); - std::string fn (ut::testsrc ()); + std::string fn (tl::testsrc ()); fn += "/testdata/ruby/basic.rb"; try { - ut::ruby_interpreter ()->load_file (fn.c_str ()); + rba::RubyInterpreter::instance ()->load_file (fn.c_str ()); gsi_test::E::reset_inst (); } catch (tl::ExitException &ex) { gsi_test::E::reset_inst (); @@ -76,12 +78,14 @@ TEST (1) } } -void run_rubytest (ut::TestBase * /*_this*/, const std::string &fn) +void run_rubytest (tl::TestBase * /*_this*/, const std::string &fn) { - std::string fp (ut::testsrc ()); + tl_assert (rba::RubyInterpreter::instance ()); + + std::string fp (tl::testsrc ()); fp += "/testdata/ruby/"; fp += fn; - ut::ruby_interpreter ()->load_file (fp.c_str ()); + rba::RubyInterpreter::instance ()->load_file (fp.c_str ()); } #define RUBYTEST(n, file) \ diff --git a/src/rba/unit_tests/unit_tests.pro b/src/rba/unit_tests/unit_tests.pro index d8e7ec233..c17b48e53 100644 --- a/src/rba/unit_tests/unit_tests.pro +++ b/src/rba/unit_tests/unit_tests.pro @@ -9,8 +9,8 @@ include($$PWD/../../lib_ut.pri) SOURCES = \ rba.cc -INCLUDEPATH += $$GSI_TEST_INC $$RBA_INC $$TL_INC $$DB_INC $$GSI_INC $$UT_INC -DEPENDPATH += $$GSI_TEST_INC $$RBA_INC $$TL_INC $$DB_INC $$GSI_INC $$UT_INC +INCLUDEPATH += $$GSI_TEST_INC $$RBA_INC $$TL_INC $$DB_INC $$GSI_INC +DEPENDPATH += $$GSI_TEST_INC $$RBA_INC $$TL_INC $$DB_INC $$GSI_INC -LIBS += -L$$DESTDIR_UT -lgsi_test -lklayout_tl -lklayout_db -lklayout_gsi -lklayout_ut +LIBS += -L$$DESTDIR_UT -lgsi_test -lklayout_tl -lklayout_db -lklayout_gsi diff --git a/src/rdb/unit_tests/rdb.cc b/src/rdb/unit_tests/rdb.cc index 4b16909a1..71171d6c1 100644 --- a/src/rdb/unit_tests/rdb.cc +++ b/src/rdb/unit_tests/rdb.cc @@ -23,7 +23,7 @@ #include "rdb.h" -#include "utHead.h" +#include "tlUnitTest.h" #include "dbBox.h" #include "dbEdge.h" @@ -217,7 +217,7 @@ TEST(4) TEST(5) { - std::string tmp_file = ut::TestBase::tmp_file ("tmp_5.lyrdb"); + std::string tmp_file = tl::TestBase::tmp_file ("tmp_5.lyrdb"); { rdb::Database db; @@ -360,7 +360,7 @@ TEST(5) TEST(5a) { - std::string tmp_file = ut::TestBase::tmp_file ("tmp_5a.lyrdb"); + std::string tmp_file = tl::TestBase::tmp_file ("tmp_5a.lyrdb"); { rdb::Database db; diff --git a/src/rdb/unit_tests/unit_tests.pro b/src/rdb/unit_tests/unit_tests.pro index 13b3afdb5..2453bc017 100644 --- a/src/rdb/unit_tests/unit_tests.pro +++ b/src/rdb/unit_tests/unit_tests.pro @@ -9,8 +9,8 @@ include($$PWD/../../lib_ut.pri) SOURCES = \ rdb.cc \ -INCLUDEPATH += $$RDB_INC $$TL_INC $$DB_INC $$GSI_INC $$UT_INC -DEPENDPATH += $$RDB_INC $$TL_INC $$DB_INC $$GSI_INC $$UT_INC +INCLUDEPATH += $$RDB_INC $$TL_INC $$DB_INC $$GSI_INC +DEPENDPATH += $$RDB_INC $$TL_INC $$DB_INC $$GSI_INC -LIBS += -L$$DESTDIR_UT -lklayout_rdb -lklayout_db -lklayout_tl -lklayout_gsi -lklayout_ut +LIBS += -L$$DESTDIR_UT -lklayout_rdb -lklayout_db -lklayout_tl -lklayout_gsi diff --git a/src/tl/tl/tl.pro b/src/tl/tl/tl.pro index 5e3cb0e0b..adbcf6f28 100644 --- a/src/tl/tl/tl.pro +++ b/src/tl/tl/tl.pro @@ -42,7 +42,8 @@ SOURCES = \ tlFileUtils.cc \ tlWebDAV.cc \ tlArch.cc \ - tlCommandLineParser.cc + tlCommandLineParser.cc \ + tlUnitTest.cc HEADERS = \ tlAlgorithm.h \ @@ -90,7 +91,8 @@ HEADERS = \ tlFileUtils.h \ tlWebDAV.h \ tlArch.h \ - tlCommandLineParser.h + tlCommandLineParser.h \ + tlUnitTest.h INCLUDEPATH = DEPENDPATH = diff --git a/src/tl/tl/tlUnitTest.cc b/src/tl/tl/tlUnitTest.cc new file mode 100644 index 000000000..bec165c06 --- /dev/null +++ b/src/tl/tl/tlUnitTest.cc @@ -0,0 +1,383 @@ + +/* + + KLayout Layout Viewer + Copyright (C) 2006-2017 Matthias Koefferlein + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include "tlUnitTest.h" +#include "tlFileUtils.h" +#include "tlTimer.h" +#include "tlStream.h" + +#include +#include + +namespace tl +{ + +// -------------------------------------------------------------------------------------- + +static bool s_verbose_flag = false; +static bool s_xml_format = false; +static bool s_debug_mode = false; +static bool s_continue_flag = false; +static int s_indent = 4; + +bool verbose () +{ + return s_verbose_flag; +} + +void set_verbose (bool f) +{ + s_verbose_flag = f; +} + +void set_indent (int i) +{ + s_indent = i; +} + +int indent () +{ + return s_indent; +} + +bool xml_format () +{ + return s_xml_format; +} + +void set_xml_format (bool f) +{ + s_xml_format = f; +} + +void set_continue_flag (bool f) +{ + s_continue_flag = f; +} + +bool is_debug_mode () +{ + return s_debug_mode; +} + +void set_debug_mode (bool f) +{ + s_debug_mode = f; +} + +std::string testsrc () +{ + const char *ts = getenv ("TESTSRC"); + if (! ts) { + throw tl::Exception ("TESTSRC undefined"); + } + return ts; +} + +std::string testsrc_private () +{ + QDir d (QDir (tl::to_qstring (tl::testsrc ())).filePath (QString::fromUtf8 ("private"))); + if (! d.exists ()) { + throw tl::CancelException (); + } + return tl::to_string (d.path ()); +} + +std::string testtmp () +{ + // Ensures the test temp directory is present + const char *tt = getenv ("TESTTMP"); + if (! tt) { + throw tl::Exception ("TESTTMP undefined"); + } + return tt; +} + +bool equals (double a, double b) +{ + double m = fabs (0.5 * (a + b)); + if (m < 1e-30) { + // resolution limit is 1e-30 + return true; + } else { + double d = fabs (a - b); + // we consider two values equal for the purpose of unit tests if they have the + // same value within 1e-10 (0.00000001%). + return d < 1e-10 * m; + } +} + +// TODO: move this to tlString.h +static std::string replicate (const char *s, size_t n) +{ + std::string res; + res.reserve (strlen (s) * n); + while (n > 0) { + res += s; + --n; + } + return res; +} + +// -------------------------------------------------------------------------------------- +// CaptureChannel implementation + +CaptureChannel::CaptureChannel () +{ + tl::info.add (this, false); + tl::error.add (this, false); + tl::warn.add (this, false); +} + +void CaptureChannel::puts (const char *s) +{ + m_text << s; +} + +void CaptureChannel::endl () +{ + m_text << "\n"; +} + +void CaptureChannel::end () +{ + // .. nothing yet .. +} + +void CaptureChannel::begin () +{ + // .. nothing yet .. +} + +// -------------------------------------------------------------------------------------- +// TestRegistrar implementation + +tl::TestRegistrar *tl::TestRegistrar::ms_instance = 0; + +TestRegistrar::TestRegistrar () + : m_tests () +{ + // .. nothing yet .. +} + +void +TestRegistrar::reg (tl::TestBase *t) +{ + if (! ms_instance) { + ms_instance = new TestRegistrar (); + } + ms_instance->m_tests.push_back (t); +} + +TestRegistrar * +TestRegistrar::instance () +{ + return ms_instance; +} + +const std::vector & +TestRegistrar::tests () const +{ + return m_tests; +} + +// -------------------------------------------------------------------------------------- +// TestBase implementation + +TestBase::TestBase (const std::string &file, const std::string &name) + : m_editable (false), m_slow (false), m_cp_line (0), m_any_failed (false) +{ + QFileInfo f (tl::to_qstring (file)); + m_test = tl::to_string (f.baseName ()) + ":" + name; + m_testdir = tl::to_string (f.baseName ()) + "_" + name; + tl::TestRegistrar::reg (this); +} + +bool TestBase::do_test (bool editable, bool slow) +{ + m_editable = editable; + m_slow = slow; + + // Ensures the test temp directory is present + QDir dir (tl::to_qstring (testtmp ())); + QDir tmpdir (dir.absoluteFilePath (tl::to_qstring (m_testdir))); + if (tmpdir.exists () && ! tl::rm_dir_recursive (tmpdir.absolutePath ())) { + throw tl::Exception ("Unable to clean temporary dir: " + tl::to_string (tmpdir.absolutePath ())); + } + if (! dir.mkpath (tl::to_qstring (m_testdir))) { + throw tl::Exception ("Unable to create path for temporary files: " + tl::to_string (tmpdir.absolutePath ())); + } + dir.cd (tl::to_qstring (m_testdir)); + + m_testtmp = dir.absolutePath (); + + static std::string testname_value; + static std::string testtmp_value; + + putenv (const_cast ("TESTNAME=")); + testname_value = std::string ("TESTNAME=") + m_test; + putenv (const_cast (testname_value.c_str ())); + + putenv (const_cast ("TESTTMP_WITH_NAME=")); + testtmp_value = std::string ("TESTTMP_WITH_NAME=") + m_testtmp.toUtf8().constData(); + putenv (const_cast (testtmp_value.c_str ())); + + reset_checkpoint (); + + execute (this); + + m_testtmp.clear (); + + return (!m_any_failed); +} + +std::string TestBase::tmp_file (const std::string &fn) const +{ + tl_assert (! m_testtmp.isEmpty ()); + QDir dir (m_testtmp); + return tl::to_string (dir.absoluteFilePath (tl::to_qstring (fn))); +} + +/** + * @brief Recursively empties a directory + */ +static void empty_dir (QDir dir) +{ + QStringList entries = dir.entryList (QDir::AllEntries | QDir::NoDotAndDotDot); + for (QStringList::const_iterator e = entries.begin (); e != entries.end (); ++e) { + QString epath = dir.absoluteFilePath (*e); + if (QFileInfo (epath).isDir ()) { + empty_dir (QDir (epath)); + dir.rmdir (*e); + } else if (! dir.remove (*e)) { + throw tl::Exception ("Unable to remove file or directory: " + tl::to_string (dir.filePath (*e))); + } + } +} + +void TestBase::remove_tmp_folder () +{ + // Ensures the test temp directory is present + QDir dir (tl::to_qstring (testtmp ())); + if (dir.cd (tl::to_qstring (m_test))) { + + empty_dir (dir); + + dir.cdUp (); + if (! dir.rmdir (tl::to_qstring (m_test))) { + throw tl::Exception ("Unable to remove directory: " + tl::to_string (dir.filePath (tl::to_qstring (m_test)))); + } + + } +} + +void TestBase::checkpoint (const std::string &file, int line) +{ + m_cp_file = file; + m_cp_line = line; +} + +void TestBase::reset_checkpoint () +{ + m_cp_file = std::string (); + m_cp_line = 0; +} + +void TestBase::raise (const std::string &file, int line, const std::string &msg) +{ + std::ostringstream sstr; + sstr << file << ", line " << line << ": " << msg; + if (s_continue_flag) { + tl::error << sstr.str (); + m_any_failed = true; + } else { + throw tl::TestException (sstr.str ()); + } +} + +void TestBase::raise (const std::string &msg) +{ + std::ostringstream sstr; + if (m_cp_line > 0) { + sstr << "(last checkpoint: " << m_cp_file << ", line " << m_cp_line << "): "; + } + sstr << msg; + if (s_continue_flag) { + tl::error << sstr.str (); + m_any_failed = true; + } else { + throw tl::TestException (sstr.str ()); + } +} + +void TestBase::test_is_editable_only () +{ + if (!m_editable) { + throw tl::CancelException (); + } +} + +void TestBase::test_is_non_editable_only () +{ + if (m_editable) { + throw tl::CancelException (); + } +} + +void TestBase::test_is_long_runner () +{ + if (!m_slow) { + throw tl::CancelException (); + } +} + +void TestBase::write_detailed_diff (std::ostream &os, const std::string &subject, const std::string &ref) +{ + os << replicate (" ", tl::indent ()) << "Actual value is: " << tl::to_string (subject) << std::endl + << replicate (" ", tl::indent ()) << "Reference value is: " << tl::to_string (ref) << std::endl + ; +} + +static std::string read_file (const std::string &path) +{ + QFile file (tl::to_qstring (path)); + if (! file.open (QIODevice::ReadOnly | QIODevice::Text)) { + tl::warn << tl::sprintf ("Unable to open file %s", path); + } + + QByteArray ba = file.readAll (); + return std::string (ba.constData (), 0, ba.size ()); +} + +void TestBase::compare_text_files (const std::string &path_a, const std::string &path_b) +{ + std::string text_a = read_file (path_a); + std::string text_b = read_file (path_b); + + if (text_a != text_b) { + raise (tl::sprintf ("Compare failed - see:\n file 1: %s\n file 2: %s", + tl::to_string (QFileInfo (tl::to_qstring (path_a)).absoluteFilePath ()), + tl::to_string (QFileInfo (tl::to_qstring (path_b)).absoluteFilePath ()))); + } +} + +} diff --git a/src/ut/utTestBase.h b/src/tl/tl/tlUnitTest.h similarity index 77% rename from src/ut/utTestBase.h rename to src/tl/tl/tlUnitTest.h index be38709d8..20f956407 100644 --- a/src/ut/utTestBase.h +++ b/src/tl/tl/tlUnitTest.h @@ -20,12 +20,11 @@ */ +#ifndef HDR_tlUnitTest +#define HDR_tlUnitTest -#ifndef HDR_utTestBase -#define HDR_utTestBase - -#include "utCommon.h" -#include "dbTypes.h" +#include "tlCommon.h" +#include "tlLog.h" #include "tlException.h" #include "tlString.h" @@ -34,61 +33,44 @@ #include #include -namespace db -{ - class Layout; - class LayerMap; -} - -namespace rba -{ - class RubyInterpreter; -} - -namespace pya -{ - class PythonInterpreter; -} - -namespace ut -{ +namespace tl { /** * @brief Returns true, if the test is run in verbose mode * Verbose mode is enabled through the "-v" option */ -UT_PUBLIC bool verbose (); +TL_PUBLIC bool verbose (); /** * @brief Sets verbose mode */ -UT_PUBLIC void set_verbose (bool v); +TL_PUBLIC void set_verbose (bool v); + +/** + * @brief Gets the indent for the test output + */ +TL_PUBLIC int indent (); + +/** + * @brief Sets the indent for the test output + */ +TL_PUBLIC void set_indent (int i); /** * @brief Returns true if XML output is enabled (JUnit format) */ -UT_PUBLIC bool xml_format (); +TL_PUBLIC bool xml_format (); /** * @brief Sets XML format */ -UT_PUBLIC void set_xml_format (bool x); +TL_PUBLIC void set_xml_format (bool x); /** * @brief Enables or disables "continue" mode * In continue mode, the execution will proceed even in case of an error. */ -UT_PUBLIC void set_continue_flag (bool f); - -/** - * @brief Returns the Ruby interpreter - */ -UT_PUBLIC rba::RubyInterpreter *ruby_interpreter (); - -/** - * @brief Returns the Python interpreter - */ -UT_PUBLIC pya::PythonInterpreter *python_interpreter (); +TL_PUBLIC void set_continue_flag (bool f); /** * @brief Returns true, if the unit test is run in debug mode @@ -96,18 +78,18 @@ UT_PUBLIC pya::PythonInterpreter *python_interpreter (); * test. Specifically if layout compare is involved, it shall display the golden * file name and the actual one and terminate to allow updating the files. */ -UT_PUBLIC bool is_debug_mode (); +TL_PUBLIC bool is_debug_mode (); /** * @brief Enables or disables debug mode */ -UT_PUBLIC void set_debug_mode (bool f); +TL_PUBLIC void set_debug_mode (bool f); /** * @brief Gets the path of the test data * This path is specified through the environment variable $TESTSRC */ -UT_PUBLIC std::string testsrc (); +TL_PUBLIC std::string testsrc (); /** * @brief Gets the path of the private test data @@ -115,35 +97,25 @@ UT_PUBLIC std::string testsrc (); * private testdata directory. If no private test data is available, this * method will throw a CancelException which makes the test skipped. */ -UT_PUBLIC std::string testsrc_private (); +TL_PUBLIC std::string testsrc_private (); /** * @brief Gets the path to the temporary data * This path is specified through the environment variable $TESTTMP */ -UT_PUBLIC std::string testtmp (); +TL_PUBLIC std::string testtmp (); /** * @brief A basic exception for the unit test framework */ -struct Exception +struct TestException : public tl::Exception { - Exception (const std::string &msg) + TestException (const std::string &msg) : tl::Exception (msg) { } }; -/** - * @brief Specifies the normalization mode for compare_layouts - */ -enum NormalizationMode -{ - NoNormalization, // no normalization - take the test subject as it is - WriteGDS2, // normalize subject by writing to GDS2 and reading back - WriteOAS // normalize subject by writing to OASIS and reading back -}; - /** * @brief A generic compare operator */ @@ -156,7 +128,7 @@ inline bool equals (const X &a, const Y &b) /** * @brief A specialization of the compare operator for doubles */ -UT_PUBLIC bool equals (double a, double b); +TL_PUBLIC bool equals (double a, double b); /** * @brief Specialization of comparison of pointers vs. integers (specifically "0") @@ -209,11 +181,43 @@ inline bool equals (const char *a, const std::string &b) return equals (std::string (a), b); } +/** + * @brief A utility class to capture the warning, error and info channels + * + * Instantiate this class inside a test. Then run the test and finally + * obtain the collected output with CaptureChannel::captured_text(). + */ +class TL_PUBLIC CaptureChannel : public tl::Channel +{ +public: + CaptureChannel (); + + std::string captured_text () const + { + return m_text.str (); + } + + void clear () + { + m_text.str (std::string ()); + } + +protected: + virtual void puts (const char *s); + virtual void endl (); + virtual void end (); + virtual void begin (); + +private: + std::ostringstream m_text; +}; + /** * @brief The base class for tests */ -struct UT_PUBLIC TestBase +class TL_PUBLIC TestBase { +public: /** * @brief Constructor */ @@ -269,28 +273,6 @@ struct UT_PUBLIC TestBase */ void reset_checkpoint (); - /** - * @brief Compares a layout with a golden layout file - * @param layout The layout to compare - * @param au_file The golden file path - * @param norm The normalization mode (see NormalizationMode) - * @param tolerance A tolerance applied when comparing shapes in database units - * The layout is normalized by writing to a file and reading back - */ - void compare_layouts (const db::Layout &layout, const std::string &au_file, NormalizationMode norm = WriteGDS2, db::Coord tolerance = 0); - - /** - * @brief Compares a layout with a golden layout file with layer mapping - * @param layout The layout to compare - * @param au_file The golden file path - * @param lmap The layer mapping object - * @param read_all_others If true, all other layers will be read too - * @param norm The normalization mode (see NormalizationMode) - * @param tolerance A tolerance applied when comparing shapes in database units - * The layout is normalized by writing to a file and reading back - */ - void compare_layouts (const db::Layout &layout, const std::string &au_file, const db::LayerMap &lmap, bool read_all_others, NormalizationMode norm = WriteGDS2, db::Coord tolerance = 0); - /** * @brief Compares two text files */ @@ -449,7 +431,7 @@ struct UT_PUBLIC TestBase template void eq_helper (bool eq, const T1 &a, const T2 &b, const char *what_expr, const char *equals_expr, const char *file, int line) { - if (ut::equals (a, b) != eq) { + if (tl::equals (a, b) != eq) { std::ostringstream sstr; sstr << what_expr << " does not equal " << equals_expr; diff (file, line, sstr.str (), a, b); @@ -474,7 +456,7 @@ protected: } private: - virtual void execute (ut::TestBase *_this) throw (tl::Exception) = 0; + virtual void execute (tl::TestBase *_this) throw (tl::Exception) = 0; void write_detailed_diff (std::ostream &os, const std::string &subject, const std::string &ref); @@ -491,35 +473,59 @@ private: /** * @brief The registration facility for tests */ -struct UT_PUBLIC Registrar +class TL_PUBLIC TestRegistrar { - static void reg (ut::TestBase *t) - { - if (! ms_instance) { - ms_instance = new Registrar (); - } - ms_instance->m_tests.push_back (t); - } - - static Registrar *instance () - { - return ms_instance; - } - - const std::vector &tests () const - { - return m_tests; - } +public: + static void reg (tl::TestBase *t); + static TestRegistrar *instance (); + const std::vector &tests () const; private: - static Registrar *ms_instance; + static TestRegistrar *ms_instance; - Registrar () : m_tests () { } + TestRegistrar (); - std::vector m_tests; + std::vector m_tests; }; -} +} // namespace tl + +#define TEST(NAME) \ + namespace {\ +struct TestImpl##NAME \ + : public tl::TestBase \ + { \ + TestImpl##NAME () : TestBase (__FILE__, #NAME) { } \ + virtual void execute (tl::TestBase *_this) throw (tl::Exception); \ + }; \ + static TestImpl##NAME TestImpl_Inst##NAME; \ + } \ + void TestImpl##NAME::execute (tl::TestBase *_this) throw (tl::Exception) + +#define EXPECT_EQ(WHAT,EQUALS) \ + _this->checkpoint (__FILE__, __LINE__); \ + _this->eq_helper (true, (WHAT), (EQUALS), #WHAT, #EQUALS, __FILE__, __LINE__); + +#define EXPECT_NE(WHAT,EQUALS) \ + _this->checkpoint (__FILE__, __LINE__); \ + _this->eq_helper (false, (WHAT), (EQUALS), #WHAT, #EQUALS, __FILE__, __LINE__); + +#define EXPECT(WHAT) \ + _this->checkpoint (__FILE__, __LINE__); \ + if (!(WHAT)) { \ + std::ostringstream sstr; \ + sstr << #WHAT << " is not true"; \ + _this->raise (__FILE__, __LINE__, sstr.str ()); \ + } + +#define CHECKPOINT() \ + _this->checkpoint (__FILE__, __LINE__); + +#define FAIL_ARG(MSG,WHAT) \ + { \ + std::ostringstream sstr; \ + sstr << MSG << ", value is " << (WHAT); \ + _this->raise (__FILE__, __LINE__, sstr.str ()); \ + } #endif - diff --git a/src/tl/unit_tests/tlAlgorithm.cc b/src/tl/unit_tests/tlAlgorithm.cc index f93aba87c..1aa1cb1ac 100644 --- a/src/tl/unit_tests/tlAlgorithm.cc +++ b/src/tl/unit_tests/tlAlgorithm.cc @@ -24,7 +24,7 @@ #include "tlAlgorithm.h" #include "tlString.h" #include "tlTimer.h" -#include "utHead.h" +#include "tlUnitTest.h" #include #include diff --git a/src/tl/unit_tests/tlClassRegistry.cc b/src/tl/unit_tests/tlClassRegistry.cc index 326b5977d..7d3a6ac4d 100644 --- a/src/tl/unit_tests/tlClassRegistry.cc +++ b/src/tl/unit_tests/tlClassRegistry.cc @@ -22,7 +22,7 @@ #include "tlClassRegistry.h" -#include "utHead.h" +#include "tlUnitTest.h" // This namespace separates the test structs from other objects namespace class_registry_test diff --git a/src/tl/unit_tests/tlCommandLineParser.cc b/src/tl/unit_tests/tlCommandLineParser.cc index 45dbb400a..f44bcc505 100644 --- a/src/tl/unit_tests/tlCommandLineParser.cc +++ b/src/tl/unit_tests/tlCommandLineParser.cc @@ -22,7 +22,7 @@ #include "tlCommandLineParser.h" -#include "utHead.h" +#include "tlUnitTest.h" TEST(1) { diff --git a/src/tl/unit_tests/tlDataMapping.cc b/src/tl/unit_tests/tlDataMapping.cc index dd9e7708e..d72d9358b 100644 --- a/src/tl/unit_tests/tlDataMapping.cc +++ b/src/tl/unit_tests/tlDataMapping.cc @@ -24,10 +24,11 @@ #include "tlDataMapping.h" #include "tlString.h" #include "tlTimer.h" +#include "tlUnitTest.h" #include "string" #include "algorithm" #include "vector" -#include "utHead.h" +#include "tlUnitTest.h" std::string dm_to_string (tl::DataMappingBase &dm) { diff --git a/src/tl/unit_tests/tlDeferredExecution.cc b/src/tl/unit_tests/tlDeferredExecution.cc index 33de6dd76..b88e53874 100644 --- a/src/tl/unit_tests/tlDeferredExecution.cc +++ b/src/tl/unit_tests/tlDeferredExecution.cc @@ -23,7 +23,7 @@ #include "tlDeferredExecution.h" -#include "utHead.h" +#include "tlUnitTest.h" #include diff --git a/src/tl/unit_tests/tlDeflate.cc b/src/tl/unit_tests/tlDeflate.cc index 94b55ff31..11200db57 100644 --- a/src/tl/unit_tests/tlDeflate.cc +++ b/src/tl/unit_tests/tlDeflate.cc @@ -23,7 +23,7 @@ #include "tlStream.h" #include "tlDeflate.h" -#include "utHead.h" +#include "tlUnitTest.h" #include "zlib.h" diff --git a/src/tl/unit_tests/tlEvents.cc b/src/tl/unit_tests/tlEvents.cc index 29bbba07d..2eda9c099 100644 --- a/src/tl/unit_tests/tlEvents.cc +++ b/src/tl/unit_tests/tlEvents.cc @@ -22,8 +22,8 @@ #include "tlEvents.h" +#include "tlUnitTest.h" -#include "utHead.h" #include // Object with event diff --git a/src/tl/unit_tests/tlExpression.cc b/src/tl/unit_tests/tlExpression.cc index e77e65cc7..5da5401e4 100644 --- a/src/tl/unit_tests/tlExpression.cc +++ b/src/tl/unit_tests/tlExpression.cc @@ -23,13 +23,12 @@ #include "tlExpression.h" #include "tlVariantUserClasses.h" +#include "tlUnitTest.h" #include "dbBox.h" #include "dbEdge.h" #include "dbLayout.h" #include "dbLayoutContextHandler.h" -#include "utHead.h" - #include #include diff --git a/src/tl/unit_tests/tlFileSystemWatcher.cc b/src/tl/unit_tests/tlFileSystemWatcher.cc index b63697330..f1d2eba32 100644 --- a/src/tl/unit_tests/tlFileSystemWatcher.cc +++ b/src/tl/unit_tests/tlFileSystemWatcher.cc @@ -24,7 +24,7 @@ #include "tlFileSystemWatcher.h" #include "tlString.h" #include "tlTimer.h" -#include "utHead.h" +#include "tlUnitTest.h" #include #include diff --git a/src/tl/unit_tests/tlFileUtils.cc b/src/tl/unit_tests/tlFileUtils.cc index 7eb3032a8..2991c0605 100644 --- a/src/tl/unit_tests/tlFileUtils.cc +++ b/src/tl/unit_tests/tlFileUtils.cc @@ -22,7 +22,7 @@ #include "tlFileUtils.h" -#include "utHead.h" +#include "tlUnitTest.h" #include #include diff --git a/src/tl/unit_tests/tlGlobPattern.cc b/src/tl/unit_tests/tlGlobPattern.cc index 3bb003e5b..0cbfd1ab3 100644 --- a/src/tl/unit_tests/tlGlobPattern.cc +++ b/src/tl/unit_tests/tlGlobPattern.cc @@ -23,7 +23,7 @@ #include "tlGlobPattern.h" -#include "utHead.h" +#include "tlUnitTest.h" TEST(1) { diff --git a/src/tl/unit_tests/tlHttpStream.cc b/src/tl/unit_tests/tlHttpStream.cc index 2c493de12..25344a0ae 100644 --- a/src/tl/unit_tests/tlHttpStream.cc +++ b/src/tl/unit_tests/tlHttpStream.cc @@ -22,7 +22,7 @@ #include "tlHttpStream.h" -#include "utHead.h" +#include "tlUnitTest.h" static std::string test_url1 ("http://www.klayout.org/svn-public/klayout-resources/trunk/testdata/text"); static std::string test_url2 ("http://www.klayout.org/svn-public/klayout-resources/trunk/testdata/dir1"); diff --git a/src/tl/unit_tests/tlIntervalMap.cc b/src/tl/unit_tests/tlIntervalMap.cc index d0a760a19..fb404e3d1 100644 --- a/src/tl/unit_tests/tlIntervalMap.cc +++ b/src/tl/unit_tests/tlIntervalMap.cc @@ -24,7 +24,7 @@ #include "tlIntervalMap.h" #include "tlString.h" -#include "utHead.h" +#include "tlUnitTest.h" #include diff --git a/src/tl/unit_tests/tlIntervalSet.cc b/src/tl/unit_tests/tlIntervalSet.cc index 60661c4d3..017cc0275 100644 --- a/src/tl/unit_tests/tlIntervalSet.cc +++ b/src/tl/unit_tests/tlIntervalSet.cc @@ -25,7 +25,7 @@ #include "tlIntervalSet.h" #include "tlString.h" -#include "utHead.h" +#include "tlUnitTest.h" typedef tl::interval_set is_t; diff --git a/src/tl/unit_tests/tlKDTree.cc b/src/tl/unit_tests/tlKDTree.cc index 5517790be..ccaffb549 100644 --- a/src/tl/unit_tests/tlKDTree.cc +++ b/src/tl/unit_tests/tlKDTree.cc @@ -22,7 +22,7 @@ #include "tlKDTree.h" -#include "utHead.h" +#include "tlUnitTest.h" #include #include @@ -87,9 +87,9 @@ typedef tl::kd_tree_it TestTreeIt; template -static void test_tree (ut::TestBase *_this, const Tree &t, const Picker &p, const Search &s) +static void test_tree (tl::TestBase *_this, const Tree &t, const Picker &p, const Search &s) { - if (ut::verbose ()) { + if (tl::verbose ()) { std::cout << "Testing vs. " << s.to_string () << std::endl; } @@ -100,7 +100,7 @@ static void test_tree (ut::TestBase *_this, const Tree &t, const Picker &p, cons } } - if (ut::verbose ()) { + if (tl::verbose ()) { for (typename Tree::size_type i = 0; i < t.size (); ++i) { std::cout << i << " b=" << t.bounds() [i] << ", v=" << p (0, t.objects() [i]) << "," << p (1, t.objects() [i]) << std::endl; } @@ -113,7 +113,7 @@ static void test_tree (ut::TestBase *_this, const Tree &t, const Picker &p, cons } else { good_idx.erase (i); } - if (ut::verbose ()) { + if (tl::verbose ()) { std::cout << p(0, *i) << "," << p(1, *i) << std::endl; } ++i; diff --git a/src/tl/unit_tests/tlMath.cc b/src/tl/unit_tests/tlMath.cc index 32806225e..a451b0a80 100644 --- a/src/tl/unit_tests/tlMath.cc +++ b/src/tl/unit_tests/tlMath.cc @@ -21,7 +21,7 @@ */ #include "tlMath.h" -#include "utHead.h" +#include "tlUnitTest.h" TEST(1) { diff --git a/src/tl/unit_tests/tlObject.cc b/src/tl/unit_tests/tlObject.cc index 51d9303b5..60949fac1 100644 --- a/src/tl/unit_tests/tlObject.cc +++ b/src/tl/unit_tests/tlObject.cc @@ -22,7 +22,7 @@ #include "tlObjectCollection.h" -#include "utHead.h" +#include "tlUnitTest.h" namespace { diff --git a/src/tl/unit_tests/tlReuseVector.cc b/src/tl/unit_tests/tlReuseVector.cc index c4fc14ab4..c9fcde3e2 100644 --- a/src/tl/unit_tests/tlReuseVector.cc +++ b/src/tl/unit_tests/tlReuseVector.cc @@ -21,8 +21,7 @@ */ -#include "utHead.h" - +#include "tlUnitTest.h" #include "tlReuseVector.h" #include @@ -45,7 +44,7 @@ std::string to_string (const tl::reuse_vector &x) } tl::reuse_vector::iterator -test_insert (ut::TestBase *_this, tl::reuse_vector &rv, const std::string &s) +test_insert (tl::TestBase *_this, tl::reuse_vector &rv, const std::string &s) { tl::reuse_vector::iterator si = rv.insert (s); EXPECT_EQ (*si, s); diff --git a/src/tl/unit_tests/tlStableVector.cc b/src/tl/unit_tests/tlStableVector.cc index 3e30d7ae3..acbe09b24 100644 --- a/src/tl/unit_tests/tlStableVector.cc +++ b/src/tl/unit_tests/tlStableVector.cc @@ -24,7 +24,7 @@ #include "tlStableVector.h" #include "tlAlgorithm.h" -#include "utHead.h" +#include "tlUnitTest.h" std::string to_string (const tl::stable_vector &v) { diff --git a/src/tl/unit_tests/tlString.cc b/src/tl/unit_tests/tlString.cc index 60ff6b6ef..6792cd0ed 100644 --- a/src/tl/unit_tests/tlString.cc +++ b/src/tl/unit_tests/tlString.cc @@ -23,7 +23,7 @@ #include "tlString.h" #include "tlTimer.h" -#include "utHead.h" +#include "tlUnitTest.h" #include diff --git a/src/tl/unit_tests/tlThreadedWorkers.cc b/src/tl/unit_tests/tlThreadedWorkers.cc index d06ccd837..31cf772a2 100644 --- a/src/tl/unit_tests/tlThreadedWorkers.cc +++ b/src/tl/unit_tests/tlThreadedWorkers.cc @@ -24,7 +24,7 @@ #include "tlThreadedWorkers.h" #include "tlTimer.h" -#include "utHead.h" +#include "tlUnitTest.h" #include diff --git a/src/tl/unit_tests/tlUtils.cc b/src/tl/unit_tests/tlUtils.cc index 418f4418d..a557c237d 100644 --- a/src/tl/unit_tests/tlUtils.cc +++ b/src/tl/unit_tests/tlUtils.cc @@ -21,7 +21,7 @@ */ #include "tlUtils.h" -#include "utHead.h" +#include "tlUnitTest.h" namespace { diff --git a/src/tl/unit_tests/tlVariant.cc b/src/tl/unit_tests/tlVariant.cc index 33592d50b..cdb62a453 100644 --- a/src/tl/unit_tests/tlVariant.cc +++ b/src/tl/unit_tests/tlVariant.cc @@ -26,10 +26,10 @@ #include "tlVariantUserClasses.h" #include "tlObject.h" #include "tlTypeTraits.h" +#include "tlUnitTest.h" #include "gsiDecl.h" #include "dbBox.h" #include "dbLayerProperties.h" -#include "utHead.h" #include struct A diff --git a/src/tl/unit_tests/tlWebDAV.cc b/src/tl/unit_tests/tlWebDAV.cc index bba9764f8..a83e0e6c7 100644 --- a/src/tl/unit_tests/tlWebDAV.cc +++ b/src/tl/unit_tests/tlWebDAV.cc @@ -22,7 +22,7 @@ #include "tlWebDAV.h" -#include "utHead.h" +#include "tlUnitTest.h" #include diff --git a/src/tl/unit_tests/tlXMLParser.cc b/src/tl/unit_tests/tlXMLParser.cc index 18f8320a5..d7192ffae 100644 --- a/src/tl/unit_tests/tlXMLParser.cc +++ b/src/tl/unit_tests/tlXMLParser.cc @@ -23,7 +23,7 @@ #include "tlXMLParser.h" -#include "utHead.h" +#include "tlUnitTest.h" #include #include @@ -333,7 +333,7 @@ TEST (6) TEST (7) { - std::string tmp_file = ut::TestBase::tmp_file ("tmp_tlXMLParser_7.xml"); + std::string tmp_file = tl::TestBase::tmp_file ("tmp_tlXMLParser_7.xml"); FILE *f = fopen (tmp_file.c_str (), "w"); tl_assert (f != NULL); @@ -389,7 +389,7 @@ TEST (7) TEST (7a) { - std::string tmp_file = ut::TestBase::tmp_file ("tmp_tlXMLParser_7a.xml"); + std::string tmp_file = tl::TestBase::tmp_file ("tmp_tlXMLParser_7a.xml"); FILE *f = fopen (tmp_file.c_str (), "w"); tl_assert (f != NULL); @@ -445,7 +445,7 @@ TEST (7a) TEST (8) { - std::string tmp_file = ut::TestBase::tmp_file ("tmp_tlXMLParser_8.xml"); + std::string tmp_file = tl::TestBase::tmp_file ("tmp_tlXMLParser_8.xml"); FILE *f = fopen (tmp_file.c_str (), "w"); tl_assert (f != NULL); @@ -519,7 +519,7 @@ TEST (8) TEST (8a) { - std::string tmp_file = ut::TestBase::tmp_file ("tmp_tlXMLParser_8a.xml"); + std::string tmp_file = tl::TestBase::tmp_file ("tmp_tlXMLParser_8a.xml"); FILE *f = fopen (tmp_file.c_str (), "w"); tl_assert (f != NULL); diff --git a/src/tl/unit_tests/unit_tests.pro b/src/tl/unit_tests/unit_tests.pro index 4d74a71e9..16cd8727a 100644 --- a/src/tl/unit_tests/unit_tests.pro +++ b/src/tl/unit_tests/unit_tests.pro @@ -33,12 +33,12 @@ SOURCES = \ tlWebDAV.cc \ tlXMLParser.cc \ -INCLUDEPATH += $$TL_INC $$GSI_INC $$UT_INC -DEPENDPATH += $$TL_INC $$GSI_INC $$UT_INC +INCLUDEPATH += $$TL_INC $$GSI_INC +DEPENDPATH += $$TL_INC $$GSI_INC # because of db types support in ut: INCLUDEPATH += $$DB_INC DEPENDPATH += $$DB_INC -LIBS += -L$$DESTDIR_UT -lklayout_db -lklayout_tl -lklayout_gsi -lklayout_ut +LIBS += -L$$DESTDIR_UT -lklayout_db -lklayout_tl -lklayout_gsi diff --git a/src/unit_tests/unit_test_main.cc b/src/unit_tests/unit_test_main.cc index 8672cfaea..a06f23432 100644 --- a/src/unit_tests/unit_test_main.cc +++ b/src/unit_tests/unit_test_main.cc @@ -22,8 +22,9 @@ */ -#include "utHead.h" +#include "utTestConsole.h" +#include "tlUnitTest.h" #include "tlStaticObjects.h" #include "tlTimer.h" #include "tlSystemPaths.h" @@ -65,7 +66,7 @@ main (int argc, char **argv) } static int -run_tests (const std::vector &selected_tests, bool editable, bool non_editable, bool slow, lay::Application &app, bool gsi_coverage, const std::vector &class_names_vector) +run_tests (const std::vector &selected_tests, bool editable, bool non_editable, bool slow, lay::Application &app, bool gsi_coverage, const std::vector &class_names_vector) { std::set class_names; class_names.insert (class_names_vector.begin (), class_names_vector.end ()); @@ -74,9 +75,9 @@ run_tests (const std::vector &selected_tests, bool editable, boo grand_timer.start (); int failed_ne = 0, failed_e = 0; - std::vector failed_tests_e, failed_tests_ne; + std::vector failed_tests_e, failed_tests_ne; int skipped_ne = 0, skipped_e = 0; - std::vector skipped_tests_e, skipped_tests_ne; + std::vector skipped_tests_e, skipped_tests_ne; for (int e = 0; e < 2; ++e) { @@ -90,9 +91,9 @@ run_tests (const std::vector &selected_tests, bool editable, boo app.set_editable (e != 0); int failed = 0; - std::vector failed_tests; + std::vector failed_tests; int skipped = 0; - std::vector skipped_tests; + std::vector skipped_tests; tl::Timer timer; @@ -105,11 +106,11 @@ run_tests (const std::vector &selected_tests, bool editable, boo skipped = 0; skipped_tests.clear (); - for (std::vector ::const_iterator t = selected_tests.begin (); t != selected_tests.end (); ++t) { + for (std::vector ::const_iterator t = selected_tests.begin (); t != selected_tests.end (); ++t) { (*t)->remove_tmp_folder (); } - for (std::vector ::const_iterator t = selected_tests.begin (); t != selected_tests.end (); ++t) { + for (std::vector ::const_iterator t = selected_tests.begin (); t != selected_tests.end (); ++t) { ut::ctrl << "name () << "\">"; @@ -118,18 +119,33 @@ run_tests (const std::vector &selected_tests, bool editable, boo try { + ut::ctrl << ""; + + tl::Timer timer; + timer.start(); + if (! (*t)->do_test (e != 0, slow)) { + timer.stop(); + + ut::ctrl << ""; + ut::ctrl << "name (), false) << " failed (continued mode - see previous messages)" << "\"/>"; tl::error << "Test " << (*t)->name () << " failed (continued mode - see previous messages)"; failed_tests.push_back (*t); ++failed; + } else { + ut::ctrl << ""; } + ut::noctrl << "Time: " << timer.sec_wall () << "s (wall) " << timer.sec_user () << "s (user) " << timer.sec_sys () << "s (sys)"; + ut::ctrl << ""; + } catch (tl::CancelException &) { + ut::ctrl << ""; ut::ctrl << ""; tl::error << "Test " << (*t)->name () << " skipped"; @@ -138,6 +154,7 @@ run_tests (const std::vector &selected_tests, bool editable, boo } catch (tl::Exception &ex) { + ut::ctrl << ""; ut::ctrl << ""; tl::error << "Test " << (*t)->name () << " failed:"; tl::info << ex.msg (); @@ -231,10 +248,10 @@ run_tests (const std::vector &selected_tests, bool editable, boo tl::warn << "GSI coverage test failed - the following methods were not called:"; } if (first_of_class) { - tl::warn << tl::replicate (" ", ut::TestConsole::instance ()->indent ()) << "Class " << c->name (); + tl::warn << tl::replicate (" ", tl::indent ()) << "Class " << c->name (); first_of_class = false; } - tl::warn << tl::replicate (" ", ut::TestConsole::instance ()->indent () * 2) << (*m)->to_string (); + tl::warn << tl::replicate (" ", tl::indent () * 2) << (*m)->to_string (); } @@ -258,14 +275,14 @@ run_tests (const std::vector &selected_tests, bool editable, boo if (skipped_e + skipped_ne > 0) { if (non_editable) { tl::warn << "Skipped in non-editable mode"; - for (std::vector ::const_iterator f = skipped_tests_ne.begin (); f != skipped_tests_ne.end (); ++f) { - tl::warn << tl::replicate (" ", ut::TestConsole::instance ()->indent ()) << (*f)->name (); + for (std::vector ::const_iterator f = skipped_tests_ne.begin (); f != skipped_tests_ne.end (); ++f) { + tl::warn << tl::replicate (" ", tl::indent ()) << (*f)->name (); } } if (editable) { tl::warn << "Skipped in editable mode"; - for (std::vector ::const_iterator f = skipped_tests_e.begin (); f != skipped_tests_e.end (); ++f) { - tl::warn << tl::replicate (" ", ut::TestConsole::instance ()->indent ()) << (*f)->name (); + for (std::vector ::const_iterator f = skipped_tests_e.begin (); f != skipped_tests_e.end (); ++f) { + tl::warn << tl::replicate (" ", tl::indent ()) << (*f)->name (); } } tl::warn << tl::to_string (skipped_e + skipped_ne) << " test(s) skipped"; @@ -275,14 +292,14 @@ run_tests (const std::vector &selected_tests, bool editable, boo if (result > 0) { if (non_editable) { tl::warn << "Failed in non-editable mode"; - for (std::vector ::const_iterator f = failed_tests_ne.begin (); f != failed_tests_ne.end (); ++f) { - tl::warn << tl::replicate (" ", ut::TestConsole::instance ()->indent ()) << (*f)->name (); + for (std::vector ::const_iterator f = failed_tests_ne.begin (); f != failed_tests_ne.end (); ++f) { + tl::warn << tl::replicate (" ", tl::indent ()) << (*f)->name (); } } if (editable) { tl::warn << "Failed in editable mode"; - for (std::vector ::const_iterator f = failed_tests_e.begin (); f != failed_tests_e.end (); ++f) { - tl::warn << tl::replicate (" ", ut::TestConsole::instance ()->indent ()) << (*f)->name (); + for (std::vector ::const_iterator f = failed_tests_e.begin (); f != failed_tests_e.end (); ++f) { + tl::warn << tl::replicate (" ", tl::indent ()) << (*f)->name (); } } tl::warn << tl::to_string (result) << " test(s) failed"; @@ -418,16 +435,16 @@ main_cont (int argc, char **argv) if (list_tests) { tl::info << "List of installed tests:"; - for (std::vector::const_iterator i = ut::Registrar::instance()->tests ().begin (); i != ut::Registrar::instance()->tests ().end (); ++i) { + for (std::vector::const_iterator i = tl::TestRegistrar::instance()->tests ().begin (); i != tl::TestRegistrar::instance()->tests ().end (); ++i) { tl::info << " " << (*i)->name (); } throw tl::CancelException (); } - ut::set_verbose (verbose); - ut::set_xml_format (xml_format); - ut::set_continue_flag (continue_flag); - ut::set_debug_mode (debug_mode); + tl::set_verbose (verbose); + tl::set_xml_format (xml_format); + tl::set_continue_flag (continue_flag); + tl::set_debug_mode (debug_mode); try { @@ -437,17 +454,17 @@ main_cont (int argc, char **argv) ut::noctrl << tl::replicate ("=", console.real_columns ()); ut::noctrl << "Entering KLayout test suite"; - ut::noctrl << "TESTSRC=" << ut::testsrc (); - ut::noctrl << "TESTTMP=" << tl::to_string (QDir (tl::to_qstring (ut::testtmp ())).absolutePath ()); + ut::noctrl << "TESTSRC=" << tl::testsrc (); + ut::noctrl << "TESTTMP=" << tl::to_string (QDir (tl::to_qstring (tl::testtmp ())).absolutePath ()); - const std::vector *selected_tests = 0; - std::vector subset; + const std::vector *selected_tests = 0; + std::vector subset; if (! test_list.empty ()) { selected_tests = ⊂ ut::noctrl << "Selected tests:"; - for (std::vector::const_iterator i = ut::Registrar::instance()->tests ().begin (); i != ut::Registrar::instance()->tests ().end (); ++i) { + for (std::vector::const_iterator i = tl::TestRegistrar::instance()->tests ().begin (); i != tl::TestRegistrar::instance()->tests ().end (); ++i) { bool exclude = false; @@ -470,7 +487,7 @@ main_cont (int argc, char **argv) } } else { - selected_tests = &ut::Registrar::instance()->tests (); + selected_tests = &tl::TestRegistrar::instance()->tests (); } result = run_tests (*selected_tests, editable, non_editable, slow, app, gsi_coverage, class_names); diff --git a/src/unit_tests/unit_tests.pro b/src/unit_tests/unit_tests.pro index 1dae7eae6..7e45e19fd 100644 --- a/src/unit_tests/unit_tests.pro +++ b/src/unit_tests/unit_tests.pro @@ -10,6 +10,10 @@ TARGET = ut_runner SOURCES = \ unit_test_main.cc \ + utTestConsole.cc \ + +HEADERS += \ + utTestConsole.h \ !win32 { LIBS += -ldl diff --git a/src/ut/utTestConsole.cc b/src/unit_tests/utTestConsole.cc similarity index 89% rename from src/ut/utTestConsole.cc rename to src/unit_tests/utTestConsole.cc index 035688b19..9b734bdaf 100644 --- a/src/ut/utTestConsole.cc +++ b/src/unit_tests/utTestConsole.cc @@ -21,10 +21,7 @@ */ #include "utTestConsole.h" -#include "utHead.h" - -#include "rba.h" -#include "pya.h" +#include "tlUnitTest.h" #include @@ -39,36 +36,6 @@ namespace ut { -// ------------------------------------------------ -// CaptureChannel implementation - -CaptureChannel::CaptureChannel () -{ - tl::info.add (this, false); - tl::error.add (this, false); - tl::warn.add (this, false); -} - -void CaptureChannel::puts (const char *s) -{ - m_text << s; -} - -void CaptureChannel::endl () -{ - m_text << "\n"; -} - -void CaptureChannel::end () -{ - // .. nothing yet .. -} - -void CaptureChannel::begin () -{ - // .. nothing yet .. -} - // ------------------------------------------------ // tl::Channel implementations for redirecting the log output @@ -184,21 +151,21 @@ public: protected: virtual void puts (const char *s) { - if (m_with_xml == ut::xml_format ()) { + if (m_with_xml == tl::xml_format ()) { TestConsole::instance ()->raw_write (s); } } virtual void endl () { - if (m_with_xml == ut::xml_format ()) { + if (m_with_xml == tl::xml_format ()) { TestConsole::instance ()->raw_write ("\n"); } } virtual void end () { - if (m_with_xml == ut::xml_format ()) { + if (m_with_xml == tl::xml_format ()) { TestConsole::instance ()->end (); TestConsole::instance ()->flush (); } @@ -206,7 +173,7 @@ protected: virtual void begin () { - if (m_with_xml == ut::xml_format ()) { + if (m_with_xml == tl::xml_format ()) { TestConsole::instance ()->begin_info (); } } @@ -227,7 +194,6 @@ TestConsole::TestConsole (FILE *file) : m_file (file), m_col (0), m_max_col (250), m_columns (50), m_rows (0), m_file_is_tty (false) { ms_instance = this; - m_indent = 4; m_file_is_tty = isatty (fileno (file)); @@ -252,6 +218,12 @@ TestConsole::~TestConsole () } } +int +TestConsole::columns () +{ + return std::max (m_columns - tl::indent (), 0); +} + void TestConsole::write_str (const char *text, output_stream os) { @@ -280,7 +252,7 @@ bool TestConsole::is_tty () { // NOTE: this assumes we are delivering to stdout - return m_file_is_tty && ! ut::xml_format (); + return m_file_is_tty && ! tl::xml_format (); } void @@ -318,7 +290,7 @@ TestConsole::end () void TestConsole::basic_write (const char *s) { - if (ut::xml_format ()) { + if (tl::xml_format ()) { for (const char *cp = s; *cp; ++cp) { if (*cp == '&') { @@ -343,10 +315,10 @@ TestConsole::basic_write (const char *s) fputc (*cp, m_file); } else { if (m_col == 0) { - for (int i = 0; i < m_indent; ++i) { + for (int i = 0; i < tl::indent (); ++i) { fputc (' ', m_file); } - m_col = m_indent; + m_col = tl::indent (); } if (m_col > m_max_col) { // ignore char @@ -409,5 +381,4 @@ tl::LogTee noctrl (new CtrlChannel (false), true); tl::LogTee ctrl (new CtrlChannel (true), true); - } diff --git a/src/ut/utTestConsole.h b/src/unit_tests/utTestConsole.h similarity index 68% rename from src/ut/utTestConsole.h rename to src/unit_tests/utTestConsole.h index d189713e1..ef56225fa 100644 --- a/src/ut/utTestConsole.h +++ b/src/unit_tests/utTestConsole.h @@ -24,7 +24,6 @@ #ifndef HDR_utTestConsole #define HDR_utTestConsole -#include "utCommon.h" #include "tlLog.h" #include "gsiInterpreter.h" @@ -34,41 +33,13 @@ namespace ut { -/** - * @brief A utility class to capture the warning, error and info channels - * - * Instantiate this class inside a test. Then run the test and finally - * obtain the collected output with CaptureChannel::captured_text(). - */ -class UT_PUBLIC CaptureChannel : public tl::Channel -{ -public: - CaptureChannel (); - - std::string captured_text () const - { - return m_text.str (); - } - - void clear () - { - m_text.str (std::string ()); - } - -protected: - virtual void puts (const char *s); - virtual void endl (); - virtual void end (); - virtual void begin (); - -private: - std::ostringstream m_text; -}; +extern tl::LogTee ctrl; +extern tl::LogTee noctrl; /** * @brief Redirects the interpreter output and serves as a general output device */ -class UT_PUBLIC TestConsole +class TestConsole : public gsi::Console { public: @@ -81,21 +52,12 @@ public: TestConsole (FILE *file); ~TestConsole (); - int indent () const - { - return m_indent; - } - void write_str (const char *text, output_stream os); void raw_write (const char *text); virtual void flush (); virtual bool is_tty (); - - virtual int columns () - { - return std::max (m_columns - m_indent, 0); - } + virtual int columns (); virtual int rows () { @@ -119,7 +81,6 @@ private: int m_max_col; int m_columns, m_rows; bool m_file_is_tty; - int m_indent; static TestConsole *ms_instance; void redirect (); diff --git a/src/ut/ut.pro b/src/ut/ut.pro deleted file mode 100644 index 078b42b96..000000000 --- a/src/ut/ut.pro +++ /dev/null @@ -1,42 +0,0 @@ - -DESTDIR = $$OUT_PWD/.. -TARGET = klayout_ut - -include($$PWD/../lib.pri) - -DEFINES += MAKE_UT_LIBRARY - -# Input -HEADERS = \ - utHead.h \ - utTestBase.h \ - utTestConsole.h \ - utCommon.h - -SOURCES = \ - utTestConsole.cc \ - utTestBase.cc \ - -INCLUDEPATH = $$TL_INC $$DB_INC $$GSI_INC -DEPENDPATH = $$TL_INC $$DB_INC $$GSI_INC - -LIBS += -L$$DESTDIR -lklayout_tl -lklayout_db -lklayout_gsi - -INCLUDEPATH += $$RBA_INC -DEPENDPATH += $$RBA_INC - -equals(HAVE_RUBY, "1") { - LIBS += -lklayout_rba -} else { - LIBS += -lklayout_rbastub -} - -INCLUDEPATH += $$PYA_INC -DEPENDPATH += $$PYA_INC - -equals(HAVE_PYTHON, "1") { - LIBS += -lklayout_pya -} else { - LIBS += -lklayout_pyastub -} - diff --git a/src/ut/utCommon.h b/src/ut/utCommon.h deleted file mode 100644 index c3fdfb778..000000000 --- a/src/ut/utCommon.h +++ /dev/null @@ -1,48 +0,0 @@ - -/* - - KLayout Layout Viewer - Copyright (C) 2006-2017 Matthias Koefferlein - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -*/ - - -#if !defined(HDR_utCommon_h) -# define HDR_utCommon_h - -# if defined _WIN32 || defined __CYGWIN__ - -# ifdef MAKE_UT_LIBRARY -# define UT_PUBLIC __declspec(dllexport) -# else -# define UT_PUBLIC __declspec(dllimport) -# endif -# define UT_LOCAL - -# else - -# if __GNUC__ >= 4 -# define UT_PUBLIC __attribute__ ((visibility ("default"))) -# define UT_LOCAL __attribute__ ((visibility ("hidden"))) -# else -# define UT_PUBLIC -# define UT_LOCAL -# endif - -# endif - -#endif diff --git a/src/ut/utHead.h b/src/ut/utHead.h deleted file mode 100644 index 692425b68..000000000 --- a/src/ut/utHead.h +++ /dev/null @@ -1,77 +0,0 @@ - -/* - - KLayout Layout Viewer - Copyright (C) 2006-2017 Matthias Koefferlein - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -*/ - - -#ifndef HDR_utHead -#define HDR_utHead - -#include "utCommon.h" -#include "utTestBase.h" -#include "utTestConsole.h" - -namespace ut { - -extern UT_PUBLIC tl::LogTee ctrl; -extern UT_PUBLIC tl::LogTee noctrl; - -} // namespace ut - -#define TEST(NAME) \ - namespace {\ -struct TestImpl##NAME \ - : public ut::TestBase \ - { \ - TestImpl##NAME () : TestBase (__FILE__, #NAME) { } \ - virtual void execute (ut::TestBase *_this) throw (tl::Exception); \ - }; \ - static TestImpl##NAME TestImpl_Inst##NAME; \ - } \ - void TestImpl##NAME::execute (ut::TestBase *_this) throw (tl::Exception) - -#define EXPECT_EQ(WHAT,EQUALS) \ - _this->checkpoint (__FILE__, __LINE__); \ - _this->eq_helper (true, (WHAT), (EQUALS), #WHAT, #EQUALS, __FILE__, __LINE__); - -#define EXPECT_NE(WHAT,EQUALS) \ - _this->checkpoint (__FILE__, __LINE__); \ - _this->eq_helper (false, (WHAT), (EQUALS), #WHAT, #EQUALS, __FILE__, __LINE__); - -#define EXPECT(WHAT) \ - _this->checkpoint (__FILE__, __LINE__); \ - if (!(WHAT)) { \ - std::ostringstream sstr; \ - sstr << #WHAT << " is not true"; \ - _this->raise (__FILE__, __LINE__, sstr.str ()); \ - } - -#define CHECKPOINT() \ - _this->checkpoint (__FILE__, __LINE__); - -#define FAIL_ARG(MSG,WHAT) \ - { \ - std::ostringstream sstr; \ - sstr << MSG << ", value is " << (WHAT); \ - _this->raise (__FILE__, __LINE__, sstr.str ()); \ - } - -#endif - diff --git a/src/ut/utTestBase.cc b/src/ut/utTestBase.cc deleted file mode 100644 index 2fcc5c7d8..000000000 --- a/src/ut/utTestBase.cc +++ /dev/null @@ -1,469 +0,0 @@ - -/* - - KLayout Layout Viewer - Copyright (C) 2006-2017 Matthias Koefferlein - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -*/ - -#include "utTestBase.h" -#include "utTestConsole.h" -#include "utHead.h" -#include "tlFileUtils.h" -#include "tlTimer.h" -#include "tlStream.h" -#include "dbLayout.h" -#include "dbStreamLayers.h" -#include "dbGDS2Writer.h" -#include "dbOASISWriter.h" -#include "dbReader.h" -#include "dbCommonReader.h" -#include "dbLayoutDiff.h" - -#include "pya.h" -#include "rba.h" - -#include - -namespace ut -{ - -// -------------------------------------------------------------------------------------- - -static bool s_verbose_flag = false; -static bool s_xml_format = false; -static bool s_debug_mode = false; -static bool s_continue_flag = false; - -bool verbose () -{ - return s_verbose_flag; -} - -void set_verbose (bool f) -{ - s_verbose_flag = f; -} - -bool xml_format () -{ - return s_xml_format; -} - -void set_xml_format (bool f) -{ - s_xml_format = f; -} - -void set_continue_flag (bool f) -{ - s_continue_flag = f; -} - -bool is_debug_mode () -{ - return s_debug_mode; -} - -void set_debug_mode (bool f) -{ - s_debug_mode = f; -} - -pya::PythonInterpreter *python_interpreter () -{ - pya::PythonInterpreter *ip = pya::PythonInterpreter::instance (); - tl_assert (ip != 0); - return ip; -} - -rba::RubyInterpreter *ruby_interpreter () -{ - rba::RubyInterpreter *ip = rba::RubyInterpreter::instance (); - tl_assert (ip != 0); - return ip; -} - -std::string testsrc () -{ - const char *ts = getenv ("TESTSRC"); - if (! ts) { - throw tl::Exception ("TESTSRC undefined"); - } - return ts; -} - -std::string testsrc_private () -{ - QDir d (QDir (tl::to_qstring (ut::testsrc ())).filePath (QString::fromUtf8 ("private"))); - if (! d.exists ()) { - throw tl::CancelException (); - } - return tl::to_string (d.path ()); -} - -std::string testtmp () -{ - // Ensures the test temp directory is present - const char *tt = getenv ("TESTTMP"); - if (! tt) { - throw tl::Exception ("TESTTMP undefined"); - } - return tt; -} - -bool equals (double a, double b) -{ - double m = fabs (0.5 * (a + b)); - if (m < 1e-30) { - // resolution limit is 1e-30 - return true; - } else { - double d = fabs (a - b); - // we consider two values equal for the purpose of unit tests if they have the - // same value within 1e-10 (0.00000001%). - return d < 1e-10 * m; - } -} - -// TODO: move this to tlString.h -static std::string replicate (const char *s, size_t n) -{ - std::string res; - res.reserve (strlen (s) * n); - while (n > 0) { - res += s; - --n; - } - return res; -} - -// -------------------------------------------------------------------------------------- -// TestBase implementation - -ut::Registrar *ut::Registrar::ms_instance = 0; - -TestBase::TestBase (const std::string &file, const std::string &name) - : m_editable (false), m_slow (false), m_cp_line (0), m_any_failed (false) -{ - QFileInfo f (tl::to_qstring (file)); - m_test = tl::to_string (f.baseName ()) + ":" + name; - m_testdir = tl::to_string (f.baseName ()) + "_" + name; - ut::Registrar::reg (this); -} - -bool TestBase::do_test (bool editable, bool slow) -{ - m_editable = editable; - m_slow = slow; - - ut::ctrl << ""; - - try { - - // Ensures the test temp directory is present - QDir dir (tl::to_qstring (testtmp ())); - QDir tmpdir (dir.absoluteFilePath (tl::to_qstring (m_testdir))); - if (tmpdir.exists () && ! tl::rm_dir_recursive (tmpdir.absolutePath ())) { - throw tl::Exception ("Unable to clean temporary dir: " + tl::to_string (tmpdir.absolutePath ())); - } - if (! dir.mkpath (tl::to_qstring (m_testdir))) { - throw tl::Exception ("Unable to create path for temporary files: " + tl::to_string (tmpdir.absolutePath ())); - } - dir.cd (tl::to_qstring (m_testdir)); - - m_testtmp = dir.absolutePath (); - - static std::string testname_value; - static std::string testtmp_value; - - putenv (const_cast ("TESTNAME=")); - testname_value = std::string ("TESTNAME=") + m_test; - putenv (const_cast (testname_value.c_str ())); - - putenv (const_cast ("TESTTMP_WITH_NAME=")); - testtmp_value = std::string ("TESTTMP_WITH_NAME=") + m_testtmp.toUtf8().constData(); - putenv (const_cast (testtmp_value.c_str ())); - - reset_checkpoint (); - - tl::Timer timer; - timer.start(); - - execute (this); - - timer.stop(); - - m_testtmp.clear (); - - ut::ctrl << ""; - - ut::noctrl << "Time: " << timer.sec_wall () << "s (wall) " << timer.sec_user () << "s (user) " << timer.sec_sys () << "s (sys)"; - ut::ctrl << ""; - - } catch (...) { - ut::ctrl << ""; - throw; - } - - return (!m_any_failed); -} - -std::string TestBase::tmp_file (const std::string &fn) const -{ - tl_assert (! m_testtmp.isEmpty ()); - QDir dir (m_testtmp); - return tl::to_string (dir.absoluteFilePath (tl::to_qstring (fn))); -} - -/** - * @brief Recursively empties a directory - */ -static void empty_dir (QDir dir) -{ - QStringList entries = dir.entryList (QDir::AllEntries | QDir::NoDotAndDotDot); - for (QStringList::const_iterator e = entries.begin (); e != entries.end (); ++e) { - QString epath = dir.absoluteFilePath (*e); - if (QFileInfo (epath).isDir ()) { - empty_dir (QDir (epath)); - dir.rmdir (*e); - } else if (! dir.remove (*e)) { - throw tl::Exception ("Unable to remove file or directory: " + tl::to_string (dir.filePath (*e))); - } - } -} - -void TestBase::remove_tmp_folder () -{ - // Ensures the test temp directory is present - QDir dir (tl::to_qstring (testtmp ())); - if (dir.cd (tl::to_qstring (m_test))) { - - empty_dir (dir); - - dir.cdUp (); - if (! dir.rmdir (tl::to_qstring (m_test))) { - throw tl::Exception ("Unable to remove directory: " + tl::to_string (dir.filePath (tl::to_qstring (m_test)))); - } - - } -} - -void TestBase::checkpoint (const std::string &file, int line) -{ - m_cp_file = file; - m_cp_line = line; -} - -void TestBase::reset_checkpoint () -{ - m_cp_file = std::string (); - m_cp_line = 0; -} - -void TestBase::raise (const std::string &file, int line, const std::string &msg) -{ - std::ostringstream sstr; - sstr << file << ", line " << line << ": " << msg; - if (s_continue_flag) { - tl::error << sstr.str (); - m_any_failed = true; - } else { - throw ut::Exception (sstr.str ()); - } -} - -void TestBase::raise (const std::string &msg) -{ - std::ostringstream sstr; - if (m_cp_line > 0) { - sstr << "(last checkpoint: " << m_cp_file << ", line " << m_cp_line << "): "; - } - sstr << msg; - if (s_continue_flag) { - tl::error << sstr.str (); - m_any_failed = true; - } else { - throw ut::Exception (sstr.str ()); - } -} - -void TestBase::test_is_editable_only () -{ - if (!m_editable) { - throw tl::CancelException (); - } -} - -void TestBase::test_is_non_editable_only () -{ - if (m_editable) { - throw tl::CancelException (); - } -} - -void TestBase::test_is_long_runner () -{ - if (!m_slow) { - throw tl::CancelException (); - } -} - -void TestBase::compare_layouts (const db::Layout &layout, const std::string &au_file, NormalizationMode norm, db::Coord tolerance) -{ - compare_layouts (layout, au_file, db::LayerMap (), true, norm, tolerance); -} - -void TestBase::compare_layouts (const db::Layout &layout, const std::string &au_file, const db::LayerMap &lm, bool read_other_layers, NormalizationMode norm, db::Coord tolerance) -{ - // normalize the layout by writing to GDS and reading from .. - - // generate a "unique" name ... - unsigned int hash = 0; - for (const char *cp = au_file.c_str (); *cp; ++cp) { - hash = (hash << 4) ^ (hash >> 4) ^ ((unsigned int) *cp); - } - - std::string tmp_file; - - if (norm == WriteGDS2) { - - tmp_file = ut::TestBase::tmp_file (tl::sprintf ("tmp_%x.gds", hash)); - - tl::OutputStream stream (tmp_file.c_str ()); - db::GDS2Writer writer; - db::SaveLayoutOptions options; - writer.write (const_cast (layout), stream, options); - - } else { - - tmp_file = ut::TestBase::tmp_file (tl::sprintf ("tmp_%x.oas", hash)); - - tl::OutputStream stream (tmp_file.c_str ()); - db::OASISWriter writer; - db::SaveLayoutOptions options; - writer.write (const_cast (layout), stream, options); - - } - - const db::Layout *subject = 0; - db::Layout layout2; - - if (norm != NoNormalization) { - - // read all layers from the original layout, so the layer table is the same - for (db::Layout::layer_iterator l = layout.begin_layers (); l != layout.end_layers (); ++l) { - layout2.insert_layer ((*l).first, *(*l).second); - } - - tl::InputStream stream (tmp_file); - db::Reader reader (stream); - reader.read (layout2); - - subject = &layout2; - - } else { - subject = &layout; - } - - bool equal = false; - bool any = false; - - int n = 0; - for ( ; ! equal; ++n) { - - db::Layout layout_au; - - // read all layers from the original layout, so the layer table is the same - for (db::Layout::layer_iterator l = layout.begin_layers (); l != layout.end_layers (); ++l) { - layout_au.insert_layer ((*l).first, *(*l).second); - } - - db::LoadLayoutOptions options; - options.get_options ().layer_map = lm; - options.get_options ().create_other_layers = read_other_layers; - - std::string fn = au_file; - if (n > 0) { - fn += tl::sprintf (".%d", n); - } - - if (QFileInfo (tl::to_qstring (fn)).exists ()) { - - if (n == 1 && any) { - throw tl::Exception (tl::sprintf ("Inconsistent reference variants for %s: there can be either variants (.1,.2,... suffix) or a single file (without suffix)", au_file)); - } - - any = true; - - tl::InputStream stream (fn); - db::Reader reader (stream); - reader.read (layout_au, options); - - equal = db::compare_layouts (*subject, layout_au, (n > 0 ? db::layout_diff::f_silent : db::layout_diff::f_verbose) | db::layout_diff::f_flatten_array_insts /*| db::layout_diff::f_no_text_details | db::layout_diff::f_no_text_orientation*/, tolerance, 100 /*max diff lines*/); - if (equal && n > 0) { - tl::info << tl::sprintf ("Found match on golden reference variant %s", fn); - } - - } else if (n > 0) { - if (! any) { - tl::warn << tl::sprintf ("No golden data found (%s)", au_file); - } - break; - } - - } - - if (! equal) { - raise (tl::sprintf ("Compare failed - see\n actual: %s\n golden: %s%s", - tl::to_string (QFileInfo (tl::to_qstring (tmp_file)).absoluteFilePath ()), - tl::to_string (QFileInfo (tl::to_qstring (au_file)).absoluteFilePath ()), - (n > 1 ? "\nand variants" : ""))); - } -} - -void TestBase::write_detailed_diff (std::ostream &os, const std::string &subject, const std::string &ref) -{ - os << replicate (" ", TestConsole::instance ()->indent ()) << "Actual value is: " << tl::to_string (subject) << std::endl - << replicate (" ", TestConsole::instance ()->indent ()) << "Reference value is: " << tl::to_string (ref) << std::endl - ; -} - -static std::string read_file (const std::string &path) -{ - QFile file (tl::to_qstring (path)); - if (! file.open (QIODevice::ReadOnly | QIODevice::Text)) { - tl::warn << tl::sprintf ("Unable to open file %s", path); - } - - QByteArray ba = file.readAll (); - return std::string (ba.constData (), 0, ba.size ()); -} - -void TestBase::compare_text_files (const std::string &path_a, const std::string &path_b) -{ - std::string text_a = read_file (path_a); - std::string text_b = read_file (path_b); - - if (text_a != text_b) { - raise (tl::sprintf ("Compare failed - see:\n file 1: %s\n file 2: %s", - tl::to_string (QFileInfo (tl::to_qstring (path_a)).absoluteFilePath ()), - tl::to_string (QFileInfo (tl::to_qstring (path_b)).absoluteFilePath ()))); - } -} - -} diff --git a/src/with_all_libs.pri b/src/with_all_libs.pri index c1d1940c7..42a093fae 100644 --- a/src/with_all_libs.pri +++ b/src/with_all_libs.pri @@ -1,8 +1,8 @@ -INCLUDEPATH += $$TL_INC $$GSI_INC $$DB_INC $$RDB_INC $$LYM_INC $$LAYBASIC_INC $$LAY_INC $$ANT_INC $$IMG_INC $$EDT_INC $$DRC_INC $$EXT_INC $$LIB_INC $$UT_INC $$RBA_INC $$PYA_INC $$VERSION_INC -DEPENDPATH += $$TL_INC $$GSI_INC $$DB_INC $$RDB_INC $$LYM_INC $$LAYBASIC_INC $$LAY_INC $$ANT_INC $$IMG_INC $$EDT_INC $$DRC_INC $$EXT_INC $$LIB_INC $$UT_INC $$RBA_INC $$PYA_INC $$VERSION_INC +INCLUDEPATH += $$TL_INC $$GSI_INC $$DB_INC $$RDB_INC $$LYM_INC $$LAYBASIC_INC $$LAY_INC $$ANT_INC $$IMG_INC $$EDT_INC $$DRC_INC $$EXT_INC $$LIB_INC $$RBA_INC $$PYA_INC $$VERSION_INC +DEPENDPATH += $$TL_INC $$GSI_INC $$DB_INC $$RDB_INC $$LYM_INC $$LAYBASIC_INC $$LAY_INC $$ANT_INC $$IMG_INC $$EDT_INC $$DRC_INC $$EXT_INC $$LIB_INC $$RBA_INC $$PYA_INC $$VERSION_INC -LIBS += $$PYTHONLIBFILE $$RUBYLIBFILE -L$$DESTDIR -lklayout_tl -lklayout_gsi -lklayout_db -lklayout_rdb -lklayout_lym -lklayout_laybasic -lklayout_lay -lklayout_ant -lklayout_img -lklayout_edt -lklayout_drc -lklayout_ext -lklayout_lib -lklayout_ut +LIBS += $$PYTHONLIBFILE $$RUBYLIBFILE -L$$DESTDIR -lklayout_tl -lklayout_gsi -lklayout_db -lklayout_rdb -lklayout_lym -lklayout_laybasic -lklayout_lay -lklayout_ant -lklayout_img -lklayout_edt -lklayout_drc -lklayout_ext -lklayout_lib # Note: this accounts for UI-generated headers placed into the output folders in # shadow builds: