simple.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #pragma once
  2. #include "registar.h"
  3. namespace NUnitTest {
  4. struct TSimpleTestExecutor: public TTestBase {
  5. typedef TVector<TBaseTestCase> TTests;
  6. TTests Tests;
  7. virtual void Execute() override final {
  8. AtStart();
  9. for (typename TTests::iterator i = Tests.begin(), ie = Tests.end(); i != ie; ++i) {
  10. if (!CheckAccessTest(i->Name_)) {
  11. continue;
  12. }
  13. TTestContext context(this->Processor());
  14. try {
  15. BeforeTest(i->Name_);
  16. {
  17. TCleanUp cleaner(this);
  18. TTestBase::Run([i, &context] { i->Body_(context); }, Name(), i->Name_, i->ForceFork_);
  19. }
  20. } catch (const ::NUnitTest::TAssertException&) {
  21. } catch (const yexception& e) {
  22. CATCH_REACTION_BT(i->Name_, e, &context);
  23. } catch (const std::exception& e) {
  24. CATCH_REACTION(i->Name_, e, &context);
  25. } catch (...) {
  26. AddError("non-std exception!", &context);
  27. }
  28. Finish(i->Name_, &context);
  29. }
  30. AtEnd();
  31. }
  32. };
  33. }