Skip to content

Commit

Permalink
Fix tests post changes to CubicBSpline
Browse files Browse the repository at this point in the history
This may solve the issue reported in #34.
  • Loading branch information
bchretien committed Jan 26, 2016
1 parent 1b0d7c1 commit 2081b3e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 3 additions & 1 deletion tests/cubic-b-spline-gradient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,9 @@ BOOST_AUTO_TEST_CASE (trajectory_cubic_b_spline_gradient)
// eval_data.cast<float> ());

// Compare data
BOOST_CHECK (allclose (eval_data, reference, tol));
double max_err = (reference - eval_data).lpNorm<Eigen::Infinity> ();
BOOST_CHECK (max_err < std::numeric_limits<float>::epsilon ());
BOOST_CHECK (allclose (eval_data, reference, tol, tol));
}

BOOST_AUTO_TEST_SUITE_END ()
6 changes: 3 additions & 3 deletions tests/cubic-b-spline-matplotlib.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ plt.axvline(0.625, ls='--', color='gray')
plt.hlines(2.16667, 0.75, 0.875, lw=2, color='c')
plt.hlines(5.75, 0.75, 0.875, lw=2, color='g')
plt.axvline(0.75, ls='--', color='gray')
plt.hlines(-1.42109e-14, 0.875, 1, lw=2, color='c')
plt.hlines(0, 0.875, 1, lw=2, color='c')
plt.hlines(7.37052, 0.875, 1, lw=2, color='g')
plt.axvline(0.875, ls='--', color='gray')

Expand Down Expand Up @@ -64,7 +64,7 @@ plt.axvline(3, ls='--', color='gray')
plt.hlines(2.16667, 3.5, 4.04167, lw=2, color='c')
plt.hlines(5.75, 3.5, 4.04167, lw=2, color='g')
plt.axvline(3.5, ls='--', color='gray')
plt.hlines(-1.42109e-14, 4.04167, 5, lw=2, color='c')
plt.hlines(0, 4.04167, 5, lw=2, color='c')
plt.hlines(7.37052, 4.04167, 5, lw=2, color='g')
plt.axvline(4.04167, ls='--', color='gray')
plt.plot(CP[:,0], CP[:,1], '*', ls=':', lw=3, color='m', label="Control Points")
Expand Down Expand Up @@ -98,7 +98,7 @@ plt.axvline(3, ls='--', color='gray')
plt.hlines(2.16667, 3.5, 4.04167, lw=2, color='c')
plt.hlines(5.75, 3.5, 4.04167, lw=2, color='g')
plt.axvline(3.5, ls='--', color='gray')
plt.hlines(-1.42109e-14, 4.04167, 5, lw=2, color='c')
plt.hlines(0, 4.04167, 5, lw=2, color='c')
plt.hlines(7.37052, 4.04167, 5, lw=2, color='g')
plt.axvline(4.04167, ls='--', color='gray')
plt.plot(CP[:,0], CP[:,1], '*', ls=':', lw=3, color='m', label="Control Points")
Expand Down
5 changes: 3 additions & 2 deletions tests/cubic-b-spline.cc
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ void test_fd (const TestData& data)

value_type threshold = 2. * finiteDifferenceThreshold;
value_type dt = 1e-3;
Function::vector_t x (1);

for (std::vector<CubicBSpline>::const_iterator
spline = splines.begin();
Expand All @@ -386,9 +387,9 @@ void test_fd (const TestData& data)
{
try
{
Function::vector_t x (1);
x[0] = t;
checkGradientAndThrow (*spline, 0, x, threshold);
// FIXME: numerical errors there?
checkGradientAndThrow (*spline, 0, x, 10. * threshold);

SplineDerivWrtParameters splineDerivWrtParams (*spline, t);
checkGradientAndThrow
Expand Down

0 comments on commit 2081b3e

Please sign in to comment.