rapidcheck icon indicating copy to clipboard operation
rapidcheck copied to clipboard

Add Support for Gtest Typed Tests

Open theNerd247 opened this issue 9 years ago • 1 comments

theNerd247 avatar Jun 15 '16 17:06 theNerd247

This is what I've been toying around with for now:

#define RC_GTEST_TYPED_PROP(CaseName, TestName, ArgList)                                                                 \
  template<typename TypeParam> void rapidCheck_propImpl_##CaseName##_##TestName ArgList;                                 \
  TYPED_TEST(CaseName, TestName) { ::rc::detail::checkGTest(&rapidCheck_propImpl_##CaseName##_##TestName<TypeParam>); }  \
  template<typename TypeParam> void rapidCheck_propImpl_##CaseName##_##TestName ArgList

template <typename T> class FooTest : public ::testing::Test {};
using FooTestTypes = ::testing::Types<int8_t,int16_t,int32_t,int64_t>;
TYPED_TEST_CASE(FooTest, FooTestTypes);

// just nonsense examples
RC_GTEST_TYPED_PROP(FooTest, Prop1, (TypeParam x)) { RC_ASSERT(x == x); }
RC_GTEST_TYPED_PROP(FooTest, Prop2, (TypeParam x)) { RC_ASSERT(x != x); }

I can update as I find issues.

ibtaylor avatar Jan 09 '19 16:01 ibtaylor