G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
TimeConstraint.h
1#ifndef UNITTEST_TIMECONSTRAINT_H
2#define UNITTEST_TIMECONSTRAINT_H
3
4#include "TimeHelpers.h"
5#include "HelperMacros.h"
6
7namespace UnitTest {
8
9class TestResults;
10class TestDetails;
11
12class UNITTEST_LINKAGE TimeConstraint
13{
14public:
15 TimeConstraint(int ms, TestDetails const& details);
16 ~TimeConstraint();
17
18private:
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, UnitTest::TestDetails(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