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 | using namespace std; |
---|
11 | |
---|
12 | if ( strcmp ( expected, actual ) ) { |
---|
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 | CheckStringsEqual ( results, expected, actual, details ); |
---|
26 | } |
---|
27 | |
---|
28 | void CheckEqual ( TestResults& results, char* expected, char* actual, |
---|
29 | TestDetails const& details ) { |
---|
30 | CheckStringsEqual ( results, expected, actual, details ); |
---|
31 | } |
---|
32 | |
---|
33 | void CheckEqual ( TestResults& results, char* expected, char const* actual, |
---|
34 | TestDetails const& details ) { |
---|
35 | CheckStringsEqual ( results, expected, actual, details ); |
---|
36 | } |
---|
37 | |
---|
38 | void CheckEqual ( TestResults& results, char const* expected, char* actual, |
---|
39 | TestDetails const& details ) { |
---|
40 | CheckStringsEqual ( results, expected, actual, details ); |
---|
41 | } |
---|
42 | |
---|
43 | |
---|
44 | } |
---|