more realistic expression benchmark string - refs #1167
This commit is contained in:
parent
2806bd1cac
commit
ab7fc55535
1 changed files with 19 additions and 7 deletions
|
@ -10,11 +10,17 @@ class test : public benchmark::test_case
|
||||||
public:
|
public:
|
||||||
test(mapnik::parameters const& params)
|
test(mapnik::parameters const& params)
|
||||||
: test_case(params),
|
: test_case(params),
|
||||||
expr_("([foo]=1)") {}
|
expr_("((([mapnik::geometry_type]=2) and ([oneway]=1)) and ([class]='path'))") {}
|
||||||
bool validate() const
|
bool validate() const
|
||||||
{
|
{
|
||||||
mapnik::expression_ptr expr = mapnik::parse_expression(expr_,"utf-8");
|
mapnik::expression_ptr expr = mapnik::parse_expression(expr_,"utf-8");
|
||||||
return mapnik::to_expression_string(*expr) == expr_;
|
std::string result = mapnik::to_expression_string(*expr);
|
||||||
|
bool ret = (result == expr_);
|
||||||
|
if (!ret)
|
||||||
|
{
|
||||||
|
std::clog << result << " != " << expr_ << "\n";
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
void operator()() const
|
void operator()() const
|
||||||
{
|
{
|
||||||
|
@ -30,13 +36,19 @@ class test2 : public benchmark::test_case
|
||||||
public:
|
public:
|
||||||
test2(mapnik::parameters const& params)
|
test2(mapnik::parameters const& params)
|
||||||
: test_case(params),
|
: test_case(params),
|
||||||
expr_("([foo]=1)") {}
|
expr_("((([mapnik::geometry_type]=2) and ([oneway]=1)) and ([class]='path'))") {}
|
||||||
bool validate() const
|
bool validate() const
|
||||||
{
|
{
|
||||||
mapnik::transcoder tr("utf-8");
|
mapnik::transcoder tr("utf-8");
|
||||||
mapnik::expression_grammar<std::string::const_iterator> expr_grammar(tr);
|
mapnik::expression_grammar<std::string::const_iterator> expr_grammar(tr);
|
||||||
mapnik::expression_ptr expr = mapnik::parse_expression(expr_,expr_grammar);
|
mapnik::expression_ptr expr = mapnik::parse_expression(expr_,expr_grammar);
|
||||||
return mapnik::to_expression_string(*expr) == expr_;
|
std::string result = mapnik::to_expression_string(*expr);
|
||||||
|
bool ret = (result == expr_);
|
||||||
|
if (!ret)
|
||||||
|
{
|
||||||
|
std::clog << result << " != " << expr_ << "\n";
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
void operator()() const
|
void operator()() const
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue