minor unit test cleanups to prepare to test amalgamation

This commit is contained in:
Dane Springmeyer 2016-03-03 10:53:58 -08:00
parent 4173fff42c
commit fde36984de
50 changed files with 79 additions and 44 deletions

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
#include <mapnik/css_color_grammar.hpp> #include <mapnik/css_color_grammar.hpp>
#include <mapnik/css_color_grammar_impl.hpp> #include <mapnik/css_color_grammar_impl.hpp>

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
#include <mapnik/coord.hpp> #include <mapnik/coord.hpp>

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
#include <mapnik/value_types.hpp> #include <mapnik/value_types.hpp>

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
#include <mapnik/value_types.hpp> #include <mapnik/value_types.hpp>

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
#include <iostream> #include <iostream>

View file

@ -1,3 +1,4 @@
#include "catch_ext.hpp" #include "catch_ext.hpp"
#include <mapnik/expression.hpp> #include <mapnik/expression.hpp>

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
#include <iostream> #include <iostream>

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
#include <mapnik/value_types.hpp> #include <mapnik/value_types.hpp>

View file

@ -79,31 +79,11 @@ mapnik::datasource_ptr get_csv_ds(std::string const& file_name, bool strict = tr
return ds; return ds;
} }
int create_disk_index(std::string const& filename, bool silent = true)
{
std::string cmd;
if (std::getenv("DYLD_LIBRARY_PATH") != nullptr)
{
cmd += std::string("DYLD_LIBRARY_PATH=") + std::getenv("DYLD_LIBRARY_PATH") + " ";
}
cmd += "mapnik-index " + filename;
if (silent)
{
#ifndef _WINDOWS
cmd += " 2>/dev/null";
#else
cmd += " 2> nul";
#endif
}
return std::system(cmd.c_str());
}
} // anonymous namespace } // anonymous namespace
static const std::string csv_plugin("./plugins/input/csv.input");
TEST_CASE("csv") { TEST_CASE("csv") {
std::string csv_plugin("./plugins/input/csv.input");
if (mapnik::util::exists(csv_plugin)) if (mapnik::util::exists(csv_plugin))
{ {
// make the tests silent since we intentionally test error conditions that are noisy // make the tests silent since we intentionally test error conditions that are noisy

View file

@ -20,6 +20,10 @@
* *
*****************************************************************************/ *****************************************************************************/
#ifndef MAPNIK_UNIT_DATSOURCE_UTIL
#define MAPNIK_UNIT_DATSOURCE_UTIL
#include "catch.hpp" #include "catch.hpp"
#include <mapnik/datasource.hpp> #include <mapnik/datasource.hpp>
@ -176,4 +180,25 @@ inline void require_geometry(mapnik::feature_ptr feature,
CHECK(feature_count(feature->get_geometry()) == num_parts); CHECK(feature_count(feature->get_geometry()) == num_parts);
} }
inline int create_disk_index(std::string const& filename, bool silent = true)
{
std::string cmd;
if (std::getenv("DYLD_LIBRARY_PATH") != nullptr)
{
cmd += std::string("DYLD_LIBRARY_PATH=") + std::getenv("DYLD_LIBRARY_PATH") + " ";
} }
cmd += "mapnik-index " + filename;
if (silent)
{
#ifndef _WINDOWS
cmd += " 2>/dev/null";
#else
cmd += " 2> nul";
#endif
}
return std::system(cmd.c_str());
}
}
#endif // MAPNIK_UNIT_DATSOURCE_UTIL

View file

@ -62,25 +62,6 @@ std::pair<mapnik::datasource_ptr,mapnik::feature_ptr> fetch_first_feature(std::s
return std::make_pair(ds,feature); return std::make_pair(ds,feature);
} }
int create_disk_index(std::string const& filename, bool silent = true)
{
std::string cmd;
if (std::getenv("DYLD_LIBRARY_PATH") != nullptr)
{
cmd += std::string("DYLD_LIBRARY_PATH=") + std::getenv("DYLD_LIBRARY_PATH") + " ";
}
cmd += "mapnik-index " + filename;
if (silent)
{
#ifndef _WINDOWS
cmd += " 2>/dev/null";
#else
cmd += " 2> nul";
#endif
}
return std::system(cmd.c_str());
}
} }
TEST_CASE("geojson") { TEST_CASE("geojson") {

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
#include <mapnik/memory_datasource.hpp> #include <mapnik/memory_datasource.hpp>

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
#include <mapnik/geometry_centroid.hpp> #include <mapnik/geometry_centroid.hpp>

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
#include <mapnik/geometry.hpp> #include <mapnik/geometry.hpp>

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
#include <mapnik/geometry.hpp> #include <mapnik/geometry.hpp>

View file

@ -1,3 +1,7 @@
#ifndef MAPNIK_UNIT_GEOMETRY_EQUAL
#define MAPNIK_UNIT_GEOMETRY_EQUAL
#include "catch.hpp" #include "catch.hpp"
// boost // boost
@ -214,3 +218,5 @@ void assert_g_equal(T const& g1, T const& g2)
{ {
return geometry_equal_visitor()(g1,g2); return geometry_equal_visitor()(g1,g2);
} }
#endif // MAPNIK_UNIT_GEOMETRY_EQUAL

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
#include <mapnik/geometry.hpp> #include <mapnik/geometry.hpp>

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
#include <boost/version.hpp> #include <boost/version.hpp>

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
#include <mapnik/geometry.hpp> #include <mapnik/geometry.hpp>

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
#include "geometry_equal.hpp" #include "geometry_equal.hpp"

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
#include "geometry_equal.hpp" #include "geometry_equal.hpp"

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
#include <mapnik/geometry_is_empty.hpp> #include <mapnik/geometry_is_empty.hpp>

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
#include <mapnik/geometry_is_empty.hpp> #include <mapnik/geometry_is_empty.hpp>

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
#include <mapnik/geometry_remove_empty.hpp> #include <mapnik/geometry_remove_empty.hpp>

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
// mapnik // mapnik

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
// mapnik // mapnik

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
// mapnik // mapnik

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
#include <iostream> #include <iostream>

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
// mapnik // mapnik

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
#include <iostream> #include <iostream>

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
// mapnik // mapnik

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
// mapnik // mapnik

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
// mapnik // mapnik

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
#include <mapnik/enumeration.hpp> #include <mapnik/enumeration.hpp>
#include <mapnik/symbolizer_enumerations.hpp> #include <mapnik/symbolizer_enumerations.hpp>

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
#include <mapnik/safe_cast.hpp> #include <mapnik/safe_cast.hpp>

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
#include <iostream> #include <iostream>

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
#include <mapnik/palette.hpp> #include <mapnik/palette.hpp>

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
#include <mapnik/projection.hpp> #include <mapnik/projection.hpp>

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
#include <iostream> #include <iostream>

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
#include <mapnik/xml_tree.hpp> #include <mapnik/xml_tree.hpp>

View file

@ -317,7 +317,7 @@ TEST_CASE("SVG parser") {
std::make_tuple(0, 10,2), std::make_tuple(0, 10,2),
std::make_tuple(0, 10,95)}; std::make_tuple(0, 10,95)};
REQUIRE(std::equal(expected.begin(),expected.end(), vec.begin(),detail::vertex_equal<3>())); REQUIRE(std::equal(expected.begin(),expected.end(), vec.begin(),vertex_equal<3>()));
} }
SECTION("SVG viewbox fallback") SECTION("SVG viewbox fallback")
@ -377,7 +377,7 @@ TEST_CASE("SVG parser") {
std::make_tuple(0, 10,2), std::make_tuple(0, 10,2),
std::make_tuple(0, 10,95)}; std::make_tuple(0, 10,95)};
REQUIRE(std::equal(expected.begin(),expected.end(), vec.begin(),detail::vertex_equal<3>())); REQUIRE(std::equal(expected.begin(),expected.end(), vec.begin(),vertex_equal<3>()));
} }
SECTION("SVG beveled <rect>") SECTION("SVG beveled <rect>")

View file

@ -50,7 +50,7 @@ void test_path_parser(std::string const& str, Expected const& expected)
vec.emplace_back(x, y, cmd); vec.emplace_back(x, y, cmd);
//std::cerr << "std::make_tuple(" << x << ", " << y << ", " << cmd << ")," << std::endl; //std::cerr << "std::make_tuple(" << x << ", " << y << ", " << cmd << ")," << std::endl;
} }
REQUIRE(std::equal(expected.begin(),expected.end(), vec.begin(), detail::vertex_equal<3>())); REQUIRE(std::equal(expected.begin(),expected.end(), vec.begin(), vertex_equal<3>()));
} }
} // anonymous ns } // anonymous ns

View file

@ -25,7 +25,7 @@
#include <cmath> #include <cmath>
namespace detail { namespace {
template <int N = 6> template <int N = 6>
struct vertex_equal struct vertex_equal

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
#include <iostream> #include <iostream>

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
#include <mapnik/text/icu_shaper.hpp> #include <mapnik/text/icu_shaper.hpp>
#include <mapnik/text/harfbuzz_shaper.hpp> #include <mapnik/text/harfbuzz_shaper.hpp>

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
// mapnik // mapnik

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
// mapnik // mapnik

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
// mapnik // mapnik

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
//#include <mapnik/wkt/wkt_factory.hpp> //#include <mapnik/wkt/wkt_factory.hpp>

View file

@ -1,3 +1,4 @@
#include "catch.hpp" #include "catch.hpp"
#include <mapnik/vertex_adapters.hpp> #include <mapnik/vertex_adapters.hpp>