mirror of
https://github.com/mapnik/mapnik.git
synced 2025-12-08 20:13:09 +00:00
fix merge remove old DATASOURCE_PLUGIN call fix memory_datasource wip wip fix temp return fix install wip before_unload linux remove docker remove docker comments add windows error message if libmapnik=static and plugins=dynamic fix false plugin macro plugin default de/constructor to remove UB simplyfy plugin targets - add fpic fix makro simplyfy use unique_ptr for plugin handle rename option static plugins replace local init with fnc call call setup everywhere init datasource_static
45 lines
1.1 KiB
C++
45 lines
1.1 KiB
C++
#include "bench_framework.hpp"
|
|
#include <mapnik/unicode.hpp>
|
|
#include <mapnik/attribute.hpp>
|
|
#include <mapnik/expression.hpp>
|
|
#include <mapnik/expression_string.hpp>
|
|
|
|
class test : public benchmark::test_case
|
|
{
|
|
std::string expr_;
|
|
|
|
public:
|
|
test(mapnik::parameters const& params)
|
|
: test_case(params)
|
|
, expr_("((([mapnik::geometry_type]=2) and ([oneway]=1)) and ([class]='path'))")
|
|
{}
|
|
bool validate() const
|
|
{
|
|
mapnik::expression_ptr expr = mapnik::parse_expression(expr_);
|
|
std::string result = mapnik::to_expression_string(*expr);
|
|
bool ret = (result == expr_);
|
|
if (!ret)
|
|
{
|
|
std::clog << result << " != " << expr_ << "\n";
|
|
}
|
|
return ret;
|
|
}
|
|
bool operator()() const
|
|
{
|
|
for (std::size_t i = 0; i < iterations_; ++i)
|
|
{
|
|
mapnik::expression_ptr expr = mapnik::parse_expression(expr_);
|
|
}
|
|
return true;
|
|
}
|
|
};
|
|
|
|
int main(int argc, char** argv)
|
|
{
|
|
mapnik::setup();
|
|
mapnik::parameters params;
|
|
benchmark::handle_args(argc, argv, params);
|
|
test test_runner(params);
|
|
return run(test_runner, "expr parsing");
|
|
}
|