...
 
Commits (3)
Subproject commit ea65d78d2ab708da3ab736122cd19859bf4e46f8
Subproject commit fb4c22c319ec5320f9a85527eb1a4130954846f5
......@@ -10,3 +10,4 @@ ADD_PYTHON_UNIT_TEST("python-sinusoidal" "python/test/test-sinusoidal.py" "pytho
ADD_PYTHON_UNIT_TEST("python-minjerk" "python/test/test-minjerk.py" "python")
ADD_PYTHON_UNIT_TEST("python-optimization" "python/test/optimization.py" "python")
ADD_PYTHON_UNIT_TEST("python-notebook" "python/test/notebook.py" "python")
ADD_PYTHON_UNIT_TEST("python-registration" "python/test/registration.py" "python")
import unittest
class TestRegistration(unittest.TestCase):
"""Check registration incompatibilities.
ref https://github.com/stack-of-tasks/eigenpy/issues/83
ref https://gitlab.laas.fr/loco-3d/curves/-/issues/6
"""
def test_pinocchio_then_curves(self):
import pinocchio
import curves
self.assertTrue(hasattr(pinocchio, 'Quaternion'))
self.assertTrue(hasattr(curves, 'Quaternion'))
def test_curves_then_pinocchio(self):
import curves
import pinocchio
self.assertTrue(hasattr(pinocchio, 'Quaternion'))
self.assertTrue(hasattr(curves, 'Quaternion'))
if __name__ == '__main__':
unittest.main()
......@@ -5,6 +5,7 @@ TARGET_COMPILE_DEFINITIONS(curves_tests PRIVATE -DTEST_DATA_PATH="${CMAKE_CURREN
SET(${PROJECT_NAME}_TESTS
test-constant
test-sinusoidal
test-sinusoidal-serialization
test-minjerk
)
......
#define BOOST_TEST_MODULE test_sinusoidal
#include "curves/fwd.h"
#include "curves/sinusoidal.h"
#include "curves/serialization/curves.hpp"
#include <boost/test/included/unit_test.hpp>
using namespace curves;
BOOST_AUTO_TEST_SUITE(BOOST_TEST_MODULE)
BOOST_AUTO_TEST_CASE(serialization) {
std::string fileName("fileTest_sinusoidal");
pointX_t p0(3), amp(3);
p0 << -1, 0.5, 2.;
amp << 2, -0.8, -1;
double T = 1.5;
double phi = 0.;
sinusoidal_t c(p0, amp, T, phi, 0., 20.);
c.saveAsText<sinusoidal_t>(fileName + ".txt");
c.saveAsXML<sinusoidal_t>(fileName + ".xml", "sinusoidal");
c.saveAsBinary<sinusoidal_t>(fileName);
sinusoidal_t c_txt, c_xml, c_binary;
c_txt.loadFromText<sinusoidal_t>(fileName + ".txt");
c_xml.loadFromXML<sinusoidal_t>(fileName + ".xml", "sinusoidal");
c_binary.loadFromBinary<sinusoidal_t>(fileName);
BOOST_CHECK(c == c_txt);
BOOST_CHECK(c == c_xml);
BOOST_CHECK(c == c_binary);
}
BOOST_AUTO_TEST_SUITE_END()
......@@ -238,28 +238,4 @@ BOOST_AUTO_TEST_CASE(comparison) {
BOOST_CHECK(c1 != cn6);
}
BOOST_AUTO_TEST_CASE(serialization) {
std::string fileName("fileTest_sinusoidal");
pointX_t p0(3), amp(3);
p0 << -1, 0.5, 2.;
amp << 2, -0.8, -1;
double T = 1.5;
double phi = 0.;
sinusoidal_t c(p0, amp, T, phi, 0., 20.);
c.saveAsText<sinusoidal_t>(fileName + ".txt");
c.saveAsXML<sinusoidal_t>(fileName + ".xml", "sinusoidal");
c.saveAsBinary<sinusoidal_t>(fileName);
sinusoidal_t c_txt, c_xml, c_binary;
c_txt.loadFromText<sinusoidal_t>(fileName + ".txt");
c_xml.loadFromXML<sinusoidal_t>(fileName + ".xml", "sinusoidal");
c_binary.loadFromBinary<sinusoidal_t>(fileName);
BOOST_CHECK(c == c_txt);
BOOST_CHECK(c == c_xml);
BOOST_CHECK(c == c_binary);
}
BOOST_AUTO_TEST_SUITE_END()