root/library/tests/unittest-cpp/Checks.cpp @ 434

Revision 418, 1.2 kB (checked in by vbarta, 15 years ago)

#27: added UnitTest?++ to bdm sources, changed test_user_data to use it

Line 
1#include "Checks.h"
2#include <cstring>
3
4namespace UnitTest {
5
6namespace {
7
8void 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
25void CheckEqual(TestResults& results, char const* expected, char const* actual,
26                TestDetails const& details)
27{
28    CheckStringsEqual(results, expected, actual, details);
29}
30
31void CheckEqual(TestResults& results, char* expected, char* actual,
32                TestDetails const& details)
33{
34    CheckStringsEqual(results, expected, actual, details);
35}
36
37void CheckEqual(TestResults& results, char* expected, char const* actual,
38                TestDetails const& details)
39{
40    CheckStringsEqual(results, expected, actual, details);
41}
42
43void CheckEqual(TestResults& results, char const* expected, char* actual,
44                TestDetails const& details)
45{
46    CheckStringsEqual(results, expected, actual, details);
47}
48
49
50}
Note: See TracBrowser for help on using the browser.