diff --git a/examples/gtest/main.cpp b/examples/gtest/main.cpp index ceaee2a3..9eb100b4 100644 --- a/examples/gtest/main.cpp +++ b/examples/gtest/main.cpp @@ -33,15 +33,28 @@ class MyFixture : public ::testing::Test { // SetUp works as usual... } - void increment() { counter++; } + static void SetUpTestSuite() { + // ... SetUpTestSuite also works + step_size = 1U; + } + + void increment() { counter += step_size; } void TearDown() override { // ...as does TearDown } + static void TearDownTestSuite() { + // ... and TearDownTestSuite + EXPECT_EQ(step_size, 1U); + } + std::size_t counter; + static std::size_t step_size; }; +std::size_t MyFixture::step_size{0U}; + // ...and use them like this: RC_GTEST_FIXTURE_PROP(MyFixture, shouldInstantiateFixtureOnEachRun, diff --git a/extras/gtest/include/rapidcheck/gtest.h b/extras/gtest/include/rapidcheck/gtest.h index 0ef19b09..868759a8 100644 --- a/extras/gtest/include/rapidcheck/gtest.h +++ b/extras/gtest/include/rapidcheck/gtest.h @@ -54,7 +54,7 @@ void checkGTest(Testable &&testable) { void rapidCheck_fixtureTearDown() { TearDown(); } \ }; \ \ - TEST(Fixture##_RapidCheck, Name) { \ + TEST_F(Fixture, RapidCheck_##Name) { \ ::rc::detail::checkGTest(&rc::detail::ExecFixture< \ RapidCheckPropImpl_##Fixture##_##Name>::exec); \ } \