diff options
author | Mmanu Chaturvedi <mmanu.chaturvedi@kitware.com> | 2017-05-23 17:12:36 -0400 |
---|---|---|
committer | Mmanu Chaturvedi <mmanu.chaturvedi@kitware.com> | 2017-05-23 17:12:36 -0400 |
commit | 2971503fed85add086cb163d24ee5d402d631aab (patch) | |
tree | 7e0e309f5aa16c22fb1b5e8be0bbe295bfd97dbc /unsupported/test/autodiff_scalar.cpp | |
parent | 26e8f9171eb07e188af45d7583b03c5be40a5f48 (diff) |
Specializing numeric_limits For AutoDiffScalar
Diffstat (limited to 'unsupported/test/autodiff_scalar.cpp')
-rw-r--r-- | unsupported/test/autodiff_scalar.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/unsupported/test/autodiff_scalar.cpp b/unsupported/test/autodiff_scalar.cpp index 4df2f5c57..3a78d6b8d 100644 --- a/unsupported/test/autodiff_scalar.cpp +++ b/unsupported/test/autodiff_scalar.cpp @@ -72,6 +72,19 @@ template<typename Scalar> void check_hyperbolic_functions() VERIFY_IS_APPROX(res3.derivatives().x(), Scalar(0.339540557256150)); } +template <typename Scalar> +void check_limits_specialization() +{ + typedef Eigen::Matrix<Scalar, 1, 1> Deriv; + typedef Eigen::AutoDiffScalar<Deriv> AD; + + typedef std::numeric_limits<AD> A; + typedef std::numeric_limits<Scalar> B; + + bool res = std::is_base_of<B, A>::value; + VERIFY_IS_EQUAL(res, true); +} + void test_autodiff_scalar() { for(int i = 0; i < g_repeat; i++) { @@ -79,5 +92,6 @@ void test_autodiff_scalar() CALL_SUBTEST_2( check_atan2<double>() ); CALL_SUBTEST_3( check_hyperbolic_functions<float>() ); CALL_SUBTEST_4( check_hyperbolic_functions<double>() ); + CALL_SUBTEST_5( check_limits_specialization<double>()); } } |