Mercurial > fife-parpg
comparison ext/UnitTest++/src/Checks.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 "Checks.h" | |
2 #include <cstring> | |
3 | |
4 namespace UnitTest { | |
5 | |
6 namespace { | |
7 | |
8 void CheckStringsEqual(TestResults& results, char const* expected, char const* actual, | |
9 TestDetails const& details) | |
10 { | |
11 if (std::strcmp(expected, actual)) | |
12 { | |
13 UnitTest::MemoryOutStream stream; | |
14 stream << "Expected " << expected << " but was " << actual; | |
15 | |
16 results.OnTestFailure(details, stream.GetText()); | |
17 } | |
18 } | |
19 | |
20 } | |
21 | |
22 | |
23 void CheckEqual(TestResults& results, char const* expected, char const* actual, | |
24 TestDetails const& details) | |
25 { | |
26 CheckStringsEqual(results, expected, actual, details); | |
27 } | |
28 | |
29 void CheckEqual(TestResults& results, char* expected, char* actual, | |
30 TestDetails const& details) | |
31 { | |
32 CheckStringsEqual(results, expected, actual, details); | |
33 } | |
34 | |
35 void CheckEqual(TestResults& results, char* expected, char const* actual, | |
36 TestDetails const& details) | |
37 { | |
38 CheckStringsEqual(results, expected, actual, details); | |
39 } | |
40 | |
41 void CheckEqual(TestResults& results, char const* expected, char* actual, | |
42 TestDetails const& details) | |
43 { | |
44 CheckStringsEqual(results, expected, actual, details); | |
45 } | |
46 | |
47 | |
48 } |