diff --git a/src/db/dbOASISWriter.cc b/src/db/dbOASISWriter.cc index 6d8b5b1b4..bbfc31e76 100644 --- a/src/db/dbOASISWriter.cc +++ b/src/db/dbOASISWriter.cc @@ -25,7 +25,7 @@ #include "dbPolygonGenerators.h" #include "tlDeflate.h" -#include "tlUtils.h" +#include "tlMath.h" #include diff --git a/src/laybasic/layLineStylePalette.cc b/src/laybasic/layLineStylePalette.cc index 1e7d8a221..cb568f5ee 100644 --- a/src/laybasic/layLineStylePalette.cc +++ b/src/laybasic/layLineStylePalette.cc @@ -137,7 +137,6 @@ LineStylePalette::from_string (const std::string &s) while (true) { unsigned int s = 0; - unsigned int st = 0; if (! x.try_read (s)) { break; diff --git a/src/tl/tl.pro b/src/tl/tl.pro index bcccb8173..c59dc2ec9 100644 --- a/src/tl/tl.pro +++ b/src/tl/tl.pro @@ -82,7 +82,9 @@ HEADERS = \ tlXMLParser.h \ tlXMLWriter.h \ tlFileSystemWatcher.h \ - tlCommon.h + tlCommon.h \ + tlMath.h \ + tlCpp.h INCLUDEPATH = DEPENDPATH = diff --git a/src/tl/tlAssert.h b/src/tl/tlAssert.h index 14d7be4aa..c94749dcd 100644 --- a/src/tl/tlAssert.h +++ b/src/tl/tlAssert.h @@ -26,6 +26,7 @@ #define HDR_tlAssert #include "tlCommon.h" +#include "tlCpp.h" namespace tl { @@ -34,10 +35,10 @@ namespace tl * @brief The corresponding assert macro */ -TL_PUBLIC void assertion_failed (const char *filename, unsigned int line, const char *condition); +TL_PUBLIC NO_RETURN void assertion_failed (const char *filename, unsigned int line, const char *condition); // the throw int(0) instruction will tell the compiler that the assertion will not return -#define tl_assert(COND) if (!(COND)) { tl::assertion_failed (__FILE__, __LINE__, #COND); throw int(0); } +#define tl_assert(COND) if (!(COND)) { tl::assertion_failed (__FILE__, __LINE__, #COND); } } // namespace tl diff --git a/src/tl/tlCpp.h b/src/tl/tlCpp.h new file mode 100644 index 000000000..20e54884f --- /dev/null +++ b/src/tl/tlCpp.h @@ -0,0 +1,46 @@ + +/* + + 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_tlCpp +#define HDR_tlCpp + +// A subsitute for C++11 [[noreturn]] +#ifdef __GNUC__ +#define NO_RETURN __attribute__((noreturn)) +#elif __MINGW32__ +#define NO_RETURN __attribute__((noreturn)) +#elif __clang__ +#define NO_RETURN __attribute__((noreturn)) +#elif _MSC_VER +#define NO_RETURN __declspec(noreturn) +#endif + +namespace tl +{ + +// .. nothing yet .. + +} + +#endif + diff --git a/src/tl/tlMath.h b/src/tl/tlMath.h new file mode 100644 index 000000000..77e4d1bcf --- /dev/null +++ b/src/tl/tlMath.h @@ -0,0 +1,58 @@ + +/* + + 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_tlMath +#define HDR_tlMath + +#include "tlAssert.h" + +namespace tl +{ + +/** + * @brief Compute the largest common divider of two numbers using the euclidian method + */ +template +T lcd (T a, T b) +{ + while (true) { + if (a < b) { + b %= a; + if (b == 0) { + return a; + } + } else if (b < a) { + a %= b; + if (a == 0) { + return b; + } + } else { + return a; + } + } +} + +} + +#endif + diff --git a/src/tl/tlUtils.h b/src/tl/tlUtils.h index a1bb6dc7d..c362fbcc6 100644 --- a/src/tl/tlUtils.h +++ b/src/tl/tlUtils.h @@ -358,29 +358,6 @@ struct get_inner_type typedef X result; }; -/** - * @brief Compute the largest common divider of two numbers using the euclidian method - */ -template -T lcd (T a, T b) -{ - while (true) { - if (a < b) { - b %= a; - if (b == 0) { - return a; - } - } else if (b < a) { - a %= b; - if (a == 0) { - return b; - } - } else { - return a; - } - } -} - } #endif diff --git a/src/unit_tests/dbBox.cc b/src/unit_tests/dbBox.cc index 9bcfdca46..69270bae4 100644 --- a/src/unit_tests/dbBox.cc +++ b/src/unit_tests/dbBox.cc @@ -83,10 +83,10 @@ TEST(5) db::Box empty; EXPECT_EQ (b.area (), 100.0 * 200.0); - EXPECT_EQ (b.perimeter (), 600); + EXPECT_EQ (b.perimeter (), db::Box::perimeter_type (600)); EXPECT_EQ (b.to_string (), "(10,10;110,210)"); - EXPECT_EQ (b.width (), 100); - EXPECT_EQ (b.height (), 200); + EXPECT_EQ (b.width (), db::Box::distance_type (100)); + EXPECT_EQ (b.height (), db::Box::distance_type (200)); EXPECT_EQ (b.top (), 210); EXPECT_EQ (b.left (), 10); EXPECT_EQ (b.right (), 110); diff --git a/src/unit_tests/dbBoxScanner.cc b/src/unit_tests/dbBoxScanner.cc index 2b0d6980c..675b359fb 100644 --- a/src/unit_tests/dbBoxScanner.cc +++ b/src/unit_tests/dbBoxScanner.cc @@ -780,8 +780,8 @@ TEST(100) } - EXPECT_EQ (top_cell.shapes (ltmp1).size (), 0); - EXPECT_EQ (top_cell.shapes (ltmp2).size (), 0); + EXPECT_EQ (top_cell.shapes (ltmp1).size (), size_t (0)); + EXPECT_EQ (top_cell.shapes (ltmp2).size (), size_t (0)); } diff --git a/src/unit_tests/dbBoxTree.cc b/src/unit_tests/dbBoxTree.cc index f61fa6aa6..1f9470507 100644 --- a/src/unit_tests/dbBoxTree.cc +++ b/src/unit_tests/dbBoxTree.cc @@ -182,7 +182,7 @@ static void test_tree_overlap (ut::TestBase *_this, const Tree &t, const Box &b, ++i; } - EXPECT_EQ (good_idx.size (), 0); + EXPECT_EQ (good_idx.size (), size_t (0)); } template @@ -220,7 +220,7 @@ static void test_tree_touching (ut::TestBase *_this, const Tree &t, const Box &b ++i; } - EXPECT_EQ (good_idx.size (), 0); + EXPECT_EQ (good_idx.size (), size_t (0)); } inline int rvalue () @@ -264,7 +264,7 @@ TEST(0) t.sort (conv); - EXPECT_EQ (t.size (), 1); + EXPECT_EQ (t.size (), size_t (1)); it = t.begin_touching (db::Box (db::Point (-m,-m), db::Point (m, m)), conv); bitset = 0; @@ -278,7 +278,7 @@ TEST(0) ++it; } - EXPECT_EQ (bitset, 0x1); + EXPECT_EQ (bitset, (unsigned int) 0x1); t.insert (db::Box (-10, 20, 0, 100)); t.insert (db::Box (-10, -20, 20, -15)); @@ -290,7 +290,7 @@ TEST(0) t.insert (db::Box (-10, -20, 5, -10)); t.sort (conv); - EXPECT_EQ (t.size (), 9); + EXPECT_EQ (t.size (), size_t (9)); it = t.begin_touching (db::Box (db::Point (-m,-m), db::Point (m, m)), conv); bitset = 0; @@ -304,7 +304,7 @@ TEST(0) ++it; } - EXPECT_EQ (bitset, 0x1ff); + EXPECT_EQ (bitset, (unsigned int) 0x1ff); it = t.begin_touching (db::Box (-10, 20, -9, 21), conv); bitset = 0; @@ -318,7 +318,7 @@ TEST(0) ++it; } - EXPECT_EQ (bitset, 0xc2); + EXPECT_EQ (bitset, (unsigned int) 0xc2); it = t.begin_touching (db::Box (-20, 20, -19, 21), conv); bitset = 0; @@ -332,7 +332,7 @@ TEST(0) ++it; } - EXPECT_EQ (bitset, 0); + EXPECT_EQ (bitset, (unsigned int) 0); } TEST(1) @@ -681,7 +681,7 @@ TEST(0U) t.sort (conv); - EXPECT_EQ (t.size (), 1); + EXPECT_EQ (t.size (), size_t (1)); it = t.begin_touching (db::Box (db::Point (-m,-m), db::Point (m, m)), conv); bitset = 0; @@ -690,7 +690,7 @@ TEST(0U) ++it; } - EXPECT_EQ (bitset, 0x1); + EXPECT_EQ (bitset, (unsigned int) 0x1); t.insert (db::Box (-10, 20, 0, 100)); t.insert (db::Box (-10, -20, 20, -15)); @@ -702,7 +702,7 @@ TEST(0U) t.insert (db::Box (-10, -20, 5, -10)); t.sort (conv); - EXPECT_EQ (t.size (), 9); + EXPECT_EQ (t.size (), size_t (9)); it = t.begin_touching (db::Box (db::Point (-m,-m), db::Point (m, m)), conv); bitset = 0; @@ -711,7 +711,7 @@ TEST(0U) ++it; } - EXPECT_EQ (bitset, 0x1ff); + EXPECT_EQ (bitset, (unsigned int) 0x1ff); it = t.begin_touching (db::Box (-10, 20, -9, 21), conv); bitset = 0; @@ -720,7 +720,7 @@ TEST(0U) ++it; } - EXPECT_EQ (bitset, 0x31); + EXPECT_EQ (bitset, (unsigned int) 0x31); it = t.begin_touching (db::Box (-20, 20, -19, 21), conv); bitset = 0; @@ -729,7 +729,7 @@ TEST(0U) ++it; } - EXPECT_EQ (bitset, 0); + EXPECT_EQ (bitset, (unsigned int) 0); } TEST(1U) diff --git a/src/unit_tests/dbCell.cc b/src/unit_tests/dbCell.cc index afa8e9c54..fd250483c 100644 --- a/src/unit_tests/dbCell.cc +++ b/src/unit_tests/dbCell.cc @@ -525,7 +525,7 @@ TEST(2) // iterator. Therefore we make a copy in order to prevent that problem. See bug #120. cx = c0; EXPECT_EQ (c2s_unsorted(cx), "4[r0 *1 0,0]#0,3[r90 *1 100,-200]#11,5[r0 *1 0,0]#2,1[r0 *1 0,0]#1,3[r0 *1 0,0]#13"); - EXPECT_EQ (c0.cell_instances (), 5); + EXPECT_EQ (c0.cell_instances (), size_t (5)); // not yet: EXPECT_EQ (c0.empty (), false); inst = c0.begin (); db::Instance i1 = *inst; @@ -572,10 +572,10 @@ TEST(2) c0.erase (i4); EXPECT_EQ (c2s_unsorted(c0), "5[r0 *1 0,0]#2,3[r0 *1 0,0]#13"); - EXPECT_EQ (c0.cell_instances (), 2); + EXPECT_EQ (c0.cell_instances (), size_t (2)); c0.erase (i5); EXPECT_EQ (c2s_unsorted(c0), "5[r0 *1 0,0]#2"); - EXPECT_EQ (c0.cell_instances (), 1); + EXPECT_EQ (c0.cell_instances (), size_t (1)); // not yet: EXPECT_EQ (c0.empty (), false); // note: double delete is not supported in non-editable mode @@ -607,7 +607,7 @@ TEST(2) c0.erase (i3); EXPECT_EQ (c2s_unsorted(c0), ""); - EXPECT_EQ (c0.cell_instances (), 0); + EXPECT_EQ (c0.cell_instances (), size_t (0)); // not yet: EXPECT_EQ (c0.empty (), true); } @@ -748,42 +748,42 @@ TEST(3b) g.transform (db::ICplxTrans (2.5)); m.commit (); - EXPECT_EQ (c1.cell_instances (), 0); - EXPECT_EQ (c0.cell_instances (), 1); + EXPECT_EQ (c1.cell_instances (), size_t (0)); + EXPECT_EQ (c0.cell_instances (), size_t (1)); EXPECT_EQ (c0.begin ()->to_string (), "cell_index=1 r0 250,-250 prop_id=5"); - EXPECT_EQ (c0.shapes (0).size (), 1); - EXPECT_EQ (c0.shapes (1).size (), 0); - EXPECT_EQ (c1.shapes (0).size (), 0); - EXPECT_EQ (c1.shapes (1).size (), 1); + EXPECT_EQ (c0.shapes (0).size (), size_t (1)); + EXPECT_EQ (c0.shapes (1).size (), size_t (0)); + EXPECT_EQ (c1.shapes (0).size (), size_t (0)); + EXPECT_EQ (c1.shapes (1).size (), size_t (1)); EXPECT_EQ (c0.shapes (0).begin (db::ShapeIterator::All)->to_string (), "box (0,250;2500,3000) prop_id=17"); EXPECT_EQ (c1.shapes (1).begin (db::ShapeIterator::All)->to_string (), "box (0,250;2500,3000)"); m.undo (); - EXPECT_EQ (c1.cell_instances (), 0); - EXPECT_EQ (c0.cell_instances (), 1); + EXPECT_EQ (c1.cell_instances (), size_t (0)); + EXPECT_EQ (c0.cell_instances (), size_t (1)); EXPECT_EQ (c0.begin ()->to_string (), "cell_index=1 r0 100,-100 prop_id=5"); - EXPECT_EQ (c0.shapes (0).size (), 1); - EXPECT_EQ (c0.shapes (1).size (), 0); - EXPECT_EQ (c1.shapes (0).size (), 0); - EXPECT_EQ (c1.shapes (1).size (), 1); + EXPECT_EQ (c0.shapes (0).size (), size_t (1)); + EXPECT_EQ (c0.shapes (1).size (), size_t (0)); + EXPECT_EQ (c1.shapes (0).size (), size_t (0)); + EXPECT_EQ (c1.shapes (1).size (), size_t (1)); EXPECT_EQ (c0.shapes (0).begin (db::ShapeIterator::All)->to_string (), "box (0,100;1000,1200) prop_id=17"); EXPECT_EQ (c1.shapes (1).begin (db::ShapeIterator::All)->to_string (), "box (0,100;1000,1200)"); m.redo (); - EXPECT_EQ (c1.cell_instances (), 0); - EXPECT_EQ (c0.cell_instances (), 1); + EXPECT_EQ (c1.cell_instances (), size_t (0)); + EXPECT_EQ (c0.cell_instances (), size_t (1)); EXPECT_EQ (c0.begin ()->to_string (), "cell_index=1 r0 250,-250 prop_id=5"); - EXPECT_EQ (c0.shapes (0).size (), 1); - EXPECT_EQ (c0.shapes (1).size (), 0); - EXPECT_EQ (c1.shapes (0).size (), 0); - EXPECT_EQ (c1.shapes (1).size (), 1); + EXPECT_EQ (c0.shapes (0).size (), size_t (1)); + EXPECT_EQ (c0.shapes (1).size (), size_t (0)); + EXPECT_EQ (c1.shapes (0).size (), size_t (0)); + EXPECT_EQ (c1.shapes (1).size (), size_t (1)); EXPECT_EQ (c0.shapes (0).begin (db::ShapeIterator::All)->to_string (), "box (0,250;2500,3000) prop_id=17"); EXPECT_EQ (c1.shapes (1).begin (db::ShapeIterator::All)->to_string (), "box (0,250;2500,3000)"); diff --git a/src/unit_tests/dbCellGraphUtils.cc b/src/unit_tests/dbCellGraphUtils.cc index ae6ab3774..6b16e8308 100644 --- a/src/unit_tests/dbCellGraphUtils.cc +++ b/src/unit_tests/dbCellGraphUtils.cc @@ -48,69 +48,69 @@ TEST(1) { db::CellCounter cc (&g); - EXPECT_EQ (cc.weight (c0.cell_index ()), 1); - EXPECT_EQ (cc.weight (c1.cell_index ()), 10); - EXPECT_EQ (cc.weight (c2.cell_index ()), 13); - EXPECT_EQ (cc.weight (c3.cell_index ()), 27); - EXPECT_EQ (cc.weight (c4.cell_index ()), 1); + EXPECT_EQ (cc.weight (c0.cell_index ()), size_t (1)); + EXPECT_EQ (cc.weight (c1.cell_index ()), size_t (10)); + EXPECT_EQ (cc.weight (c2.cell_index ()), size_t (13)); + EXPECT_EQ (cc.weight (c3.cell_index ()), size_t (27)); + EXPECT_EQ (cc.weight (c4.cell_index ()), size_t (1)); } { db::CellCounter cc (&g); - EXPECT_EQ (cc.weight (c4.cell_index ()), 1); - EXPECT_EQ (cc.weight (c3.cell_index ()), 27); - EXPECT_EQ (cc.weight (c0.cell_index ()), 1); - EXPECT_EQ (cc.weight (c1.cell_index ()), 10); - EXPECT_EQ (cc.weight (c2.cell_index ()), 13); + EXPECT_EQ (cc.weight (c4.cell_index ()), size_t (1)); + EXPECT_EQ (cc.weight (c3.cell_index ()), size_t (27)); + EXPECT_EQ (cc.weight (c0.cell_index ()), size_t (1)); + EXPECT_EQ (cc.weight (c1.cell_index ()), size_t (10)); + EXPECT_EQ (cc.weight (c2.cell_index ()), size_t (13)); } { db::CellCounter cc (&g); - EXPECT_EQ (cc.weight (c4.cell_index ()), 1); - EXPECT_EQ (cc.weight (c3.cell_index ()), 27); - EXPECT_EQ (cc.weight (c2.cell_index ()), 13); - EXPECT_EQ (cc.weight (c0.cell_index ()), 1); - EXPECT_EQ (cc.weight (c1.cell_index ()), 10); + EXPECT_EQ (cc.weight (c4.cell_index ()), size_t (1)); + EXPECT_EQ (cc.weight (c3.cell_index ()), size_t (27)); + EXPECT_EQ (cc.weight (c2.cell_index ()), size_t (13)); + EXPECT_EQ (cc.weight (c0.cell_index ()), size_t (1)); + EXPECT_EQ (cc.weight (c1.cell_index ()), size_t (10)); } { db::CellCounter cc (&g, c2.cell_index ()); - EXPECT_EQ (cc.weight (c3.cell_index ()), 2); - EXPECT_EQ (cc.weight (c2.cell_index ()), 1); - EXPECT_EQ (cc.weight (c4.cell_index ()), 0); - EXPECT_EQ (cc.weight (c0.cell_index ()), 0); - EXPECT_EQ (cc.weight (c1.cell_index ()), 0); + EXPECT_EQ (cc.weight (c3.cell_index ()), size_t (2)); + EXPECT_EQ (cc.weight (c2.cell_index ()), size_t (1)); + EXPECT_EQ (cc.weight (c4.cell_index ()), size_t (0)); + EXPECT_EQ (cc.weight (c0.cell_index ()), size_t (0)); + EXPECT_EQ (cc.weight (c1.cell_index ()), size_t (0)); } { db::CellCounter cc (&g, c3.cell_index ()); - EXPECT_EQ (cc.weight (c3.cell_index ()), 1); - EXPECT_EQ (cc.weight (c4.cell_index ()), 0); - EXPECT_EQ (cc.weight (c0.cell_index ()), 0); - EXPECT_EQ (cc.weight (c1.cell_index ()), 0); - EXPECT_EQ (cc.weight (c2.cell_index ()), 0); + EXPECT_EQ (cc.weight (c3.cell_index ()), size_t (1)); + EXPECT_EQ (cc.weight (c4.cell_index ()), size_t (0)); + EXPECT_EQ (cc.weight (c0.cell_index ()), size_t (0)); + EXPECT_EQ (cc.weight (c1.cell_index ()), size_t (0)); + EXPECT_EQ (cc.weight (c2.cell_index ()), size_t (0)); } { db::CellCounter cc (&g, c0.cell_index ()); - EXPECT_EQ (cc.weight (c4.cell_index ()), 0); - EXPECT_EQ (cc.weight (c3.cell_index ()), 3); - EXPECT_EQ (cc.weight (c2.cell_index ()), 1); - EXPECT_EQ (cc.weight (c0.cell_index ()), 1); - EXPECT_EQ (cc.weight (c1.cell_index ()), 10); + EXPECT_EQ (cc.weight (c4.cell_index ()), size_t (0)); + EXPECT_EQ (cc.weight (c3.cell_index ()), size_t (3)); + EXPECT_EQ (cc.weight (c2.cell_index ()), size_t (1)); + EXPECT_EQ (cc.weight (c0.cell_index ()), size_t (1)); + EXPECT_EQ (cc.weight (c1.cell_index ()), size_t (10)); } { db::CellCounter cc (&g, c4.cell_index ()); - EXPECT_EQ (cc.weight (c4.cell_index ()), 1); - EXPECT_EQ (cc.weight (c3.cell_index ()), 24); - EXPECT_EQ (cc.weight (c2.cell_index ()), 12); - EXPECT_EQ (cc.weight (c0.cell_index ()), 0); - EXPECT_EQ (cc.weight (c1.cell_index ()), 0); + EXPECT_EQ (cc.weight (c4.cell_index ()), size_t (1)); + EXPECT_EQ (cc.weight (c3.cell_index ()), size_t (24)); + EXPECT_EQ (cc.weight (c2.cell_index ()), size_t (12)); + EXPECT_EQ (cc.weight (c0.cell_index ()), size_t (0)); + EXPECT_EQ (cc.weight (c1.cell_index ()), size_t (0)); } } diff --git a/src/unit_tests/dbCellHullGenerator.cc b/src/unit_tests/dbCellHullGenerator.cc index c37de98b7..aedbbb74c 100644 --- a/src/unit_tests/dbCellHullGenerator.cc +++ b/src/unit_tests/dbCellHullGenerator.cc @@ -258,8 +258,8 @@ TEST(2) hull.clear (); chg.set_complexity (0); chg.generate_hull (c1, hull); - EXPECT_EQ (hull.size (), 1); - EXPECT_EQ (hull.front ().holes (), 0); + EXPECT_EQ (hull.size (), size_t (1)); + EXPECT_EQ (hull.front ().holes (), size_t (0)); EXPECT_EQ (hull.front ().hull ().size () <= 8, true); EXPECT_EQ (check_hull (hull, c1.shapes (l1)), true); } diff --git a/src/unit_tests/dbCellMapping.cc b/src/unit_tests/dbCellMapping.cc index a77ff7341..3cb441d63 100644 --- a/src/unit_tests/dbCellMapping.cc +++ b/src/unit_tests/dbCellMapping.cc @@ -286,7 +286,7 @@ TEST(3) cm.clear (); nc = cm.create_from_geometry_full (h, b0.cell_index (), g, a0.cell_index ()); - EXPECT_EQ (nc.size (), 0); + EXPECT_EQ (nc.size (), size_t (0)); if (pass < 3) { if (order == 1) { EXPECT_EQ (m2sr (cm, g, h), "a0->b0;a5->b5;a4->b4"); @@ -354,7 +354,7 @@ TEST(4) cm.clear (); db::Layout hh = h; nc = cm.create_from_names_full (hh, b0.cell_index (), g, a0.cell_index ()); - EXPECT_EQ (nc.size (), 0); + EXPECT_EQ (nc.size (), size_t (0)); EXPECT_EQ (m2sr (cm, g, hh), "a0->a0top;a4->a4;a5->a5"); } @@ -410,7 +410,7 @@ TEST(5) cm.clear (); db::Layout hh = h; nc = cm.create_single_mapping_full (hh, b0.cell_index (), g, a0.cell_index ()); - EXPECT_EQ (nc.size (), 2); + EXPECT_EQ (nc.size (), size_t (2)); EXPECT_EQ (m2sr (cm, g, hh), "a0->a0top;a4->a4$1;a5->a5$1"); EXPECT_EQ (l2s (g), "a0#0:cell_index=1 r90 0,0 array=(0,10,10,0 5x2),cell_index=2 r90 0,0 array=(0,10,10,0 5x2);a4#1:;a5#2:"); @@ -421,7 +421,7 @@ TEST(5) hh = h; hh.dbu (hh.dbu () * 0.5); nc = cm.create_single_mapping_full (hh, b0.cell_index (), g, a0.cell_index ()); - EXPECT_EQ (nc.size (), 2); + EXPECT_EQ (nc.size (), size_t (2)); EXPECT_EQ (m2sr (cm, g, hh), "a0->a0top;a4->a4$1;a5->a5$1"); EXPECT_EQ (l2s (hh), "a0top#0:cell_index=4 r90 0,0 array=(0,10,10,0 5x1),cell_index=5 r90 0,0 array=(0,10,10,0 5x2),cell_index=1 r0 10,0,cell_index=6 r90 0,0 array=(0,20,20,0 5x2),cell_index=7 r90 0,0 array=(0,20,20,0 5x2);a1#1:cell_index=2 r0 0,0,cell_index=2 r0 0,20,cell_index=3 r0 0,40;a2#2:cell_index=3 r0 0,0,cell_index=3 r0 0,10;a3#3:cell_index=4 r90 0,0;a4#4:;a5#5:;a4$1#6:;a5$1#7:"); diff --git a/src/unit_tests/dbClip.cc b/src/unit_tests/dbClip.cc index 561ce49b4..549bc4c61 100644 --- a/src/unit_tests/dbClip.cc +++ b/src/unit_tests/dbClip.cc @@ -52,7 +52,7 @@ TEST(1) out_spoly.clear (); db::clip_poly (in_poly, t270 * box, out_spoly); - EXPECT_EQ (out_spoly.size (), 1); + EXPECT_EQ (out_spoly.size (), size_t (1)); EXPECT_EQ (out_spoly[0].to_string(), "(0,-90;0,-20;20,-20;20,-80;80,-80;80,-20;0,-20;0,0;90,0;90,-90)"); db::FTrans t180 (db::FTrans::r180); @@ -60,7 +60,7 @@ TEST(1) out_spoly.clear (); db::clip_poly (in_poly, t180 * box, out_spoly); - EXPECT_EQ (out_spoly.size (), 1); + EXPECT_EQ (out_spoly.size (), size_t (1)); EXPECT_EQ (out_spoly[0].to_string(), "(-90,-90;-90,-20;-80,-20;-80,-80;-20,-80;-20,-20;-90,-20;-90,0;0,0;0,-90)"); db::FTrans t90 (db::FTrans::r90); @@ -68,14 +68,14 @@ TEST(1) out_spoly.clear (); db::clip_poly (in_poly, t90 * box, out_spoly); - EXPECT_EQ (out_spoly.size (), 1); + EXPECT_EQ (out_spoly.size (), size_t (1)); EXPECT_EQ (out_spoly[0].to_string(), "(-90,0;-90,80;-80,80;-80,20;-20,20;-20,80;-90,80;-90,90;0,90;0,0)"); in_poly.assign_hull(input, input + sizeof(input) / sizeof(input[0])); out_spoly.clear (); db::clip_poly (in_poly, box, out_spoly); - EXPECT_EQ (out_spoly.size (), 1); + EXPECT_EQ (out_spoly.size (), size_t (1)); EXPECT_EQ (out_spoly[0].to_string(), "(0,0;0,80;20,80;20,20;80,20;80,80;0,80;0,90;90,90;90,0)"); } @@ -105,7 +105,7 @@ TEST(2) out_spoly.clear (); db::clip_poly (in_poly, box, out_spoly); - EXPECT_EQ (out_spoly.size (), 1); + EXPECT_EQ (out_spoly.size (), size_t (1)); EXPECT_EQ (out_spoly[0].to_string(), "(0,0;0,1000;400,1000;400,500;1000,500;1000,1000;0,1000;0,1700;1400,1700;1400,1000;2200,1000;2200,0)"); box = db::Box (0, 0, 1200, 2000); @@ -114,7 +114,7 @@ TEST(2) out_spoly.clear (); db::clip_poly (in_poly, box, out_spoly); - EXPECT_EQ (out_spoly.size (), 1); + EXPECT_EQ (out_spoly.size (), size_t (1)); EXPECT_EQ (out_spoly[0].to_string(), "(0,0;0,1000;400,1000;400,500;1000,500;1000,1000;0,1000;0,1700;1200,1700;1200,0)"); box = db::Box (0, 0, 1200, 1200); @@ -123,7 +123,7 @@ TEST(2) out_spoly.clear (); db::clip_poly (in_poly, box, out_spoly); - EXPECT_EQ (out_spoly.size (), 1); + EXPECT_EQ (out_spoly.size (), size_t (1)); EXPECT_EQ (out_spoly[0].to_string(), "(0,0;0,1000;400,1000;400,500;1000,500;1000,1000;0,1000;0,1200;1200,1200;1200,0)"); box = db::Box (200, 200, 1200, 1200); @@ -132,7 +132,7 @@ TEST(2) out_spoly.clear (); db::clip_poly (in_poly, box, out_spoly); - EXPECT_EQ (out_spoly.size (), 1); + EXPECT_EQ (out_spoly.size (), size_t (1)); EXPECT_EQ (out_spoly[0].to_string(), "(200,200;200,1000;400,1000;400,500;1000,500;1000,1000;200,1000;200,1200;1200,1200;1200,200)"); box = db::Box (200, 200, 800, 1200); @@ -141,7 +141,7 @@ TEST(2) out_spoly.clear (); db::clip_poly (in_poly, box, out_spoly); - EXPECT_EQ (out_spoly.size (), 1); + EXPECT_EQ (out_spoly.size (), size_t (1)); EXPECT_EQ (out_spoly[0].to_string(), "(200,200;200,1200;800,1200;800,1000;400,1000;400,500;800,500;800,200)"); } @@ -481,7 +481,7 @@ TEST(3) } } - EXPECT_EQ (out_spoly.size (), 2); + EXPECT_EQ (out_spoly.size (), size_t (2)); EXPECT_EQ (out_spoly[0].to_string (), "(104931394,20747500;105644194,21460300;105644194,20747500)"); EXPECT_EQ (out_spoly[1].to_string (), "(102977000,26550100;102928399,26559767;102859667,26628499;102850000,26677100;" "102850000,27150000;101100000,27150000;101100000,26877100;101090333,26828499;" @@ -549,7 +549,7 @@ TEST(4) std::vector out_poly; db::clip_poly (in_poly, box, out_poly); - EXPECT_EQ (out_poly.size (), 0); + EXPECT_EQ (out_poly.size (), size_t (0)); } TEST(5) @@ -580,7 +580,7 @@ TEST(5) std::vector out_poly; db::clip_poly (in_poly, box, out_poly); - EXPECT_EQ (out_poly.size (), 2); + EXPECT_EQ (out_poly.size (), size_t (2)); EXPECT_EQ (out_poly[0].to_string(), "(54,0;54,10;100,671;100,631)"); EXPECT_EQ (out_poly[1].to_string(), "(51,20;51,40;100,737;100,711;53,50;52,30)"); diff --git a/src/unit_tests/dbEdge.cc b/src/unit_tests/dbEdge.cc index 26b6c29ae..dd063ca5b 100644 --- a/src/unit_tests/dbEdge.cc +++ b/src/unit_tests/dbEdge.cc @@ -40,8 +40,8 @@ TEST(1) EXPECT_EQ (e.dx (), 100); EXPECT_EQ (e.dy (), 200); EXPECT_EQ (e.transformed (db::Trans (1, db::Vector (0, 0))).dx (), -200); - EXPECT_EQ (e.transformed (db::Trans (1, db::Vector (0, 0))).dx_abs (), 200); - EXPECT_EQ (e.transformed (db::Trans (1, db::Vector (0, -100))).dy_abs (), 100); + EXPECT_EQ (e.transformed (db::Trans (1, db::Vector (0, 0))).dx_abs (), db::Edge::distance_type (200)); + EXPECT_EQ (e.transformed (db::Trans (1, db::Vector (0, -100))).dy_abs (), db::Edge::distance_type (100)); EXPECT_EQ (e.dy (), 200); EXPECT_EQ (e != db::Edge (db::Point (0, 0), db::Point (100, 200)), false); EXPECT_EQ (e == db::Edge (db::Point (0, 0), db::Point (100, 200)), true); @@ -49,7 +49,7 @@ TEST(1) EXPECT_EQ (e.enlarged (db::Vector (10, 20)), db::Edge (db::Point (-10, -20), db::Point (110, 220))); EXPECT_EQ (e.length (), db::coord_traits ::rounded_distance (sqrt (double (100*100+200*200)))); EXPECT_EQ (e.sq_length (), 100*100+200*200); - EXPECT_EQ (e.ortho_length (), 100+200); + EXPECT_EQ (e.ortho_length (), size_t (100+200)); EXPECT_EQ (e.to_string (), "(0,0;100,200)"); EXPECT_EQ (e.swapped_points ().to_string (), "(100,200;0,0)"); EXPECT_EQ (e.to_string (), "(0,0;100,200)"); @@ -94,10 +94,10 @@ TEST(2) EXPECT_EQ (e.contains (db::Point (-200,-400)), false); EXPECT_EQ (e.contains (db::Point (0,0)), true); EXPECT_EQ (db::Edge (10,20,110,230).distance (db::Point (100, 200)), -4); - EXPECT_EQ (db::Edge (10,20,110,230).distance_abs (db::Point (100, 200)), 4); + EXPECT_EQ (db::Edge (10,20,110,230).distance_abs (db::Point (100, 200)), db::Edge::distance_type (4)); EXPECT_EQ (db::Edge (10,20,110,210).distance (db::Point (100, 200)), 4); EXPECT_EQ (db::Edge (10,20,110,222).distance (db::Point (100, 200)), -1); - EXPECT_EQ (db::Edge (10,20,110,222).distance_abs (db::Point (100, 200)), 1); + EXPECT_EQ (db::Edge (10,20,110,222).distance_abs (db::Point (100, 200)), db::Edge::distance_type (1)); EXPECT_EQ (db::Edge (10,20,110,222).contains (db::Point (0, 0)), false); EXPECT_EQ (db::Edge (10,20,110,222).contains (db::Point (100, 200)), false); } diff --git a/src/unit_tests/dbEdgePairRelations.cc b/src/unit_tests/dbEdgePairRelations.cc index 1aa792f45..13071ebc0 100644 --- a/src/unit_tests/dbEdgePairRelations.cc +++ b/src/unit_tests/dbEdgePairRelations.cc @@ -28,24 +28,24 @@ TEST(1) { - EXPECT_EQ (edge_projection (db::Edge (db::Point (0, 0), db::Point (100, 0)), db::Edge (db::Point (50, 0), db::Point (75, 0))), 25); - EXPECT_EQ (edge_projection (db::Edge (db::Point (100, 0), db::Point (0, 0)), db::Edge (db::Point (50, 0), db::Point (75, 0))), 25); - EXPECT_EQ (edge_projection (db::Edge (db::Point (100, 0), db::Point (0, 0)), db::Edge (db::Point (75, 0), db::Point (50, 0))), 25); - EXPECT_EQ (edge_projection (db::Edge (db::Point (0, 0), db::Point (100, 0)), db::Edge (db::Point (75, 0), db::Point (50, 0))), 25); - EXPECT_EQ (edge_projection (db::Edge (db::Point (0, 0), db::Point (100, 0)), db::Edge (db::Point (50, 10), db::Point (75, 100))), 25); - EXPECT_EQ (edge_projection (db::Edge (db::Point (10, 10), db::Point (100, 100)), db::Edge (db::Point (0, 0), db::Point (60, 0))), 28); - EXPECT_EQ (edge_projection (db::Edge (db::Point (10, 10), db::Point (100, 100)), db::Edge (db::Point (0, 0), db::Point (0, 0))), 0); - EXPECT_EQ (edge_projection (db::Edge (db::Point (0, 0), db::Point (0, 0)), db::Edge (db::Point (0, 0), db::Point (0, 0))), 0); - EXPECT_EQ (edge_projection (db::Edge (db::Point (0, 0), db::Point (0, 0)), db::Edge (db::Point (0, 0), db::Point (10, 0))), 0); - EXPECT_EQ (edge_projection (db::Edge (db::Point (10, 10), db::Point (100, 100)), db::Edge (db::Point (0, 0), db::Point (10, 0))), 0); - EXPECT_EQ (edge_projection (db::Edge (db::Point (-10, -10), db::Point (100, 100)), db::Edge (db::Point (0, 0), db::Point (10, 0))), 7); - EXPECT_EQ (edge_projection (db::Edge (db::Point (100, 100), db::Point (-10, -10)), db::Edge (db::Point (0, 0), db::Point (10, 0))), 7); - EXPECT_EQ (edge_projection (db::Edge (db::Point (100, 100), db::Point (-10, -10)), db::Edge (db::Point (10, 0), db::Point (0, 0))), 7); - EXPECT_EQ (edge_projection (db::Edge (db::Point (-10, -10), db::Point (100, 100)), db::Edge (db::Point (10, 0), db::Point (0, 0))), 7); - EXPECT_EQ (edge_projection (db::Edge (db::Point (-10, -10), db::Point (100, 100)), db::Edge (db::Point (0, 0), db::Point (12, -10))), 1); - EXPECT_EQ (edge_projection (db::Edge (db::Point (-10, -10), db::Point (100, 100)), db::Edge (db::Point (0, 0), db::Point (10, -12))), 1); - EXPECT_EQ (edge_projection (db::Edge (db::Point (-5, -15), db::Point (105, 95)), db::Edge (db::Point (-20, 24), db::Point (20, -24))), 6); - EXPECT_EQ (edge_projection (db::Edge (db::Point (-15, -5), db::Point (95, 105)), db::Edge (db::Point (24, -20), db::Point (-24, 20))), 6); + EXPECT_EQ (edge_projection (db::Edge (db::Point (0, 0), db::Point (100, 0)), db::Edge (db::Point (50, 0), db::Point (75, 0))), db::Edge::distance_type (25)); + EXPECT_EQ (edge_projection (db::Edge (db::Point (100, 0), db::Point (0, 0)), db::Edge (db::Point (50, 0), db::Point (75, 0))), db::Edge::distance_type (25)); + EXPECT_EQ (edge_projection (db::Edge (db::Point (100, 0), db::Point (0, 0)), db::Edge (db::Point (75, 0), db::Point (50, 0))), db::Edge::distance_type (25)); + EXPECT_EQ (edge_projection (db::Edge (db::Point (0, 0), db::Point (100, 0)), db::Edge (db::Point (75, 0), db::Point (50, 0))), db::Edge::distance_type (25)); + EXPECT_EQ (edge_projection (db::Edge (db::Point (0, 0), db::Point (100, 0)), db::Edge (db::Point (50, 10), db::Point (75, 100))), db::Edge::distance_type (25)); + EXPECT_EQ (edge_projection (db::Edge (db::Point (10, 10), db::Point (100, 100)), db::Edge (db::Point (0, 0), db::Point (60, 0))), db::Edge::distance_type (28)); + EXPECT_EQ (edge_projection (db::Edge (db::Point (10, 10), db::Point (100, 100)), db::Edge (db::Point (0, 0), db::Point (0, 0))), db::Edge::distance_type (0)); + EXPECT_EQ (edge_projection (db::Edge (db::Point (0, 0), db::Point (0, 0)), db::Edge (db::Point (0, 0), db::Point (0, 0))), db::Edge::distance_type (0)); + EXPECT_EQ (edge_projection (db::Edge (db::Point (0, 0), db::Point (0, 0)), db::Edge (db::Point (0, 0), db::Point (10, 0))), db::Edge::distance_type (0)); + EXPECT_EQ (edge_projection (db::Edge (db::Point (10, 10), db::Point (100, 100)), db::Edge (db::Point (0, 0), db::Point (10, 0))), db::Edge::distance_type (0)); + EXPECT_EQ (edge_projection (db::Edge (db::Point (-10, -10), db::Point (100, 100)), db::Edge (db::Point (0, 0), db::Point (10, 0))), db::Edge::distance_type (7)); + EXPECT_EQ (edge_projection (db::Edge (db::Point (100, 100), db::Point (-10, -10)), db::Edge (db::Point (0, 0), db::Point (10, 0))), db::Edge::distance_type (7)); + EXPECT_EQ (edge_projection (db::Edge (db::Point (100, 100), db::Point (-10, -10)), db::Edge (db::Point (10, 0), db::Point (0, 0))), db::Edge::distance_type (7)); + EXPECT_EQ (edge_projection (db::Edge (db::Point (-10, -10), db::Point (100, 100)), db::Edge (db::Point (10, 0), db::Point (0, 0))), db::Edge::distance_type (7)); + EXPECT_EQ (edge_projection (db::Edge (db::Point (-10, -10), db::Point (100, 100)), db::Edge (db::Point (0, 0), db::Point (12, -10))), db::Edge::distance_type (1)); + EXPECT_EQ (edge_projection (db::Edge (db::Point (-10, -10), db::Point (100, 100)), db::Edge (db::Point (0, 0), db::Point (10, -12))), db::Edge::distance_type (1)); + EXPECT_EQ (edge_projection (db::Edge (db::Point (-5, -15), db::Point (105, 95)), db::Edge (db::Point (-20, 24), db::Point (20, -24))), db::Edge::distance_type (6)); + EXPECT_EQ (edge_projection (db::Edge (db::Point (-15, -5), db::Point (95, 105)), db::Edge (db::Point (24, -20), db::Point (-24, 20))), db::Edge::distance_type (6)); } TEST(2) diff --git a/src/unit_tests/dbEdgePairs.cc b/src/unit_tests/dbEdgePairs.cc index ab4846af1..086913743 100644 --- a/src/unit_tests/dbEdgePairs.cc +++ b/src/unit_tests/dbEdgePairs.cc @@ -37,13 +37,13 @@ TEST(1) EXPECT_EQ (ep != db::EdgePairs (), false); ep.insert (db::Edge (db::Point (10, 20), db::Point (110, 120)), db::Edge (db::Point (-10, -20), db::Point (90, 80))); EXPECT_EQ (ep.empty (), false); - EXPECT_EQ (ep.size (), 1); + EXPECT_EQ (ep.size (), size_t (1)); EXPECT_EQ (ep.bbox ().to_string (), "(-10,-20;110,120)"); EXPECT_EQ (ep.to_string (), "(10,20;110,120)/(-10,-20;90,80)"); ep.clear (); EXPECT_EQ (ep.empty (), true); - EXPECT_EQ (ep.size (), 0); + EXPECT_EQ (ep.size (), size_t (0)); EXPECT_EQ (ep.bbox ().to_string (), "()"); ep.insert (db::EdgePair (db::Edge (db::Point (10, 20), db::Point (110, 120)), db::Edge (db::Point (-10, -20), db::Point (90, 80)))); EXPECT_EQ (ep == db::EdgePairs (), false); @@ -65,14 +65,14 @@ TEST(1) db::EdgePairs ep2; EXPECT_EQ (ep2.empty (), true); - EXPECT_EQ (ep2.size (), 0); + EXPECT_EQ (ep2.size (), size_t (0)); EXPECT_EQ (ep2.bbox ().to_string (), "()"); ep2.swap (ep); EXPECT_EQ (ep.empty (), true); - EXPECT_EQ (ep.size (), 0); + EXPECT_EQ (ep.size (), size_t (0)); EXPECT_EQ (ep.bbox ().to_string (), "()"); EXPECT_EQ (ep2.empty (), false); - EXPECT_EQ (ep2.size (), 1); + EXPECT_EQ (ep2.size (), size_t (1)); EXPECT_EQ (ep2.bbox ().to_string (), "(-20,-110;120,10)"); } diff --git a/src/unit_tests/dbEdgeProcessor.cc b/src/unit_tests/dbEdgeProcessor.cc index 00ad30a38..5a222e523 100644 --- a/src/unit_tests/dbEdgeProcessor.cc +++ b/src/unit_tests/dbEdgeProcessor.cc @@ -902,11 +902,11 @@ TEST(13) db::EdgeProcessor ep; ep.size (in, -75, out); - EXPECT_EQ (out.size (), 0); + EXPECT_EQ (out.size (), size_t (0)); out.clear(); ep.size (in, -25, out); - EXPECT_EQ (out.size (), 1); + EXPECT_EQ (out.size (), size_t (1)); EXPECT_EQ (out[0].to_string (), "(25,25;25,75;75,75;75,25)"); } @@ -969,7 +969,7 @@ TEST(14) db::EdgeProcessor ep; ep.boolean (in1, in2, out, db::BooleanOp::Xor, false, false); - EXPECT_EQ (out.size (), 3); + EXPECT_EQ (out.size (), size_t (3)); std::sort (out.begin (), out.end ()); EXPECT_EQ (out[0].to_string (), "(71239900,114014305;71192097,114062108;71192097,114062113;71151715,114102490;71117705,114136500;71117701,114136500;70303697,114950403;70198487,114950397;70124100,114876000;70124100,115107255;71239900,115107255)"); EXPECT_EQ (out[1].to_string (), "(70198495,114696400;70164485,114730410;70198499,114696400)"); @@ -1010,7 +1010,7 @@ TEST(15) db::EdgeProcessor ep; ep.boolean (in1, in2, out, db::BooleanOp::And, false, false); - EXPECT_EQ (out.size (), 1); + EXPECT_EQ (out.size (), size_t (1)); std::sort (out.begin (), out.end ()); EXPECT_EQ (out[0].to_string (), "(43264,22390;1467712,245710;1511719,25671;1511726,25637;1512360,22467)"); } @@ -1053,7 +1053,7 @@ TEST(16) db::EdgeProcessor ep; ep.simple_merge (in1, out, false, false); - EXPECT_EQ (out.size (), 1); + EXPECT_EQ (out.size (), size_t (1)); std::sort (out.begin (), out.end ()); EXPECT_EQ (out[0].to_string (), "(13,0;13,2818;0,2818;13,6286;13,6422;4,9832;25,9817;27,10304;2825,7874;10592,2485;7336,2442;10873,6)"); } @@ -1096,7 +1096,7 @@ TEST(17) db::EdgeProcessor ep; ep.simple_merge (in1, out, false, false); - EXPECT_EQ (out.size (), 1); + EXPECT_EQ (out.size (), size_t (1)); std::sort (out.begin (), out.end ()); EXPECT_EQ (out[0].to_string (), "(0,18;130,64;113,64;218,100;204,100;700,266;706,268;1177,434;1177,429;1293,469;1293,463;1388,495;1387,101;1293,101;1293,64;1178,64;1178,18)"); } @@ -1139,7 +1139,7 @@ TEST(18) db::EdgeProcessor ep; ep.simple_merge (in1, out, false, false); - EXPECT_EQ (out.size (), 1); + EXPECT_EQ (out.size (), size_t (1)); std::sort (out.begin (), out.end ()); EXPECT_EQ (out[0].to_string (), "(419,1400;468,1405;453,1405;926,1451;953,1454;2281,1589;2284,1589;2284,1585;2316,1588;2316,1405;2284,1405;2284,1400)"); } @@ -1185,7 +1185,7 @@ TEST(19) db::EdgeProcessor ep; ep.simple_merge (in1, out, false, false); - EXPECT_EQ (out.size (), 1); + EXPECT_EQ (out.size (), size_t (1)); std::sort (out.begin (), out.end ()); EXPECT_EQ (out[0].to_string (), "(12654800,0;0,8492100;12316037,26845401;12771101,29120740;12851400,29524600;12851876,29524621;16663400,48582400;31607400,45593600;28260773,30196549;145086300,35290900;145086300,20050900;27739393,27797800;26821540,23574973;27109200,23471400;26629840,22693003;26029700,19931900;25128663,20255356)"); } @@ -1228,7 +1228,7 @@ TEST(20) db::EdgeProcessor ep; ep.simple_merge (in1, out, false, false); - EXPECT_EQ (out.size (), 2); + EXPECT_EQ (out.size (), size_t (2)); std::sort (out.begin (), out.end ()); EXPECT_EQ (out[0].to_string (), "(7362,2768;7532,2826;7374,2768)"); EXPECT_EQ (out[1].to_string (), "(7394,2768;7533,2826;7434,2768;7427,2768;7533,2826;7404,2768)"); @@ -1266,7 +1266,7 @@ TEST(21) db::EdgeProcessor ep; ep.boolean (in1, in2, out, db::BooleanOp::And, false, false); - EXPECT_EQ (out.size (), 1); + EXPECT_EQ (out.size (), size_t (1)); std::sort (out.begin (), out.end ()); EXPECT_EQ (out[0].to_string (), "(3527,4261;3805,5687;4217,5015;4217,5014)"); } @@ -1301,7 +1301,7 @@ TEST(22) db::EdgeProcessor ep; ep.boolean (in1, in2, out, db::BooleanOp::And, false, false); - EXPECT_EQ (out.size (), 1); + EXPECT_EQ (out.size (), size_t (1)); std::sort (out.begin (), out.end ()); EXPECT_EQ (out[0].to_string (), "(9985,0;0,2236;13709,3746;12464,2479)"); } @@ -1325,7 +1325,7 @@ TEST(23) db::EdgeProcessor ep; ep.simple_merge (in1, out, false, false); - EXPECT_EQ (out.size (), 1); + EXPECT_EQ (out.size (), size_t (1)); std::sort (out.begin (), out.end ()); EXPECT_EQ (out[0].to_string (), "(0,0;0,1;1,0)"); } @@ -1390,7 +1390,7 @@ TEST(24) db::EdgeProcessor ep; ep.simple_merge (in1, out, false, false); - EXPECT_EQ (out.size (), 2); + EXPECT_EQ (out.size (), size_t (2)); std::sort (out.begin (), out.end ()); EXPECT_EQ (out[0].to_string (), "(0,-9;0,0;3,0;3,-2;1,0;1,-9)"); EXPECT_EQ (out[1].to_string (), "(-2,1;-2,3;0,1;0,10;1,10;1,1)"); @@ -1435,7 +1435,7 @@ TEST(25) db::EdgeProcessor ep; ep.simple_merge (in1, out, false, false, 1); - EXPECT_EQ (out.size (), 2); + EXPECT_EQ (out.size (), size_t (2)); std::sort (out.begin (), out.end ()); EXPECT_EQ (out[0].to_string (), "(-471,2264;-471,2367;-353,2367;-353,2264)"); EXPECT_EQ (out[1].to_string (), "(-323,2390;-327,2392;-324,2392)"); @@ -1538,7 +1538,7 @@ TEST(27) ep.process (pg, op); - EXPECT_EQ (out.size (), 4); + EXPECT_EQ (out.size (), size_t (4)); EXPECT_EQ (out[0].to_string (), "(100,0;100,100;900,100;900,0)"); EXPECT_EQ (out[1].to_string (), "(0,100;0,900;100,900;100,100)"); EXPECT_EQ (out[2].to_string (), "(900,100;900,900;1000,900;1000,100)"); @@ -1558,7 +1558,7 @@ TEST(27) ep.process (pg, op); - EXPECT_EQ (out.size (), 1); + EXPECT_EQ (out.size (), size_t (1)); EXPECT_EQ (out[0].to_string (), "(100,0;100,100;0,100;0,900;100,900;100,1000;900,1000;900,900;1000,900;1000,100;900,100;900,0/100,100;900,100;900,900;100,900)"); } @@ -1575,7 +1575,7 @@ TEST(27) ep.process (pg, op); - EXPECT_EQ (out.size (), 1); + EXPECT_EQ (out.size (), size_t (1)); EXPECT_EQ (out[0].to_string (), "(0,0;0,1000;1000,1000;1000,0/100,100;900,100;900,900;100,900)"); } @@ -1591,7 +1591,7 @@ TEST(27) ep.process (pg, op); - EXPECT_EQ (out.size (), 1); + EXPECT_EQ (out.size (), size_t (1)); EXPECT_EQ (out[0].to_string (), "(100,0;100,100;0,100;0,900;100,900;100,1000;900,1000;900,900;1000,900;1000,100;900,100;900,0/100,100;900,100;900,900;100,900)"); } @@ -1607,7 +1607,7 @@ TEST(27) ep.process (pg, op); - EXPECT_EQ (out.size (), 1); + EXPECT_EQ (out.size (), size_t (1)); EXPECT_EQ (out[0].to_string (), "(0,0;0,1000;1000,1000;1000,0/100,100;900,100;900,900;100,900)"); } } @@ -1667,7 +1667,7 @@ TEST(28) ep.process (pg, op); - EXPECT_EQ (out.size (), 1); + EXPECT_EQ (out.size (), size_t (1)); EXPECT_EQ (out[0].to_string (), "(-488720,-758200;-490960,-728451;-489451,-724867;-489450,-724867;-487680,-724734;-487675,-724800;-485180,-757934)"); } @@ -1714,7 +1714,7 @@ TEST(29) ep.process (pg, op); - EXPECT_EQ (out.size (), 1); + EXPECT_EQ (out.size (), size_t (1)); EXPECT_EQ (out[0].to_string (), "(0,0;0,608;172,602;572,588;580,588;710,583;710,0)"); } @@ -1744,7 +1744,7 @@ TEST(30) ep.process (ec, op); - EXPECT_EQ (out.size (), 2); + EXPECT_EQ (out.size (), size_t (2)); EXPECT_EQ (out[0].to_string (), "(0,400;400,400)"); EXPECT_EQ (out[1].to_string (), "(0,403;386,414)"); } @@ -1959,7 +1959,7 @@ TEST(40) ep.process (pg, op); - EXPECT_EQ (out.size (), 4); + EXPECT_EQ (out.size (), size_t (4)); EXPECT_EQ (out[0].to_string (), "(0,0;0,100;1000,100;1000,0)"); EXPECT_EQ (out[1].to_string (), "(0,100;0,800;100,800;100,100)"); EXPECT_EQ (out[2].to_string (), "(800,100;800,800;1000,800;1000,100)"); @@ -1980,7 +1980,7 @@ TEST(41) ep.process (pg, op); - EXPECT_EQ (out.size (), 6); + EXPECT_EQ (out.size (), size_t (6)); EXPECT_EQ (out[0].to_string (), "(0,0;0,100;1000,100;1000,0)"); EXPECT_EQ (out[1].to_string (), "(0,100;0,400;100,400;100,100)"); EXPECT_EQ (out[2].to_string (), "(400,100;400,400;1000,400;1000,100)"); @@ -2002,7 +2002,7 @@ TEST(42) ep.process (pg, op); - EXPECT_EQ (out.size (), 4); + EXPECT_EQ (out.size (), size_t (4)); EXPECT_EQ (out[0].to_string (), "(400,0;400,400;1000,400;1000,0)"); EXPECT_EQ (out[1].to_string (), "(0,400;0,600;400,600;400,400)"); EXPECT_EQ (out[2].to_string (), "(600,400;600,600;1000,600;1000,400)"); @@ -2024,7 +2024,7 @@ TEST(43) ep.process (pg, op); - EXPECT_EQ (out.size (), 2); + EXPECT_EQ (out.size (), size_t (2)); EXPECT_EQ (out[0].to_string (), "(0,0;250,500;1000,500;1000,0)"); EXPECT_EQ (out[1].to_string (), "(250,500;500,1000;1000,500)"); } @@ -2054,7 +2054,7 @@ TEST(44) ep.process (pg, op); - EXPECT_EQ (out.size (), 5); + EXPECT_EQ (out.size (), size_t (5)); EXPECT_EQ (out[0].to_string (), "(0,0;0,2000;9000,2000;9000,0)"); EXPECT_EQ (out[1].to_string (), "(0,2000;0,2500;3000,2500;6500,2000)"); EXPECT_EQ (out[2].to_string (), "(0,2500;0,3000;2500,3000;3000,2500)"); @@ -2087,7 +2087,7 @@ TEST(45) ep.process (pg, op); - EXPECT_EQ (out.size (), 5); + EXPECT_EQ (out.size (), size_t (5)); EXPECT_EQ (out[0].to_string (), "(0,0;0,50;1000,50;1000,0)"); EXPECT_EQ (out[1].to_string (), "(0,50;0,100;300,100;800,50)"); EXPECT_EQ (out[2].to_string (), "(0,100;0,150;250,150;300,100)"); @@ -2117,7 +2117,7 @@ TEST(46) ep.process (pg, op); - EXPECT_EQ (out.size (), 6); + EXPECT_EQ (out.size (), size_t (6)); EXPECT_EQ (out[0].to_string (), "(0,0;73,122;326,122)"); EXPECT_EQ (out[1].to_string (), "(350,0;326,122;391,122)"); EXPECT_EQ (out[2].to_string (), "(326,122;400,150;391,122)"); diff --git a/src/unit_tests/dbEdges.cc b/src/unit_tests/dbEdges.cc index acaf86255..b3be1c4cd 100644 --- a/src/unit_tests/dbEdges.cc +++ b/src/unit_tests/dbEdges.cc @@ -79,24 +79,24 @@ TEST(1) r += db::Edges (db::Box (db::Point (10, 0), db::Point (110, 200))); EXPECT_EQ (r.to_string (), "(0,0;0,200);(0,200;100,200);(100,200;100,0);(100,0;0,0);(10,0;10,200);(10,200;110,200);(110,200;110,0);(110,0;10,0)"); EXPECT_EQ (r.is_merged (), false); - EXPECT_EQ (r.size (), 8); + EXPECT_EQ (r.size (), size_t (8)); r.set_merged_semantics (false); - EXPECT_EQ (r.length (), 1200); - EXPECT_EQ (r.length (db::Box (db::Point (-10, -10), db::Point (50, 50))), 190); - EXPECT_EQ (r.length (db::Box (db::Point (-10, -10), db::Point (0, 50))), 0); - EXPECT_EQ (r.length (db::Box (db::Point (0, 0), db::Point (50, 50))), 190); + EXPECT_EQ (r.length (), db::Edges::length_type (1200)); + EXPECT_EQ (r.length (db::Box (db::Point (-10, -10), db::Point (50, 50))), db::Edges::length_type (190)); + EXPECT_EQ (r.length (db::Box (db::Point (-10, -10), db::Point (0, 50))), db::Edges::length_type (0)); + EXPECT_EQ (r.length (db::Box (db::Point (0, 0), db::Point (50, 50))), db::Edges::length_type (190)); r.set_merged_semantics (true); - EXPECT_EQ (r.length (), 1020); - EXPECT_EQ (r.length (db::Box (db::Point (-10, -10), db::Point (50, 50))), 150); - EXPECT_EQ (r.length (db::Box (db::Point (-10, -10), db::Point (0, 50))), 0); - EXPECT_EQ (r.length (db::Box (db::Point (0, 0), db::Point (50, 50))), 150); + EXPECT_EQ (r.length (), db::Edges::length_type (1020)); + EXPECT_EQ (r.length (db::Box (db::Point (-10, -10), db::Point (50, 50))), db::Edges::length_type (150)); + EXPECT_EQ (r.length (db::Box (db::Point (-10, -10), db::Point (0, 50))), db::Edges::length_type (0)); + EXPECT_EQ (r.length (db::Box (db::Point (0, 0), db::Point (50, 50))), db::Edges::length_type (150)); r.merge (); EXPECT_EQ (r.to_string (), "(0,0;0,200);(100,200;100,0);(10,0;10,200);(0,200;110,200);(110,200;110,0);(110,0;0,0)"); EXPECT_EQ (r.bbox ().to_string (), "(0,0;110,200)"); EXPECT_EQ (r.is_merged (), true); EXPECT_EQ (r.empty (), false); - EXPECT_EQ (r.size (), 6); - EXPECT_EQ (r.length (), 1020); + EXPECT_EQ (r.size (), size_t (6)); + EXPECT_EQ (r.length (), db::Edges::length_type (1020)); r.clear (); EXPECT_EQ (r.empty (), true); @@ -405,7 +405,7 @@ TEST(9) } // std::cerr << "Interacting edges: " << ea.size () << std::endl; - EXPECT_NE (ea.size (), 0); + EXPECT_NE (ea.size (), size_t (0)); // brute force for (db::Edges::const_iterator i = e.begin (); ! i.at_end (); ++i) { @@ -466,7 +466,7 @@ TEST(10) } // std::cerr << "Interacting edges: " << ea.size () << std::endl; - EXPECT_NE (ea.size (), 0); + EXPECT_NE (ea.size (), size_t (0)); // brute force for (db::Edges::const_iterator i = e.begin (); ! i.at_end (); ++i) { @@ -592,10 +592,10 @@ TEST(20) EXPECT_EQ (r1.has_valid_edges (), false); EXPECT_EQ (r1.to_string (), "(120,20;120,40);(120,40;140,40);(140,40;140,20);(140,20;120,20);(160,80;160,140);(220,80;160,80)"); EXPECT_EQ (r1.has_valid_edges (), false); - EXPECT_EQ (r1.length (), 200); + EXPECT_EQ (r1.length (), db::Edges::length_type (200)); EXPECT_EQ (r1.has_valid_edges (), true); // length, since merging, will implicitly convert to valid edges EXPECT_EQ (r1.bbox ().to_string (), "(120,20;220,140)"); - EXPECT_EQ (r1.size (), 6); + EXPECT_EQ (r1.size (), size_t (6)); EXPECT_EQ (r1.empty (), false); db::EdgeLengthFilter f0 (0, 50, false); @@ -605,23 +605,23 @@ TEST(20) db::Edges r2 = r1; EXPECT_EQ (r2.has_valid_edges (), true); - EXPECT_EQ (r2.length (), 200); + EXPECT_EQ (r2.length (), db::Edges::length_type (200)); EXPECT_EQ (r2.bbox ().to_string (), "(120,20;220,140)"); - EXPECT_EQ (r2.size (), 6); + EXPECT_EQ (r2.size (), size_t (6)); EXPECT_EQ (r2.empty (), false); r2.filter (f0); EXPECT_EQ (r2.has_valid_edges (), true); EXPECT_EQ (r2.to_string (), "(120,20;120,40);(120,40;140,40);(140,40;140,20);(140,20;120,20)"); - EXPECT_EQ (r2.size (), 4); + EXPECT_EQ (r2.size (), size_t (4)); EXPECT_EQ (r2.empty (), false); - EXPECT_EQ (r2.length (), 80); + EXPECT_EQ (r2.length (), db::Edges::length_type (80)); r1.insert (db::Box (0, 0, 10, 20)); EXPECT_EQ (r1.has_valid_edges (), true); EXPECT_EQ (r1.to_string (), "(120,20;120,40);(120,40;140,40);(140,40;140,20);(140,20;120,20);(160,80;160,140);(220,80;160,80);(0,0;0,20);(0,20;10,20);(10,20;10,0);(10,0;0,0)"); EXPECT_EQ (r1.to_string (2), "(120,20;120,40);(120,40;140,40)..."); - EXPECT_EQ (r1.size (), 10); - EXPECT_EQ (r1.length (), 260); + EXPECT_EQ (r1.size (), size_t (10)); + EXPECT_EQ (r1.length (), db::Edges::length_type (260)); rr = r1.filtered (f0); EXPECT_EQ (rr.to_string (), "(120,20;120,40);(120,40;140,40);(140,40;140,20);(140,20;120,20);(0,0;0,20);(0,20;10,20);(10,20;10,0);(10,0;0,0)"); @@ -636,7 +636,7 @@ TEST(20) EXPECT_EQ (r1.has_valid_edges (), false); EXPECT_EQ (r1.to_string (), "(120,20;120,40);(120,40;140,40);(140,40;140,20);(140,20;120,20)"); EXPECT_EQ (r1.has_valid_edges (), false); - EXPECT_EQ (r1.size (), 4); + EXPECT_EQ (r1.size (), size_t (4)); EXPECT_EQ (r1.empty (), false); db::Edges r2 = r1; @@ -648,9 +648,9 @@ TEST(20) r1.clear (); EXPECT_EQ (r1.has_valid_edges (), true); - EXPECT_EQ (r1.size (), 0); + EXPECT_EQ (r1.size (), size_t (0)); EXPECT_EQ (r1.empty (), true); - EXPECT_EQ (r1.length (), 0); + EXPECT_EQ (r1.length (), db::Edges::length_type (0)); EXPECT_EQ (r2.to_string (), "(120,20;120,40);(120,40;140,40);(140,40;140,20);(140,20;120,20)"); r1.swap (r2); @@ -658,9 +658,9 @@ TEST(20) EXPECT_EQ (r1.to_string (), "(120,20;120,40);(120,40;140,40);(140,40;140,20);(140,20;120,20)"); EXPECT_EQ (r1.has_valid_edges (), false); EXPECT_EQ (r2.has_valid_edges (), true); - EXPECT_EQ (r2.size (), 0); + EXPECT_EQ (r2.size (), size_t (0)); EXPECT_EQ (r2.empty (), true); - EXPECT_EQ (r2.length (), 0); + EXPECT_EQ (r2.length (), db::Edges::length_type (0)); } { diff --git a/src/unit_tests/dbEdgesToContours.cc b/src/unit_tests/dbEdgesToContours.cc index 6460ef389..4adcf2232 100644 --- a/src/unit_tests/dbEdgesToContours.cc +++ b/src/unit_tests/dbEdgesToContours.cc @@ -48,24 +48,24 @@ TEST(1) db::EdgesToContours e2c; e2c.fill (&edges[0], &edges[0] + (sizeof (edges) / sizeof (edges [0])), false); - EXPECT_EQ (e2c.contours (), 1); + EXPECT_EQ (e2c.contours (), size_t (1)); EXPECT_EQ (c2s (e2c.contour (0)), "0,0;100,0;100,100;0,100;0,0"); edges [0].swap_points (); e2c.fill (&edges[0], &edges[0] + (sizeof (edges) / sizeof (edges [0])), false); - EXPECT_EQ (e2c.contours (), 2); + EXPECT_EQ (e2c.contours (), size_t (2)); EXPECT_EQ (c2s (e2c.contour (0)), "100,0;0,0"); EXPECT_EQ (c2s (e2c.contour (1)), "100,0;100,100;0,100;0,0"); e2c.fill (&edges[0], &edges[0] + (sizeof (edges) / sizeof (edges [0])), true); - EXPECT_EQ (e2c.contours (), 1); + EXPECT_EQ (e2c.contours (), size_t (1)); EXPECT_EQ (c2s (e2c.contour (0)), "100,0;0,0;0,100;100,100;100,0"); edges [2].swap_points (); e2c.fill (&edges[0], &edges[0] + (sizeof (edges) / sizeof (edges [0])), true); - EXPECT_EQ (e2c.contours (), 1); + EXPECT_EQ (e2c.contours (), size_t (1)); EXPECT_EQ (c2s (e2c.contour (0)), "100,0;0,0;0,100;100,100;100,0"); } @@ -84,7 +84,7 @@ TEST(2) db::EdgesToContours e2c; e2c.fill (&edges[0], &edges[0] + (sizeof (edges) / sizeof (edges [0])), true); - EXPECT_EQ (e2c.contours (), 2); + EXPECT_EQ (e2c.contours (), size_t (2)); EXPECT_EQ (c2s (e2c.contour (0)), "-100,-100;100,-100;0,0;-100,-100"); EXPECT_EQ (c2s (e2c.contour (1)), "200,-50;0,0;-200,-50;0,100;200,-50"); @@ -92,7 +92,7 @@ TEST(2) e2c.fill (&edges[0], &edges[0] + (sizeof (edges) / sizeof (edges [0])), true); - EXPECT_EQ (e2c.contours (), 2); + EXPECT_EQ (e2c.contours (), size_t (2)); EXPECT_EQ (c2s (e2c.contour (0)), "200,-50;0,100;-200,-50;0,0;200,-50"); EXPECT_EQ (c2s (e2c.contour (1)), "100,-100;0,0;-100,-100;100,-100"); @@ -113,7 +113,7 @@ TEST(3) db::EdgesToContours e2c; e2c.fill (&edges[0], &edges[0] + (sizeof (edges) / sizeof (edges [0])), false); - EXPECT_EQ (e2c.contours (), 2); + EXPECT_EQ (e2c.contours (), size_t (2)); EXPECT_EQ (c2s (e2c.contour (0)), "-100,-100;100,-100;0,0;-100,-100"); EXPECT_EQ (c2s (e2c.contour (1)), "0,0;200,-50;0,100;-200,-50;0,0"); @@ -121,7 +121,7 @@ TEST(3) e2c.fill (&edges[0], &edges[0] + (sizeof (edges) / sizeof (edges [0])), false); - EXPECT_EQ (e2c.contours (), 2); + EXPECT_EQ (e2c.contours (), size_t (2)); EXPECT_EQ (c2s (e2c.contour (0)), "200,-50;0,100;-200,-50;0,0;200,-50"); EXPECT_EQ (c2s (e2c.contour (1)), "100,-100;0,0;-100,-100;100,-100"); @@ -145,7 +145,7 @@ TEST(4) db::EdgesToContours e2c; e2c.fill (&edges[0], &edges[0] + (sizeof (edges) / sizeof (edges [0])), false); - EXPECT_EQ (e2c.contours (), 1); + EXPECT_EQ (e2c.contours (), size_t (1)); EXPECT_EQ (c2s (e2c.contour (0)), "0,0;0,100;-100,100;-100,200;200,200;200,100;0,100;0,200;100,200;100,0;0,0"); } @@ -166,7 +166,7 @@ TEST(5) db::EdgesToContours e2c; e2c.fill (&edges[0], &edges[0] + (sizeof (edges) / sizeof (edges [0])), false); - EXPECT_EQ (e2c.contours (), 1); + EXPECT_EQ (e2c.contours (), size_t (1)); EXPECT_EQ (c2s (e2c.contour (0)), "0,0;0,100;-100,100;-100,200;200,200;200,100;0,100;0,200;100,200;100,0"); } @@ -186,7 +186,7 @@ TEST(6) db::EdgesToContours e2c; e2c.fill (&edges[0], &edges[0] + (sizeof (edges) / sizeof (edges [0])), false); - EXPECT_EQ (e2c.contours (), 2); + EXPECT_EQ (e2c.contours (), size_t (2)); EXPECT_EQ (c2s (e2c.contour (0)), "0,0;100,0;100,100;0,100;0,0"); EXPECT_EQ (c2s (e2c.contour (1)), "1000,0;1100,0;1100,100;1000,100;1000,0"); } @@ -211,7 +211,7 @@ TEST(7) db::EdgesToContours e2c; e2c.fill (&edges[0], &edges[0] + (sizeof (edges) / sizeof (edges [0])), false); - EXPECT_EQ (e2c.contours (), 1); + EXPECT_EQ (e2c.contours (), size_t (1)); EXPECT_EQ (c2s (e2c.contour (0)), "0,0;0,100;200,100;400,100;400,0;300,0;300,100;200,100;200,0;200,100;100,100;100,0;0,0"); } diff --git a/src/unit_tests/dbGDS2Reader.cc b/src/unit_tests/dbGDS2Reader.cc index 20ebdb0b9..5d4835cce 100644 --- a/src/unit_tests/dbGDS2Reader.cc +++ b/src/unit_tests/dbGDS2Reader.cc @@ -231,7 +231,7 @@ TEST(1) EXPECT_EQ (fabs (layout.dbu () / 0.001 - 1.0) < 1e-6, true); EXPECT_EQ (reader.libname (), "LIB.DB"); - EXPECT_EQ (layout.layers (), 11); + EXPECT_EQ (layout.layers (), size_t (11)); EXPECT_EQ (map.mapping_str (0), "2/0 : 2/0"); EXPECT_EQ (map.mapping_str (1), "4/0 : 4/0"); EXPECT_EQ (map.mapping_str (2), "6/0 : 6/0"); @@ -246,7 +246,7 @@ TEST(1) EXPECT_EQ (map.mapping (10).layer, 8); EXPECT_EQ (map.mapping (10).datatype, 1); - EXPECT_EQ (layout.cells (), 3); + EXPECT_EQ (layout.cells (), size_t (3)); EXPECT_EQ (std::string (layout.cell_name (0)), "TRANS"); EXPECT_EQ (std::string (layout.cell_name (1)), "INV2"); EXPECT_EQ (std::string (layout.cell_name (2)), "RINGO"); @@ -254,7 +254,7 @@ TEST(1) db::Layout layout2 (&m); layout2 = layout; - EXPECT_EQ (layout2.cells (), 3); + EXPECT_EQ (layout2.cells (), size_t (3)); EXPECT_EQ (std::string (layout2.cell_name (0)), "TRANS"); EXPECT_EQ (std::string (layout2.cell_name (1)), "INV2"); EXPECT_EQ (std::string (layout2.cell_name (2)), "RINGO"); @@ -292,7 +292,7 @@ TEST(2) EXPECT_EQ (reader.libname (), "LIB.DB"); } - EXPECT_EQ (layout_none.layers (), 0); + EXPECT_EQ (layout_none.layers (), size_t (0)); db::LDPair pairs[] = { db::LDPair(1, 0), @@ -325,7 +325,7 @@ TEST(2) db::GDS2Reader reader (file); reader.read (layout_layer, options); - EXPECT_EQ (layout_layer.layers (), 1); + EXPECT_EQ (layout_layer.layers (), size_t (1)); EXPECT_EQ (layout_layer.get_properties (0).layer, pairs[i].layer); EXPECT_EQ (layout_layer.get_properties (0).datatype, pairs[i].datatype); diff --git a/src/unit_tests/dbLayout.cc b/src/unit_tests/dbLayout.cc index 32124149e..bc90c89bb 100644 --- a/src/unit_tests/dbLayout.cc +++ b/src/unit_tests/dbLayout.cc @@ -85,7 +85,7 @@ TEST(1) for (db::Layout::bottom_up_iterator c = g.begin_bottom_up (); c != g.end_bottom_up (); ++c) { m = (m << 4) + *c; } - EXPECT_EQ (m, 0x04231); // c1,c5,c3,c4,c2 + EXPECT_EQ (m, (unsigned int) 0x04231); // c1,c5,c3,c4,c2 // check relation informations .. db::Cell::child_cell_iterator ch; @@ -94,12 +94,12 @@ TEST(1) db::Cell::parent_inst_iterator pai; // .. for c1 - EXPECT_EQ (c1.child_cells (), 0); + EXPECT_EQ (c1.child_cells (), size_t (0)); ch = c1.begin_child_cells (); EXPECT_EQ (ch.at_end (), true); chi = c1.begin (); EXPECT_EQ (chi.at_end (), true); - EXPECT_EQ (c1.parent_cells (), 3); + EXPECT_EQ (c1.parent_cells (), size_t (3)); pa = c1.begin_parent_cells (); EXPECT_EQ (*pa, c2.cell_index ()); ++pa; @@ -128,7 +128,7 @@ TEST(1) // .. for c2 ch = c2.begin_child_cells (); - EXPECT_EQ (c2.child_cells (), 3); + EXPECT_EQ (c2.child_cells (), size_t (3)); EXPECT_EQ (*ch, c1.cell_index ()); ++ch; EXPECT_EQ (*ch, c4.cell_index ()); @@ -154,19 +154,19 @@ TEST(1) ++chi; EXPECT_EQ (chi.at_end (), true); // ... - EXPECT_EQ (c2.parent_cells (), 0); + EXPECT_EQ (c2.parent_cells (), size_t (0)); pa = c2.begin_parent_cells (); EXPECT_EQ (pa == c2.end_parent_cells (), true); pai = c2.begin_parent_insts (); EXPECT_EQ (pai.at_end (), true); // .. for c3,c4,c5 - EXPECT_EQ (c3.child_cells (), 1); - EXPECT_EQ (c3.parent_cells (), 1); - EXPECT_EQ (c4.child_cells (), 2); - EXPECT_EQ (c4.parent_cells (), 1); - EXPECT_EQ (c5.child_cells (), 1); - EXPECT_EQ (c5.parent_cells (), 2); + EXPECT_EQ (c3.child_cells (), size_t (1)); + EXPECT_EQ (c3.parent_cells (), size_t (1)); + EXPECT_EQ (c4.child_cells (), size_t (2)); + EXPECT_EQ (c4.parent_cells (), size_t (1)); + EXPECT_EQ (c5.child_cells (), size_t (1)); + EXPECT_EQ (c5.parent_cells (), size_t (2)); // get some called cell sets std::set cc; diff --git a/src/unit_tests/dbLayoutDiff.cc b/src/unit_tests/dbLayoutDiff.cc index 7bb6848a1..0c394b5ca 100644 --- a/src/unit_tests/dbLayoutDiff.cc +++ b/src/unit_tests/dbLayoutDiff.cc @@ -669,16 +669,16 @@ TEST(2P) db::PropertiesRepository::properties_set ps; ps.insert (std::make_pair (g.properties_repository ().prop_name_id ("A"), tl::Variant (1))); pi1 = g.properties_repository ().properties_id (ps); - EXPECT_EQ (pi1, 1); + EXPECT_EQ (pi1, db::properties_id_type (1)); ps.clear (); ps.insert (std::make_pair (g.properties_repository ().prop_name_id ("B"), tl::Variant (2))); pi2 = g.properties_repository ().properties_id (ps); - EXPECT_EQ (pi2, 2); + EXPECT_EQ (pi2, db::properties_id_type (2)); ps.insert (std::make_pair (g.properties_repository ().prop_name_id ("C"), tl::Variant ("c"))); pi3 = g.properties_repository ().properties_id (ps); - EXPECT_EQ (pi3, 3); + EXPECT_EQ (pi3, db::properties_id_type (3)); EXPECT_EQ (ps2string (g.properties_repository (), 1), "A:1"); EXPECT_EQ (ps2string (g.properties_repository (), 2), "B:2"); diff --git a/src/unit_tests/dbLibraries.cc b/src/unit_tests/dbLibraries.cc index 4d0304e5c..684ac9f95 100644 --- a/src/unit_tests/dbLibraries.cc +++ b/src/unit_tests/dbLibraries.cc @@ -514,7 +514,7 @@ TEST(2) EXPECT_EQ (tmp_i2.cell_index (), tmp_pd2.second); std::vector new_param = tmp.get_pcell_parameters (tmp_pd2.second); - EXPECT_EQ (new_param.size (), 3); + EXPECT_EQ (new_param.size (), size_t (3)); EXPECT_EQ (new_param[0].to_string (), std::string ("2")); EXPECT_EQ (new_param[1].to_string (), std::string ("10")); EXPECT_EQ (new_param[2].to_string (), std::string ("3")); diff --git a/src/unit_tests/dbPCells.cc b/src/unit_tests/dbPCells.cc index 07c271d42..52b73d1cb 100644 --- a/src/unit_tests/dbPCells.cc +++ b/src/unit_tests/dbPCells.cc @@ -237,7 +237,7 @@ TEST(1) EXPECT_EQ (copy_top.is_pcell_instance (i1_copy).second, pd_id_copy); std::vector parameters = copy_top.get_pcell_parameters (i1_copy); - EXPECT_EQ (parameters.size (), 3); + EXPECT_EQ (parameters.size (), size_t (3)); EXPECT_EQ (std::string (parameters[0].to_string()), "0.4"); EXPECT_EQ (std::string (parameters[1].to_string()), "0.8"); EXPECT_EQ (std::string (parameters[2].to_string()), "1"); diff --git a/src/unit_tests/dbPolygon.cc b/src/unit_tests/dbPolygon.cc index 164c35b62..77495a6b2 100644 --- a/src/unit_tests/dbPolygon.cc +++ b/src/unit_tests/dbPolygon.cc @@ -49,9 +49,9 @@ TEST(1) c1.push_back (db::Point (100, 0)); p.assign_hull (c1.begin (), c1.end ()); b = p.box (); - EXPECT_EQ (p.holes (), 0); + EXPECT_EQ (p.holes (), size_t (0)); EXPECT_EQ (p.area (), 1000*100); - EXPECT_EQ (p.perimeter (), 2200); + EXPECT_EQ (p.perimeter (), db::Polygon::perimeter_type (2200)); EXPECT_EQ (p.is_box (), true); c2.push_back (db::Point (10, 10)); @@ -65,28 +65,28 @@ TEST(1) c3.push_back (db::Point (90, 890)); c3.push_back (db::Point (90, 510)); p.insert_hole (c3.begin (), c3.end ()); - EXPECT_EQ (p.holes (), 2); + EXPECT_EQ (p.holes (), size_t (2)); EXPECT_EQ (p.to_string (), std::string ("(0,0;0,1000;100,1000;100,0/10,10;90,10;90,390;10,390/10,510;90,510;90,890;10,890)")); db::DPolygon dp (p, db::cast_op ()); EXPECT_EQ (dp.to_string (), std::string ("(0,0;0,1000;100,1000;100,0/10,10;90,10;90,390;10,390/10,510;90,510;90,890;10,890)")); db::Polygon ip = db::Polygon (dp); EXPECT_EQ (ip.to_string (), std::string ("(0,0;0,1000;100,1000;100,0/10,10;90,10;90,390;10,390/10,510;90,510;90,890;10,890)")); - EXPECT_EQ (ip.vertices (), 12); + EXPECT_EQ (ip.vertices (), size_t (12)); EXPECT_EQ (p.area (), 1000*100-2*380*80); - EXPECT_EQ (p.perimeter (), 2000+200+4*(380+80)); + EXPECT_EQ (p.perimeter (), db::Polygon::perimeter_type (2000+200+4*(380+80))); EXPECT_EQ (p.is_box (), false); EXPECT_EQ (p.box (), b); - unsigned e = 0; + unsigned int e = 0; db::Edge::distance_type u = 0; for (db::Polygon::polygon_edge_iterator i = p.begin_edge (); ! i.at_end (); ++i) { ++e; u += (*i).length (); } - EXPECT_EQ (e, 12); - EXPECT_EQ (u, 2*(1000+100)+4*(380+80)); + EXPECT_EQ (e, (unsigned int) 12); + EXPECT_EQ (u, db::Edge::distance_type (2*(1000+100)+4*(380+80))); db::Polygon pp; pp.insert_hole (c3.begin (), c3.end ()); @@ -133,9 +133,9 @@ TEST(2) c1.push_back (db::Point (100, 0)); p.assign_hull (c1.begin (), c1.end ()); b = p.box (); - EXPECT_EQ (p.holes (), 0); + EXPECT_EQ (p.holes (), size_t (0)); EXPECT_EQ (p.area (), 1000*100); - EXPECT_EQ (p.perimeter (), 2000+200); + EXPECT_EQ (p.perimeter (), db::SimplePolygon::perimeter_type (2000+200)); EXPECT_EQ (p.is_box (), true); EXPECT_EQ (p.to_string (), "(0,0;0,1000;100,1000;100,0)"); @@ -144,14 +144,14 @@ TEST(2) db::SimplePolygon ip = db::SimplePolygon (dp); EXPECT_EQ (ip.to_string (), "(0,0;0,1000;100,1000;100,0)"); - unsigned e = 0; + unsigned int e = 0; db::Edge::distance_type u = 0; for (db::SimplePolygon::polygon_edge_iterator i = p.begin_edge (); ! i.at_end (); ++i) { ++e; u += (*i).length (); } - EXPECT_EQ (e, 4); - EXPECT_EQ (u, 2*(1000+100)); + EXPECT_EQ (e, (unsigned int) 4); + EXPECT_EQ (u, db::Edge::distance_type (2*(1000+100))); db::SimplePolygon pp; pp = p; @@ -207,7 +207,7 @@ TEST(3) } contour.assign (c1.begin (), c1.end (), false); - EXPECT_EQ (contour.size (), 6); + EXPECT_EQ (contour.size (), size_t (6)); EXPECT_EQ (contour.is_hole (), false); EXPECT_EQ (contour.mem_used (), 3 * sizeof(db::Point) + sizeof(Ctr)); EXPECT_EQ (contour[0], db::Point (100,100)); @@ -219,7 +219,7 @@ TEST(3) contour.assign (c1.begin (), c1.end (), true); - EXPECT_EQ (contour.size (), 6); + EXPECT_EQ (contour.size (), size_t (6)); EXPECT_EQ (contour.is_hole (), true); EXPECT_EQ (contour.mem_used (), 3 * sizeof(db::Point) + sizeof(Ctr)); EXPECT_EQ (contour[0], db::Point (100,100)); @@ -238,7 +238,7 @@ TEST(3) contour2.transform (t.inverted ()); EXPECT_EQ (contour2 == contour, true); - EXPECT_EQ (contour2.size (), 6); + EXPECT_EQ (contour2.size (), size_t (6)); EXPECT_EQ (contour2.is_hole (), true); EXPECT_EQ (contour2.mem_used (), 3 * sizeof(db::Point) + sizeof(Ctr)); EXPECT_EQ (contour2[0], db::Point (100,100)); @@ -274,7 +274,7 @@ TEST(4) } contour.assign (c1.begin (), c1.end (), false); - EXPECT_EQ (contour.size (), 5); + EXPECT_EQ (contour.size (), size_t (5)); EXPECT_EQ (contour.is_hole (), false); EXPECT_EQ (contour.mem_used (), 5 * sizeof(db::Point) + sizeof(Ctr)); EXPECT_EQ (contour[0], db::Point (100,100)); @@ -285,7 +285,7 @@ TEST(4) contour.assign (c1.begin (), c1.end (), true); - EXPECT_EQ (contour.size (), 5); + EXPECT_EQ (contour.size (), size_t (5)); EXPECT_EQ (contour.is_hole (), true); EXPECT_EQ (contour.mem_used (), 5 * sizeof(db::Point) + sizeof(Ctr)); EXPECT_EQ (contour[0], db::Point (100,100)); @@ -304,7 +304,7 @@ TEST(4) contour2.transform (t.inverted ()); EXPECT_EQ (contour2 == contour, true); - EXPECT_EQ (contour2.size (), 5); + EXPECT_EQ (contour2.size (), size_t (5)); EXPECT_EQ (contour2.is_hole (), true); EXPECT_EQ (contour2.mem_used (), 5 * sizeof(db::Point) + sizeof(Ctr)); EXPECT_EQ (contour2[0], db::Point (100,100)); @@ -327,7 +327,7 @@ TEST(5) c1.push_back (db::Point (100, 1000)); c1.push_back (db::Point (100, 0)); p.assign_hull (c1.begin (), c1.end ()); - EXPECT_EQ (p.vertices (), 4); + EXPECT_EQ (p.vertices (), size_t (4)); std::vector c2; c2.push_back (db::Point (10, 10)); @@ -335,7 +335,7 @@ TEST(5) c2.push_back (db::Point (20, 110)); c2.push_back (db::Point (20, 10)); p.insert_hole (c2.begin (), c2.end ()); - EXPECT_EQ (p.vertices (), 8); + EXPECT_EQ (p.vertices (), size_t (8)); { db::Polygon::polygon_contour_iterator pt = p.begin_hull (); @@ -417,9 +417,9 @@ TEST(5) } EXPECT_EQ (p.area (), 100*1000-10*100); - EXPECT_EQ (p.perimeter (), 200+2000+20+200); + EXPECT_EQ (p.perimeter (), db::Polygon::perimeter_type (200+2000+20+200)); EXPECT_EQ (pref.area (), 100*1000-10*100); - EXPECT_EQ (pref.perimeter (), 200+2000+20+200); + EXPECT_EQ (pref.perimeter (), db::Polygon::perimeter_type (200+2000+20+200)); } @@ -551,7 +551,7 @@ TEST(7) } contour.assign (c1.begin (), c1.end (), false); - EXPECT_EQ (contour.size (), 6); + EXPECT_EQ (contour.size (), size_t (6)); EXPECT_EQ (contour.is_hole (), false); EXPECT_EQ (contour.mem_used (), 6 * sizeof(db::Point) + sizeof(Ctr)); EXPECT_EQ (contour[0], db::Point (0,0)); @@ -563,7 +563,7 @@ TEST(7) contour.assign (c1.begin (), c1.end (), true); - EXPECT_EQ (contour.size (), 6); + EXPECT_EQ (contour.size (), size_t (6)); EXPECT_EQ (contour.is_hole (), true); EXPECT_EQ (contour.mem_used (), 6 * sizeof(db::Point) + sizeof(Ctr)); EXPECT_EQ (contour[0], db::Point (0,0)); @@ -582,7 +582,7 @@ TEST(7) contour2.transform (t.inverted ()); EXPECT_EQ (contour2 == contour, true); - EXPECT_EQ (contour2.size (), 6); + EXPECT_EQ (contour2.size (), size_t (6)); EXPECT_EQ (contour2.is_hole (), true); EXPECT_EQ (contour2.mem_used (), 6 * sizeof(db::Point) + sizeof(Ctr)); EXPECT_EQ (contour2[0], db::Point (0,0)); @@ -880,22 +880,22 @@ TEST(13M) p.assign_hull (pts.begin (), pts.end (), false /*not compressed*/); EXPECT_EQ (p.to_string(), "(0,0;0,2000;1000,2000;1000,3000;1000,2000;1000,2000;1000,2000;1000,1500;1000,1000;1000,0)"); - EXPECT_EQ (p.vertices (), 10); + EXPECT_EQ (p.vertices (), size_t (10)); p.compress (true /*remove reflected*/); EXPECT_EQ (p.to_string(), "(0,0;0,2000;1000,2000;1000,0)"); - EXPECT_EQ (p.vertices (), 4); + EXPECT_EQ (p.vertices (), size_t (4)); p.assign_hull (pts.begin (), pts.end (), true /*compressed*/); EXPECT_EQ (p.to_string(), "(0,0;0,2000;1000,2000;1000,3000;1000,0)"); - EXPECT_EQ (p.vertices (), 5); + EXPECT_EQ (p.vertices (), size_t (5)); p.assign_hull (pts.begin (), pts.end (), true /*compressed*/, true /*remove reflected*/); EXPECT_EQ (p.to_string(), "(0,0;0,2000;1000,2000;1000,0)"); - EXPECT_EQ (p.vertices (), 4); + EXPECT_EQ (p.vertices (), size_t (4)); } @@ -952,12 +952,12 @@ TEST(14S) p.assign_hull (pts.begin (), pts.end (), false /*not compressed*/); EXPECT_EQ (p.to_string(), "(0,0;0,2000;1000,2000;1000,3000;1000,2000;1000,2000;1000,2000;1000,1500;1000,1000;500,500;200,200)"); - EXPECT_EQ (p.vertices (), 11); + EXPECT_EQ (p.vertices (), size_t (11)); p.compress (true); EXPECT_EQ (p.to_string(), "(0,0;0,2000;1000,2000;1000,1000)"); - EXPECT_EQ (p.vertices (), 4); + EXPECT_EQ (p.vertices (), size_t (4)); p.assign_hull (pts.begin (), pts.end (), true /*not compressed*/); diff --git a/src/unit_tests/dbPolygonTools.cc b/src/unit_tests/dbPolygonTools.cc index 53797e0fe..481fab086 100644 --- a/src/unit_tests/dbPolygonTools.cc +++ b/src/unit_tests/dbPolygonTools.cc @@ -36,29 +36,29 @@ TEST(1) db::cut_polygon (in, db::Edge (db::Point (0, 500), db::Point (1, 500)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 1); + EXPECT_EQ (right_of.size (), size_t (1)); EXPECT_EQ (right_of[0].to_string (), "(0,0;0,500;1000,500;1000,0)"); right_of.clear (); db::cut_polygon (in, db::Edge (db::Point (0, -100), db::Point (1, -100)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 0); + EXPECT_EQ (right_of.size (), size_t (0)); right_of.clear (); db::cut_polygon (in, db::Edge (db::Point (0, 0), db::Point (1, 0)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 0); + EXPECT_EQ (right_of.size (), size_t (0)); right_of.clear (); db::cut_polygon (in, db::Edge (db::Point (0, 1000), db::Point (1, 1000)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 1); + EXPECT_EQ (right_of.size (), size_t (1)); EXPECT_EQ (right_of[0].to_string (), "(0,0;0,1000;1000,1000;1000,0)"); right_of.clear (); db::cut_polygon (in, db::Edge (db::Point (0, 1001), db::Point (1, 1001)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 1); + EXPECT_EQ (right_of.size (), size_t (1)); EXPECT_EQ (right_of[0].to_string (), "(0,0;0,1000;1000,1000;1000,0)"); } @@ -86,41 +86,41 @@ TEST(2) db::cut_polygon (in, db::Edge (db::Point (0, 200), db::Point (1, 200)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 2); + EXPECT_EQ (right_of.size (), size_t (2)); EXPECT_EQ (right_of[0].to_string (), "(0,0;0,200;100,200;100,100;200,100;200,0)"); EXPECT_EQ (right_of[1].to_string (), "(300,0;300,200;400,200;400,100;600,100;600,200;700,200;700,0)"); right_of.clear (); db::cut_polygon (in, db::Edge (db::Point (0, 100), db::Point (1, 100)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 2); + EXPECT_EQ (right_of.size (), size_t (2)); EXPECT_EQ (right_of[0].to_string (), "(0,0;0,100;200,100;200,0)"); EXPECT_EQ (right_of[1].to_string (), "(300,0;300,100;700,100;700,0)"); right_of.clear (); db::cut_polygon (in, db::Edge (db::Point (0, 50), db::Point (1, 50)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 2); + EXPECT_EQ (right_of.size (), size_t (2)); EXPECT_EQ (right_of[0].to_string (), "(0,0;0,50;200,50;200,0)"); EXPECT_EQ (right_of[1].to_string (), "(300,0;300,50;700,50;700,0)"); right_of.clear (); db::cut_polygon (in, db::Edge (db::Point (0, 300), db::Point (1, 300)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 2); + EXPECT_EQ (right_of.size (), size_t (2)); EXPECT_EQ (right_of[0].to_string (), "(0,0;0,300;100,300;100,100;200,100;200,0)"); EXPECT_EQ (right_of[1].to_string (), "(300,0;300,300;400,300;400,100;600,100;600,300;700,300;700,0)"); right_of.clear (); db::cut_polygon (in, db::Edge (db::Point (0, 400), db::Point (1, 400)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 1); + EXPECT_EQ (right_of.size (), size_t (1)); EXPECT_EQ (right_of[0].to_string (), "(0,0;0,400;400,400;400,100;600,100;600,300;700,300;700,0;300,0;300,300;100,300;100,100;200,100;200,0)"); right_of.clear (); db::cut_polygon (in, db::Edge (db::Point (0, 500), db::Point (1, 500)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 1); + EXPECT_EQ (right_of.size (), size_t (1)); EXPECT_EQ (right_of[0].to_string (), "(0,0;0,400;400,400;400,100;600,100;600,300;700,300;700,0;300,0;300,300;100,300;100,100;200,100;200,0)"); } @@ -146,19 +146,19 @@ TEST(3) std::vector right_of; db::cut_polygon (in, db::Edge (db::Point (0, 200), db::Point (1, 200)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 1); + EXPECT_EQ (right_of.size (), size_t (1)); EXPECT_EQ (right_of[0].to_string (), "(0,0;0,200;100,200;100,100;200,100;200,200;400,200;400,100;500,100;500,200;1000,200;1000,0)"); right_of.clear (); db::cut_polygon (in, db::Edge (db::Point (0, 50), db::Point (1, 50)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 1); + EXPECT_EQ (right_of.size (), size_t (1)); EXPECT_EQ (right_of[0].to_string (), "(0,0;0,50;1000,50;1000,0)"); right_of.clear (); db::cut_polygon (in, db::Edge (db::Point (0, 500), db::Point (1, 500)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 1); + EXPECT_EQ (right_of.size (), size_t (1)); EXPECT_EQ (right_of[0].to_string (), "(0,0;0,500;1000,500;1000,0/100,100;200,100;200,400;100,400/400,100;500,100;500,400;400,400)"); } @@ -182,38 +182,38 @@ TEST(4) db::cut_polygon (in, db::Edge (db::Point (0, 300), db::Point (1, 300)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 1); + EXPECT_EQ (right_of.size (), size_t (1)); EXPECT_EQ (right_of[0].to_string (), "(0,0;0,300;400,300;400,200;300,200;300,100;400,100;400,300;600,300;600,0)"); right_of.clear (); db::cut_polygon (in, db::Edge (db::Point (1, 300), db::Point (0, 300)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 2); + EXPECT_EQ (right_of.size (), size_t (2)); EXPECT_EQ (right_of[0].to_string (), "(400,300;400,400;600,400;600,300)"); EXPECT_EQ (right_of[1].to_string (), "(0,300;0,400;400,400;400,300)"); right_of.clear (); db::cut_polygon (in, db::Edge (db::Point (0, 50), db::Point (1, 50)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 1); + EXPECT_EQ (right_of.size (), size_t (1)); EXPECT_EQ (right_of[0].to_string (), "(0,0;0,50;600,50;600,0)"); right_of.clear (); db::cut_polygon (in, db::Edge (db::Point (0, 100), db::Point (1, 100)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 1); + EXPECT_EQ (right_of.size (), size_t (1)); EXPECT_EQ (right_of[0].to_string (), "(0,0;0,100;600,100;600,0)"); right_of.clear (); db::cut_polygon (in, db::Edge (db::Point (0, 150), db::Point (1, 150)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 1); + EXPECT_EQ (right_of.size (), size_t (1)); EXPECT_EQ (right_of[0].to_string (), "(0,0;0,150;300,150;300,100;400,100;400,150;600,150;600,0)"); right_of.clear (); db::cut_polygon (in, db::Edge (db::Point (0, 200), db::Point (1, 200)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 1); + EXPECT_EQ (right_of.size (), size_t (1)); EXPECT_EQ (right_of[0].to_string (), "(0,0;0,200;300,200;300,100;400,100;400,200;600,200;600,0)"); } @@ -287,7 +287,7 @@ TEST(5) db::cut_polygon (in, db::Edge (db::Point (565, 1), db::Point (565, 0)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 1); + EXPECT_EQ (right_of.size (), size_t (1)); EXPECT_EQ (right_of[0].to_string (), "(0,0;0,884;565,884;565,332;72,332;72,313;89,313;89,332;565,332;565,327;173,327;173,304;211,304;211,327;565,327;565,302;174,302;174,275;212,275;212,302;565,302;565,268;47,268;47,257;62,257;62,268;565,268;565,243;49,243;49,231;63,231;63,243;565,243;565,214;72,214;72,194;93,194;93,214;565,214;565,77;5,77;5,15;67,15;67,77;565,77;565,38;328,38;328,17;405,17;405,38;565,38;565,0)"); } @@ -310,7 +310,7 @@ TEST(6) db::cut_polygon (in, db::Edge (db::Point (0, 200), db::Point (1, 200)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 1); + EXPECT_EQ (right_of.size (), size_t (1)); EXPECT_EQ (right_of[0].to_string (), "(0,0;0,100;100,100;200,200;300,100;400,100;400,200;500,200;500,0)"); c.push_back (db::Point ()); } @@ -330,12 +330,12 @@ TEST(7) std::vector right_of; db::cut_polygon (in, db::Edge (db::Point (2, 0), db::Point (2, 1)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 1); + EXPECT_EQ (right_of.size (), size_t (1)); EXPECT_EQ (right_of[0].to_string (), "(2,0;2,1;3,1;3,0)"); right_of.clear (); db::cut_polygon (in, db::Edge (db::Point (2, 1), db::Point (2, 0)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 1); + EXPECT_EQ (right_of.size (), size_t (1)); EXPECT_EQ (right_of[0].to_string (), "(0,0;0,1;2,1;2,0)"); } @@ -359,13 +359,13 @@ TEST(8) std::vector right_of; db::cut_polygon (in, db::Edge (db::Point (200, 0), db::Point (200, 1)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 2); + EXPECT_EQ (right_of.size (), size_t (2)); EXPECT_EQ (right_of[0].to_string (), "(200,0;200,50;300,50;300,0)"); EXPECT_EQ (right_of[1].to_string (), "(200,200;200,300;300,300)"); right_of.clear (); db::cut_polygon (in, db::Edge (db::Point (200, 1), db::Point (200, 0)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 1); + EXPECT_EQ (right_of.size (), size_t (1)); EXPECT_EQ (right_of[0].to_string (), "(0,0;0,300;200,300;200,200;100,200;100,100;200,200;150,50;200,50;200,0)"); } @@ -395,13 +395,13 @@ TEST(9) std::vector right_of; db::cut_polygon (in, db::Edge (db::Point (200, 0), db::Point (200, 1)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 2); + EXPECT_EQ (right_of.size (), size_t (2)); EXPECT_EQ (right_of[0].to_string (), "(200,0;200,200;250,200;250,100;300,100;300,200;200,200;200,400;400,400;400,0)"); EXPECT_EQ (right_of[1].to_string (), "(200,400;200,500;400,500;400,400)"); right_of.clear (); db::cut_polygon (in, db::Edge (db::Point (200, 1), db::Point (200, 0)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 2); + EXPECT_EQ (right_of.size (), size_t (2)); EXPECT_EQ (right_of[0].to_string (), "(0,200;0,500;200,500;200,400;100,400;100,300;150,300;150,400;200,400;200,200)"); EXPECT_EQ (right_of[1].to_string (), "(0,0;0,200;200,200;200,0)"); } @@ -477,7 +477,7 @@ TEST(9a) std::vector right_of; db::cut_polygon (in, db::Edge (db::Point (1016, 0), db::Point (1016, 1)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 4); + EXPECT_EQ (right_of.size (), size_t (4)); EXPECT_EQ (right_of[0].to_string (), "(1016,10230;1016,10259;1027,10252;1037,10266;1021,10280;1034,10280;1038,10269;1039,10277;1036,10285;1090,10285;1090,10252;1027,10252;1017,10237;1019,10230)"); EXPECT_EQ (right_of[1].to_string (), "(1016,10265;1016,10280;1021,10280)"); EXPECT_EQ (right_of[2].to_string (), "(1016,10280;1016,10283;1017,10283;1016,10284;1016,10288;1024,10288;1022,10283;1032,10285;1027,10297;1031,10297;1036,10285;1041,10286;1043,10302;1090,10302;1090,10285;1032,10285;1034,10280)"); @@ -485,7 +485,7 @@ TEST(9a) right_of.clear (); db::cut_polygon (in, db::Edge (db::Point (1016, 1), db::Point (1016, 0)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 2); + EXPECT_EQ (right_of.size (), size_t (2)); EXPECT_EQ (right_of[0].to_string (), "(942,10230;994,10274;988,10278;999,10278;994,10274;1007,10265;1002,10280;1016,10280;1016,10265;1007,10265;1012,10252;1014,10260;1007,10265;1016,10265;1014,10260;1016,10259;1016,10230;942,10230;942,10281;983,10281;988,10278;1002,10280;994,10302;1016,10302;1016,10288;1011,10288;1003,10281;1016,10283;1016,10280;1002,10280;999,10278;988,10278;943,10272)"); EXPECT_EQ (right_of[1].to_string (), "(1016,10284;1011,10288;1016,10288)"); } @@ -514,12 +514,12 @@ TEST(9b) std::vector right_of; db::cut_polygon (in, db::Edge (db::Point (1007, 0), db::Point (1007, 1)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 1); + EXPECT_EQ (right_of.size (), size_t (1)); EXPECT_EQ (right_of[0].to_string (), "(1007,10230;1007,10265;1012,10252;1014,10260;1007,10265;1016,10265;1014,10260;1016,10259;1016,10230)"); right_of.clear (); db::cut_polygon (in, db::Edge (db::Point (1007, 1), db::Point (1007, 0)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 1); + EXPECT_EQ (right_of.size (), size_t (1)); EXPECT_EQ (right_of[0].to_string (), "(942,10230;942,10265;943,10265;942,10230;983,10265;1007,10265;1007,10230)"); } @@ -559,14 +559,14 @@ TEST(9c) std::vector right_of; db::cut_polygon (in, db::Edge (db::Point (15835, 0), db::Point (15835, 1)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 3); + EXPECT_EQ (right_of.size (), size_t (3)); EXPECT_EQ (right_of[0].to_string (), "(17335,8265;16335,9265;15835,9265;15835,9765;17335,9765)"); EXPECT_EQ (right_of[1].to_string (), "(15835,9765;16002,9932;15835,10015;17335,10015;17335,9765)"); EXPECT_EQ (right_of[2].to_string (), "(15835,10015;15835,10265;17335,10265;17335,10015)"); right_of.clear (); db::cut_polygon (in, db::Edge (db::Point (15835, 1), db::Point (15835, 0)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 1); + EXPECT_EQ (right_of.size (), size_t (1)); EXPECT_EQ (right_of[0].to_string (), "(14335,8265;14335,10265;15335,10265;15335,9765;15668,9932;15335,10265;15835,10265;15835,10015;15668,9932;15835,9765;15335,9765;14335,9265;15335,9265;15335,9765;15835,9765;15835,9265;15335,9265)"); } @@ -592,12 +592,12 @@ TEST(9d) std::vector right_of; db::cut_polygon (in, db::Edge (db::Point (16002, 0), db::Point (16002, 1)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 1); + EXPECT_EQ (right_of.size (), size_t (1)); EXPECT_EQ (right_of[0].to_string (), "(17335,8265;16335,9265;16002,9265;16002,10265;17335,10265)"); right_of.clear (); db::cut_polygon (in, db::Edge (db::Point (16002, 1), db::Point (16002, 0)), std::back_inserter (right_of)); - EXPECT_EQ (right_of.size (), 2); + EXPECT_EQ (right_of.size (), size_t (2)); EXPECT_EQ (right_of[0].to_string (), "(15668,9932;15335,10265;16002,10265;16002,9932;15835,10015)"); EXPECT_EQ (right_of[1].to_string (), "(15335,9265;15335,9765;15668,9932;15835,9765;16002,9932;16002,9265)"); } @@ -1284,7 +1284,7 @@ TEST(200) unsigned int n; db::Polygon pr; db::Polygon pp = compute_rounded (p, 0, 20000, 200); - EXPECT_EQ (pp.hull ().size (), 200); + EXPECT_EQ (pp.hull ().size (), size_t (200)); EXPECT_EQ (extract_rad (pp, rinner, router, n, &pr), true); EXPECT_EQ (tl::to_string (rinner), "0"); @@ -1298,7 +1298,7 @@ TEST(200) unsigned int n; db::Polygon pr; db::Polygon pp = compute_rounded (p, 0, 50000, 200); - EXPECT_EQ (pp.hull ().size (), 200); + EXPECT_EQ (pp.hull ().size (), size_t (200)); EXPECT_EQ (extract_rad (pp, rinner, router, n, &pr), true); EXPECT_EQ (tl::to_string (rinner), "0"); @@ -1312,7 +1312,7 @@ TEST(200) unsigned int n; db::Polygon pr; db::Polygon pp = compute_rounded (p, 0, 70000, 200); - EXPECT_EQ (pp.hull ().size (), 200); + EXPECT_EQ (pp.hull ().size (), size_t (200)); EXPECT_EQ (extract_rad (pp, rinner, router, n, &pr), true); EXPECT_EQ (tl::to_string (rinner), "0"); @@ -1340,7 +1340,7 @@ TEST(201) unsigned int n; db::Polygon pr; db::Polygon pp = compute_rounded (p, 0, 50000, 200); - EXPECT_EQ (pp.hull ().size (), 200); + EXPECT_EQ (pp.hull ().size (), size_t (200)); EXPECT_EQ (extract_rad (pp, rinner, router, n, &pr), true); EXPECT_EQ (tl::to_string (rinner), "0"); @@ -1380,7 +1380,7 @@ TEST(202) unsigned int n; db::Polygon pr; db::Polygon pp = compute_rounded (p, 50000, 150000, 200); - EXPECT_EQ (pp.hull ().size (), 300); + EXPECT_EQ (pp.hull ().size (), size_t (300)); EXPECT_EQ (extract_rad (pp, rinner, router, n, &pr), true); EXPECT_EQ (tl::to_string (rinner), "50000"); @@ -1394,7 +1394,7 @@ TEST(202) unsigned int n; db::Polygon pr; db::Polygon pp = compute_rounded (p, 100000, 150000, 200); - EXPECT_EQ (pp.hull ().size (), 300); + EXPECT_EQ (pp.hull ().size (), size_t (300)); EXPECT_EQ (extract_rad (pp, rinner, router, n, &pr), true); EXPECT_EQ (tl::to_string (rinner), "92000"); @@ -1419,7 +1419,7 @@ TEST(202) ep.simple_merge (in, out, false /*no cut line*/); pp = out.front (); - EXPECT_EQ (pp.hull ().size (), 301); + EXPECT_EQ (pp.hull ().size (), size_t (301)); EXPECT_EQ (extract_rad (pp, rinner, router, n, &pr), true); EXPECT_EQ (tl::to_string (rinner), "50000"); @@ -1470,7 +1470,7 @@ TEST(203) pp = out.front (); pp = smooth (pp, 1); - EXPECT_EQ (pp.hull ().size (), 300); + EXPECT_EQ (pp.hull ().size (), size_t (300)); EXPECT_EQ (extract_rad (pp, rinner, router, n, &pr), true); EXPECT_EQ (tl::to_string (rinner), "5000"); @@ -1516,7 +1516,7 @@ TEST(204) pp = out.front (); pp = smooth (pp, 1); - EXPECT_EQ (pp.hull ().size (), 200); + EXPECT_EQ (pp.hull ().size (), size_t (200)); EXPECT_EQ (extract_rad (pp, rinner, router, n, &pr), true); EXPECT_EQ (tl::to_string (rinner), "10000"); diff --git a/src/unit_tests/dbPropertiesRepository.cc b/src/unit_tests/dbPropertiesRepository.cc index 26908cbc2..23e489d2a 100644 --- a/src/unit_tests/dbPropertiesRepository.cc +++ b/src/unit_tests/dbPropertiesRepository.cc @@ -85,14 +85,14 @@ TEST(2) size_t id1 = rep.prop_name_id (n1); size_t id2 = rep.prop_name_id (n2); - EXPECT_EQ (id1, 0); - EXPECT_EQ (id2, 1); + EXPECT_EQ (id1, size_t (0)); + EXPECT_EQ (id2, size_t (1)); id2 = rep.prop_name_id (n2); id1 = rep.prop_name_id (n1); - EXPECT_EQ (id1, 0); - EXPECT_EQ (id2, 1); + EXPECT_EQ (id1, size_t (0)); + EXPECT_EQ (id2, size_t (1)); EXPECT_EQ (rep.prop_name (0) == n1, true); EXPECT_EQ (rep.prop_name (1) == n2, true); @@ -103,8 +103,8 @@ TEST(2) id2 = rep2.prop_name_id (n2); id1 = rep2.prop_name_id (n1); - EXPECT_EQ (id1, 0); - EXPECT_EQ (id2, 1); + EXPECT_EQ (id1, size_t (0)); + EXPECT_EQ (id2, size_t (1)); EXPECT_EQ (rep2.prop_name (0) == n1, true); EXPECT_EQ (rep2.prop_name (1) == n2, true); @@ -113,7 +113,7 @@ TEST(2) rep2 = empty_rep; id1 = rep2.prop_name_id (n2); - EXPECT_EQ (id1, 0); + EXPECT_EQ (id1, size_t (0)); } TEST(3) @@ -126,14 +126,14 @@ TEST(3) size_t id1 = rep.prop_name_id (n1); size_t id2 = rep.prop_name_id (n2); - EXPECT_EQ (id1, 0); - EXPECT_EQ (id2, 1); + EXPECT_EQ (id1, size_t (0)); + EXPECT_EQ (id2, size_t (1)); id2 = rep.prop_name_id (n2); id1 = rep.prop_name_id (n1); - EXPECT_EQ (id1, 0); - EXPECT_EQ (id2, 1); + EXPECT_EQ (id1, size_t (0)); + EXPECT_EQ (id2, size_t (1)); EXPECT_EQ (rep.prop_name (0) == n1, true); EXPECT_EQ (rep.prop_name (1) == n2, true); @@ -144,8 +144,8 @@ TEST(3) id2 = rep2.prop_name_id (n2); id1 = rep2.prop_name_id (n1); - EXPECT_EQ (id1, 0); - EXPECT_EQ (id2, 1); + EXPECT_EQ (id1, size_t (0)); + EXPECT_EQ (id2, size_t (1)); EXPECT_EQ (rep2.prop_name (0) == n1, true); EXPECT_EQ (rep2.prop_name (1) == n2, true); @@ -154,7 +154,7 @@ TEST(3) rep2 = empty_rep; id1 = rep2.prop_name_id (n2); - EXPECT_EQ (id1, 0); + EXPECT_EQ (id1, size_t (0)); } TEST(4) @@ -173,14 +173,14 @@ TEST(4) size_t id1 = rep.properties_id (set1); size_t id2 = rep.properties_id (set2); - EXPECT_EQ (id1, 1); - EXPECT_EQ (id2, 2); + EXPECT_EQ (id1, size_t (1)); + EXPECT_EQ (id2, size_t (2)); id2 = rep.properties_id (set2); id1 = rep.properties_id (set1); - EXPECT_EQ (id1, 1); - EXPECT_EQ (id2, 2); + EXPECT_EQ (id1, size_t (1)); + EXPECT_EQ (id2, size_t (2)); EXPECT_EQ (rep.properties (1) == set1, true); EXPECT_EQ (rep.properties (2) == set2, true); @@ -191,8 +191,8 @@ TEST(4) id2 = rep2.properties_id (set2); id1 = rep2.properties_id (set1); - EXPECT_EQ (id1, 1); - EXPECT_EQ (id2, 2); + EXPECT_EQ (id1, size_t (1)); + EXPECT_EQ (id2, size_t (2)); EXPECT_EQ (rep2.properties (1) == set1, true); EXPECT_EQ (rep2.properties (2) == set2, true); @@ -201,7 +201,7 @@ TEST(4) rep2 = empty_rep; id1 = rep2.properties_id (set2); - EXPECT_EQ (id1, 1); + EXPECT_EQ (id1, size_t (1)); } TEST(5) @@ -243,8 +243,8 @@ TEST(6) size_t id1 = rep.prop_name_id (n1); size_t id2 = rep.prop_name_id (n2); - EXPECT_EQ (id1, 0); - EXPECT_EQ (id2, 0); + EXPECT_EQ (id1, size_t (0)); + EXPECT_EQ (id2, size_t (0)); db::PropertiesRepository::properties_set set1; db::PropertiesRepository::properties_set set2; @@ -255,7 +255,7 @@ TEST(6) size_t pid1 = rep.properties_id (set1); size_t pid2 = rep.properties_id (set2); - EXPECT_EQ (pid1, 1); - EXPECT_EQ (pid2, 2); + EXPECT_EQ (pid1, size_t (1)); + EXPECT_EQ (pid2, size_t (2)); } diff --git a/src/unit_tests/dbRegion.cc b/src/unit_tests/dbRegion.cc index 641612c78..4c4ab93d9 100644 --- a/src/unit_tests/dbRegion.cc +++ b/src/unit_tests/dbRegion.cc @@ -77,16 +77,16 @@ TEST(1) EXPECT_EQ (r.is_box (), false); EXPECT_EQ (r.to_string (), "(0,0;0,200;100,200;100,0);(10,20;10,220;110,220;110,20)"); EXPECT_EQ (r.is_merged (), false); - EXPECT_EQ (r.size (), 2); + EXPECT_EQ (r.size (), size_t (2)); r.set_merged_semantics (false); EXPECT_EQ (r.area (), 40000); EXPECT_EQ (r.area (db::Box (db::Point (-10, -10), db::Point (50, 50))), 50 * 50 + 40 * 30); - EXPECT_EQ (r.perimeter (), 1200); - EXPECT_EQ (r.perimeter (db::Box (db::Point (-10, -10), db::Point (50, 50))), 170); - EXPECT_EQ (r.perimeter (db::Box (db::Point (-10, -10), db::Point (0, 50))), 0); - EXPECT_EQ (r.perimeter (db::Box (db::Point (0, 0), db::Point (50, 50))), 170); - EXPECT_EQ (r.perimeter (db::Box (db::Point (10, 20), db::Point (50, 50))), 70); - EXPECT_EQ (r.perimeter (db::Box (db::Point (90, 200), db::Point (110, 220))), 40); + EXPECT_EQ (r.perimeter (), db::Region::perimeter_type (1200)); + EXPECT_EQ (r.perimeter (db::Box (db::Point (-10, -10), db::Point (50, 50))), db::Region::perimeter_type (170)); + EXPECT_EQ (r.perimeter (db::Box (db::Point (-10, -10), db::Point (0, 50))), db::Region::perimeter_type (0)); + EXPECT_EQ (r.perimeter (db::Box (db::Point (0, 0), db::Point (50, 50))), db::Region::perimeter_type (170)); + EXPECT_EQ (r.perimeter (db::Box (db::Point (10, 20), db::Point (50, 50))), db::Region::perimeter_type (70)); + EXPECT_EQ (r.perimeter (db::Box (db::Point (90, 200), db::Point (110, 220))), db::Region::perimeter_type (40)); db::Coord ptot = 0; for (db::Coord x = 0; x < 110; x += 10) { for (db::Coord y = 0; y < 220; y += 10) { @@ -97,19 +97,19 @@ TEST(1) r.set_merged_semantics (true); EXPECT_EQ (r.area (), 23800); EXPECT_EQ (r.area (db::Box (db::Point (-10, -10), db::Point (50, 50))), 50 * 50); - EXPECT_EQ (r.perimeter (), 660); - EXPECT_EQ (r.perimeter (db::Box (db::Point (-10, -10), db::Point (50, 50))), 100); - EXPECT_EQ (r.perimeter (db::Box (db::Point (-10, -10), db::Point (0, 50))), 0); - EXPECT_EQ (r.perimeter (db::Box (db::Point (0, 0), db::Point (50, 50))), 100); + EXPECT_EQ (r.perimeter (), db::Region::perimeter_type (660)); + EXPECT_EQ (r.perimeter (db::Box (db::Point (-10, -10), db::Point (50, 50))), db::Region::perimeter_type (100)); + EXPECT_EQ (r.perimeter (db::Box (db::Point (-10, -10), db::Point (0, 50))), db::Region::perimeter_type (0)); + EXPECT_EQ (r.perimeter (db::Box (db::Point (0, 0), db::Point (50, 50))), db::Region::perimeter_type (100)); r.merge (); EXPECT_EQ (r.to_string (), "(0,0;0,200;10,200;10,220;110,220;110,20;100,20;100,0)"); EXPECT_EQ (r.bbox ().to_string (), "(0,0;110,220)"); EXPECT_EQ (r.is_merged (), true); EXPECT_EQ (r.is_box (), false); EXPECT_EQ (r.empty (), false); - EXPECT_EQ (r.size (), 1); + EXPECT_EQ (r.size (), size_t (1)); EXPECT_EQ (r.area (), 23800); - EXPECT_EQ (r.perimeter (), 660); + EXPECT_EQ (r.perimeter (), db::Region::perimeter_type (660)); r.clear (); EXPECT_EQ (r.empty (), true); @@ -134,8 +134,8 @@ TEST(1b) db::Region r; r.insert (db::Box (db::Point (52200, 20000), db::Point (55200, 21000))); r.set_merged_semantics (false); - EXPECT_EQ (r.perimeter (db::Box (db::Point (51100, 20000), db::Point (55200, 21000))), 8000); - EXPECT_EQ (r.perimeter (db::Box (db::Point (55200, 20000), db::Point (59300, 21000))), 0); + EXPECT_EQ (r.perimeter (db::Box (db::Point (51100, 20000), db::Point (55200, 21000))), db::Region::perimeter_type (8000)); + EXPECT_EQ (r.perimeter (db::Box (db::Point (55200, 20000), db::Point (59300, 21000))), db::Region::perimeter_type (0)); } TEST(2) @@ -658,7 +658,7 @@ TEST(18a) EXPECT_EQ (o.to_string (), "(50,10;50,30;70,30;70,10);(70,60;70,80;90,80;90,60)"); o = r; EXPECT_EQ (o.selected_not_outside (rr).to_string (), "(0,0;0,20;20,20;20,0);(20,30;20,50;40,50;40,30);(0,60;0,80;60,80;60,60);(0,100;0,130;30,130;30,100)"); - EXPECT_EQ (o.selected_outside (rr).size () + o.selected_not_outside (rr).size (), 6); + EXPECT_EQ (o.selected_outside (rr).size () + o.selected_not_outside (rr).size (), size_t (6)); o.select_not_outside (rr); EXPECT_EQ (o.to_string (), "(0,0;0,20;20,20;20,0);(20,30;20,50;40,50;40,30);(0,60;0,80;60,80;60,60);(0,100;0,130;30,130;30,100)"); } @@ -669,7 +669,7 @@ TEST(18a) EXPECT_EQ (o.to_string (), "(20,30;20,50;40,50;40,30)"); o = r; EXPECT_EQ (o.selected_not_inside (rr).to_string (), "(0,0;0,20;20,20;20,0);(50,10;50,30;70,30;70,10);(70,60;70,80;90,80;90,60);(0,60;0,80;60,80;60,60);(0,100;0,130;30,130;30,100)"); - EXPECT_EQ (o.selected_inside (rr).size () + o.selected_not_inside (rr).size (), 6); + EXPECT_EQ (o.selected_inside (rr).size () + o.selected_not_inside (rr).size (), size_t (6)); o.select_not_inside (rr); EXPECT_EQ (o.to_string (), "(0,0;0,20;20,20;20,0);(50,10;50,30;70,30;70,10);(70,60;70,80;90,80;90,60);(0,60;0,80;60,80;60,60);(0,100;0,130;30,130;30,100)"); } @@ -680,7 +680,7 @@ TEST(18a) EXPECT_EQ (o.to_string (), "(0,0;0,20;20,20;20,0);(20,30;20,50;40,50;40,30);(50,10;50,30;70,30;70,10);(0,60;0,80;60,80;60,60);(0,100;0,130;30,130;30,100)"); o = r; EXPECT_EQ (o.selected_not_interacting (rr).to_string (), "(70,60;70,80;90,80;90,60)"); - EXPECT_EQ (o.selected_interacting (rr).size () + o.selected_not_interacting (rr).size (), 6); + EXPECT_EQ (o.selected_interacting (rr).size () + o.selected_not_interacting (rr).size (), size_t (6)); o.select_not_interacting (rr); EXPECT_EQ (o.to_string (), "(70,60;70,80;90,80;90,60)"); } @@ -691,7 +691,7 @@ TEST(18a) EXPECT_EQ (o.to_string (), "(0,0;0,20;20,20;20,0);(20,30;20,50;40,50;40,30);(0,60;0,80;60,80;60,60);(0,100;0,130;30,130;30,100)"); o = r; EXPECT_EQ (o.selected_not_overlapping (rr).to_string (), "(50,10;50,30;70,30;70,10);(70,60;70,80;90,80;90,60)"); - EXPECT_EQ (o.selected_overlapping (rr).size () + o.selected_not_overlapping (rr).size (), 6); + EXPECT_EQ (o.selected_overlapping (rr).size () + o.selected_not_overlapping (rr).size (), size_t (6)); o.select_not_overlapping (rr); EXPECT_EQ (o.to_string (), "(50,10;50,30;70,30;70,10);(70,60;70,80;90,80;90,60)"); } @@ -811,10 +811,10 @@ TEST(20) EXPECT_EQ (r1.to_string (), "(120,20;120,40;140,40;140,20);(160,80;160,140;220,140;220,80)"); EXPECT_EQ (r1.has_valid_polygons (), false); EXPECT_EQ (r1.area (), 4000); - EXPECT_EQ (r1.perimeter (), 320); + EXPECT_EQ (r1.perimeter (), db::Region::perimeter_type (320)); EXPECT_EQ (r1.bbox ().to_string (), "(120,20;220,140)"); EXPECT_EQ (r1.is_box (), false); - EXPECT_EQ (r1.size (), 2); + EXPECT_EQ (r1.size (), size_t (2)); EXPECT_EQ (r1.empty (), false); db::RegionPerimeterFilter f0 (0, 100, false); @@ -824,27 +824,27 @@ TEST(20) db::Region r2 = r1; EXPECT_EQ (r2.has_valid_polygons (), false); EXPECT_EQ (r2.area (), 4000); - EXPECT_EQ (r2.perimeter (), 320); + EXPECT_EQ (r2.perimeter (), db::Region::perimeter_type (320)); EXPECT_EQ (r2.bbox ().to_string (), "(120,20;220,140)"); EXPECT_EQ (r2.is_box (), false); - EXPECT_EQ (r2.size (), 2); + EXPECT_EQ (r2.size (), size_t (2)); EXPECT_EQ (r2.empty (), false); r2.filter (f0); EXPECT_EQ (r2.has_valid_polygons (), true); EXPECT_EQ (r2.to_string (), "(120,20;120,40;140,40;140,20)"); - EXPECT_EQ (r2.size (), 1); + EXPECT_EQ (r2.size (), size_t (1)); EXPECT_EQ (r2.empty (), false); EXPECT_EQ (r2.is_box (), true); EXPECT_EQ (r2.area (), 400); - EXPECT_EQ (r2.perimeter (), 80); + EXPECT_EQ (r2.perimeter (), db::Region::perimeter_type (80)); r1.insert (db::Box (0, 0, 10, 20)); EXPECT_EQ (r1.has_valid_polygons (), true); EXPECT_EQ (r1.to_string (), "(120,20;120,40;140,40;140,20);(160,80;160,140;220,140;220,80);(0,0;0,20;10,20;10,0)"); EXPECT_EQ (r1.to_string (2), "(120,20;120,40;140,40;140,20);(160,80;160,140;220,140;220,80)..."); - EXPECT_EQ (r1.size (), 3); + EXPECT_EQ (r1.size (), size_t (3)); EXPECT_EQ (r1.area (), 4200); - EXPECT_EQ (r1.perimeter (), 380); + EXPECT_EQ (r1.perimeter (), db::Region::perimeter_type (380)); rr = r1.filtered (f0); EXPECT_EQ (rr.to_string (), "(0,0;0,20;10,20;10,0);(120,20;120,40;140,40;140,20)"); @@ -860,7 +860,7 @@ TEST(20) EXPECT_EQ (r1.to_string (), "(120,20;120,40;140,40;140,20)"); EXPECT_EQ (r1.has_valid_polygons (), false); EXPECT_EQ (r1.is_box (), true); - EXPECT_EQ (r1.size (), 1); + EXPECT_EQ (r1.size (), size_t (1)); EXPECT_EQ (r1.empty (), false); db::Region r2 = r1; @@ -872,9 +872,9 @@ TEST(20) r1.clear (); EXPECT_EQ (r1.has_valid_polygons (), true); - EXPECT_EQ (r1.size (), 0); + EXPECT_EQ (r1.size (), size_t (0)); EXPECT_EQ (r1.empty (), true); - EXPECT_EQ (r1.perimeter (), 0); + EXPECT_EQ (r1.perimeter (), db::Region::perimeter_type (0)); EXPECT_EQ (r1.area (), 0); EXPECT_EQ (r2.to_string (), "(120,20;120,40;140,40;140,20)"); @@ -883,9 +883,9 @@ TEST(20) EXPECT_EQ (r1.to_string (), "(120,20;120,40;140,40;140,20)"); EXPECT_EQ (r1.has_valid_polygons (), false); EXPECT_EQ (r2.has_valid_polygons (), true); - EXPECT_EQ (r2.size (), 0); + EXPECT_EQ (r2.size (), size_t (0)); EXPECT_EQ (r2.empty (), true); - EXPECT_EQ (r2.perimeter (), 0); + EXPECT_EQ (r2.perimeter (), db::Region::perimeter_type (0)); EXPECT_EQ (r2.area (), 0); } diff --git a/src/unit_tests/dbShape.cc b/src/unit_tests/dbShape.cc index 50526bd39..17fde1b1a 100644 --- a/src/unit_tests/dbShape.cc +++ b/src/unit_tests/dbShape.cc @@ -711,7 +711,7 @@ TEST(5) EXPECT_EQ (si->area (), bx1.area()); EXPECT_EQ (si->perimeter (), bx1.perimeter()); EXPECT_EQ (si->has_prop_id (), true); - EXPECT_EQ (si->prop_id (), 17); + EXPECT_EQ (si->prop_id (), size_t (17)); ++si; @@ -735,7 +735,7 @@ TEST(6) EXPECT_EQ (si->area (), bx1.area ()); EXPECT_EQ (si->perimeter (), bx1.perimeter ()); EXPECT_EQ (si->has_prop_id (), true); - EXPECT_EQ (si->prop_id (), 17); + EXPECT_EQ (si->prop_id (), size_t (17)); ++si; diff --git a/src/unit_tests/dbShapeArray.cc b/src/unit_tests/dbShapeArray.cc index 5464131f2..b038ee5bf 100644 --- a/src/unit_tests/dbShapeArray.cc +++ b/src/unit_tests/dbShapeArray.cc @@ -82,7 +82,7 @@ TEST(1) ++n; } - EXPECT_EQ (n, 9); + EXPECT_EQ (n, (unsigned int) 9); EXPECT_EQ (s.at_end (), true); for (unsigned int i = 0; i < n; ++i) { diff --git a/src/unit_tests/dbShapeRepository.cc b/src/unit_tests/dbShapeRepository.cc index 0a9c560a6..7c5f07773 100644 --- a/src/unit_tests/dbShapeRepository.cc +++ b/src/unit_tests/dbShapeRepository.cc @@ -55,7 +55,7 @@ TEST(1) db::PolygonRef pref2 (p2, rep); - EXPECT_EQ (rep.repository (db::Polygon::tag ()).size (), 1); + EXPECT_EQ (rep.repository (db::Polygon::tag ()).size (), size_t (1)); EXPECT_EQ (pref1.trans (), db::Disp (db::Vector (100, 0))); EXPECT_EQ (pref1.instantiate (), p1); @@ -124,7 +124,7 @@ TEST(2) db::PolygonRef pr2 (p2, *rep); - EXPECT_EQ (rep->repository (db::Polygon::tag ()).size (), 1); + EXPECT_EQ (rep->repository (db::Polygon::tag ()).size (), size_t (1)); // copy everything into a new repository db::GenericRepository rep2; @@ -135,7 +135,7 @@ TEST(2) delete rep; rep = 0; - EXPECT_EQ (rep2.repository (db::Polygon::tag ()).size (), 1); + EXPECT_EQ (rep2.repository (db::Polygon::tag ()).size (), size_t (1)); EXPECT_EQ (pref1.trans (), db::Disp (db::Vector (100, 0))); EXPECT_EQ (pref1.instantiate (), p1); @@ -165,7 +165,7 @@ TEST(1SIMPLE) db::SimplePolygonRef pref2 (p2, rep); - EXPECT_EQ (rep.repository (db::SimplePolygon::tag ()).size (), 1); + EXPECT_EQ (rep.repository (db::SimplePolygon::tag ()).size (), size_t (1)); EXPECT_EQ (pref1.trans (), db::Disp (db::Vector (100, 0))); EXPECT_EQ (pref1.instantiate (), p1); @@ -234,7 +234,7 @@ TEST(2SIMPLE) db::SimplePolygonRef pr2 (p2, *rep); - EXPECT_EQ (rep->repository (db::SimplePolygon::tag ()).size (), 1); + EXPECT_EQ (rep->repository (db::SimplePolygon::tag ()).size (), size_t (1)); // copy everything into a new repository db::GenericRepository rep2; @@ -245,7 +245,7 @@ TEST(2SIMPLE) delete rep; rep = 0; - EXPECT_EQ (rep2.repository (db::SimplePolygon::tag ()).size (), 1); + EXPECT_EQ (rep2.repository (db::SimplePolygon::tag ()).size (), size_t (1)); EXPECT_EQ (pref1.trans (), db::Disp (db::Vector (100, 0))); EXPECT_EQ (pref1.instantiate (), p1); @@ -276,7 +276,7 @@ TEST(3) shapes.insert (p2); shapes.insert (db::SimplePolygonRef (p2, *rep)); - EXPECT_EQ (rep->repository (db::SimplePolygon::tag ()).size (), 1); + EXPECT_EQ (rep->repository (db::SimplePolygon::tag ()).size (), size_t (1)); db::Shapes::shape_iterator s = shapes.begin (db::ShapeIterator::All); unsigned int n = 0; @@ -304,7 +304,7 @@ TEST(3) } - EXPECT_EQ (n, 4); + EXPECT_EQ (n, (unsigned int) 4); db::Layout rep2; db::Cell &rep2_cell = rep2.cell (rep2.add_cell ()); @@ -316,7 +316,7 @@ TEST(3) delete rep; rep = 0; - EXPECT_EQ (rep2.shape_repository ().repository (db::SimplePolygon::tag ()).size (), 1); + EXPECT_EQ (rep2.shape_repository ().repository (db::SimplePolygon::tag ()).size (), size_t (1)); s = shapes2.begin (db::ShapeIterator::All); n = 0; @@ -328,7 +328,7 @@ TEST(3) ++n; } - EXPECT_EQ (n, 4); + EXPECT_EQ (n, size_t (4)); } @@ -364,10 +364,10 @@ TEST(4) shapes.insert (tt); shapes.insert (db::TextRef (tt, rep)); - EXPECT_EQ (rep.repository (db::SimplePolygon::tag ()).size (), 1); - EXPECT_EQ (rep.repository (db::Polygon::tag ()).size (), 1); - EXPECT_EQ (rep.repository (db::Path::tag ()).size (), 1); - EXPECT_EQ (rep.repository (db::Text::tag ()).size (), 1); + EXPECT_EQ (rep.repository (db::SimplePolygon::tag ()).size (), size_t (1)); + EXPECT_EQ (rep.repository (db::Polygon::tag ()).size (), size_t (1)); + EXPECT_EQ (rep.repository (db::Path::tag ()).size (), size_t (1)); + EXPECT_EQ (rep.repository (db::Text::tag ()).size (), size_t (1)); db::Shapes::shape_iterator s = shapes.begin (db::ShapeIterator::All); unsigned int n = 0; @@ -390,7 +390,7 @@ TEST(4) EXPECT_EQ (r == c1.end (), true); EXPECT_EQ (s->path_width (), 21); } else { - EXPECT_EQ (s->holes (), 0); + EXPECT_EQ (s->holes (), size_t (0)); std::vector::const_iterator r = c1.begin (); for (db::Shape::point_iterator pt = s->begin_hull (); pt != s->end_hull (); ++pt) { EXPECT_EQ (*pt, *r); @@ -404,7 +404,7 @@ TEST(4) } - EXPECT_EQ (n, 8); + EXPECT_EQ (n, size_t (8)); } diff --git a/src/unit_tests/dbShapes.cc b/src/unit_tests/dbShapes.cc index 77d6a3832..3e206b4c8 100644 --- a/src/unit_tests/dbShapes.cc +++ b/src/unit_tests/dbShapes.cc @@ -3160,11 +3160,11 @@ TEST(20) { db::Shapes shapes; db::ShapeIterator s = shapes.begin (db::ShapeIterator::All); - EXPECT_EQ (s.quad_id (), 0); + EXPECT_EQ (s.quad_id (), size_t (0)); EXPECT_EQ (s.quad_box ().to_string (), db::Box::world ().to_string ()); s = shapes.begin_touching (db::Box (-500, -500, 500, 500), db::ShapeIterator::All); - EXPECT_EQ (s.quad_id (), 0); + EXPECT_EQ (s.quad_id (), size_t (0)); EXPECT_EQ (s.quad_box ().to_string (), "()"); for (int i = 0; i < 200; ++i) { @@ -3203,11 +3203,11 @@ TEST(21) { db::Shapes shapes; db::ShapeIterator s = shapes.begin (db::ShapeIterator::All); - EXPECT_EQ (s.quad_id (), 0); + EXPECT_EQ (s.quad_id (), size_t (0)); EXPECT_EQ (s.quad_box ().to_string (), db::Box::world ().to_string ()); s = shapes.begin_touching (db::Box (-500, -500, 500, 500), db::ShapeIterator::All); - EXPECT_EQ (s.quad_id (), 0); + EXPECT_EQ (s.quad_id (), size_t (0)); EXPECT_EQ (s.quad_box ().to_string (), "()"); for (int i = 0; i < 50; ++i) { diff --git a/src/unit_tests/dbStreamLayers.cc b/src/unit_tests/dbStreamLayers.cc index 2c5544f96..284da16d0 100644 --- a/src/unit_tests/dbStreamLayers.cc +++ b/src/unit_tests/dbStreamLayers.cc @@ -32,11 +32,11 @@ TEST(1) lm.map (db::LDPair (1, 5), 17); EXPECT_EQ (lm.logical (db::LDPair (1, 6)).first, false); EXPECT_EQ (lm.logical (db::LDPair (1, 5)).first, true); - EXPECT_EQ (lm.logical (db::LDPair (1, 5)).second, 17); + EXPECT_EQ (lm.logical (db::LDPair (1, 5)).second, (unsigned int) 17); lm.map (db::LDPair (1, 0), db::LDPair (5,0), 18); EXPECT_EQ (lm.logical (db::LDPair (2, 0)).first, true); - EXPECT_EQ (lm.logical (db::LDPair (2, 0)).second, 18); + EXPECT_EQ (lm.logical (db::LDPair (2, 0)).second, (unsigned int) 18); EXPECT_EQ (lm.logical (db::LDPair (0, 0)).first, false); EXPECT_EQ (lm.mapping_str (18), "1/0;2-5/0"); @@ -63,11 +63,11 @@ TEST(1) lm.map_expr ("XP;10/7-8 : XN", 13); EXPECT_EQ (lm.mapping_str (13), "10/7-8;XP : XN"); - EXPECT_EQ (lm.logical ("XP").second, 13); + EXPECT_EQ (lm.logical ("XP").second, (unsigned int) 13); EXPECT_EQ (lm.logical ("XP").first, true); EXPECT_EQ (lm.logical (db::LDPair(10, 6)).first, false); EXPECT_EQ (lm.logical (db::LDPair(10, 7)).first, true); - EXPECT_EQ (lm.logical (db::LDPair(10, 7)).second, 13); + EXPECT_EQ (lm.logical (db::LDPair(10, 7)).second, (unsigned int) 13); EXPECT_EQ (lm.mapping (13).to_string (), "XN (10/7)"); diff --git a/src/unit_tests/dbText.cc b/src/unit_tests/dbText.cc index aedee01dd..e5bef0d0a 100644 --- a/src/unit_tests/dbText.cc +++ b/src/unit_tests/dbText.cc @@ -69,7 +69,7 @@ TEST(2) EXPECT_EQ (t < tt, false); EXPECT_EQ (tt < t, false); - EXPECT_EQ (rep.size (), 1); + EXPECT_EQ (rep.size (), size_t (1)); rep.change_string_ref (ref, "NOCHWAS"); EXPECT_EQ (std::string (t.string ()), "NOCHWAS"); @@ -80,12 +80,12 @@ TEST(2) EXPECT_EQ (t < tt, false); EXPECT_EQ (tt < t, false); - EXPECT_EQ (rep.size (), 1); + EXPECT_EQ (rep.size (), size_t (1)); t = db::Text (); tt = db::Text (); - EXPECT_EQ (rep.size (), 0); + EXPECT_EQ (rep.size (), size_t (0)); } TEST(3) diff --git a/src/unit_tests/dbTilingProcessor.cc b/src/unit_tests/dbTilingProcessor.cc index bf594d2ec..2b506497f 100644 --- a/src/unit_tests/dbTilingProcessor.cc +++ b/src/unit_tests/dbTilingProcessor.cc @@ -274,9 +274,9 @@ TEST(3) } EXPECT_EQ (or2.has_valid_polygons (), true); - EXPECT_EQ (or2.size () / 1000, 100); // because we use rand () the value may vary - it's only accurate to 1% + EXPECT_EQ (or2.size () / 1000, size_t (100)); // because we use rand () the value may vary - it's only accurate to 1% EXPECT_EQ (or2_copy.has_valid_polygons (), true); - EXPECT_EQ (or2_copy.size () / 1000, 81); // because we use rand () the value may vary - it's only accurate to 1% + EXPECT_EQ (or2_copy.size () / 1000, size_t (81)); // because we use rand () the value may vary - it's only accurate to 1% EXPECT_EQ ((or2 ^ or2_copy).empty (), true); #if 0 diff --git a/src/unit_tests/imgObject.cc b/src/unit_tests/imgObject.cc index 7ce19fafe..8cb32a053 100644 --- a/src/unit_tests/imgObject.cc +++ b/src/unit_tests/imgObject.cc @@ -35,7 +35,7 @@ TEST(1) EXPECT_EQ (image.float_data ()[0], 0.0); EXPECT_EQ (image.float_data ()[1], 0.0); EXPECT_EQ (image.float_data ()[12*8-1], 0.0); - EXPECT_EQ (image.data_length(), 12 * 8); + EXPECT_EQ (image.data_length(), size_t (12 * 8)); EXPECT_EQ (db::DCplxTrans (image.matrix ()).to_string (), "r0 *1 0,0"); @@ -57,8 +57,8 @@ TEST(1) copy1.set_data (12, 8, d); EXPECT_EQ (copy1.equals (&image), true); EXPECT_EQ (copy1.float_data () == image.float_data (), false); - EXPECT_EQ (copy1.width (), 12); - EXPECT_EQ (copy1.height (), 8); + EXPECT_EQ (copy1.width (), size_t (12)); + EXPECT_EQ (copy1.height (), size_t (8)); d[0] = 12.5; d[5] = -12.5; @@ -104,14 +104,14 @@ TEST(1) EXPECT_EQ (copy1.data_mapping ().brightness, 0.5); EXPECT_EQ (copy1.data_mapping ().red_gain, 1.25); - EXPECT_EQ (copy1.data_mapping ().false_color_nodes.size (), 3); + EXPECT_EQ (copy1.data_mapping ().false_color_nodes.size (), size_t (3)); img::Object copy2; copy2.from_string (image.to_string ().c_str ()); EXPECT_EQ (copy2.data_mapping ().brightness, 0.5); EXPECT_EQ (tl::to_string (copy2.data_mapping ().red_gain), "1.25"); - EXPECT_EQ (copy2.data_mapping ().false_color_nodes.size (), 3); + EXPECT_EQ (copy2.data_mapping ().false_color_nodes.size (), size_t (3)); EXPECT_EQ (copy2.equals (&image), true); EXPECT_EQ (image.to_string (), copy2.to_string ()); @@ -141,7 +141,7 @@ TEST(2) EXPECT_EQ (image.float_data (channel)[0], 0.0); EXPECT_EQ (image.float_data (channel)[1], 0.0); EXPECT_EQ (image.float_data (channel)[12*8-1], 0.0); - EXPECT_EQ (image.data_length(), 12 * 8); + EXPECT_EQ (image.data_length(), size_t (12 * 8)); EXPECT_EQ (db::DCplxTrans (image.matrix ()).to_string (), "r0 *1 0,0"); @@ -165,8 +165,8 @@ TEST(2) copy1.set_data (12, 8, d[0], d[1], d[2]); EXPECT_EQ (copy1.equals (&image), true); EXPECT_EQ (copy1.float_data (channel) == image.float_data (channel), false); - EXPECT_EQ (copy1.width (), 12); - EXPECT_EQ (copy1.height (), 8); + EXPECT_EQ (copy1.width (), size_t (12)); + EXPECT_EQ (copy1.height (), size_t (8)); d[channel][0] = 12.5; d[channel][5] = -12.5; @@ -212,14 +212,14 @@ TEST(2) EXPECT_EQ (copy1.data_mapping ().brightness, 0.5); EXPECT_EQ (copy1.data_mapping ().red_gain, 1.25); - EXPECT_EQ (copy1.data_mapping ().false_color_nodes.size (), 3); + EXPECT_EQ (copy1.data_mapping ().false_color_nodes.size (), size_t (3)); img::Object copy2; copy2.from_string (image.to_string ().c_str ()); EXPECT_EQ (copy2.data_mapping ().brightness, 0.5); EXPECT_EQ (tl::to_string (copy2.data_mapping ().red_gain), "1.25"); - EXPECT_EQ (copy2.data_mapping ().false_color_nodes.size (), 3); + EXPECT_EQ (copy2.data_mapping ().false_color_nodes.size (), size_t (3)); EXPECT_EQ (copy2.equals (&image), true); EXPECT_EQ (image.to_string (), copy2.to_string ()); @@ -263,7 +263,7 @@ TEST(3) EXPECT_EQ ((int)image.byte_data ()[0], 11); EXPECT_EQ ((int)image.byte_data ()[1], 12); EXPECT_EQ ((int)image.byte_data ()[12*8-1], 81); - EXPECT_EQ (image.data_length(), 12 * 8); + EXPECT_EQ (image.data_length (), size_t (12 * 8)); img::Object copy1 (image); EXPECT_EQ (copy1.equals (&image), true); @@ -286,8 +286,8 @@ TEST(3) EXPECT_EQ (copy1.is_byte_data (), true); EXPECT_EQ (copy1.equals (&image), true); EXPECT_EQ (copy1.byte_data () == image.byte_data (), false); - EXPECT_EQ (copy1.width (), 12); - EXPECT_EQ (copy1.height (), 8); + EXPECT_EQ (copy1.width (), size_t (12)); + EXPECT_EQ (copy1.height (), size_t (8)); EXPECT_EQ (image.mask (1, 2), true); image.set_mask (1, 2, false); diff --git a/src/unit_tests/layLayerProperties.cc b/src/unit_tests/layLayerProperties.cc index be159a197..f8141fb77 100644 --- a/src/unit_tests/layLayerProperties.cc +++ b/src/unit_tests/layLayerProperties.cc @@ -888,7 +888,7 @@ TEST (9) lay::LayerPropertiesList list; list.load (s); - EXPECT_EQ (size (list), 8); + EXPECT_EQ (size (list), size_t (8)); size_t n, nn; @@ -917,7 +917,7 @@ TEST (9) } EXPECT_EQ (iter3 == end, true); } - EXPECT_EQ (n, 8); + EXPECT_EQ (n, size_t (8)); } TEST (10) @@ -954,7 +954,7 @@ TEST (10) lay::LayerPropertiesList org_list = list; - EXPECT_EQ (size (list), 8); + EXPECT_EQ (size (list), size_t (8)); std::vector nodes; std::vector positions; @@ -969,7 +969,7 @@ TEST (10) list.erase (iter); } - EXPECT_EQ (nodes.size (), 8); + EXPECT_EQ (nodes.size (), size_t (8)); for (unsigned int i = 0; i < 8; ++i) { lay::LayerPropertiesIterator iter (list, positions.back ()); @@ -987,7 +987,7 @@ TEST (10) list.erase (iter); } - EXPECT_EQ (nodes.size (), 2); + EXPECT_EQ (nodes.size (), size_t (2)); for (unsigned int i = 0; i < 2; ++i) { lay::LayerPropertiesIterator iter (list, positions.back ()); diff --git a/src/unit_tests/layParsedLayerSource.cc b/src/unit_tests/layParsedLayerSource.cc index 1550bc828..372ab37b0 100644 --- a/src/unit_tests/layParsedLayerSource.cc +++ b/src/unit_tests/layParsedLayerSource.cc @@ -231,12 +231,12 @@ TEST (5) ids.clear (); inv = ps1.property_selector ().matching (rep, ids); EXPECT_EQ (inv, false); - EXPECT_EQ (ids.size (), 1); + EXPECT_EQ (ids.size (), size_t (1)); EXPECT_EQ (*ids.begin (), id1); ids.clear (); inv = ps0.property_selector ().matching (rep, ids); EXPECT_EQ (inv, true); - EXPECT_EQ (ids.size (), 0); + EXPECT_EQ (ids.size (), size_t (0)); ps.clear (); ps.insert (std::make_pair (rep.prop_name_id (tl::Variant ("X")), tl::Variant (3l))); @@ -246,13 +246,13 @@ TEST (5) ids.clear (); inv = ps1.property_selector ().matching (rep, ids); EXPECT_EQ (inv, false); - EXPECT_EQ (ids.size (), 1); + EXPECT_EQ (ids.size (), size_t (1)); EXPECT_EQ (*ids.begin () == id2, false); EXPECT_EQ (*ids.begin (), id1); ids.clear (); inv = ps0.property_selector ().matching (rep, ids); EXPECT_EQ (inv, true); - EXPECT_EQ (ids.size (), 0); + EXPECT_EQ (ids.size (), size_t (0)); ps.clear (); ps.insert (std::make_pair (rep.prop_name_id (tl::Variant ("X")), tl::Variant (2l))); @@ -263,13 +263,13 @@ TEST (5) ids.clear (); inv = ps2.property_selector ().matching (rep, ids); EXPECT_EQ (inv, false); - EXPECT_EQ (ids.size (), 1); + EXPECT_EQ (ids.size (), size_t (1)); EXPECT_EQ (*ids.begin () == id3, false); EXPECT_EQ (*ids.begin (), id1); ids.clear (); inv = ps0.property_selector ().matching (rep, ids); EXPECT_EQ (inv, true); - EXPECT_EQ (ids.size (), 0); + EXPECT_EQ (ids.size (), size_t (0)); ps.clear (); ps.insert (std::make_pair (rep.prop_name_id (tl::Variant ("X")), tl::Variant (2l))); @@ -279,7 +279,7 @@ TEST (5) ids.clear (); inv = ps2.property_selector ().matching (rep, ids); EXPECT_EQ (inv, false); - EXPECT_EQ (ids.size (), 2); + EXPECT_EQ (ids.size (), size_t (2)); EXPECT_EQ (*ids.begin (), id1); EXPECT_EQ (*(++ids.begin ()), id4); ps.clear (); @@ -291,7 +291,7 @@ TEST (5) ids.clear (); inv = ps2.property_selector ().matching (rep, ids); EXPECT_EQ (inv, false); - EXPECT_EQ (ids.size (), 3); + EXPECT_EQ (ids.size (), size_t (3)); EXPECT_EQ (*ids.begin (), id1); EXPECT_EQ (*(++ids.begin ()), id4); EXPECT_EQ (*(++(++ids.begin ())), id5); @@ -300,7 +300,7 @@ TEST (5) ids.clear (); inv = ps2a.property_selector ().matching (rep, ids); EXPECT_EQ (inv, true); - EXPECT_EQ (ids.size (), 3); + EXPECT_EQ (ids.size (), size_t (3)); EXPECT_EQ (*ids.begin (), id1); EXPECT_EQ (*(++ids.begin ()), id4); EXPECT_EQ (*(++(++ids.begin ())), id5); @@ -309,7 +309,7 @@ TEST (5) ids.clear (); inv = ps2b.property_selector ().matching (rep, ids); EXPECT_EQ (inv, true); - EXPECT_EQ (ids.size (), 3); + EXPECT_EQ (ids.size (), size_t (3)); EXPECT_EQ (*ids.begin (), id1); EXPECT_EQ (*(++ids.begin ()), id4); EXPECT_EQ (*(++(++ids.begin ())), id5); @@ -321,7 +321,7 @@ TEST (5) ids.clear (); inv = ps2.property_selector ().matching (rep, ids); EXPECT_EQ (inv, false); - EXPECT_EQ (ids.size (), 3); + EXPECT_EQ (ids.size (), size_t (3)); EXPECT_EQ (*ids.begin (), id1); EXPECT_EQ (*(++ids.begin ()), id4); EXPECT_EQ (*(++(++ids.begin ())), id5); @@ -330,7 +330,7 @@ TEST (5) ids.clear (); inv = ps0.property_selector ().matching (rep, ids); EXPECT_EQ (inv, true); - EXPECT_EQ (ids.size (), 0); + EXPECT_EQ (ids.size (), size_t (0)); ps.insert (std::make_pair (rep.prop_name_id (tl::Variant ("Z")), tl::Variant (5l))); db::properties_id_type id7 = rep.properties_id (ps); @@ -338,7 +338,7 @@ TEST (5) ids.clear (); inv = ps4.property_selector ().matching (rep, ids); EXPECT_EQ (inv, false); - EXPECT_EQ (ids.size (), 5); + EXPECT_EQ (ids.size (), size_t (5)); EXPECT_EQ (ids.find (id7) == ids.end (), true); ps.insert (std::make_pair (rep.prop_name_id (tl::Variant ("X")), tl::Variant (15l))); @@ -347,7 +347,7 @@ TEST (5) ids.clear (); inv = ps4.property_selector ().matching (rep, ids); EXPECT_EQ (inv, false); - EXPECT_EQ (ids.size (), 6); + EXPECT_EQ (ids.size (), size_t (6)); EXPECT_EQ (ids.find (id8) != ids.end (), true); } diff --git a/src/unit_tests/rdb.cc b/src/unit_tests/rdb.cc index b3e65afd3..4b16909a1 100644 --- a/src/unit_tests/rdb.cc +++ b/src/unit_tests/rdb.cc @@ -131,42 +131,42 @@ TEST(3) rdb::Item *i2 = db.create_item (c2->id (), cath2->id ()); rdb::Item *i3 = db.create_item (c1->id (), cath2->id ()); - EXPECT_EQ (cath2->num_items (), 2); - EXPECT_EQ (cath->num_items (), 1); - EXPECT_EQ (c1->num_items (), 2); - EXPECT_EQ (c2->num_items (), 1); + EXPECT_EQ (cath2->num_items (), size_t (2)); + EXPECT_EQ (cath->num_items (), size_t (1)); + EXPECT_EQ (c1->num_items (), size_t (2)); + EXPECT_EQ (c2->num_items (), size_t (1)); db.set_item_visited (i1, true); - EXPECT_EQ (cath2->num_items_visited (), 0); - EXPECT_EQ (cath->num_items_visited (), 1); - EXPECT_EQ (c1->num_items_visited (), 1); - EXPECT_EQ (c2->num_items_visited (), 0); - EXPECT_EQ (db.num_items_visited (), 1); + EXPECT_EQ (cath2->num_items_visited (), size_t (0)); + EXPECT_EQ (cath->num_items_visited (), size_t (1)); + EXPECT_EQ (c1->num_items_visited (), size_t (1)); + EXPECT_EQ (c2->num_items_visited (), size_t (0)); + EXPECT_EQ (db.num_items_visited (), size_t (1)); db.set_item_visited (i2, true); - EXPECT_EQ (cath2->num_items_visited (), 1); - EXPECT_EQ (cath->num_items_visited (), 1); - EXPECT_EQ (c1->num_items_visited (), 1); - EXPECT_EQ (c2->num_items_visited (), 1); - EXPECT_EQ (db.num_items_visited (), 2); + EXPECT_EQ (cath2->num_items_visited (), size_t (1)); + EXPECT_EQ (cath->num_items_visited (), size_t (1)); + EXPECT_EQ (c1->num_items_visited (), size_t (1)); + EXPECT_EQ (c2->num_items_visited (), size_t (1)); + EXPECT_EQ (db.num_items_visited (), size_t (2)); db.set_item_visited (i3, true); - EXPECT_EQ (cath2->num_items_visited (), 2); - EXPECT_EQ (cath->num_items_visited (), 1); - EXPECT_EQ (c1->num_items_visited (), 2); - EXPECT_EQ (c2->num_items_visited (), 1); - EXPECT_EQ (db.num_items_visited (), 3); + EXPECT_EQ (cath2->num_items_visited (), size_t (2)); + EXPECT_EQ (cath->num_items_visited (), size_t (1)); + EXPECT_EQ (c1->num_items_visited (), size_t (2)); + EXPECT_EQ (c2->num_items_visited (), size_t (1)); + EXPECT_EQ (db.num_items_visited (), size_t (3)); db.set_item_visited (i1, false); - EXPECT_EQ (cath2->num_items_visited (), 2); - EXPECT_EQ (cath->num_items_visited (), 0); - EXPECT_EQ (c1->num_items_visited (), 1); - EXPECT_EQ (c2->num_items_visited (), 1); - EXPECT_EQ (db.num_items_visited (), 2); + EXPECT_EQ (cath2->num_items_visited (), size_t (2)); + EXPECT_EQ (cath->num_items_visited (), size_t (0)); + EXPECT_EQ (c1->num_items_visited (), size_t (1)); + EXPECT_EQ (c2->num_items_visited (), size_t (1)); + EXPECT_EQ (db.num_items_visited (), size_t (2)); } TEST(4) @@ -506,28 +506,28 @@ TEST(6) rdb::Cell *c1 = db.create_cell ("c1"); EXPECT_EQ (c1->qname (), "c1"); - EXPECT_EQ (db.variants ("c1").size (), 0); + EXPECT_EQ (db.variants ("c1").size (), size_t (0)); rdb::Cell *c1a = db.create_cell ("c1"); EXPECT_EQ (c1a->qname (), "c1:2"); EXPECT_EQ (c1->qname (), "c1:1") - EXPECT_EQ (db.variants ("c1").size (), 2); + EXPECT_EQ (db.variants ("c1").size (), size_t (2)); EXPECT_EQ (db.variants ("c1")[0], c1->id ()); EXPECT_EQ (db.variants ("c1")[1], c1a->id ()); rdb::Cell *c1b = db.create_cell ("c1", "var"); EXPECT_EQ (c1b->qname (), "c1:var") - EXPECT_EQ (db.variants ("c1").size (), 3); + EXPECT_EQ (db.variants ("c1").size (), size_t (3)); rdb::Cell *c2 = db.create_cell ("c2", "1027"); EXPECT_EQ (c2->qname (), "c2:1027"); - EXPECT_EQ (db.variants ("c2").size (), 1); + EXPECT_EQ (db.variants ("c2").size (), size_t (1)); rdb::Cell *c2a = db.create_cell ("c2"); EXPECT_EQ (c2a->qname (), "c2:1"); EXPECT_EQ (c2->qname (), "c2:1027") - EXPECT_EQ (db.variants ("c2").size (), 2); + EXPECT_EQ (db.variants ("c2").size (), size_t (2)); rdb::Cell *c2b = db.create_cell ("c2", "var"); EXPECT_EQ (c2b->qname (), "c2:var") @@ -541,7 +541,7 @@ TEST(6) rdb::Cell *c2e = db.create_cell ("c2"); EXPECT_EQ (c2e->qname (), "c2:4"); - EXPECT_EQ (db.variants ("c2").size (), 6); + EXPECT_EQ (db.variants ("c2").size (), size_t (6)); EXPECT_EQ (db.variants ("c2")[0], c2->id ()); EXPECT_EQ (db.variants ("c2")[5], c2e->id ()); } diff --git a/src/unit_tests/tlGlobPattern.cc b/src/unit_tests/tlGlobPattern.cc index 54bb78cdb..3bb003e5b 100644 --- a/src/unit_tests/tlGlobPattern.cc +++ b/src/unit_tests/tlGlobPattern.cc @@ -122,13 +122,13 @@ TEST(7) std::vector v; EXPECT_EQ (a.match ("abcg", v), true); - EXPECT_EQ (v.size (), 3); + EXPECT_EQ (v.size (), size_t (3)); EXPECT_EQ (v[0], "abc"); EXPECT_EQ (v[1], "bc"); EXPECT_EQ (v[2], "g"); EXPECT_EQ (a.match ("bc", v), true); - EXPECT_EQ (v.size (), 3); + EXPECT_EQ (v.size (), size_t (3)); EXPECT_EQ (v[0], "bc"); EXPECT_EQ (v[1], "bc"); EXPECT_EQ (v[2], ""); @@ -147,7 +147,7 @@ TEST(8) a.set_case_sensitive (false); EXPECT_EQ (a.case_sensitive (), false); EXPECT_EQ (a.match ("aBcG", v), true); - EXPECT_EQ (v.size (), 3); + EXPECT_EQ (v.size (), size_t (3)); EXPECT_EQ (v[0], "aBc"); EXPECT_EQ (v[1], "Bc"); EXPECT_EQ (v[2], "G"); diff --git a/src/unit_tests/tlKDTree.cc b/src/unit_tests/tlKDTree.cc index ead929ce3..5517790be 100644 --- a/src/unit_tests/tlKDTree.cc +++ b/src/unit_tests/tlKDTree.cc @@ -119,7 +119,7 @@ static void test_tree (ut::TestBase *_this, const Tree &t, const Picker &p, cons ++i; } - EXPECT_EQ (good_idx.size (), 0); + EXPECT_EQ (good_idx.size (), size_t (0)); } TEST(1) diff --git a/src/unit_tests/tlMath.cc b/src/unit_tests/tlMath.cc new file mode 100644 index 000000000..50f47c23b --- /dev/null +++ b/src/unit_tests/tlMath.cc @@ -0,0 +1,40 @@ + +/* + + 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 "tlMath.h" +#include "utHead.h" + +TEST(1) +{ + int x; + x = tl::lcd (17, 6); + EXPECT_EQ (x, 1); + x = tl::lcd (27, 6); + EXPECT_EQ (x, 3); + x = tl::lcd (30, 6); + EXPECT_EQ (x, 6); + x = tl::lcd (31*17, 371*17); + EXPECT_EQ (x, 17); + x = tl::lcd (702*17, 372*17); + EXPECT_EQ (x, 102); +} + diff --git a/src/unit_tests/tlReuseVector.cc b/src/unit_tests/tlReuseVector.cc index a47632515..5cd5ecdf3 100644 --- a/src/unit_tests/tlReuseVector.cc +++ b/src/unit_tests/tlReuseVector.cc @@ -171,13 +171,13 @@ TEST(3) rv.erase (a); EXPECT_EQ (a.is_valid (), false); - EXPECT_EQ (rv.size (), 3); - EXPECT_EQ (rv.capacity (), 4); + EXPECT_EQ (rv.size (), size_t (3)); + EXPECT_EQ (rv.capacity (), size_t (4)); EXPECT_EQ (to_string (rv), "b,c,d"); a = rv.insert ("a"); EXPECT_EQ (a.is_valid (), true); - EXPECT_EQ (rv.size (), 4); + EXPECT_EQ (rv.size (), size_t (4)); EXPECT_EQ (to_string (rv), "a,b,c,d") EXPECT_EQ (*d, "d"); diff --git a/src/unit_tests/tlStableVector.cc b/src/unit_tests/tlStableVector.cc index 04e4d8248..3e30d7ae3 100644 --- a/src/unit_tests/tlStableVector.cc +++ b/src/unit_tests/tlStableVector.cc @@ -50,7 +50,7 @@ struct test_compare { TEST(1) { tl::stable_vector v; - EXPECT_EQ (v.size (), 0); + EXPECT_EQ (v.size (), size_t (0)); v.push_back ("d"); EXPECT_EQ (v.back (), "d"); v.push_back (new std::string ("a")); @@ -93,7 +93,7 @@ TEST(1) EXPECT_EQ (i == v.end (), false); EXPECT_EQ (i != v.end (), true); - EXPECT_EQ (v.size (), 4); + EXPECT_EQ (v.size (), size_t (4)); tl::sort (v.begin (), v.end ()); EXPECT_EQ (to_string (v), "a ba bx d "); @@ -117,7 +117,7 @@ TEST(1) vv.pop_back (); EXPECT_EQ (to_string (vv), "d bx ba "); - EXPECT_EQ (vv.size (), 3); + EXPECT_EQ (vv.size (), size_t (3)); v = vv; EXPECT_EQ (to_string (vv), "d bx ba "); @@ -130,13 +130,13 @@ TEST(1) EXPECT_EQ (v == vv, false); EXPECT_EQ (v != vv, true); EXPECT_EQ (to_string (vv), ""); - EXPECT_EQ (vv.size (), 0); + EXPECT_EQ (vv.size (), size_t (0)); EXPECT_EQ (vv.empty (), true); EXPECT_EQ (v.empty (), false); v.erase (v.begin (), v.end ()); EXPECT_EQ (to_string (v), ""); - EXPECT_EQ (v.size (), 0); + EXPECT_EQ (v.size (), size_t (0)); EXPECT_EQ (v.empty (), true); } diff --git a/src/unit_tests/tlString.cc b/src/unit_tests/tlString.cc index 72a910cda..9c6c3fd19 100644 --- a/src/unit_tests/tlString.cc +++ b/src/unit_tests/tlString.cc @@ -135,7 +135,7 @@ TEST(2) EXPECT_EQ (error, true); from_string (" 12 ", ul); - EXPECT_EQ (ul, 12); + EXPECT_EQ (ul, (unsigned int) 12); error = false; try { from_string ("a", ul); } catch (...) { error = true; } EXPECT_EQ (error, true); @@ -150,7 +150,7 @@ TEST(2) EXPECT_EQ (error, true); from_string (" 12 ", ui); - EXPECT_EQ (ui, 12); + EXPECT_EQ (ui, (unsigned int) 12); error = false; try { from_string ("a", ui); } catch (...) { error = true; } EXPECT_EQ (error, true); @@ -181,14 +181,14 @@ TEST(4) tl::string s; EXPECT_EQ (std::string (s.c_str ()), ""); EXPECT_EQ (s.std_str (), ""); - EXPECT_EQ (s.size (), 0); - EXPECT_EQ (s.capacity (), 0); + EXPECT_EQ (s.size (), size_t (0)); + EXPECT_EQ (s.capacity (), size_t (0)); s = "abc"; EXPECT_EQ (std::string (s.c_str ()), "abc"); EXPECT_EQ (s.std_str (), "abc"); - EXPECT_EQ (s.size (), 3); - EXPECT_EQ (s.capacity (), 3); + EXPECT_EQ (s.size (), size_t (3)); + EXPECT_EQ (s.capacity (), size_t (3)); s.assign ("abc", 1, 2); EXPECT_EQ (std::string (s.c_str ()), "b"); @@ -204,28 +204,28 @@ TEST(4) EXPECT_EQ (s < "ba", true); EXPECT_EQ (s < "c", true); EXPECT_EQ (s.std_str (), "b"); - EXPECT_EQ (s.size (), 1); - EXPECT_EQ (s.capacity (), 3); + EXPECT_EQ (s.size (), size_t (1)); + EXPECT_EQ (s.capacity (), size_t (3)); s = std::string ("abcdef"); EXPECT_EQ (s.std_str (), "abcdef"); - EXPECT_EQ (s.size (), 6); - EXPECT_EQ (s.capacity (), 6); + EXPECT_EQ (s.size (), size_t (6)); + EXPECT_EQ (s.capacity (), size_t (6)); s = std::string (); EXPECT_EQ (s.std_str (), ""); - EXPECT_EQ (s.size (), 0); - EXPECT_EQ (s.capacity (), 6); + EXPECT_EQ (s.size (), size_t (0)); + EXPECT_EQ (s.capacity (), size_t (6)); s = "xyz"; EXPECT_EQ (s.std_str (), "xyz"); - EXPECT_EQ (s.size (), 3); - EXPECT_EQ (s.capacity (), 6); + EXPECT_EQ (s.size (), size_t (3)); + EXPECT_EQ (s.capacity (), size_t (6)); s.clear (); EXPECT_EQ (s.std_str (), ""); - EXPECT_EQ (s.size (), 0); - EXPECT_EQ (s.capacity (), 0); + EXPECT_EQ (s.size (), size_t (0)); + EXPECT_EQ (s.capacity (), size_t (0)); // ... @@ -250,7 +250,7 @@ TEST(5) x.read (s, "-"); x.read (d); - EXPECT_EQ (ui, 5); + EXPECT_EQ (ui, (unsigned int) 5); EXPECT_EQ (l, -6); EXPECT_EQ (s, "oder"); EXPECT_EQ (d, -15.0); @@ -268,7 +268,7 @@ TEST(6) EXPECT_EQ (x.try_read (ul), true); EXPECT_EQ (x.try_read (ul), false); - EXPECT_EQ (ul, 5); + EXPECT_EQ (ul, (unsigned long) 5); EXPECT_EQ (x.test (";"), false); x.expect (":"); EXPECT_EQ (x.try_read (i), true); diff --git a/src/unit_tests/tlThreadedWorkers.cc b/src/unit_tests/tlThreadedWorkers.cc index 36dd0c247..d06ccd837 100644 --- a/src/unit_tests/tlThreadedWorkers.cc +++ b/src/unit_tests/tlThreadedWorkers.cc @@ -127,19 +127,19 @@ TEST(1) boss2.register_job(job1); n = 0; for (tl::Boss::iterator j = boss1.begin (); j != boss1.end (); ++j) { ++n; } - EXPECT_EQ (n, 1); + EXPECT_EQ (n, size_t (1)); n = 0; for (tl::Boss::iterator j = boss2.begin (); j != boss2.end (); ++j) { ++n; } - EXPECT_EQ (n, 1); + EXPECT_EQ (n, size_t (1)); delete job1; job1 = new MyJob (2); n = 0; for (tl::Boss::iterator j = boss1.begin (); j != boss1.end (); ++j) { ++n; } - EXPECT_EQ (n, 0); + EXPECT_EQ (n, size_t (0)); n = 0; for (tl::Boss::iterator j = boss2.begin (); j != boss2.end (); ++j) { ++n; } - EXPECT_EQ (n, 0); + EXPECT_EQ (n, size_t (0)); tl::Boss *tmp_boss = new tl::Boss (); tmp_boss->register_job(job1); @@ -150,19 +150,19 @@ TEST(1) delete tmp_boss; n = 0; for (tl::Boss::iterator j = boss1.begin (); j != boss1.end (); ++j) { ++n; } - EXPECT_EQ (n, 1); + EXPECT_EQ (n, size_t (1)); n = 0; for (tl::Boss::iterator j = boss2.begin (); j != boss2.end (); ++j) { ++n; } - EXPECT_EQ (n, 2); + EXPECT_EQ (n, size_t (2)); delete job1; delete job2; n = 0; for (tl::Boss::iterator j = boss1.begin (); j != boss1.end (); ++j) { ++n; } - EXPECT_EQ (n, 0); + EXPECT_EQ (n, size_t (0)); n = 0; for (tl::Boss::iterator j = boss2.begin (); j != boss2.end (); ++j) { ++n; } - EXPECT_EQ (n, 0); + EXPECT_EQ (n, size_t (0)); } TEST(2) diff --git a/src/unit_tests/tlUtils.cc b/src/unit_tests/tlUtils.cc index d0c47b18b..418f4418d 100644 --- a/src/unit_tests/tlUtils.cc +++ b/src/unit_tests/tlUtils.cc @@ -20,26 +20,9 @@ */ - - #include "tlUtils.h" #include "utHead.h" -TEST(1) -{ - int x; - x = tl::lcd (17, 6); - EXPECT_EQ (x, 1); - x = tl::lcd (27, 6); - EXPECT_EQ (x, 3); - x = tl::lcd (30, 6); - EXPECT_EQ (x, 6); - x = tl::lcd (31*17, 371*17); - EXPECT_EQ (x, 17); - x = tl::lcd (702*17, 372*17); - EXPECT_EQ (x, 102); -} - namespace { class A { }; @@ -56,7 +39,7 @@ struct XXX class XX : public XXX, private tl::Object { }; -TEST(2) +TEST(1) { EXPECT_EQ (tl::value_from_type (tl::type_from_value::value ()), false); EXPECT_EQ (tl::value_from_type (tl::type_from_value::value ()), true); diff --git a/src/unit_tests/tlVariant.cc b/src/unit_tests/tlVariant.cc index 61ded6fc2..33592d50b 100644 --- a/src/unit_tests/tlVariant.cc +++ b/src/unit_tests/tlVariant.cc @@ -340,9 +340,9 @@ TEST(1) v.morph (); EXPECT_EQ (*(long long *)v.native_ptr (), 5); v.morph (); - EXPECT_EQ (*(unsigned long *)v.native_ptr (), 5); + EXPECT_EQ (*(unsigned long *)v.native_ptr (), (unsigned long) 5); v.morph (); - EXPECT_EQ (*(unsigned int *)v.native_ptr (), 5); + EXPECT_EQ (*(unsigned int *)v.native_ptr (), (unsigned int) 5); v.morph (); EXPECT_EQ (*(unsigned short *)v.native_ptr (), 5); v.morph (); @@ -424,7 +424,7 @@ TEST(1) EXPECT_EQ (vx == v, true); EXPECT_EQ (vx.is_ulong (), true); EXPECT_EQ (v.is (), true); - EXPECT_EQ (*(unsigned long *)vx.native_ptr(), 2); + EXPECT_EQ (*(unsigned long *)vx.native_ptr(), (unsigned long) 2); EXPECT_EQ (*(unsigned short *)v.native_ptr(), 2); v.morph(); EXPECT_EQ (vx == v, true); @@ -505,7 +505,7 @@ TEST(1) EXPECT_EQ (v.is_cstring (), false); EXPECT_EQ (v.is_double (), false); EXPECT_EQ (v.to_parsable_string (), "(#1,#5,#25)"); - EXPECT_EQ (v.get_list ().size (), 3); + EXPECT_EQ (v.get_list ().size (), size_t (3)); EXPECT_EQ (v.begin ()->is_long (), true); EXPECT_EQ (v.begin ()->to_long (), 1); EXPECT_EQ (v.begin ()[1].is_long (), true); diff --git a/src/unit_tests/tlXMLParser.cc b/src/unit_tests/tlXMLParser.cc index a5eaec8fc..18f8320a5 100644 --- a/src/unit_tests/tlXMLParser.cc +++ b/src/unit_tests/tlXMLParser.cc @@ -268,14 +268,14 @@ TEST (5) } EXPECT_EQ (error, ""); - EXPECT_EQ (root.m_subs.size (), 2); + EXPECT_EQ (root.m_subs.size (), size_t (2)); EXPECT_EQ (root.m_subs [0], 1.0); EXPECT_EQ (root.m_subs [1], -2.5); - EXPECT_EQ (root.m_isubs.size (), 1); + EXPECT_EQ (root.m_isubs.size (), size_t (1)); EXPECT_EQ (root.m_isubs [0], -100); EXPECT_EQ (root.m, 10); - EXPECT_EQ (root.mi, 21); - EXPECT_EQ (root.m_children.size (), 2); + EXPECT_EQ (root.mi, (unsigned int) 21); + EXPECT_EQ (root.m_children.size (), size_t (2)); EXPECT_EQ (root.m_children [0].txt, " Text "); EXPECT_EQ (fabs (root.m_children [0].d - 0.001) < 1e-12, true); EXPECT_EQ (root.m_children [1].txt, "T2"); @@ -374,13 +374,13 @@ TEST (7) } EXPECT_EQ (error, ""); - EXPECT_EQ (root.m_subs.size (), 2); + EXPECT_EQ (root.m_subs.size (), size_t (2)); EXPECT_EQ (root.m_subs [0], 1.0); EXPECT_EQ (root.m_subs [1], -2.5); - EXPECT_EQ (root.m_isubs.size (), 1); + EXPECT_EQ (root.m_isubs.size (), size_t (1)); EXPECT_EQ (root.m_isubs [0], -100); EXPECT_EQ (root.m, 10); - EXPECT_EQ (root.m_children.size (), 2); + EXPECT_EQ (root.m_children.size (), size_t (2)); EXPECT_EQ (root.m_children [0].txt, " Text "); EXPECT_EQ (fabs (root.m_children [0].d - 0.001) < 1e-12, true); EXPECT_EQ (root.m_children [1].txt, "T2"); @@ -430,13 +430,13 @@ TEST (7a) } EXPECT_EQ (error, ""); - EXPECT_EQ (root.m_subs.size (), 2); + EXPECT_EQ (root.m_subs.size (), size_t (2)); EXPECT_EQ (root.m_subs [0], 1.0); EXPECT_EQ (root.m_subs [1], -2.5); - EXPECT_EQ (root.m_isubs.size (), 1); + EXPECT_EQ (root.m_isubs.size (), size_t (1)); EXPECT_EQ (root.m_isubs [0], -100); EXPECT_EQ (root.m, 10); - EXPECT_EQ (root.m_children.size (), 2); + EXPECT_EQ (root.m_children.size (), size_t (2)); EXPECT_EQ (root.m_children [0].txt, " Text "); EXPECT_EQ (fabs (root.m_children [0].d - 0.001) < 1e-12, true); EXPECT_EQ (root.m_children [1].txt, "T2"); @@ -493,13 +493,13 @@ TEST (8) EXPECT_EQ (error, ""); EXPECT_EQ (root.m, 10); - EXPECT_EQ (root.m_children.size (), 2); + EXPECT_EQ (root.m_children.size (), size_t (2)); EXPECT_EQ (root.m_children [0].txt, " Text "); EXPECT_EQ (fabs (root.m_children [0].d - 0.125) < 1e-12, true); - EXPECT_EQ (root.m_children [0].children.size (), 2); + EXPECT_EQ (root.m_children [0].children.size (), size_t (2)); EXPECT_EQ (root.m_children [0].children [0].txt, "C1"); EXPECT_EQ (root.m_children [0].children [1].txt, "c2"); - EXPECT_EQ (root.m_children [0].children [1].children.size (), 1); + EXPECT_EQ (root.m_children [0].children [1].children.size (), size_t (1)); EXPECT_EQ (root.m_children [0].children [1].children [0].txt, "d2"); EXPECT_EQ (root.m_children [1].txt, "T2"); EXPECT_EQ (root.m_children [1].d, -1.0); @@ -567,13 +567,13 @@ TEST (8a) EXPECT_EQ (error, ""); EXPECT_EQ (root.m, 10); - EXPECT_EQ (root.m_children.size (), 2); + EXPECT_EQ (root.m_children.size (), size_t (2)); EXPECT_EQ (root.m_children [0].txt, " Text "); EXPECT_EQ (fabs (root.m_children [0].d - 0.125) < 1e-12, true); - EXPECT_EQ (root.m_children [0].children.size (), 2); + EXPECT_EQ (root.m_children [0].children.size (), size_t (2)); EXPECT_EQ (root.m_children [0].children [0].txt, "C1"); EXPECT_EQ (root.m_children [0].children [1].txt, "c2"); - EXPECT_EQ (root.m_children [0].children [1].children.size (), 1); + EXPECT_EQ (root.m_children [0].children [1].children.size (), size_t (1)); EXPECT_EQ (root.m_children [0].children [1].children [0].txt, "d2"); EXPECT_EQ (root.m_children [1].txt, "T2"); EXPECT_EQ (root.m_children [1].d, -1.0); @@ -640,13 +640,13 @@ TEST (9) EXPECT_EQ (error, ""); EXPECT_EQ (root.m, 10); - EXPECT_EQ (root.m_children.size (), 2); + EXPECT_EQ (root.m_children.size (), size_t (2)); EXPECT_EQ (root.m_children [0].txt, " Text "); EXPECT_EQ (fabs (root.m_children [0].d - 0.125) < 1e-12, true); - EXPECT_EQ (root.m_children [0].children.size (), 2); + EXPECT_EQ (root.m_children [0].children.size (), size_t (2)); EXPECT_EQ (root.m_children [0].children [0].txt, "C1"); EXPECT_EQ (root.m_children [0].children [1].txt, "c2"); - EXPECT_EQ (root.m_children [0].children [1].children.size (), 1); + EXPECT_EQ (root.m_children [0].children [1].children.size (), size_t (1)); EXPECT_EQ (root.m_children [0].children [1].children [0].txt, "d2"); EXPECT_EQ (root.m_children [1].txt, "T2"); EXPECT_EQ (root.m_children [1].d, -1.0); diff --git a/src/unit_tests/unit_tests.pro b/src/unit_tests/unit_tests.pro index c889a89e2..ffe60f38f 100644 --- a/src/unit_tests/unit_tests.pro +++ b/src/unit_tests/unit_tests.pro @@ -95,7 +95,8 @@ SOURCES = \ tlVariant.cc \ tlXMLParser.cc \ gsiTest.cc \ - tlFileSystemWatcher.cc + tlFileSystemWatcher.cc \ + tlMath.cc # main components: SOURCES += \