Skip to content
Snippets Groups Projects

Build fix

Merged Cyril Moineau requested to merge BuildFix into main
1 file
+ 25
25
Compare changes
  • Side-by-side
  • Inline
#include "aidge/nodeTester/ConditionalInterpreter.hpp"
using namespace Aidge;
using namespace Aidge;
///////////////////////////////
@@ -31,7 +31,7 @@ using namespace Aidge;
mLambdaRegiter.insert("getType",+[](NodePtr NodeOp){return NodeOp->type();});
}
bool ConditionalInterpreter::test( const NodePtr nodeOp)
{
@@ -39,9 +39,9 @@ using namespace Aidge;
clearRes();
try{
std::vector<ConditionalData*> r = visit({mTree},nodeOp);
if (mResolution.size() != 1){
throw std::runtime_error("Multy output interpretation output");
throw std::runtime_error("Multi-output interpretation output");
}else{
if (!mResolution[0]->isTypeEqualTo<bool>()){
throw std::runtime_error("TEST OUT MUST BE A BOOL ");
@@ -53,7 +53,7 @@ using namespace Aidge;
}catch(const std::exception& e){
std::ostringstream errorMessage;
errorMessage << "Error in test " << "\n\t" << e.what() << "\n";
throw std::runtime_error(errorMessage.str());
throw std::runtime_error(errorMessage.str());
}
}
@@ -70,7 +70,7 @@ using namespace Aidge;
switch (node->getType()){
///////////////////////////////////
//OPERATOR
///////////////////////////////////
///////////////////////////////////
case ConditionalTokenTypes::NOT:
{
visit(node->getChilds(),nodeOp);
@@ -105,10 +105,10 @@ using namespace Aidge;
///////////////////////////////////
//VALUE
///////////////////////////////////
///////////////////////////////////
case ConditionalTokenTypes::KEY:
break;
case ConditionalTokenTypes::INTEGER:
{
@@ -118,7 +118,7 @@ using namespace Aidge;
case ConditionalTokenTypes::FLOAT:
{
fStrToFloat(node);
}
break;
case ConditionalTokenTypes::STRING:
@@ -126,7 +126,7 @@ using namespace Aidge;
fStrToStr(node);
}
break;
case ConditionalTokenTypes::NODE: //TODO
{
@@ -141,14 +141,14 @@ using namespace Aidge;
{
visit(node->getChilds(),nodeOp);
fLambda(node);
}
break;
case ConditionalTokenTypes::BOOL: //TODO
{
ConditionalData* data = new ConditionalData;
if(node->getValue() == "true"){
data->setValue<bool>(true);
}else{
@@ -170,7 +170,7 @@ using namespace Aidge;
}catch(const std::exception& e){
std::ostringstream errorMessage;
errorMessage << "Error in visiting AST for node"<< nodeOp->name() << "\n\t" << e.what() << "\n";
throw std::runtime_error(errorMessage.str());
throw std::runtime_error(errorMessage.str());
}
}
@@ -192,7 +192,7 @@ using namespace Aidge;
void ConditionalInterpreter::fStrToFloat(const std::shared_ptr<AstNode<ConditionalTokenTypes>>& node)
{
ConditionalData* data = new ConditionalData;
data->setValue<float>(std::stof(node->getValue()));
mResolution.push_back(data);
@@ -205,7 +205,7 @@ using namespace Aidge;
mResolution.push_back(data);
}
void ConditionalInterpreter::fLambda(const std::shared_ptr<AstNode<ConditionalTokenTypes>>& node)
void ConditionalInterpreter::fLambda(const std::shared_ptr<AstNode<ConditionalTokenTypes>>& node)
{
//if the lambda have input
ConditionalData* data;
@@ -214,7 +214,7 @@ using namespace Aidge;
} catch (const std::exception& e) {
std::ostringstream errorMessage;
errorMessage << "Error in conditional interpretation when run the "<< node->getValue() <<" Lambda\n\t" << e.what() << "\n";
throw std::runtime_error(errorMessage.str());
throw std::runtime_error(errorMessage.str());
}
clearRes();
@@ -224,7 +224,7 @@ using namespace Aidge;
void ConditionalInterpreter::fEq(void)
{
if (mResolution.size() != 2){
throw std::runtime_error("EQ need 2 arg and get :" + mResolution.size());
throw std::runtime_error("EQ need 2 arg and get :" + std::to_string(mResolution.size()));
}
auto a = mResolution[0];
auto b = mResolution[1];
@@ -256,7 +256,7 @@ using namespace Aidge;
void ConditionalInterpreter::fNeq(void)
{
if (mResolution.size() != 2){
throw std::runtime_error("NEQ need 2 arg and get :" + mResolution.size());
throw std::runtime_error("NEQ need 2 arg and get :" + std::to_string(mResolution.size()));
}
auto a = mResolution[0];
auto b = mResolution[1];
@@ -285,7 +285,7 @@ using namespace Aidge;
void ConditionalInterpreter::fAnd(void)
{
if (mResolution.size() != 2){
throw std::runtime_error("AND need 2 arg and get :" + mResolution.size());
throw std::runtime_error("AND need 2 arg and get :" + std::to_string(mResolution.size()));
}
auto a = mResolution[0];
auto b = mResolution[1];
@@ -297,7 +297,7 @@ using namespace Aidge;
ConditionalData* data = new ConditionalData;
data->setValue<bool>( a->getValue<bool>() && b->getValue<bool>());
clearRes();
mResolution.push_back(data);
@@ -306,7 +306,7 @@ using namespace Aidge;
void ConditionalInterpreter::fOr(void)
{
if (mResolution.size() != 2){
throw std::runtime_error("OR need 2 arg and get :" + mResolution.size());
throw std::runtime_error("OR need 2 arg and get :" + std::to_string(mResolution.size()));
}
auto a = mResolution[0];
auto b = mResolution[1];
@@ -318,7 +318,7 @@ using namespace Aidge;
ConditionalData* data = new ConditionalData;
data->setValue<bool>( a->getValue<bool>() || b->getValue<bool>());
clearRes();
mResolution.push_back(data);
@@ -327,7 +327,7 @@ using namespace Aidge;
void ConditionalInterpreter::fNot()
{
if (mResolution.size() != 1){
throw std::runtime_error("not need 1 arg and get :" + mResolution.size());
throw std::runtime_error("NOT need 1 arg and get :" + std::to_string(mResolution.size()));
}
auto a = mResolution[0];
@@ -337,7 +337,7 @@ using namespace Aidge;
ConditionalData* data = new ConditionalData;
data->setValue<bool>( !a->getValue<bool>() );
clearRes();
mResolution.push_back(data);
Loading