add a csv_datasource initialization c++ test
This commit is contained in:
parent
a3254965fe
commit
f4a74d0dde
2 changed files with 40 additions and 8 deletions
|
@ -6,16 +6,18 @@ Import ('env')
|
||||||
|
|
||||||
test_env = env.Clone()
|
test_env = env.Clone()
|
||||||
|
|
||||||
headers = env['CPPPATH']
|
test_env['LIBS'] = copy(env['LIBMAPNIK_LIBS'])
|
||||||
|
test_env.AppendUnique(LIBS='mapnik')
|
||||||
libraries = copy(env['LIBMAPNIK_LIBS'])
|
test_env.AppendUnique(LIBS='sqlite3')
|
||||||
libraries.append('mapnik')
|
test_env.AppendUnique(CXXFLAGS='-g')
|
||||||
libraries.append('sqlite3')
|
|
||||||
|
|
||||||
test_env.Append(CXXFLAGS='-g')
|
|
||||||
|
|
||||||
for cpp_test in glob.glob('*_test.cpp'):
|
for cpp_test in glob.glob('*_test.cpp'):
|
||||||
test_program = test_env.Program(cpp_test.replace('.cpp','-bin'), [cpp_test], CPPPATH=headers, LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS'])
|
test_env_local = test_env.Clone()
|
||||||
|
name = cpp_test.replace('.cpp','-bin')
|
||||||
|
source_files = [cpp_test]
|
||||||
|
if 'csv_parse' in cpp_test:
|
||||||
|
source_files += glob.glob('../../plugins/input/csv/' + '*.cpp')
|
||||||
|
test_program = test_env_local.Program(name, source=source_files, LINKFLAGS=env['CUSTOM_LDFLAGS'])
|
||||||
Depends(test_program, env.subst('../../src/%s' % env['MAPNIK_LIB_NAME']))
|
Depends(test_program, env.subst('../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||||
# build locally if installing
|
# build locally if installing
|
||||||
if 'install' in COMMAND_LINE_TARGETS:
|
if 'install' in COMMAND_LINE_TARGETS:
|
||||||
|
|
30
tests/cpp_tests/csv_parse_test.cpp
Normal file
30
tests/cpp_tests/csv_parse_test.cpp
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
#include <boost/version.hpp>
|
||||||
|
#include <boost/detail/lightweight_test.hpp>
|
||||||
|
#include <iostream>
|
||||||
|
#include "plugins/input/csv/csv_datasource.hpp"
|
||||||
|
#include <mapnik/params.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
int main( int, char*[] )
|
||||||
|
{
|
||||||
|
// 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()) {
|
||||||
|
std::clog << "C++ CSV parse: \x1b[1;32m✓ \x1b[0m\n";
|
||||||
|
#if BOOST_VERSION >= 104600
|
||||||
|
::boost::detail::report_errors_remind().called_report_errors_function = true;
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
return ::boost::report_errors();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue