FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
unittest-cpp/tests/TestTimeConstraint.cpp at master · unittest-cpp/unittest-cpp · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
unittest-cpp
/
unittest-cpp
Public
Notifications
You must be signed in to change notification settings
Fork
175
Star
583
Code
Issues
33
Pull requests
11
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
unittest-cpp
/
tests
/
TestTimeConstraint.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
69 lines (57 loc) · 1.75 KB
Breadcrumbs
unittest-cpp
/
tests
/
TestTimeConstraint.cpp
Copy path
File metadata and controls
69 lines (57 loc) · 1.75 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#
include
"
UnitTest++/UnitTestPP.h
"
#
include
"
UnitTest++/TestResults.h
"
#
include
"
UnitTest++/TimeHelpers.h
"
#
include
"
RecordingReporter.h
"
#
include
"
ScopedCurrentTest.h
"
using
namespace
UnitTest
;
namespace
{
TEST
(TimeConstraintSucceedsWithFastTest)
{
TestResults result;
{
ScopedCurrentTest
scopedResult
(result);
TimeConstraint
t
(
200
,
TestDetails
(
"
"
,
"
"
,
"
"
,
0
),
0
);
TimeHelpers::SleepMs
(
5
);
}
CHECK_EQUAL
(
0
, result.
GetFailureCount
());
}
TEST
(TimeConstraintFailsWithSlowTest)
{
TestResults result;
{
ScopedCurrentTest
scopedResult
(result);
TimeConstraint
t
(
10
,
TestDetails
(
"
"
,
"
"
,
"
"
,
0
),
0
);
TimeHelpers::SleepMs
(
20
);
}
CHECK_EQUAL
(
1
, result.
GetFailureCount
());
}
TEST
(TimeConstraintFailureIncludesCorrectData)
{
RecordingReporter reporter;
TestResults
result
(&reporter);
{
ScopedCurrentTest
scopedResult
(result);
TestDetails
const
details
(
"
testname
"
,
"
suitename
"
,
"
filename
"
,
10
);
TimeConstraint
t
(
10
, details,
10
);
TimeHelpers::SleepMs
(
20
);
}
using
namespace
std
;
CHECK
(
strstr
(reporter.
lastFailedFile
,
"
filename
"
));
CHECK_EQUAL
(
10
, reporter.
lastFailedLine
);
CHECK
(
strstr
(reporter.
lastFailedTest
,
"
testname
"
));
}
TEST
(TimeConstraintFailureIncludesTimeoutInformation)
{
RecordingReporter reporter;
TestResults
result
(&reporter);
{
ScopedCurrentTest
scopedResult
(result);
TimeConstraint
t
(
10
,
TestDetails
(
"
"
,
"
"
,
"
"
,
0
),
0
);
TimeHelpers::SleepMs
(
20
);
}
using
namespace
std
;
CHECK
(
strstr
(reporter.
lastFailedMessage
,
"
ime constraint
"
));
CHECK
(
strstr
(reporter.
lastFailedMessage
,
"
under 10ms
"
));
}
}
Back
|
FazBrowse Home
|
New Git URL