MCPcopy Create free account
hub / github.com/cpputest/cpputest / GTestUTest

Class GTestUTest

include/CppUTestExt/GTestConvertor.h:256–311  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

254}
255
256class GTestUTest: public Utest {
257public:
258 GTestUTest(::testing::TestInfo* testinfo, GTestFlagsThatAllocateMemory* flags) : testinfo_(testinfo), test_(NULL), flags_(flags)
259 {
260
261 }
262
263 void testBody()
264 {
265 try {
266 test_->TestBody();
267 }
268 catch (CppUTestFailedException& ex)
269 {
270 }
271 }
272
273 void setup()
274 {
275 flags_->resetValuesOfGTestFlags();
276
277 #ifdef GTEST_VERSION_GTEST_1_5
278 test_ = testinfo_->impl()->factory_->CreateTest();
279 #else
280 test_ = testinfo_->factory_->CreateTest();
281 #endif
282
283 ::testing::UnitTest::GetInstance()->impl()->set_current_test_info(testinfo_);
284 try {
285 test_->SetUp();
286 }
287 catch (CppUTestFailedException& ex)
288 {
289 }
290 }
291
292 void teardown()
293 {
294 try {
295 test_->TearDown();
296 }
297 catch (CppUTestFailedException& ex)
298 {
299 }
300 ::testing::UnitTest::GetInstance()->impl()->set_current_test_info(NULL);
301 delete test_;
302
303 flags_->setGTestFLagValuesToNULLToAvoidMemoryLeaks();
304 ::testing::internal::DeathTest::set_last_death_test_message(GTEST_NO_STRING_VALUE);
305 }
306
307private:
308 ::testing::Test* test_;
309 ::testing::TestInfo* testinfo_;
310 GTestFlagsThatAllocateMemory* flags_;
311};
312
313inline Utest* GTestShell::createTest()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected