annotate ext/UnitTest++/src/Checks.cpp @ 165:fbc55c6f57cf

(Convenient) Timers.
author phoku@33b003aa-7bff-0310-803a-e67f0ece8222
date Wed, 15 Oct 2008 18:04:52 +0000
parents 0d325e9d5953
children
rev   line source
37
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
1 #include "Checks.h"
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
2 #include <cstring>
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
3
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
4 namespace UnitTest {
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
5
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
6 namespace {
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
7
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
8 void CheckStringsEqual(TestResults& results, char const* expected, char const* actual,
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
9 TestDetails const& details)
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
10 {
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
11 if (std::strcmp(expected, actual))
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
12 {
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
13 UnitTest::MemoryOutStream stream;
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
14 stream << "Expected " << expected << " but was " << actual;
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
15
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
16 results.OnTestFailure(details, stream.GetText());
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
17 }
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
18 }
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
19
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
20 }
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
21
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
22
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
23 void CheckEqual(TestResults& results, char const* expected, char const* actual,
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
24 TestDetails const& details)
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
25 {
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
26 CheckStringsEqual(results, expected, actual, details);
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
27 }
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
28
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
29 void CheckEqual(TestResults& results, char* expected, char* actual,
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
30 TestDetails const& details)
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
31 {
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
32 CheckStringsEqual(results, expected, actual, details);
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
33 }
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
34
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
35 void CheckEqual(TestResults& results, char* expected, char const* actual,
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
36 TestDetails const& details)
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
37 {
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
38 CheckStringsEqual(results, expected, actual, details);
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
39 }
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
40
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
41 void CheckEqual(TestResults& results, char const* expected, char* actual,
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
42 TestDetails const& details)
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
43 {
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
44 CheckStringsEqual(results, expected, actual, details);
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
45 }
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
46
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
47
0d325e9d5953 added unittest++ files into ext. Not hooked into build scripts yet
jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
48 }