|
@@ -14,7 +14,7 @@ TEST(ModuleMath, INT_PLUS_INT){
|
|
|
|
|
|
auto generators = GetGenerators();
|
|
|
IModule::Ptr mod = generators["mdd::ModuleMath"]->Generate();
|
|
|
- //mod->configure();
|
|
|
+ mod->configure(mod->getBaseConfiguration());
|
|
|
mod->update();
|
|
|
auto ids = mod->getOutputIDs();
|
|
|
auto id = ids[0];
|
|
@@ -23,16 +23,17 @@ TEST(ModuleMath, INT_PLUS_INT){
|
|
|
EXPECT_FLOAT_EQ(res[0], 2.0);
|
|
|
}
|
|
|
|
|
|
-/*
|
|
|
+
|
|
|
TEST(ModuleMath, FLOAT_PLUS_FLOAT){
|
|
|
- IModule::Ptr test = GetGenerators()["class mdd::ModuleMath"]->Generate();
|
|
|
- test->configure();
|
|
|
+ IModule::Ptr test = GetGenerators()["mdd::ModuleMath"]->Generate();
|
|
|
+ test->configure(test->getBaseConfiguration());
|
|
|
test->getInput(test->getInputIDs()[0])->setValue() = { 1.25 };
|
|
|
test->getInput(test->getInputIDs()[1])->setValue() = { 3.125 };
|
|
|
test->update();
|
|
|
|
|
|
EXPECT_FLOAT_EQ(test->getOutput(test->getOutputIDs()[0])->getValue()[0], 4.375);
|
|
|
}
|
|
|
+/*
|
|
|
TEST(ModuleMath, FLOAT_PLUS_FLOAT_HARDER){
|
|
|
ModuleMath test = ModuleMath();
|
|
|
test.getInput(test.getInputIDs()[0])->setValue() = { 2.2 };
|
|
@@ -80,17 +81,25 @@ TEST(ModuleMath, ARRAY_MINUS_ARRAY){
|
|
|
|
|
|
EXPECT_EQ(test.getOutput(test.getOutputIDs()[0])->getValue(), expect);
|
|
|
}
|
|
|
-
|
|
|
+*/
|
|
|
TEST(ModuleMath, ARRAY_MAL_ARRAY){
|
|
|
- ModuleMath test = ModuleMath(MathOperation::MULTIPLY);
|
|
|
- test.getInput(test.getInputIDs()[0])->setValue() = {10,30,-3.5,45};
|
|
|
- test.getInput(test.getInputIDs()[1])->setValue() = {1,2.5,2.25,20};
|
|
|
+ IModule::Ptr test = GetGenerators()["mdd::ModuleMath"]->Generate();
|
|
|
+
|
|
|
+ test->configure(R"JSON(
|
|
|
+ {
|
|
|
+ "operation": "multiply"
|
|
|
+ }
|
|
|
+ )JSON");
|
|
|
+ test->update();
|
|
|
+
|
|
|
+ test->getInput(test->getInputIDs()[0])->setValue() = {10,30,-3.5,45};
|
|
|
+ test->getInput(test->getInputIDs()[1])->setValue() = {1,2.5,2.25,20};
|
|
|
std::vector<double> expect = { 10,75.0,-7.875,900 };
|
|
|
- test.update();
|
|
|
+ test->update();
|
|
|
|
|
|
- EXPECT_EQ(test.getOutput(test.getOutputIDs()[0])->getValue(), expect);
|
|
|
+ EXPECT_EQ(test->getOutput(test->getOutputIDs()[0])->getValue(), expect);
|
|
|
}
|
|
|
-
|
|
|
+/*
|
|
|
TEST(ModuleMath, ARRAY_DURCH_ARRAY){
|
|
|
ModuleMath test = ModuleMath(MathOperation::DIVIDE);
|
|
|
test.getInput(test.getInputIDs()[0])->setValue() = {10,30,-3.5,45};
|