|
@@ -1,182 +1,243 @@
|
|
#include <gtest/gtest.h>
|
|
#include <gtest/gtest.h>
|
|
#include <json.hpp>
|
|
#include <json.hpp>
|
|
#include <Registration.h>
|
|
#include <Registration.h>
|
|
|
|
+#include "ProcessorStandard.h"
|
|
|
|
+
|
|
//#define private public
|
|
//#define private public
|
|
-/*
|
|
|
|
|
|
+
|
|
|
|
|
|
using namespace mdd;
|
|
using namespace mdd;
|
|
|
|
+namespace TEST_PROCESSOR_STANDARD {
|
|
|
|
+
|
|
|
|
+ auto regi = Registration();
|
|
|
|
+
|
|
TEST(ProcessorStandard, CalculateSimpleFormula){
|
|
TEST(ProcessorStandard, CalculateSimpleFormula){
|
|
//f4:(f3:(f1:(5*3)-f2:(4+5))/2)==(15-9)/2==6/2==3
|
|
//f4:(f3:(f1:(5*3)-f2:(4+5))/2)==(15-9)/2==6/2==3
|
|
- std::vector<std::string> inputs;
|
|
|
|
- std::shared_ptr<ModuleMath> f1 = std::make_shared<ModuleMath>(MathOperation::MULTIPLY);
|
|
|
|
- inputs = f1->getInputIDs();
|
|
|
|
- f1->getInput(inputs[0])->setValue() = { 5 };
|
|
|
|
- f1->getInput(inputs[1])->setValue() = { 3 };
|
|
|
|
-
|
|
|
|
- std::shared_ptr<ModuleMath> f2 = std::make_shared<ModuleMath>(MathOperation::ADD);
|
|
|
|
- inputs = f2->getInputIDs();
|
|
|
|
- f2->getInput(inputs[0])->setValue() = { 4 };
|
|
|
|
- f2->getInput(inputs[1])->setValue() = { 5 };
|
|
|
|
-
|
|
|
|
- std::shared_ptr<ModuleMath> f3 = std::make_shared<ModuleMath>(MathOperation::SUBTRACT);
|
|
|
|
- inputs = f3->getInputIDs();
|
|
|
|
- f3->getInput(inputs[0])->connect(f1->getOutput(f1->getOutputIDs()[0]));
|
|
|
|
- f3->getInput(inputs[1])->connect(f2->getOutput(f2->getOutputIDs()[0]));
|
|
|
|
-
|
|
|
|
- std::shared_ptr<ModuleMath> f4 = std::make_shared<ModuleMath>(MathOperation::DIVIDE);
|
|
|
|
- inputs = f4->getInputIDs();
|
|
|
|
- f4->getInput(inputs[0])->connect(f3->getOutput(f3->getOutputIDs()[0]));
|
|
|
|
- f4->getInput(inputs[1])->setValue() = { 2 };
|
|
|
|
-
|
|
|
|
- std::shared_ptr<ProcessorStandard> processor = std::make_shared<ProcessorStandard>();
|
|
|
|
|
|
+ auto f1 = regi.generateModule("ModuleMath");
|
|
|
|
+ json config = json::parse(f1->getConfiguration());
|
|
|
|
+ config[0]["value"] = "multiply";
|
|
|
|
+ f1->configure(config.dump());
|
|
|
|
+ f1->getInput(0)->setValue() = { 5 };
|
|
|
|
+ f1->getInput(1)->setValue() = { 3 };
|
|
|
|
+
|
|
|
|
+ auto f2 = regi.generateModule("ModuleMath");
|
|
|
|
+ config = json::parse(f2->getConfiguration());
|
|
|
|
+ config[0]["value"] = "add";
|
|
|
|
+ f2->configure(config.dump());
|
|
|
|
+ f2->getInput(0)->setValue() = { 4 };
|
|
|
|
+ f2->getInput(1)->setValue() = { 5 };
|
|
|
|
+
|
|
|
|
+ auto f3 = regi.generateModule("ModuleMath");
|
|
|
|
+ config = json::parse(f3->getConfiguration());
|
|
|
|
+ config[0]["value"] = "subtract";
|
|
|
|
+ f3->configure(config.dump());
|
|
|
|
+ f3->getInput(0)->connect(f1->getOutput(0));
|
|
|
|
+ f3->getInput(1)->connect(f2->getOutput(0));
|
|
|
|
+
|
|
|
|
+ auto f4 = regi.generateModule("ModuleMath");
|
|
|
|
+ config = json::parse(f4->getConfiguration());
|
|
|
|
+ config[0]["value"] = "divide";
|
|
|
|
+ f4->configure(config.dump());
|
|
|
|
+ f4->getInput(0)->connect(f3->getOutput(0));
|
|
|
|
+ f4->getInput(1)->setValue() = { 2 };
|
|
|
|
+
|
|
|
|
+ auto processor = std::make_shared<ProcessorStandard>();
|
|
|
|
+ //regi.generateModule("ProcessorStandard");;
|
|
processor->addModule(f1);
|
|
processor->addModule(f1);
|
|
processor->addModule(f2);
|
|
processor->addModule(f2);
|
|
processor->addModule(f3);
|
|
processor->addModule(f3);
|
|
processor->addModule(f4);
|
|
processor->addModule(f4);
|
|
- processor->addModuleOutput(f4, f4->getOutput(f4->getOutputIDs()[0]));
|
|
|
|
|
|
+
|
|
|
|
+ processor->getOutputParams().push_back(std::make_shared<Parameter>(&(*processor)));
|
|
|
|
+ processor->getOutputParams().at(0)->getInput(0)->connect(f4->getOutput(0));
|
|
|
|
+
|
|
processor->update();
|
|
processor->update();
|
|
|
|
|
|
- EXPECT_EQ(f1->getOutput(f1->getOutputIDs()[0])->getValue()[0], 15);
|
|
|
|
|
|
+ EXPECT_EQ(f1->getOutput(0)->getValue()[0], 15);
|
|
|
|
|
|
- EXPECT_EQ(f2->getOutput(f2->getOutputIDs()[0])->getValue()[0], 9);
|
|
|
|
|
|
+ EXPECT_EQ(f2->getOutput(0)->getValue()[0], 9);
|
|
|
|
|
|
- EXPECT_EQ(f3->getOutput(f3->getOutputIDs()[0])->getValue()[0], 6);
|
|
|
|
|
|
+ EXPECT_EQ(f3->getOutput(0)->getValue()[0], 6);
|
|
|
|
|
|
- EXPECT_EQ(f4->getOutput(f4->getOutputIDs()[0])->getValue()[0], 3);
|
|
|
|
|
|
+ EXPECT_EQ(f4->getOutput(0)->getValue()[0], 3);
|
|
|
|
|
|
- EXPECT_EQ(processor->getOutput(processor->getOutputIDs()[1])->getValue()[0], 3);
|
|
|
|
|
|
+ EXPECT_EQ(processor->getOutput(1)->getValue()[0], 3);
|
|
|
|
+ //processor->disconnect();
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
TEST(ProcessorStandard, CalculateAdvancedFormula){
|
|
TEST(ProcessorStandard, CalculateAdvancedFormula){
|
|
//f4:(f3:(f1:(5*3)-f2:(4+5))/2)==(15-9)/2==6/2==3
|
|
//f4:(f3:(f1:(5*3)-f2:(4+5))/2)==(15-9)/2==6/2==3
|
|
- std::vector<std::string> inputs;
|
|
|
|
- std::shared_ptr<ModuleMath> f1 = std::make_shared<ModuleMath>(MathOperation::MULTIPLY);
|
|
|
|
- inputs = f1->getInputIDs();
|
|
|
|
- f1->getInput(inputs[0])->setValue() = { 5 };
|
|
|
|
- f1->getInput(inputs[1])->setValue() = { 3 };
|
|
|
|
-
|
|
|
|
- std::shared_ptr<ModuleMath> f2 = std::make_shared<ModuleMath>(MathOperation::ADD);
|
|
|
|
- inputs = f2->getInputIDs();
|
|
|
|
- f2->getInput(inputs[0])->setValue() = { 4 };
|
|
|
|
- f2->getInput(inputs[1])->setValue() = { 5 };
|
|
|
|
-
|
|
|
|
- std::shared_ptr<ModuleMath> f3 = std::make_shared<ModuleMath>(MathOperation::SUBTRACT);
|
|
|
|
- inputs = f3->getInputIDs();
|
|
|
|
- f3->getInput(inputs[0])->connect(f1->getOutput(f1->getOutputIDs()[0]));
|
|
|
|
- f3->getInput(inputs[1])->connect(f2->getOutput(f2->getOutputIDs()[0]));
|
|
|
|
-
|
|
|
|
- std::shared_ptr<ModuleMath> f4 = std::make_shared<ModuleMath>(MathOperation::DIVIDE);
|
|
|
|
- inputs = f4->getInputIDs();
|
|
|
|
- f4->getInput(inputs[0])->connect(f3->getOutput(f3->getOutputIDs()[0]));
|
|
|
|
- f4->getInput(inputs[1])->setValue() = { 2 };
|
|
|
|
-
|
|
|
|
- std::shared_ptr<ProcessorStandard> test = std::make_shared<ProcessorStandard>();
|
|
|
|
- test->addModule(f4);
|
|
|
|
- test->addModule(f3);
|
|
|
|
- test->addModule(f2);
|
|
|
|
- test->addModule(f1);
|
|
|
|
- test->addModuleOutput(f4, f4->getOutput(f4->getOutputIDs()[0]));
|
|
|
|
- test->update();
|
|
|
|
|
|
+ auto f1 = regi.generateModule("ModuleMath");
|
|
|
|
+ json config = json::parse(f1->getConfiguration());
|
|
|
|
+ config[0]["value"] = "multiply";
|
|
|
|
+ f1->configure(config.dump());
|
|
|
|
+ f1->getInput(0)->setValue() = { 5 };
|
|
|
|
+ f1->getInput(1)->setValue() = { 3 };
|
|
|
|
+
|
|
|
|
+ auto f2 = regi.generateModule("ModuleMath");
|
|
|
|
+ config = json::parse(f2->getConfiguration());
|
|
|
|
+ config[0]["value"] = "add";
|
|
|
|
+ f2->configure(config.dump());
|
|
|
|
+ f2->getInput(0)->setValue() = { 4 };
|
|
|
|
+ f2->getInput(1)->setValue() = { 5 };
|
|
|
|
+
|
|
|
|
+ auto f3 = regi.generateModule("ModuleMath");
|
|
|
|
+ config = json::parse(f3->getConfiguration());
|
|
|
|
+ config[0]["value"] = "subtract";
|
|
|
|
+ f3->configure(config.dump());
|
|
|
|
+ f3->getInput(0)->connect(f1->getOutput(0));
|
|
|
|
+ f3->getInput(1)->connect(f2->getOutput(0));
|
|
|
|
+
|
|
|
|
+ auto f4 = regi.generateModule("ModuleMath");
|
|
|
|
+ config = json::parse(f4->getConfiguration());
|
|
|
|
+ config[0]["value"] = "divide";
|
|
|
|
+ f4->configure(config.dump());
|
|
|
|
+ f4->getInput(0)->connect(f3->getOutput(0));
|
|
|
|
+ f4->getInput(1)->setValue() = { 2 };
|
|
|
|
+
|
|
|
|
+ auto processor = std::make_shared<ProcessorStandard>();
|
|
|
|
+
|
|
|
|
+ processor->addModule(f4);
|
|
|
|
+ processor->addModule(f3);
|
|
|
|
+ processor->addModule(f2);
|
|
|
|
+ processor->addModule(f1);
|
|
|
|
+ processor->getOutputParams().push_back(std::make_shared<Parameter>(&(*processor)));
|
|
|
|
+ processor->getOutputParams().at(0)->getInput(0)->connect(f4->getOutput(0));
|
|
|
|
+ processor->update();
|
|
//std::cout << test->getOutput(test->getOutputIDs()[1])->getValue()["value"].dump() << std::endl;
|
|
//std::cout << test->getOutput(test->getOutputIDs()[1])->getValue()["value"].dump() << std::endl;
|
|
- EXPECT_EQ(test->getOutput(test->getOutputIDs()[1])->getValue()[0], 3);
|
|
|
|
|
|
+ EXPECT_EQ(processor->getOutput(1)->getValue()[0], 3);
|
|
}
|
|
}
|
|
|
|
|
|
TEST(ProcessorStandard, CalculateExtremeFormula){
|
|
TEST(ProcessorStandard, CalculateExtremeFormula){
|
|
//x_0=8, x_i=x_{i-1}/2
|
|
//x_0=8, x_i=x_{i-1}/2
|
|
- std::shared_ptr<ModuleSwitch> switchModule = std::make_shared<ModuleSwitch>();
|
|
|
|
- std::shared_ptr<ModuleMath> calcModule = std::make_shared<ModuleMath>(MathOperation::DIVIDE);
|
|
|
|
|
|
+ auto switchModule = regi.generateModule("ModuleSwitch");
|
|
|
|
+ json config = json::parse(switchModule->getConfiguration());
|
|
|
|
+ config[0]["value"] = 2;
|
|
|
|
+ switchModule->configure(config.dump());
|
|
|
|
+
|
|
|
|
+ auto calcModule = regi.generateModule("ModuleMath");
|
|
|
|
+ config = json::parse(calcModule->getConfiguration());
|
|
|
|
+ config[0]["value"] = "divide";
|
|
|
|
+ calcModule->configure(config.dump());
|
|
|
|
+
|
|
std::shared_ptr<ProcessorStandard> processor = std::make_shared<ProcessorStandard>();
|
|
std::shared_ptr<ProcessorStandard> processor = std::make_shared<ProcessorStandard>();
|
|
processor->addModule(switchModule);
|
|
processor->addModule(switchModule);
|
|
processor->addModule(calcModule);
|
|
processor->addModule(calcModule);
|
|
|
|
|
|
bool connect;
|
|
bool connect;
|
|
- connect =switchModule->getInput(switchModule->getInputIDs()[0])->connect(processor->getIteration());
|
|
|
|
- switchModule->getInput(switchModule->getInputIDs()[1])->setValue() = { 8.0 };
|
|
|
|
- connect = switchModule->getInput(switchModule->getInputIDs()[2])->connect(calcModule->getOutput(calcModule->getOutputIDs()[0]));
|
|
|
|
|
|
+ connect =switchModule->getInput(0)->connect(processor->getIteration());
|
|
|
|
+ switchModule->getInput(1)->setValue() = { 8.0 };
|
|
|
|
+ connect = switchModule->getInput(2)->connect(calcModule->getOutput(0));
|
|
|
|
|
|
- calcModule->getInput(calcModule->getInputIDs()[0])->connect(switchModule->getOutput(switchModule->getOutputIDs()[0]));
|
|
|
|
- calcModule->getInput(calcModule->getInputIDs()[1])->setValue() = { 2.0 };
|
|
|
|
|
|
+ calcModule->getInput(0)->connect(switchModule->getOutput(0));
|
|
|
|
+ calcModule->getInput(1)->setValue() = { 2.0 };
|
|
|
|
|
|
- processor->addModuleOutput(calcModule,calcModule->getOutput(calcModule->getOutputIDs()[0]));
|
|
|
|
|
|
+ processor->getOutputParams().push_back(std::make_shared<Parameter>(&(*processor)));
|
|
|
|
+ processor->getOutputParams().at(0)->getInput(0)->connect(calcModule->getOutput(0));
|
|
processor->update();
|
|
processor->update();
|
|
|
|
|
|
- EXPECT_FLOAT_EQ(processor->getOutput(processor->getOutputIDs()[1])->getValue()[0], 0.0);
|
|
|
|
|
|
+ EXPECT_FLOAT_EQ(processor->getOutput(1)->getValue()[0], 0.0);
|
|
}
|
|
}
|
|
|
|
|
|
TEST(ProcessorStandard, CalculateAdvancedFormulaWithSTATIC) {
|
|
TEST(ProcessorStandard, CalculateAdvancedFormulaWithSTATIC) {
|
|
//f4:(f3:(f1:(5*3)-f2:(4+5))/2)==(15-9)/2==6/2==3
|
|
//f4:(f3:(f1:(5*3)-f2:(4+5))/2)==(15-9)/2==6/2==3
|
|
- std::vector<std::string> inputs;
|
|
|
|
- std::shared_ptr<ModuleMath> f1 = std::make_shared<ModuleMath>(MathOperation::MULTIPLY);
|
|
|
|
- inputs = f1->getInputIDs();
|
|
|
|
- f1->getInput(inputs[0])->setValue() = { 5 };
|
|
|
|
- f1->getInput(inputs[1])->setValue() = { 3 };
|
|
|
|
-
|
|
|
|
- std::shared_ptr<ModuleMath> f2 = std::make_shared<ModuleMath>(MathOperation::ADD);
|
|
|
|
- inputs = f2->getInputIDs();
|
|
|
|
- f2->getInput(inputs[0])->setValue() = { 4 };
|
|
|
|
- f2->getInput(inputs[1])->setValue() = { 5 };
|
|
|
|
-
|
|
|
|
- std::shared_ptr<ModuleMath> f3 = std::make_shared<ModuleMath>(MathOperation::SUBTRACT);
|
|
|
|
- inputs = f3->getInputIDs();
|
|
|
|
- f3->getInput(inputs[0])->connect(f1->getOutput(f1->getOutputIDs()[0]));
|
|
|
|
- f3->getInput(inputs[1])->connect(f2->getOutput(f2->getOutputIDs()[0]));
|
|
|
|
-
|
|
|
|
- std::shared_ptr<ModuleMath> f4 = std::make_shared<ModuleMath>(MathOperation::DIVIDE);
|
|
|
|
- inputs = f4->getInputIDs();
|
|
|
|
- f4->getInput(inputs[0])->connect(f3->getOutput(f3->getOutputIDs()[0]));
|
|
|
|
- f4->getInput(inputs[1])->setValue() = { 2 };
|
|
|
|
-
|
|
|
|
- std::shared_ptr<ProcessorStandard> process_static = std::make_shared<ProcessorStandard>(STATIC);
|
|
|
|
- process_static->addModule(f4);
|
|
|
|
- process_static->addModule(f3);
|
|
|
|
- process_static->addModule(f2);
|
|
|
|
- process_static->addModule(f1);
|
|
|
|
- process_static->addModuleOutput(f4, f4->getOutput(f4->getOutputIDs()[0]));
|
|
|
|
- process_static->update();
|
|
|
|
|
|
+ auto f1 = regi.generateModule("ModuleMath");
|
|
|
|
+ json config = json::parse(f1->getConfiguration());
|
|
|
|
+ config[0]["value"] = "multiply";
|
|
|
|
+ f1->configure(config.dump());
|
|
|
|
+ f1->getInput(0)->setValue() = { 5 };
|
|
|
|
+ f1->getInput(1)->setValue() = { 3 };
|
|
|
|
+
|
|
|
|
+ auto f2 = regi.generateModule("ModuleMath");
|
|
|
|
+ config = json::parse(f2->getConfiguration());
|
|
|
|
+ config[0]["value"] = "add";
|
|
|
|
+ f2->configure(config.dump());
|
|
|
|
+ f2->getInput(0)->setValue() = { 4 };
|
|
|
|
+ f2->getInput(1)->setValue() = { 5 };
|
|
|
|
+
|
|
|
|
+ auto f3 = regi.generateModule("ModuleMath");
|
|
|
|
+ config = json::parse(f3->getConfiguration());
|
|
|
|
+ config[0]["value"] = "subtract";
|
|
|
|
+ f3->configure(config.dump());
|
|
|
|
+ f3->getInput(0)->connect(f1->getOutput(0));
|
|
|
|
+ f3->getInput(1)->connect(f2->getOutput(0));
|
|
|
|
+
|
|
|
|
+ auto f4 = regi.generateModule("ModuleMath");
|
|
|
|
+ config = json::parse(f4->getConfiguration());
|
|
|
|
+ config[0]["value"] = "divide";
|
|
|
|
+ f4->configure(config.dump());
|
|
|
|
+ f4->getInput(0)->connect(f3->getOutput(0));
|
|
|
|
+ f4->getInput(1)->setValue() = { 2 };
|
|
|
|
+
|
|
|
|
+ auto processor = std::make_shared<ProcessorStandard>();
|
|
|
|
+ config = json::parse(processor->getConfiguration());
|
|
|
|
+ config[0]["value"] = "static";
|
|
|
|
+ processor->configure(config.dump());
|
|
|
|
+
|
|
|
|
+ processor->addModule(f4);
|
|
|
|
+ processor->addModule(f3);
|
|
|
|
+ processor->addModule(f2);
|
|
|
|
+ processor->addModule(f1);
|
|
|
|
+ processor->getOutputParams().push_back(std::make_shared<Parameter>(&(*processor)));
|
|
|
|
+ processor->getOutputParams().at(0)->getInput(0)->connect(f4->getOutput(0));
|
|
|
|
+ processor->update();
|
|
//std::cout << test->getOutput(test->getOutputIDs()[1])->getValue()["value"].dump() << std::endl;
|
|
//std::cout << test->getOutput(test->getOutputIDs()[1])->getValue()["value"].dump() << std::endl;
|
|
- EXPECT_EQ(process_static->getOutput(process_static->getOutputIDs()[1])->getValue()[0], 3);
|
|
|
|
|
|
+ EXPECT_EQ(processor->getOutput(1)->getValue()[0], 3);
|
|
}
|
|
}
|
|
|
|
|
|
TEST(ProcessorStandard, PrioritySTATIC) {
|
|
TEST(ProcessorStandard, PrioritySTATIC) {
|
|
//f4:(f3:(f1:(5*3)-f2:(4+5))/2)==(15-9)/2==6/2==3
|
|
//f4:(f3:(f1:(5*3)-f2:(4+5))/2)==(15-9)/2==6/2==3
|
|
- std::vector<std::string> inputs;
|
|
|
|
- std::shared_ptr<ModuleMath> f1 = std::make_shared<ModuleMath>(MathOperation::MULTIPLY);
|
|
|
|
- inputs = f1->getInputIDs();
|
|
|
|
- f1->getInput(inputs[0])->setValue() = { 5 };
|
|
|
|
- f1->getInput(inputs[1])->setValue() = { 3 };
|
|
|
|
-
|
|
|
|
- std::shared_ptr<ModuleMath> f2 = std::make_shared<ModuleMath>(MathOperation::ADD);
|
|
|
|
- inputs = f2->getInputIDs();
|
|
|
|
- f2->getInput(inputs[0])->setValue() = { 4 };
|
|
|
|
- f2->getInput(inputs[1])->setValue() = { 5 };
|
|
|
|
-
|
|
|
|
- std::shared_ptr<ModuleMath> f3 = std::make_shared<ModuleMath>(MathOperation::SUBTRACT);
|
|
|
|
- inputs = f3->getInputIDs();
|
|
|
|
- f3->getInput(inputs[0])->connect(f1->getOutput(f1->getOutputIDs()[0]));
|
|
|
|
- f3->getInput(inputs[1])->connect(f2->getOutput(f2->getOutputIDs()[0]));
|
|
|
|
-
|
|
|
|
- std::shared_ptr<ModuleMath> f4 = std::make_shared<ModuleMath>(MathOperation::DIVIDE);
|
|
|
|
- inputs = f4->getInputIDs();
|
|
|
|
- f4->getInput(inputs[0])->connect(f3->getOutput(f3->getOutputIDs()[0]));
|
|
|
|
- f4->getInput(inputs[1])->setValue() = { 2 };
|
|
|
|
-
|
|
|
|
- std::shared_ptr<ProcessorStandard> process_manual = std::make_shared<ProcessorStandard>();
|
|
|
|
|
|
+ auto f1 = regi.generateModule("ModuleMath");
|
|
|
|
+ json config = json::parse(f1->getConfiguration());
|
|
|
|
+ config[0]["value"] = "multiply";
|
|
|
|
+ f1->configure(config.dump());
|
|
|
|
+ f1->getInput(0)->setValue() = { 5 };
|
|
|
|
+ f1->getInput(1)->setValue() = { 3 };
|
|
|
|
+
|
|
|
|
+ auto f2 = regi.generateModule("ModuleMath");
|
|
|
|
+ config = json::parse(f2->getConfiguration());
|
|
|
|
+ config[0]["value"] = "add";
|
|
|
|
+ f2->configure(config.dump());
|
|
|
|
+ f2->getInput(0)->setValue() = { 4 };
|
|
|
|
+ f2->getInput(1)->setValue() = { 5 };
|
|
|
|
+
|
|
|
|
+ auto f3 = regi.generateModule("ModuleMath");
|
|
|
|
+ config = json::parse(f3->getConfiguration());
|
|
|
|
+ config[0]["value"] = "subtract";
|
|
|
|
+ f3->configure(config.dump());
|
|
|
|
+ f3->getInput(0)->connect(f1->getOutput(0));
|
|
|
|
+ f3->getInput(1)->connect(f2->getOutput(0));
|
|
|
|
+
|
|
|
|
+ auto f4 = regi.generateModule("ModuleMath");
|
|
|
|
+ config = json::parse(f4->getConfiguration());
|
|
|
|
+ config[0]["value"] = "divide";
|
|
|
|
+ f4->configure(config.dump());
|
|
|
|
+ f4->getInput(0)->connect(f3->getOutput(0));
|
|
|
|
+ f4->getInput(1)->setValue() = { 2 };
|
|
|
|
+
|
|
|
|
+ auto process_manual = std::make_shared<ProcessorStandard>();
|
|
|
|
+ auto process_static = std::make_shared<ProcessorStandard>();
|
|
|
|
+ config = json::parse(process_static->getConfiguration());
|
|
|
|
+ config[0]["value"] = "static";
|
|
|
|
+ process_static->configure(config.dump());
|
|
|
|
+
|
|
process_manual->addModule(f1);
|
|
process_manual->addModule(f1);
|
|
process_manual->addModule(f2);
|
|
process_manual->addModule(f2);
|
|
process_manual->addModule(f3);
|
|
process_manual->addModule(f3);
|
|
process_manual->addModule(f4);
|
|
process_manual->addModule(f4);
|
|
- process_manual->addModuleOutput(f4, f4->getOutput(f4->getOutputIDs()[0]));
|
|
|
|
|
|
+ process_manual->getOutputParams().push_back(std::make_shared<Parameter>(&(*process_manual)));
|
|
|
|
+ process_manual->getOutputParams().at(0)->getInput(0)->connect(f4->getOutput(0));
|
|
process_manual->update();
|
|
process_manual->update();
|
|
|
|
|
|
- std::shared_ptr<ProcessorStandard> process_static = std::make_shared<ProcessorStandard>(STATIC);
|
|
|
|
process_static->addModule(f4);
|
|
process_static->addModule(f4);
|
|
process_static->addModule(f3);
|
|
process_static->addModule(f3);
|
|
process_static->addModule(f2);
|
|
process_static->addModule(f2);
|
|
process_static->addModule(f1);
|
|
process_static->addModule(f1);
|
|
- process_static->addModuleOutput(f4, f4->getOutput(f4->getOutputIDs()[0]));
|
|
|
|
|
|
+ process_static->getOutputParams().push_back(std::make_shared<Parameter>(&(*process_static)));
|
|
|
|
+ process_static->getOutputParams().at(0)->getInput(0)->connect(f4->getOutput(0));
|
|
process_static->update();
|
|
process_static->update();
|
|
//std::cout << process_static->getOutput(process_static->getOutputIDs()[1])->getValue()["value"].dump() << std::endl;
|
|
//std::cout << process_static->getOutput(process_static->getOutputIDs()[1])->getValue()["value"].dump() << std::endl;
|
|
EXPECT_TRUE(process_static->getIteration()->getValue()[0] <= process_manual->getIteration()->getValue()[0]);
|
|
EXPECT_TRUE(process_static->getIteration()->getValue()[0] <= process_manual->getIteration()->getValue()[0]);
|
|
}
|
|
}
|
|
-//*/
|
|
|
|
|
|
+//*/
|
|
|
|
+}
|