Add method UDQDefine::input_string()
This commit is contained in:
parent
370ce5de1f
commit
2fb64e21d9
@ -57,12 +57,14 @@ public:
|
||||
|
||||
UDQSet eval(const UDQContext& context) const;
|
||||
const std::string& keyword() const;
|
||||
const std::string& input_string() const;
|
||||
UDQVarType var_type() const;
|
||||
private:
|
||||
const UDQParams& udq_params; // Beacuse of the shared RNG stream this must be a reference.
|
||||
std::string m_keyword;
|
||||
std::shared_ptr<UDQASTNode> ast;
|
||||
UDQVarType m_var_type;
|
||||
std::string string_data;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -122,6 +122,13 @@ UDQDefine::UDQDefine(const UDQParams& udq_params_arg,
|
||||
}
|
||||
}
|
||||
this->ast = std::make_shared<UDQASTNode>( UDQParser::parse(this->udq_params, this->m_var_type, this->m_keyword, tokens, parseContext, errors) );
|
||||
|
||||
this->string_data = "";
|
||||
for (std::size_t index = 0; index < deck_data.size(); index++) {
|
||||
this->string_data += deck_data[index];
|
||||
if (index != deck_data.size() - 1)
|
||||
this->string_data += " ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -184,4 +191,8 @@ const std::string& UDQDefine::keyword() const {
|
||||
return this->m_keyword;
|
||||
}
|
||||
|
||||
const std::string& UDQDefine::input_string() const {
|
||||
return this->string_data;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1039,7 +1039,10 @@ BOOST_AUTO_TEST_CASE(DECK_TEST) {
|
||||
BOOST_AUTO_TEST_CASE(UDQPARSE_TEST1) {
|
||||
UDQParams udqp;
|
||||
UDQDefine def1(udqp, "WUBHP", {"1/(WWCT", "'W1*')"});
|
||||
BOOST_CHECK_EQUAL( def1.input_string() , "1/(WWCT 'W1*')");
|
||||
|
||||
UDQDefine def2(udqp, "WUBHP", {"2*(1", "+" , "WBHP)"});
|
||||
BOOST_CHECK_EQUAL( def2.input_string() , "2*(1 + WBHP)");
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user