42 #include <gtest/gtest.h> 
   43 #include <unsupported/Eigen/AutoDiff> 
   50 using Vector2 = Eigen::Matrix<S, 2, 1>;
 
   52 using AutoDiff2 = Eigen::AutoDiffScalar<Vector2<S>>;
 
   57 void expect_eps_values(
const char* type_name) {
 
   58   static_assert(std::is_floating_point<S>::value,
 
   59                 "Only use this helper for float and double types");
 
   65             << 
"Failed for " << type_name;
 
   67             << 
"Failed for " << type_name;
 
   69             << 
"Failed for " << type_name;
 
   74 GTEST_TEST(FCL_CONSTANTS_EPS, precision_dependent) {
 
   75   expect_eps_values<double>(
"double");
 
   76   expect_eps_values<float>(
"float");
 
   84 template <
typename S> 
void expect_autodiff_constants(
const char *type_name) {
 
   85   EXPECT_TRUE((std::is_same<decltype(constants<AutoDiff2<S>>::pi()),
 
   86                             AutoDiff2<S>>::value))
 
   87       << 
"Failed for " << type_name;
 
   88   EXPECT_TRUE((std::is_same<decltype(constants<AutoDiff2<S>>::phi()),
 
   89                             AutoDiff2<S>>::value))
 
   90       << 
"Failed for " << type_name;
 
   92       (std::is_same<decltype(constants<AutoDiff2<S>>::eps()), S>::value))
 
   93       << 
"Failed for " << type_name;
 
   95       (std::is_same<decltype(constants<AutoDiff2<S>>::eps_78()), S>::value))
 
   96       << 
"Failed for " << type_name;
 
   98       (std::is_same<decltype(constants<AutoDiff2<S>>::eps_34()), S>::value))
 
   99       << 
"Failed for " << type_name;
 
  101       (std::is_same<decltype(constants<AutoDiff2<S>>::eps_12()), S>::value))
 
  102       << 
"Failed for " << type_name;
 
  107 GTEST_TEST(FCL_CONSTANTS_EPS, autodiff_compatibility) {
 
  108   expect_autodiff_constants<double>(
"double");
 
  109   expect_autodiff_constants<float>(
"float");
 
  116 int main(
int argc, 
char* argv[])
 
  118   ::testing::InitGoogleTest(&argc, argv);
 
  119   return RUN_ALL_TESTS();