2012-08-23 18:10:03 +02:00
|
|
|
#include <boost/version.hpp>
|
|
|
|
#include <boost/detail/lightweight_test.hpp>
|
|
|
|
#include <iostream>
|
|
|
|
#include "plugins/input/csv/csv_datasource.hpp"
|
|
|
|
#include <mapnik/params.hpp>
|
2013-05-25 02:21:55 +02:00
|
|
|
#include <vector>
|
2013-05-26 01:04:40 +02:00
|
|
|
#include <algorithm>
|
2012-08-23 18:10:03 +02:00
|
|
|
|
2013-05-25 02:21:55 +02:00
|
|
|
int main(int argc, char** argv)
|
2012-08-23 18:10:03 +02:00
|
|
|
{
|
2013-05-25 02:21:55 +02:00
|
|
|
std::vector<std::string> args;
|
|
|
|
for (int i=1;i<argc;++i)
|
|
|
|
{
|
|
|
|
args.push_back(argv[i]);
|
|
|
|
}
|
|
|
|
bool quiet = std::find(args.begin(), args.end(), "-q")!=args.end();
|
|
|
|
|
2012-08-23 18:10:03 +02:00
|
|
|
// test of directly instanciating a datasource
|
|
|
|
try {
|
|
|
|
mapnik::parameters params;
|
|
|
|
params["type"]="csv";
|
|
|
|
params["file"]="./tests/data/csv/wkt.csv";
|
|
|
|
csv_datasource ds(params);
|
|
|
|
BOOST_TEST(true);
|
|
|
|
} catch (std::exception const& ex) {
|
|
|
|
BOOST_TEST(false);
|
|
|
|
std::clog << "threw: " << ex.what() << "\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!::boost::detail::test_errors()) {
|
2013-05-25 02:21:55 +02:00
|
|
|
if (quiet) std::clog << "\x1b[1;32m.\x1b[0m";
|
|
|
|
else std::clog << "C++ CSV parse: \x1b[1;32m✓ \x1b[0m\n";
|
2012-08-23 18:10:03 +02:00
|
|
|
#if BOOST_VERSION >= 104600
|
|
|
|
::boost::detail::report_errors_remind().called_report_errors_function = true;
|
|
|
|
#endif
|
|
|
|
} else {
|
|
|
|
return ::boost::report_errors();
|
|
|
|
}
|
|
|
|
}
|