quiet mode for c++ tests

This commit is contained in:
Dane Springmeyer 2013-05-24 17:21:55 -07:00
parent b86303202e
commit 1211211f98
13 changed files with 141 additions and 29 deletions

View file

@ -4,6 +4,7 @@
#include <cstdio>
#include <sstream>
#include <string>
#include <vector>
#include "agg_color_rgba.h"
#include "agg_pixfmt_rgba.h"
#include "agg_rendering_buffer.h"
@ -130,8 +131,15 @@ template<class ColorT, class Order> struct comp_op_rgba_src_over2
}
int main( int, char*[] )
int main(int argc, char** argv)
{
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();
typedef agg::comp_op_rgba_src_over2<color, agg::order_rgba> source_over_old_agg;
typedef agg::comp_op_rgba_src_over<color, agg::order_rgba> source_over;
@ -194,7 +202,8 @@ int main( int, char*[] )
*/
if (!::boost::detail::test_errors()) {
std::clog << "C++ AGG blending: \x1b[1;32m✓ \x1b[0m\n";
if (quiet) std::clog << "\x1b[1;32m.\x1b[0m";
else std::clog << "C++ AGG blending: \x1b[1;32m✓ \x1b[0m\n";
#if BOOST_VERSION >= 104600
::boost::detail::report_errors_remind().called_report_errors_function = true;
#endif

View file

@ -76,8 +76,15 @@ void parse_geom(mapnik::geometry_type & geom,
}
}
int main( int, char*[] )
int main(int argc, char** argv)
{
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();
try {
std::string filename("tests/cpp_tests/data/cases.txt");
std::ifstream stream(filename.c_str(),std::ios_base::in | std::ios_base::binary);
@ -111,7 +118,8 @@ int main( int, char*[] )
if (!::boost::detail::test_errors())
{
std::clog << "C++ clipping: \x1b[1;32m✓ \x1b[0m\n";
if (quiet) std::clog << "\x1b[1;32m.\x1b[0m";
else std::clog << "C++ clipping: \x1b[1;32m✓ \x1b[0m\n";
#if BOOST_VERSION >= 104600
::boost::detail::report_errors_remind().called_report_errors_function = true;
#endif

View file

@ -3,9 +3,17 @@
#include <mapnik/util/conversions.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <iostream>
#include <vector>
int main( int, char*[] )
int main(int argc, char** argv)
{
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();
using mapnik::util::to_string;
try
@ -262,7 +270,8 @@ int main( int, char*[] )
}
if (!::boost::detail::test_errors()) {
std::clog << "C++ type conversions: \x1b[1;32m✓ \x1b[0m\n";
if (quiet) std::clog << "\x1b[1;32m.\x1b[0m";
else std::clog << "C++ type conversions: \x1b[1;32m✓ \x1b[0m\n";
#if BOOST_VERSION >= 104600
::boost::detail::report_errors_remind().called_report_errors_function = true;
#endif

View file

@ -3,10 +3,17 @@
#include <iostream>
#include "plugins/input/csv/csv_datasource.hpp"
#include <mapnik/params.hpp>
#include <vector>
int main( int, char*[] )
int main(int argc, char** argv)
{
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();
// test of directly instanciating a datasource
try {
mapnik::parameters params;
@ -20,7 +27,8 @@ int main( int, char*[] )
}
if (!::boost::detail::test_errors()) {
std::clog << "C++ CSV parse: \x1b[1;32m✓ \x1b[0m\n";
if (quiet) std::clog << "\x1b[1;32m.\x1b[0m";
else 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

View file

@ -19,13 +19,21 @@
#include <mapnik/config_error.hpp>
#include <mapnik/datasource_cache.hpp>
#include <mapnik/params.hpp>
#include <vector>
extern "C" {
#include <sqlite3.h>
}
int main( int, char*[] )
int main(int argc, char** argv)
{
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();
try {
mapnik::projection srs("foo");
// to avoid unused variable warning
@ -103,7 +111,8 @@ int main( int, char*[] )
*/
if (!::boost::detail::test_errors()) {
std::clog << "C++ exceptions: \x1b[1;32m✓ \x1b[0m\n";
if (quiet) std::clog << "\x1b[1;32m.\x1b[0m";
else std::clog << "C++ exceptions: \x1b[1;32m✓ \x1b[0m\n";
#if BOOST_VERSION >= 104600
::boost::detail::report_errors_remind().called_report_errors_function = true;
#endif

View file

@ -7,9 +7,17 @@ namespace sys = boost::system;
#include <boost/detail/lightweight_test.hpp>
#include <iostream>
#include <mapnik/font_engine_freetype.hpp>
#include <vector>
int main( int, char*[] )
int main(int argc, char** argv)
{
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();
try
{
std::string fontdir("fonts/");
@ -80,7 +88,8 @@ int main( int, char*[] )
}
if (!::boost::detail::test_errors()) {
std::clog << "C++ fonts registration: \x1b[1;32m✓ \x1b[0m\n";
if (quiet) std::clog << "\x1b[1;32m.\x1b[0m";
else std::clog << "C++ fonts registration: \x1b[1;32m✓ \x1b[0m\n";
#if BOOST_VERSION >= 104600
::boost::detail::report_errors_remind().called_report_errors_function = true;
#endif

View file

@ -17,10 +17,18 @@
#include <mapnik/image_util.hpp>
#include <mapnik/color_factory.hpp>
#include <mapnik/save_map.hpp>
#include <vector>
int main( int, char*[] )
int main(int argc, char** argv)
{
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();
// create a renderable map with a fontset and a text symbolizer
// and do not register any fonts, to ensure the error thrown is reasonable
mapnik::context_ptr ctx = boost::make_shared<mapnik::context_type>();
@ -61,7 +69,8 @@ int main( int, char*[] )
BOOST_TEST_EQ(std::string(ex.what()),std::string("No valid font face could be loaded for font set: 'fontset'"));
}
if (!::boost::detail::test_errors()) {
std::clog << "C++ fontset runtime: \x1b[1;32m✓ \x1b[0m\n";
if (quiet) std::clog << "\x1b[1;32m.\x1b[0m";
else std::clog << "C++ fontset runtime: \x1b[1;32m✓ \x1b[0m\n";
#if BOOST_VERSION >= 104600
::boost::detail::report_errors_remind().called_report_errors_function = true;
#endif

View file

@ -17,6 +17,7 @@
#include <boost/detail/lightweight_test.hpp>
#include <iostream>
#include <vector>
struct output_geometry_backend
{
@ -122,8 +123,15 @@ boost::optional<std::string> polygon_bbox_clipping(mapnik::box2d<double> bbox,
return boost::optional<std::string>();
}
int main( int, char*[] )
int main(int argc, char** argv)
{
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();
// LineString/bbox clipping
{
std::string wkt_in("LineString(0 0,200 200)");
@ -163,7 +171,8 @@ int main( int, char*[] )
#endif
if (!::boost::detail::test_errors())
{
std::clog << "C++ geometry conversions: \x1b[1;32m✓ \x1b[0m\n";
if (quiet) std::clog << "\x1b[1;32m.\x1b[0m";
else std::clog << "C++ geometry conversions: \x1b[1;32m✓ \x1b[0m\n";
#if BOOST_VERSION >= 104600
::boost::detail::report_errors_remind().called_report_errors_function = true;
#endif

View file

@ -8,10 +8,17 @@ namespace sys = boost::system;
#include <iostream>
#include <mapnik/image_reader.hpp>
#include <mapnik/image_util.hpp>
#include <vector>
int main( int, char*[] )
int main(int argc, char** argv)
{
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();
std::string should_throw;
boost::optional<std::string> type;
try
@ -80,7 +87,8 @@ int main( int, char*[] )
}
if (!::boost::detail::test_errors()) {
std::clog << "C++ image i/o: \x1b[1;32m✓ \x1b[0m\n";
if (quiet) std::clog << "\x1b[1;32m.\x1b[0m";
else std::clog << "C++ image i/o: \x1b[1;32m✓ \x1b[0m\n";
#if BOOST_VERSION >= 104600
::boost::detail::report_errors_remind().called_report_errors_function = true;
#endif

View file

@ -3,10 +3,18 @@
#include <iostream>
#include <mapnik/geometry.hpp>
#include <mapnik/geom_util.hpp>
#include <vector>
int main( int, char*[] )
int main(int argc, char** argv)
{
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();
// reused these for simplicity
double x,y;
@ -35,7 +43,8 @@ int main( int, char*[] )
// 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)))
if (!::boost::detail::test_errors()) {
std::clog << "C++ label algorithms: \x1b[1;32m✓ \x1b[0m\n";
if (quiet) std::clog << "\x1b[1;32m.\x1b[0m";
else std::clog << "C++ label algorithms: \x1b[1;32m✓ \x1b[0m\n";
#if BOOST_VERSION >= 104600
::boost::detail::report_errors_remind().called_report_errors_function = true;
#endif

View file

@ -18,6 +18,7 @@
#include <mapnik/scale_denominator.hpp>
#include <mapnik/feature_style_processor.hpp>
#include <boost/foreach.hpp>
#include <vector>
bool compare_images(std::string const& src_fn,std::string const& dest_fn)
{
@ -56,8 +57,15 @@ bool compare_images(std::string const& src_fn,std::string const& dest_fn)
return true;
}
int main( int, char*[] )
int main(int argc, char** argv)
{
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();
std::string expected("./tests/cpp_tests/support/map-request-marker-text-line-expected.png");
std::string expected_cairo("./tests/cpp_tests/support/map-request-marker-text-line-expected-cairo.png");
try {
@ -142,7 +150,8 @@ int main( int, char*[] )
std::clog << ex.what() << "\n";
}
if (!::boost::detail::test_errors()) {
std::clog << "C++ Map Request rendering hook: \x1b[1;32m✓ \x1b[0m\n";
if (quiet) std::clog << "\x1b[1;32m.\x1b[0m";
else std::clog << "C++ Map Request rendering hook: \x1b[1;32m✓ \x1b[0m\n";
#if BOOST_VERSION >= 104600
::boost::detail::report_errors_remind().called_report_errors_function = true;
#endif

View file

@ -4,11 +4,17 @@
#include <mapnik/value_types.hpp>
#include <mapnik/params.hpp>
#include <mapnik/boolean.hpp>
#include <vector>
#include <boost/variant.hpp>
int main( int, char*[] )
int main(int argc, char** argv)
{
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();
mapnik::parameters params;
@ -73,7 +79,8 @@ int main( int, char*[] )
//BOOST_TEST( (params.get<mapnik::value_null>("null")/* && *params.get<mapnik::value_null>("null") == mapnik::value_null()*/) );
if (!::boost::detail::test_errors()) {
std::clog << "C++ parameters: \x1b[1;32m✓ \x1b[0m\n";
if (quiet) std::clog << "\x1b[1;32m.\x1b[0m";
else std::clog << "C++ parameters: \x1b[1;32m✓ \x1b[0m\n";
#if BOOST_VERSION >= 104600
::boost::detail::report_errors_remind().called_report_errors_function = true;
#endif

View file

@ -5,10 +5,18 @@
#include <mapnik/wkb.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/feature_factory.hpp>
#include <vector>
int main( int, char*[] )
int main(int argc, char** argv)
{
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();
unsigned char sp_valid_blob[] = {
0x0, 0x1, 0xBC, 0xB, 0x0, 0x0, 0x1F, 0x12, 0xDB, 0xCF, 0xC3, 0xA2, 0x41, 0x41, 0x9D, 0x74, 0xB0, 0x31, 0xE6, 0x34, 0x53, 0x41, 0xDB,
0x1B, 0xB6, 0x7C, 0xD9, 0xA2, 0x41, 0x41, 0x67, 0xA7, 0xB6, 0xF, 0xF6, 0x34, 0x53, 0x41, 0x7C, 0x6, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0,
@ -107,7 +115,8 @@ int main( int, char*[] )
}
if (!::boost::detail::test_errors()) {
//std::clog << "C++ CSV parse: \x1b[1;32m✓ \x1b[0m\n";
if (quiet) std::clog << "\x1b[1;32m.\x1b[0m";
else 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