Skip to content

Commit

Permalink
Merge pull request #158 from bretthall/master
Browse files Browse the repository at this point in the history
Warning fixes when using Boost.Test and VS2015
  • Loading branch information
emil-e authored Sep 14, 2017
2 parents ffcdd99 + b96d222 commit 1316b6d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
11 changes: 7 additions & 4 deletions extras/boost_test/include/rapidcheck/boost_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@ namespace rc {
namespace detail {

template <typename Testable>
void checkBoostTest(const std::string &description, Testable &&testable) {
void checkBoostTest(Testable &&testable) {
const auto &testCase = boost::unit_test::framework::current_test_case();
TestMetadata metadata;
metadata.id = testCase.full_name();
metadata.description = testCase.p_name;

const auto result = checkTestable(std::forward<Testable>(testable), metadata);

// Without this boost.test will complain about the test case having no assertions when the
// rapidcheck test passes
BOOST_CHECK (true);

if (result.template is<SuccessResult>()) {
const auto success = result.template get<SuccessResult>();
if (!success.distribution.empty()) {
Expand All @@ -39,7 +43,7 @@ void checkBoostTest(const std::string &description, Testable &&testable) {
void rapidCheck_propImpl_##Name ArgList; \
\
BOOST_AUTO_TEST_CASE(Name) { \
::rc::detail::checkBoostTest(#Name, &rapidCheck_propImpl_##Name); \
::rc::detail::checkBoostTest(&rapidCheck_propImpl_##Name); \
} \
\
void rapidCheck_propImpl_##Name ArgList
Expand All @@ -55,8 +59,7 @@ void checkBoostTest(const std::string &description, Testable &&testable) {
}; \
\
BOOST_AUTO_TEST_CASE(Name) { \
::rc::detail::checkBoostTest( \
#Name, \
::rc::detail::checkBoostTest( \
&rc::detail::ExecFixture< \
RapidCheckPropImpl_##Fixture##_##Name>::exec); \
} \
Expand Down
7 changes: 0 additions & 7 deletions include/rapidcheck/Gen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,6 @@ Shrinkable<T> Gen<T>::operator()(const Random &random, int size) const
auto exception = std::current_exception();
return shrinkable::lambda([=]() -> T {
std::rethrow_exception(exception);

// MSVC HACK: the following is required for MSVC to stop complaining
// about missing return value. Will never be reached, of
// course.
#ifdef _MSC_VER
throw nullptr;
#endif // _MSC_VER
});
}
}
Expand Down

0 comments on commit 1316b6d

Please sign in to comment.