Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion examples/gtest/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion extras/gtest/include/rapidcheck/gtest.h
Original file line number Diff line number Diff line change
Expand Up @@ -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); \
} \
Expand Down