Mercurial > fife-parpg
comparison ext/UnitTest++/src/tests/TestTimeConstraintMacro.cpp @ 37:0d325e9d5953
added unittest++ files into ext. Not hooked into build scripts yet
author | jasoka@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Sat, 12 Jul 2008 12:00:57 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
36:6f1227f4932b | 37:0d325e9d5953 |
---|---|
1 #include "../UnitTest++.h" | |
2 #include "../TimeHelpers.h" | |
3 | |
4 #include "RecordingReporter.h" | |
5 | |
6 namespace { | |
7 | |
8 TEST (TimeConstraintMacroQualifiesNamespace) | |
9 { | |
10 // If this compiles without a "using namespace UnitTest;", all is well. | |
11 UNITTEST_TIME_CONSTRAINT(1); | |
12 } | |
13 | |
14 TEST (TimeConstraintMacroUsesCorrectInfo) | |
15 { | |
16 int testLine = 0; | |
17 RecordingReporter reporter; | |
18 { | |
19 UnitTest::TestResults testResults_(&reporter); | |
20 UNITTEST_TIME_CONSTRAINT(10); testLine = __LINE__; | |
21 UnitTest::TimeHelpers::SleepMs(20); | |
22 } | |
23 CHECK_EQUAL (1, reporter.testFailedCount); | |
24 CHECK (std::strstr(reporter.lastFailedFile, __FILE__)); | |
25 CHECK_EQUAL (testLine, reporter.lastFailedLine); | |
26 CHECK (std::strstr(reporter.lastFailedTest, "TimeConstraintMacroUsesCorrectInfo")); | |
27 } | |
28 | |
29 } |