-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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.
- Loading branch information
Showing
3 changed files
with
37 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters