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 | using namespace std; |
---|
12 | |
---|
13 | if (strcmp(expected, actual)) |
---|
14 | { |
---|
15 | UnitTest::MemoryOutStream stream; |
---|
16 | stream << "Expected " << expected << " but was " << actual; |
---|
17 | |
---|
18 | results.OnTestFailure(details, stream.GetText()); |
---|
19 | } |
---|
20 | } |
---|
21 | |
---|
22 | } |
---|
23 | |
---|
24 | |
---|
25 | void CheckEqual(TestResults& results, char const* expected, char const* actual, |
---|
26 | TestDetails const& details) |
---|
27 | { |
---|
28 | CheckStringsEqual(results, expected, actual, details); |
---|
29 | } |
---|
30 | |
---|
31 | void CheckEqual(TestResults& results, char* expected, char* actual, |
---|
32 | TestDetails const& details) |
---|
33 | { |
---|
34 | CheckStringsEqual(results, expected, actual, details); |
---|
35 | } |
---|
36 | |
---|
37 | void CheckEqual(TestResults& results, char* expected, char const* actual, |
---|
38 | TestDetails const& details) |
---|
39 | { |
---|
40 | CheckStringsEqual(results, expected, actual, details); |
---|
41 | } |
---|
42 | |
---|
43 | void CheckEqual(TestResults& results, char const* expected, char* actual, |
---|
44 | TestDetails const& details) |
---|
45 | { |
---|
46 | CheckStringsEqual(results, expected, actual, details); |
---|
47 | } |
---|
48 | |
---|
49 | |
---|
50 | } |
---|