00001 #ifndef UNITTEST_TIMECONSTRAINT_H 00002 #define UNITTEST_TIMECONSTRAINT_H 00003 00004 #include "TimeHelpers.h" 00005 00006 namespace UnitTest { 00007 00008 class TestResults; 00009 class TestDetails; 00010 00011 class TimeConstraint { 00012 public: 00013 TimeConstraint ( int ms, TestDetails const& details ); 00014 ~TimeConstraint(); 00015 00016 private: 00017 void operator= ( TimeConstraint const& ); 00018 TimeConstraint ( TimeConstraint const& ); 00019 00020 Timer m_timer; 00021 TestDetails const& m_details; 00022 int const m_maxMs; 00023 }; 00024 00025 #define UNITTEST_TIME_CONSTRAINT(ms) \ 00026 UnitTest::TimeConstraint unitTest__timeConstraint__(ms, UnitTest::TestDetails(m_details, __LINE__)) 00027 00028 #define UNITTEST_TIME_CONSTRAINT_EXEMPT() do { m_timeConstraintExempt = true; } while (0) 00029 00030 } 00031 00032 #endif