Skip to content

Commit 75fe2b4

Browse files
olivier-stasseOlivier Stasse
authored andcommitted
[tests] Add command test for return value.
1 parent 31aa778 commit 75fe2b4

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/command-test.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,16 @@ class CustomEntity : public Entity {
6363
*this, &CustomEntity::four_args,
6464
docCommandVoid4("four args", "int", "int", "int", "int")));
6565

66+
addCommand("1_arg_r",
67+
makeCommandReturnType1(
68+
*this, &CustomEntity::one_arg_ret,
69+
docCommandVoid1("one arg", "int")));
70+
71+
addCommand("2_args_r",
72+
makeCommandReturnType2(
73+
*this, &CustomEntity::two_args_ret,
74+
docCommandVoid2("two args", "int","int")));
75+
6676
/// Generating an exception by adding a command which already exist
6777
bool res = false;
6878
std::string e_1_arg("1_arg");
@@ -89,6 +99,12 @@ class CustomEntity : public Entity {
8999
void four_args(const int &, const int &, const int &, const int &) {
90100
test_four_args_ = true;
91101
}
102+
103+
int one_arg_ret(const int &) { test_one_arg_ = true; return 2;}
104+
105+
std::string two_args_ret(const int &, const int &)
106+
{ test_two_args_ = true; return std::string("return");}
107+
92108
};
93109
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(CustomEntity, "CustomEntity");
94110
} // namespace dynamicgraph

0 commit comments

Comments
 (0)