16#include <gtest/gtest.h>
17#include <rapidcheck/gtest.h>
18#include <rapidcheck/gen/Arbitrary.hpp>
22using MakeTestParams = TestParams (*)();
24template<
typename Testable>
25void checkGTestWith(Testable && testable, MakeTestParams makeTestParams)
27 const auto testInfo = ::testing::UnitTest::GetInstance()->current_test_info();
28 detail::TestMetadata metadata;
29 metadata.id = std::string(testInfo->test_case_name()) +
"/" + std::string(testInfo->name());
30 metadata.description = std::string(testInfo->name());
32 const auto result = checkTestable(std::forward<Testable>(testable), metadata, makeTestParams());
34 if (result.template is<detail::SuccessResult>()) {
35 const auto success = result.template get<detail::SuccessResult>();
36 if (!success.distribution.empty()) {
37 printResultMessage(result, std::cout);
38 std::cout << std::endl;
41 std::ostringstream ss;
42 printResultMessage(result, ss);
43 throw std::runtime_error(ss.str());
48#define RC_GTEST_PROP_WITH_PARAMS(TestCase, Name, MakeParams, ArgList) \
49 void rapidCheck_propImpl_##TestCase##_##Name ArgList; \
51 TEST(TestCase, Name) \
53 ::rc::detail::checkGTestWith(&rapidCheck_propImpl_##TestCase##_##Name, MakeParams); \
56 void rapidCheck_propImpl_##TestCase##_##Name ArgList