?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download

  1. #ifndef UNITTEST_TIMECONSTRAINT_H
  2. #define UNITTEST_TIMECONSTRAINT_H
  3.  
  4. #include "TimeHelpers.h"
  5. #include "HelperMacros.h"
  6. #include "TestDetails.h"
  7.  
  8. namespace UnitTest {
  9.  
  10.    class TestResults;
  11.  
  12.    class UNITTEST_LINKAGE TimeConstraint
  13.    {
  14.    public:
  15.       TimeConstraint(int ms, TestDetails const& details, int lineNumber);
  16.       ~TimeConstraint();
  17.  
  18.    private:
  19.       void operator=(TimeConstraint const&);
  20.       TimeConstraint(TimeConstraint const&);
  21.  
  22.       Timer m_timer;
  23.       TestDetails const m_details;
  24.       int const m_maxMs;
  25.    };
  26.  
  27.    #define UNITTEST_TIME_CONSTRAINT(ms) \
  28.       UnitTest::TimeConstraint unitTest__timeConstraint__(ms, m_details, __LINE__)
  29.  
  30.    #define UNITTEST_TIME_CONSTRAINT_EXEMPT() \
  31.       UNITTEST_MULTILINE_MACRO_BEGIN         \
  32.       m_details.timeConstraintExempt = true; \
  33.       UNITTEST_MULTILINE_MACRO_END
  34.  
  35. }
  36.  
  37. #endif
  38.