#include #include //#define private public #include #include using namespace mdd; /* TEST(ModuleSwitch, EasySwitch){ ModuleSwitch sModule = ModuleSwitch(); auto inputs = sModule.getInputIDs(); auto outputs = sModule.getOutputIDs(); sModule.getInput(inputs[0])->setValue() = { 0 }; sModule.getInput(inputs[1])->setValue() = { 1 }; sModule.getInput(inputs[2])->setValue() = { 2 }; sModule.update(); EXPECT_EQ(sModule.getOutput(outputs[0])->getValue()[0], 1); sModule.getInput(inputs[0])->setValue() = { 1 }; sModule.update(); EXPECT_EQ(sModule.getOutput(outputs[0])->getValue()[0], 1); sModule.getInput(inputs[0])->setValue() = { 2 }; sModule.update(); EXPECT_EQ(sModule.getOutput(outputs[0])->getValue()[0], 2); sModule.getInput(inputs[0])->setValue() = { 3 }; sModule.update(); EXPECT_EQ(sModule.getOutput(outputs[0])->getValue()[0], 2); sModule.getInput(inputs[0])->setValue() = { 33 }; sModule.update(); EXPECT_EQ(sModule.getOutput(outputs[0])->getValue()[0], 2); } TEST(ModuleSwitch, ConnectTest){ ModuleMath f0 = ModuleMath(MathOperation::MULTIPLY); auto inputs = f0.getInputIDs(); f0.getInput(inputs[0])->setValue() = { 1 }; f0.getInput(inputs[1])->setValue() = { 1 }; ModuleMath f1 = ModuleMath(MathOperation::MULTIPLY); inputs = f1.getInputIDs(); f1.getInput(inputs[0])->setValue() = { 2 }; f1.getInput(inputs[1])->setValue() = { 3 }; ModuleMath f2 = ModuleMath(MathOperation::MULTIPLY); inputs = f2.getInputIDs(); f2.getInput(inputs[0])->setValue() = { 5 }; f2.getInput(inputs[1])->setValue() = { 7 }; ModuleSwitch sModule = ModuleSwitch(); inputs = sModule.getInputIDs(); sModule.getInput(inputs[0])->connect(f0.getOutput(f0.getOutputIDs()[0])); sModule.getInput(inputs[1])->connect(f1.getOutput(f1.getOutputIDs()[0])); sModule.getInput(inputs[2])->connect(f2.getOutput(f2.getOutputIDs()[0])); f0.update(); f1.update(); f2.update(); sModule.update(); //std::cout << sModule.getOutput(sModule.getOutputIDs()[0])->getValue()["value"].dump() << std::endl; EXPECT_EQ(sModule.getOutput(sModule.getOutputIDs()[0])->getValue()[0], 6); }*/