Commit 65315995 authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

[Tests] workaround Boost 1.72 unittest issue

With Boost 1.72.0, if the sinusoidal comparison and the sinusoidal
serialization tests are in the same test file, the tests succeed, but
are followed by a "free(): invalid pointer" exception, marking the test
as failed.

This makes no sense, but the workaround is trivial.
parent 4113a350
......@@ -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()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment