Overpass API regression suite coverage (Saxony) / overpass_api/statements/binary_operators.cc
overpass_api/statements/binary_operators.cc
183 of 200 instrumented lines run by the suite (91.5%) at 8edf11b0419c (this file on GitHub).
runnever runcolumns: line, executions, queries (click for the queries that run the line)
1/** Copyright 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 Roland Olbricht et al.2 *3 * This file is part of Overpass_API.4 *5 * Overpass_API is free software: you can redistribute it and/or modify6 * it under the terms of the GNU Affero General Public License as7 * published by the Free Software Foundation, either version 3 of the8 * License, or (at your option) any later version.9 *10 * Overpass_API is distributed in the hope that it will be useful,11 * but WITHOUT ANY WARRANTY; without even the implied warranty of12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13 * GNU General Public License for more details.14 *15 * You should have received a copy of the GNU Affero General Public License16 * along with Overpass_API. If not, see <http://www.gnu.org/licenses/>.17 */19#include "../data/tag_store.h"20#include "../data/utils.h"21#include "binary_operators.h"241148131 qEvaluator_Pair_Operator::Evaluator_Pair_Operator(int line_number_) : Evaluator(line_number_), lhs(0), rhs(0) {}27void Evaluator_Pair_Operator::add_statement(Statement* statement, std::string text)41void Evaluator_Pair_Operator::add_substatements(Statement* result, const std::string& operator_name,42 const Token_Node_Ptr& tree_it, Statement::QL_Context tree_context,43 Statement::Factory& stmt_factory, Error_Output* error_output)66Eval_Task* Evaluator_Pair_Operator::get_string_task(Prepare_Task_Context& context, const std::string* key)74std::string Binary_Eval_Task::eval(const std::string* key) const80std::string Binary_Eval_Task::eval(const Element_With_Context< Node_Skeleton >& data, const std::string* key) const82100164836 q return evaluator->process(lhs ? lhs->eval(data, key) : "", rhs ? rhs->eval(data, key) : "");86std::string Binary_Eval_Task::eval(const Element_With_Context< Attic< Node_Skeleton > >& data, const std::string* key) const881180412 q return evaluator->process(lhs ? lhs->eval(data, key) : "", rhs ? rhs->eval(data, key) : "");92std::string Binary_Eval_Task::eval(const Element_With_Context< Way_Skeleton >& data, const std::string* key) const9457796032 q return evaluator->process(lhs ? lhs->eval(data, key) : "", rhs ? rhs->eval(data, key) : "");98std::string Binary_Eval_Task::eval(const Element_With_Context< Attic< Way_Skeleton > >& data, const std::string* key) const1001767014 q return evaluator->process(lhs ? lhs->eval(data, key) : "", rhs ? rhs->eval(data, key) : "");104std::string Binary_Eval_Task::eval(const Element_With_Context< Relation_Skeleton >& data, const std::string* key) const10668376325 q return evaluator->process(lhs ? lhs->eval(data, key) : "", rhs ? rhs->eval(data, key) : "");110std::string Binary_Eval_Task::eval(const Element_With_Context< Attic< Relation_Skeleton > >& data, const std::string* key) const112295935 q return evaluator->process(lhs ? lhs->eval(data, key) : "", rhs ? rhs->eval(data, key) : "");116std::string Binary_Eval_Task::eval(const Element_With_Context< Area_Skeleton >& data, const std::string* key) const11842 q return evaluator->process(lhs ? lhs->eval(data, key) : "", rhs ? rhs->eval(data, key) : "");122std::string Binary_Eval_Task::eval(const Element_With_Context< Derived_Skeleton >& data, const std::string* key) const124111389711 q return evaluator->process(lhs ? lhs->eval(data, key) : "", rhs ? rhs->eval(data, key) : "");128std::string Binary_Eval_Task::eval(uint pos, const Element_With_Context< Way_Skeleton >& data, const std::string* key) const130685794 q return evaluator->process(lhs ? lhs->eval(pos, data, key) : "", rhs ? rhs->eval(pos, data, key) : "");134std::string Binary_Eval_Task::eval(uint pos, const Element_With_Context< Attic< Way_Skeleton > >& data, const std::string* key) const13668891 q return evaluator->process(lhs ? lhs->eval(pos, data, key) : "", rhs ? rhs->eval(pos, data, key) : "");140std::string Binary_Eval_Task::eval(uint pos, const Element_With_Context< Relation_Skeleton >& data, const std::string* key) const1425168843 q return evaluator->process(lhs ? lhs->eval(pos, data, key) : "", rhs ? rhs->eval(pos, data, key) : "");146std::string Binary_Eval_Task::eval(uint pos, const Element_With_Context< Attic< Relation_Skeleton > >& data, const std::string* key) const1480 return evaluator->process(lhs ? lhs->eval(pos, data, key) : "", rhs ? rhs->eval(pos, data, key) : "");152Requested_Context Evaluator_Pair_Operator::request_context() const169//-----------------------------------------------------------------------------172Operator_Stmt_Maker< Evaluator_And > Evaluator_And::statement_maker;173Operator_Eval_Maker< Evaluator_And > Evaluator_And::evaluator_maker;176std::string Evaluator_And::process(const std::string& lhs_s, const std::string& rhs_s) const17810111811 q return string_represents_boolean_true(lhs_s) && string_represents_boolean_true(rhs_s) ? "1" : "0";182//-----------------------------------------------------------------------------185Operator_Stmt_Maker< Evaluator_Or > Evaluator_Or::statement_maker;186Operator_Eval_Maker< Evaluator_Or > Evaluator_Or::evaluator_maker;189std::string Evaluator_Or::process(const std::string& lhs_s, const std::string& rhs_s) const191457159 q return string_represents_boolean_true(lhs_s) || string_represents_boolean_true(rhs_s) ? "1" : "0";195//-----------------------------------------------------------------------------198Operator_Stmt_Maker< Evaluator_Equal > Evaluator_Equal::statement_maker;199Operator_Eval_Maker< Evaluator_Equal > Evaluator_Equal::evaluator_maker;202std::string Evaluator_Equal::process(const std::string& lhs_s, const std::string& rhs_s) const218//-----------------------------------------------------------------------------221Operator_Stmt_Maker< Evaluator_Not_Equal > Evaluator_Not_Equal::statement_maker;222Operator_Eval_Maker< Evaluator_Not_Equal > Evaluator_Not_Equal::evaluator_maker;225std::string Evaluator_Not_Equal::process(const std::string& lhs_s, const std::string& rhs_s) const241//-----------------------------------------------------------------------------244Operator_Stmt_Maker< Evaluator_Less > Evaluator_Less::statement_maker;245Operator_Eval_Maker< Evaluator_Less > Evaluator_Less::evaluator_maker;248std::string Evaluator_Less::process(const std::string& lhs_s, const std::string& rhs_s) const264//-----------------------------------------------------------------------------267Operator_Stmt_Maker< Evaluator_Less_Equal > Evaluator_Less_Equal::statement_maker;268Operator_Eval_Maker< Evaluator_Less_Equal > Evaluator_Less_Equal::evaluator_maker;271std::string Evaluator_Less_Equal::process(const std::string& lhs_s, const std::string& rhs_s) const287//-----------------------------------------------------------------------------290Operator_Stmt_Maker< Evaluator_Greater > Evaluator_Greater::statement_maker;291Operator_Eval_Maker< Evaluator_Greater > Evaluator_Greater::evaluator_maker;294std::string Evaluator_Greater::process(const std::string& lhs_s, const std::string& rhs_s) const310//-----------------------------------------------------------------------------313Operator_Stmt_Maker< Evaluator_Greater_Equal > Evaluator_Greater_Equal::statement_maker;314Operator_Eval_Maker< Evaluator_Greater_Equal > Evaluator_Greater_Equal::evaluator_maker;317std::string Evaluator_Greater_Equal::process(const std::string& lhs_s, const std::string& rhs_s) const333//-----------------------------------------------------------------------------336Operator_Stmt_Maker< Evaluator_Plus > Evaluator_Plus::statement_maker;337Operator_Eval_Maker< Evaluator_Plus > Evaluator_Plus::evaluator_maker;340std::string Evaluator_Plus::process(const std::string& lhs_s, const std::string& rhs_s) const356//-----------------------------------------------------------------------------359Operator_Stmt_Maker< Evaluator_Minus > Evaluator_Minus::statement_maker;360Operator_Eval_Maker< Evaluator_Minus > Evaluator_Minus::evaluator_maker;363std::string Evaluator_Minus::process(const std::string& lhs_s, const std::string& rhs_s) const379//-----------------------------------------------------------------------------382Operator_Stmt_Maker< Evaluator_Times > Evaluator_Times::statement_maker;383Operator_Eval_Maker< Evaluator_Times > Evaluator_Times::evaluator_maker;386std::string Evaluator_Times::process(const std::string& lhs_s, const std::string& rhs_s) const402//-----------------------------------------------------------------------------405Operator_Stmt_Maker< Evaluator_Divided > Evaluator_Divided::statement_maker;406Operator_Eval_Maker< Evaluator_Divided > Evaluator_Divided::evaluator_maker;409std::string Evaluator_Divided::process(const std::string& lhs_s, const std::string& rhs_s) const411 // On purpose no int64 detection