| 470 | } |
| 471 | |
| 472 | unsigned NUnitTest::TTestFactory::Execute() { |
| 473 | Items_.QuickSort(TCmp()); |
| 474 | Processor_->Start(); |
| 475 | |
| 476 | TSet<TString> types; |
| 477 | size_t cnt = 0; |
| 478 | |
| 479 | for (TIntrusiveList<ITestBaseFactory>::TIterator factory = Items_.Begin(); factory != Items_.End(); ++factory) { |
| 480 | if (!Processor_->CheckAccess(factory->Name(), cnt++)) { |
| 481 | continue; |
| 482 | } |
| 483 | |
| 484 | THolder<TTestBase> test(factory->ConstructTest()); |
| 485 | |
| 486 | #ifdef _unix_ // on Windows RTTI causes memory leaks |
| 487 | TString type = test->TypeId(); |
| 488 | if (types.insert(type).second == false) { |
| 489 | warnx("Duplicate suite found: %s (%s). Probably you have copy-pasted suite without changing it name", factory->Name().c_str(), type.c_str()); |
| 490 | return 1; |
| 491 | } |
| 492 | #endif // _unix_ |
| 493 | |
| 494 | test->Parent_ = this; |
| 495 | |
| 496 | #ifdef UT_SKIP_EXCEPTIONS |
| 497 | try { |
| 498 | #endif |
| 499 | test->Execute(); |
| 500 | #ifdef UT_SKIP_EXCEPTIONS |
| 501 | } catch (...) { |
| 502 | } |
| 503 | #endif |
| 504 | } |
| 505 | |
| 506 | Processor_->End(); |
| 507 | |
| 508 | return bool(Processor_->FailTests()); |
| 509 | } |
| 510 | |
| 511 | void NUnitTest::TTestFactory::SetProcessor(ITestSuiteProcessor* processor) { |
| 512 | Processor_ = processor; |