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 { 00013 public: 00014 TimeConstraint(int ms, TestDetails const& details); 00015 ~TimeConstraint(); 00016 00017 private: 00018 void operator=(TimeConstraint const&); 00019 TimeConstraint(TimeConstraint const&); 00020 00021 Timer m_timer; 00022 TestDetails const& m_details; 00023 int const m_maxMs; 00024 }; 00025 00026 #define UNITTEST_TIME_CONSTRAINT(ms) \ 00027 UnitTest::TimeConstraint unitTest__timeConstraint__(ms, UnitTest::TestDetails(m_details, __LINE__)) 00028 00029 #define UNITTEST_TIME_CONSTRAINT_EXEMPT() do { m_timeConstraintExempt = true; } while (0) 00030 00031 } 00032 00033 #endif