10 #define BOOST_TEST_MODULE test_sot_loader
11 #include <dynamic-graph/entity.h>
12 #include <dynamic-graph/factory.h>
13 #include <dynamic-graph/pool.h>
15 #include <boost/test/included/unit_test.hpp>
37 asotei_lib_file_ = LIB_PLUGIN_ABSTRACT_PATH;
38 good_python_script_ = TEST_GOOD_PYTHON_SCRIPT;
39 bad_python_script_ = TEST_BAD_PYTHON_SCRIPT;
49 std::map<std::string, SensorValues>
sensors;
54 BOOST_AUTO_TEST_SUITE(sot_loader_test_suite)
57 std::ifstream file(asotei_lib_file_);
58 bool file_exists =
false;
62 BOOST_CHECK(file_exists);
63 BOOST_CHECK(asotei_lib_file_ !=
"");
86 char argv0[] =
"test_sot_loader";
87 char argv1[] =
"--input-file";
88 char argv2[] = LIB_PLUGIN_ABSTRACT_PATH;
89 char *argv[] = {argv0, argv1, argv2, NULL};
98 char argv0[] =
"test_sot_loader";
99 char argv1[] =
"--sot-dynamic-library";
100 char argv2[] = LIB_PLUGIN_ABSTRACT_PATH;
101 char *argv[] = {argv0, argv1, argv2, NULL};
113 std::vector<double> controls_values;
119 BOOST_CHECK(controls.find(
"ctrl_map_name") == controls.end());
122 std::cout <<
"running the graph" << std::endl;
124 std::cout <<
"running the graph ... done" << std::endl;
125 controls_values = controls[
"ctrl_map_name"].getValues();
126 BOOST_CHECK_EQUAL(controls_values.size(), 5);
127 for (
auto value : controls_values) {
128 BOOST_CHECK_EQUAL(
value, 3.1415);
148 std::string
res, out,
err;
150 BOOST_CHECK_EQUAL(
res,
"2");
151 BOOST_CHECK_EQUAL(out,
"");
152 BOOST_CHECK_EQUAL(
err,
"");
159 std::string
res, out,
err;
161 std::cout << std::quoted(
err) << std::endl;
162 BOOST_CHECK_EQUAL(
res,
"");
163 BOOST_CHECK_EQUAL(out,
"");
164 BOOST_CHECK_EQUAL(
err,
165 "Traceback (most recent call last):\n"
166 " File \"<string>\", line 1, in <module>\n"
167 "NameError: name 'a' is not defined\n");
176 BOOST_CHECK_EQUAL(
err,
"");
185 BOOST_CHECK_EQUAL(
err,
186 "Traceback (most recent call last):\n"
189 "\", line 2, in <module>\n"
191 "NameError: name 'b' is not defined\n");
198 Device device(
"device_name");
200 std::string
res, out,
err;
202 BOOST_CHECK_EQUAL(
res,
"None");
203 BOOST_CHECK_EQUAL(out,
"device_name\n");
204 BOOST_CHECK_EQUAL(
err,
"");