diff --git a/tests/cpp_tests/agg_blend_src_over_test.cpp b/tests/cpp_tests/agg_blend_src_over_test.cpp index c453292ad..0b4648f46 100644 --- a/tests/cpp_tests/agg_blend_src_over_test.cpp +++ b/tests/cpp_tests/agg_blend_src_over_test.cpp @@ -144,64 +144,72 @@ int main(int argc, char** argv) using source_over_old_agg = agg::comp_op_rgba_src_over2; using source_over = agg::comp_op_rgba_src_over; - color white(255,255,255,255); - color black(0,0,0,255); - - BOOST_TEST_EQ( to_string(blend(white,white)), to_string(white) ); - BOOST_TEST_EQ( to_string(blend(white,black)), to_string(white) ); - BOOST_TEST_EQ( to_string(blend(black,white)), to_string(black) ); - - // https://github.com/mapnik/mapnik/issues/1452#issuecomment-8154646 - color near_white(254,254,254,254); // Source - color near_trans(1,1,1,1); // Dest - color expected_color(252,252,252,255); // expected result - BOOST_TEST_EQ( to_string(blend(near_white,near_trans)), to_string(color(252,252,252,254)) ); - BOOST_TEST_EQ( to_string(blend(near_white,near_trans)), to_string(expected_color) ); - BOOST_TEST_EQ( to_string(normal_blend(near_white,near_trans)), to_string(expected_color) ); - - // using normal_blend as expected, compare a variety of other colors - + try { - color source(128,128,128,255); - color dest(128,128,128,255); - unsigned cover = 128; - std::string expected_str = to_string(normal_blend(source,dest,cover)); - BOOST_TEST_EQ( to_string(blend(source,dest,cover)), expected_str ); - BOOST_TEST_EQ( to_string(blend(source,dest,cover)), expected_str ); - } + color white(255,255,255,255); + color black(0,0,0,255); + BOOST_TEST_EQ( to_string(blend(white,white)), to_string(white) ); + BOOST_TEST_EQ( to_string(blend(white,black)), to_string(white) ); + BOOST_TEST_EQ( to_string(blend(black,white)), to_string(black) ); + + // https://github.com/mapnik/mapnik/issues/1452#issuecomment-8154646 + color near_white(254,254,254,254); // Source + color near_trans(1,1,1,1); // Dest + color expected_color(252,252,252,255); // expected result + BOOST_TEST_EQ( to_string(blend(near_white,near_trans)), to_string(color(252,252,252,254)) ); + BOOST_TEST_EQ( to_string(blend(near_white,near_trans)), to_string(expected_color) ); + BOOST_TEST_EQ( to_string(normal_blend(near_white,near_trans)), to_string(expected_color) ); + + // using normal_blend as expected, compare a variety of other colors + + { + color source(128,128,128,255); + color dest(128,128,128,255); + unsigned cover = 128; + std::string expected_str = to_string(normal_blend(source,dest,cover)); + BOOST_TEST_EQ( to_string(blend(source,dest,cover)), expected_str ); + BOOST_TEST_EQ( to_string(blend(source,dest,cover)), expected_str ); + } + + { + color source(128,128,128,255); + color dest(128,128,128,255); + unsigned cover = 245; + std::string expected_str = to_string(normal_blend(source,dest,cover)); + BOOST_TEST_EQ( to_string(blend(source,dest,cover)), expected_str ); + BOOST_TEST_EQ( to_string(blend(source,dest,cover)), expected_str ); + } + + // commenting until I study these failures more (dane) + /* + { + // fails, why? + color source(127,127,127,127); + color dest(127,127,127,127); + unsigned cover = 255; + std::string expected_str = to_string(normal_blend(source,dest,cover)); + BOOST_TEST_EQ( to_string(blend(source,dest,cover)), expected_str ); + BOOST_TEST_EQ( to_string(blend(source,dest,cover)), expected_str ); + } + + { + // fails, why? + color source(128,128,128,128); + color dest(128,128,128,128); + unsigned cover = 128; + std::string expected_str = to_string(normal_blend(source,dest,cover)); + BOOST_TEST_EQ( to_string(blend(source,dest,cover)), expected_str ); + BOOST_TEST_EQ( to_string(blend(source,dest,cover)), expected_str ); + } + */ + } + catch (std::exception const & ex) { - color source(128,128,128,255); - color dest(128,128,128,255); - unsigned cover = 245; - std::string expected_str = to_string(normal_blend(source,dest,cover)); - BOOST_TEST_EQ( to_string(blend(source,dest,cover)), expected_str ); - BOOST_TEST_EQ( to_string(blend(source,dest,cover)), expected_str ); + std::clog << ex.what() << "\n"; + BOOST_TEST(false); } - // commenting until I study these failures more (dane) - /* - { - // fails, why? - color source(127,127,127,127); - color dest(127,127,127,127); - unsigned cover = 255; - std::string expected_str = to_string(normal_blend(source,dest,cover)); - BOOST_TEST_EQ( to_string(blend(source,dest,cover)), expected_str ); - BOOST_TEST_EQ( to_string(blend(source,dest,cover)), expected_str ); - } - - { - // fails, why? - color source(128,128,128,128); - color dest(128,128,128,128); - unsigned cover = 128; - std::string expected_str = to_string(normal_blend(source,dest,cover)); - BOOST_TEST_EQ( to_string(blend(source,dest,cover)), expected_str ); - BOOST_TEST_EQ( to_string(blend(source,dest,cover)), expected_str ); - } - */ - if (!::boost::detail::test_errors()) { if (quiet) std::clog << "\x1b[1;32m.\x1b[0m"; else std::clog << "C++ AGG blending: \x1b[1;32m✓ \x1b[0m\n"; diff --git a/tests/cpp_tests/conversions_test.cpp b/tests/cpp_tests/conversions_test.cpp index cb9d0d4fd..a837dbf57 100644 --- a/tests/cpp_tests/conversions_test.cpp +++ b/tests/cpp_tests/conversions_test.cpp @@ -295,7 +295,7 @@ int main(int argc, char** argv) } catch (std::exception const & ex) { - std::clog << "C++ type conversions problem: " << ex.what() << "\n"; + std::clog << ex.what() << "\n"; BOOST_TEST(false); } diff --git a/tests/cpp_tests/copy_move_test.cpp b/tests/cpp_tests/copy_move_test.cpp index a0afa9b29..665483e70 100644 --- a/tests/cpp_tests/copy_move_test.cpp +++ b/tests/cpp_tests/copy_move_test.cpp @@ -18,58 +18,66 @@ int main(int argc, char** argv) } bool quiet = std::find(args.begin(), args.end(), "-q")!=args.end(); - mapnik::Map m0(100,100); - mapnik::Map m2(200,100); + try + { + mapnik::Map m0(100,100); + mapnik::Map m2(200,100); - // mapnik::datasource - mapnik::datasource_cache::instance().register_datasources("plugins/input/shape.input"); - mapnik::parameters p; - p["type"]="shape"; - p["file"]="demo/data/boundaries"; - p["encoding"]="latin1"; - auto ds0 = mapnik::datasource_cache::instance().create(p); + // mapnik::datasource + mapnik::datasource_cache::instance().register_datasources("plugins/input/shape.input"); + mapnik::parameters p; + p["type"]="shape"; + p["file"]="demo/data/boundaries"; + p["encoding"]="latin1"; + auto ds0 = mapnik::datasource_cache::instance().create(p); - auto ds1 = ds0; // shared ptr copy - BOOST_TEST(ds1 == ds0); - BOOST_TEST(*ds1 == *ds0); - ds1 = mapnik::datasource_cache::instance().create(p); // new with the same parameters - BOOST_TEST(ds1 != ds0); - BOOST_TEST(*ds1 == *ds0); - auto ds2 = std::move(ds1); - BOOST_TEST(ds2 != ds0); - BOOST_TEST(*ds2 == *ds0); + auto ds1 = ds0; // shared ptr copy + BOOST_TEST(ds1 == ds0); + BOOST_TEST(*ds1 == *ds0); + ds1 = mapnik::datasource_cache::instance().create(p); // new with the same parameters + BOOST_TEST(ds1 != ds0); + BOOST_TEST(*ds1 == *ds0); + auto ds2 = std::move(ds1); + BOOST_TEST(ds2 != ds0); + BOOST_TEST(*ds2 == *ds0); - // mapnik::layer - mapnik::layer l0("test-layer"); - l0.set_datasource(ds0); + // mapnik::layer + mapnik::layer l0("test-layer"); + l0.set_datasource(ds0); - mapnik::layer l1 = l0; // copy assignment - BOOST_TEST(l1 == l0); - mapnik::layer l2(l0); // copy ctor - BOOST_TEST(l2 == l0); - mapnik::layer l3(mapnik::layer("test-layer")); // move ctor - l3.set_datasource(ds2); + mapnik::layer l1 = l0; // copy assignment + BOOST_TEST(l1 == l0); + mapnik::layer l2(l0); // copy ctor + BOOST_TEST(l2 == l0); + mapnik::layer l3(mapnik::layer("test-layer")); // move ctor + l3.set_datasource(ds2); - BOOST_TEST(l3 == l0); - mapnik::layer l4 = std::move(l3); - BOOST_TEST(l4 == l0); // move assignment + BOOST_TEST(l3 == l0); + mapnik::layer l4 = std::move(l3); + BOOST_TEST(l4 == l0); // move assignment - m0.add_layer(l4); - m0.set_background(mapnik::color("skyblue")); - m2.set_background(mapnik::color("skyblue")); + m0.add_layer(l4); + m0.set_background(mapnik::color("skyblue")); + m2.set_background(mapnik::color("skyblue")); - auto m1 = m0; //copy + auto m1 = m0; //copy - BOOST_TEST(m0 == m1); - BOOST_TEST(m0 != m2); + BOOST_TEST(m0 == m1); + BOOST_TEST(m0 != m2); - m2 = m1; // copy - BOOST_TEST(m2 == m1); - m2 = std::move(m1); - BOOST_TEST(m2 == m0); - BOOST_TEST(m1 != m0); + m2 = m1; // copy + BOOST_TEST(m2 == m1); + m2 = std::move(m1); + BOOST_TEST(m2 == m0); + BOOST_TEST(m1 != m0); - BOOST_TEST(m0 == m2); + BOOST_TEST(m0 == m2); + } + catch (std::exception const & ex) + { + std::clog << ex.what() << "\n"; + BOOST_TEST(false); + } if (!::boost::detail::test_errors()) { diff --git a/tests/cpp_tests/font_registration_test.cpp b/tests/cpp_tests/font_registration_test.cpp index 025b823fc..39e568e3f 100644 --- a/tests/cpp_tests/font_registration_test.cpp +++ b/tests/cpp_tests/font_registration_test.cpp @@ -193,7 +193,7 @@ int main(int argc, char** argv) } catch (std::exception const & ex) { - std::clog << "C++ fonts registration problem: " << ex.what() << "\n"; + std::clog << ex.what() << "\n"; BOOST_TEST(false); } diff --git a/tests/cpp_tests/geometry_converters_test.cpp b/tests/cpp_tests/geometry_converters_test.cpp index 7545b4728..23ff74d99 100644 --- a/tests/cpp_tests/geometry_converters_test.cpp +++ b/tests/cpp_tests/geometry_converters_test.cpp @@ -143,43 +143,52 @@ int main(int argc, char** argv) BOOST_TEST(set_working_dir(args)); - // LineString/bbox clipping + try { - std::string wkt_in("LineString(0 0,200 200)"); - boost::optional result = linestring_bbox_clipping(mapnik::box2d(50,50,150,150),wkt_in); - BOOST_TEST(result); - BOOST_TEST_EQ(*result,std::string("LineString(50 50,150 150)")); + // LineString/bbox clipping + { + std::string wkt_in("LineString(0 0,200 200)"); + boost::optional result = linestring_bbox_clipping(mapnik::box2d(50,50,150,150),wkt_in); + BOOST_TEST(result); + BOOST_TEST_EQ(*result,std::string("LineString(50 50,150 150)")); + } + // Polygon/bbox clipping + #if 0 + // these tests will fail + { + std::string wkt_in("Polygon((50 50,150 50,150 150,50 150,50 50))"); + boost::optional result = polygon_bbox_clipping(mapnik::box2d(50,50,150,150),wkt_in); + BOOST_TEST(result); + BOOST_TEST_EQ(*result,std::string("Polygon((50 50,150 50,150 150,50 150,50 50))")); + } + + { + std::string wkt_in("Polygon((60 60,140 60,140 160,60 140,60 60))"); + boost::optional result = polygon_bbox_clipping(mapnik::box2d(50,50,150,150),wkt_in); + BOOST_TEST(result); + BOOST_TEST_EQ(*result,std::string("Polygon((60 60,140 60,140 160,60 140,60 60))")); + } + + { + std::string wkt_in("Polygon((0 0,10 0,10 10,0 10,0 0))"); + boost::optional result = polygon_bbox_clipping(mapnik::box2d(50,50,150,150),wkt_in); + BOOST_TEST(result); + BOOST_TEST_EQ(*result, std::string("GeometryCollection EMPTY")); + } + { + std::string wkt_in("Polygon((0 0,100 200,200 0,0 0 ))"); + boost::optional result = polygon_bbox_clipping(mapnik::box2d(50,50,150,150),wkt_in); + BOOST_TEST(result); + BOOST_TEST_EQ(*result,std::string("Polygon((50 50,50 100,75 150,125 150,150 100,150 50,50 50))")); + } + #endif } - // Polygon/bbox clipping -#if 0 - // these tests will fail + catch (std::exception const & ex) { - std::string wkt_in("Polygon((50 50,150 50,150 150,50 150,50 50))"); - boost::optional result = polygon_bbox_clipping(mapnik::box2d(50,50,150,150),wkt_in); - BOOST_TEST(result); - BOOST_TEST_EQ(*result,std::string("Polygon((50 50,150 50,150 150,50 150,50 50))")); + std::clog << ex.what() << "\n"; + BOOST_TEST(false); } - { - std::string wkt_in("Polygon((60 60,140 60,140 160,60 140,60 60))"); - boost::optional result = polygon_bbox_clipping(mapnik::box2d(50,50,150,150),wkt_in); - BOOST_TEST(result); - BOOST_TEST_EQ(*result,std::string("Polygon((60 60,140 60,140 160,60 140,60 60))")); - } - - { - std::string wkt_in("Polygon((0 0,10 0,10 10,0 10,0 0))"); - boost::optional result = polygon_bbox_clipping(mapnik::box2d(50,50,150,150),wkt_in); - BOOST_TEST(result); - BOOST_TEST_EQ(*result, std::string("GeometryCollection EMPTY")); - } - { - std::string wkt_in("Polygon((0 0,100 200,200 0,0 0 ))"); - boost::optional result = polygon_bbox_clipping(mapnik::box2d(50,50,150,150),wkt_in); - BOOST_TEST(result); - BOOST_TEST_EQ(*result,std::string("Polygon((50 50,50 100,75 150,125 150,150 100,150 50,50 50))")); - } -#endif if (!::boost::detail::test_errors()) { diff --git a/tests/cpp_tests/image_io_test.cpp b/tests/cpp_tests/image_io_test.cpp index e9c010ff9..8ed34eacd 100644 --- a/tests/cpp_tests/image_io_test.cpp +++ b/tests/cpp_tests/image_io_test.cpp @@ -110,7 +110,7 @@ int main(int argc, char** argv) } catch (std::exception const & ex) { - std::clog << "C++ image i/o problem: " << ex.what() << "\n"; + std::clog << ex.what() << "\n"; BOOST_TEST(false); } diff --git a/tests/cpp_tests/image_painted_test.cpp b/tests/cpp_tests/image_painted_test.cpp index 104f0b027..946c21124 100644 --- a/tests/cpp_tests/image_painted_test.cpp +++ b/tests/cpp_tests/image_painted_test.cpp @@ -68,7 +68,7 @@ int main(int argc, char** argv) } catch (std::exception const & ex) { - std::clog << "C++ image painted problem: " << ex.what() << std::endl; + std::clog << ex.what() << std::endl; BOOST_TEST(false); } diff --git a/tests/cpp_tests/label_algo_test.cpp b/tests/cpp_tests/label_algo_test.cpp index 78cc7f682..819fd529e 100644 --- a/tests/cpp_tests/label_algo_test.cpp +++ b/tests/cpp_tests/label_algo_test.cpp @@ -14,45 +14,53 @@ int main(int argc, char** argv) } bool quiet = std::find(args.begin(), args.end(), "-q")!=args.end(); - // reused these for simplicity - double x,y; + try + { + // reused these for simplicity + double x,y; - // single point - mapnik::geometry_type pt(mapnik::geometry_type::types::Point); - pt.move_to(10,10); - BOOST_TEST( mapnik::label::centroid(pt, x, y) ); - BOOST_TEST( x == 10 ); - BOOST_TEST( y == 10 ); + // single point + mapnik::geometry_type pt(mapnik::geometry_type::types::Point); + pt.move_to(10,10); + BOOST_TEST( mapnik::label::centroid(pt, x, y) ); + BOOST_TEST( x == 10 ); + BOOST_TEST( y == 10 ); - // two points - pt.move_to(20,20); - BOOST_TEST( mapnik::label::centroid(pt, x, y) ); - BOOST_TEST_EQ( x, 15 ); - BOOST_TEST_EQ( y, 15 ); + // two points + pt.move_to(20,20); + BOOST_TEST( mapnik::label::centroid(pt, x, y) ); + BOOST_TEST_EQ( x, 15 ); + BOOST_TEST_EQ( y, 15 ); - // line with two verticies - mapnik::geometry_type line(mapnik::geometry_type::types::LineString); - line.move_to(0,0); - line.line_to(50,50); - BOOST_TEST( mapnik::label::centroid(line, x, y) ); - BOOST_TEST( x == 25 ); - BOOST_TEST( y == 25 ); + // line with two verticies + mapnik::geometry_type line(mapnik::geometry_type::types::LineString); + line.move_to(0,0); + line.line_to(50,50); + BOOST_TEST( mapnik::label::centroid(line, x, y) ); + BOOST_TEST( x == 25 ); + BOOST_TEST( y == 25 ); - // TODO - centroid and interior should be equal but they appear not to be (check largest) - // MULTIPOLYGON(((-52 40,-60 32,-68 40,-60 48,-52 40)),((-60 50,-80 30,-100 49.9999999999999,-80.0000000000001 70,-60 50)),((-52 60,-60 52,-68 60,-60 68,-52 60))) + // TODO - centroid and interior should be equal but they appear not to be (check largest) + // MULTIPOLYGON(((-52 40,-60 32,-68 40,-60 48,-52 40)),((-60 50,-80 30,-100 49.9999999999999,-80.0000000000001 70,-60 50)),((-52 60,-60 52,-68 60,-60 68,-52 60))) - // hit tests - mapnik::geometry_type pt_hit(mapnik::geometry_type::types::Point); - pt_hit.move_to(10,10); - BOOST_TEST( mapnik::label::hit_test(pt_hit, 10, 10, 0.1) ); - BOOST_TEST( !mapnik::label::hit_test(pt_hit, 9, 9, 0) ); - BOOST_TEST( mapnik::label::hit_test(pt_hit, 9, 9, 1.5) ); - mapnik::geometry_type line_hit(mapnik::geometry_type::types::LineString); - line_hit.move_to(0,0); - line_hit.line_to(50,50); - BOOST_TEST( mapnik::label::hit_test(line_hit, 0, 0, 0.001) ); - BOOST_TEST( !mapnik::label::hit_test(line_hit, 1, 1, 0) ); - BOOST_TEST( mapnik::label::hit_test(line_hit, 1, 1, 1.001) ); + // hit tests + mapnik::geometry_type pt_hit(mapnik::geometry_type::types::Point); + pt_hit.move_to(10,10); + BOOST_TEST( mapnik::label::hit_test(pt_hit, 10, 10, 0.1) ); + BOOST_TEST( !mapnik::label::hit_test(pt_hit, 9, 9, 0) ); + BOOST_TEST( mapnik::label::hit_test(pt_hit, 9, 9, 1.5) ); + mapnik::geometry_type line_hit(mapnik::geometry_type::types::LineString); + line_hit.move_to(0,0); + line_hit.line_to(50,50); + BOOST_TEST( mapnik::label::hit_test(line_hit, 0, 0, 0.001) ); + BOOST_TEST( !mapnik::label::hit_test(line_hit, 1, 1, 0) ); + BOOST_TEST( mapnik::label::hit_test(line_hit, 1, 1, 1.001) ); + } + catch (std::exception const & ex) + { + std::clog << ex.what() << "\n"; + BOOST_TEST(false); + } if (!::boost::detail::test_errors()) { if (quiet) std::clog << "\x1b[1;32m.\x1b[0m"; diff --git a/tests/cpp_tests/line_offset_test.cpp b/tests/cpp_tests/line_offset_test.cpp index cbb6e314c..9e5732be1 100644 --- a/tests/cpp_tests/line_offset_test.cpp +++ b/tests/cpp_tests/line_offset_test.cpp @@ -220,6 +220,7 @@ int main(int argc, char** argv) catch (std::exception const& ex) { std::cerr << ex.what() << "\n"; + BOOST_TEST(false); } if (!::boost::detail::test_errors()) diff --git a/tests/cpp_tests/params_test.cpp b/tests/cpp_tests/params_test.cpp index 5d89b8cbe..081cc3b08 100644 --- a/tests/cpp_tests/params_test.cpp +++ b/tests/cpp_tests/params_test.cpp @@ -15,68 +15,76 @@ int main(int argc, char** argv) } bool quiet = std::find(args.begin(), args.end(), "-q")!=args.end(); - mapnik::parameters params; + try + { + mapnik::parameters params; - // true - params["bool"] = mapnik::value_integer(true); - BOOST_TEST( (params.get("bool") && *params.get("bool") == true)); + // true + params["bool"] = mapnik::value_integer(true); + BOOST_TEST( (params.get("bool") && *params.get("bool") == true)); - params["bool"] = "true"; - BOOST_TEST( (params.get("bool") && *params.get("bool") == true)); + params["bool"] = "true"; + BOOST_TEST( (params.get("bool") && *params.get("bool") == true)); - params["bool"] = mapnik::value_integer(1); - BOOST_TEST( (params.get("bool") && *params.get("bool") == true)); + params["bool"] = mapnik::value_integer(1); + BOOST_TEST( (params.get("bool") && *params.get("bool") == true)); - params["bool"] = "1"; - BOOST_TEST( (params.get("bool") && *params.get("bool") == true)); + params["bool"] = "1"; + BOOST_TEST( (params.get("bool") && *params.get("bool") == true)); - params["bool"] = "True"; - BOOST_TEST( (params.get("bool") && *params.get("bool") == true)); + params["bool"] = "True"; + BOOST_TEST( (params.get("bool") && *params.get("bool") == true)); - params["bool"] = "on"; - BOOST_TEST( (params.get("bool") && *params.get("bool") == true)); + params["bool"] = "on"; + BOOST_TEST( (params.get("bool") && *params.get("bool") == true)); - params["bool"] = "yes"; - BOOST_TEST( (params.get("bool") && *params.get("bool") == true)); + params["bool"] = "yes"; + BOOST_TEST( (params.get("bool") && *params.get("bool") == true)); - // false - params["bool"] = mapnik::value_integer(false); - BOOST_TEST( (params.get("bool") && *params.get("bool") == false) ); + // false + params["bool"] = mapnik::value_integer(false); + BOOST_TEST( (params.get("bool") && *params.get("bool") == false) ); - params["bool"] = "false"; - BOOST_TEST( (params.get("bool") && *params.get("bool") == false) ); + params["bool"] = "false"; + BOOST_TEST( (params.get("bool") && *params.get("bool") == false) ); - params["bool"] = mapnik::value_integer(0); - BOOST_TEST( (params.get("bool") && *params.get("bool") == false)); + params["bool"] = mapnik::value_integer(0); + BOOST_TEST( (params.get("bool") && *params.get("bool") == false)); - params["bool"] = "0"; - BOOST_TEST( (params.get("bool") && *params.get("bool") == false)); + params["bool"] = "0"; + BOOST_TEST( (params.get("bool") && *params.get("bool") == false)); - params["bool"] = "False"; - BOOST_TEST( (params.get("bool") && *params.get("bool") == false)); + params["bool"] = "False"; + BOOST_TEST( (params.get("bool") && *params.get("bool") == false)); - params["bool"] = "off"; - BOOST_TEST( (params.get("bool") && *params.get("bool") == false)); + params["bool"] = "off"; + BOOST_TEST( (params.get("bool") && *params.get("bool") == false)); - params["bool"] = "no"; - BOOST_TEST( (params.get("bool") && *params.get("bool") == false)); + params["bool"] = "no"; + BOOST_TEST( (params.get("bool") && *params.get("bool") == false)); - // strings - params["string"] = "hello"; - BOOST_TEST( (params.get("string") && *params.get("string") == "hello") ); + // strings + params["string"] = "hello"; + BOOST_TEST( (params.get("string") && *params.get("string") == "hello") ); - // int - params["int"] = mapnik::value_integer(1); - BOOST_TEST( (params.get("int") && *params.get("int") == 1) ); + // int + params["int"] = mapnik::value_integer(1); + BOOST_TEST( (params.get("int") && *params.get("int") == 1) ); - // double - params["double"] = 1.5; - BOOST_TEST( (params.get("double") && *params.get("double") == 1.5) ); + // double + params["double"] = 1.5; + BOOST_TEST( (params.get("double") && *params.get("double") == 1.5) ); - // value_null - params["null"] = mapnik::value_null(); - // https://github.com/mapnik/mapnik/issues/2471 - //BOOST_TEST( (params.get("null") && *params.get("null") == mapnik::value_null()) ); + // value_null + params["null"] = mapnik::value_null(); + // https://github.com/mapnik/mapnik/issues/2471 + //BOOST_TEST( (params.get("null") && *params.get("null") == mapnik::value_null()) ); + } + catch (std::exception const& ex) + { + std::cerr << ex.what() << "\n"; + BOOST_TEST(false); + } if (!::boost::detail::test_errors()) { if (quiet) std::clog << "\x1b[1;32m.\x1b[0m"; diff --git a/tests/cpp_tests/symbolizer_test.cpp b/tests/cpp_tests/symbolizer_test.cpp index 0dc8353d1..c6877ac57 100644 --- a/tests/cpp_tests/symbolizer_test.cpp +++ b/tests/cpp_tests/symbolizer_test.cpp @@ -4,8 +4,6 @@ #include #include -#include "utils.hpp" - using namespace mapnik; int main(int argc, char** argv) @@ -25,13 +23,16 @@ int main(int argc, char** argv) BOOST_TEST_EQ(sym.properties.count(keys::markers_multipolicy),static_cast(1)); marker_multi_policy_enum policy_out = get(sym, keys::markers_multipolicy); BOOST_TEST_EQ(policy_out,MARKER_WHOLE_MULTI); - } catch (...) { - BOOST_TEST(true); + } + catch (std::exception const & ex) + { + std::clog << ex.what() << std::endl; + BOOST_TEST(false); } if (!::boost::detail::test_errors()) { if (quiet) std::clog << "\x1b[1;32m.\x1b[0m"; - else std::clog << "C++ exceptions: \x1b[1;32m✓ \x1b[0m\n"; + else std::clog << "C++ symbolizer test: \x1b[1;32m✓ \x1b[0m\n"; ::boost::detail::report_errors_remind().called_report_errors_function = true; } else { return ::boost::report_errors(); diff --git a/tests/cpp_tests/wkb_formats_test.cpp b/tests/cpp_tests/wkb_formats_test.cpp index c88c17766..29f963402 100644 --- a/tests/cpp_tests/wkb_formats_test.cpp +++ b/tests/cpp_tests/wkb_formats_test.cpp @@ -116,7 +116,7 @@ int main(int argc, char** argv) if (!::boost::detail::test_errors()) { if (quiet) std::clog << "\x1b[1;32m.\x1b[0m"; - else std::clog << "C++ CSV parse: \x1b[1;32m✓ \x1b[0m\n"; + else std::clog << "C++ WKB formats test: \x1b[1;32m✓ \x1b[0m\n"; ::boost::detail::report_errors_remind().called_report_errors_function = true; } else { return ::boost::report_errors();