[Cppunit-devel] Checking for equality of C strings
Brought to you by:
blep
|
From: Dave G. <dg...@hy...> - 2003-02-13 23:13:04
|
If I try to do something like this:
const char *sample = "Sample String";
char copy[16];
strcpy(copy, sample);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Identical strings are not equal",
(const char *)copy, sample);
I end up getting an assertion like this:
charcompare.cpp:15:Assertion
Test name: CharCompare::testCompare
equality assertion failed
- Expected: Sample String
- Actual : Sample String
- Identical strings are not equal
Is there a variant of CPPUNIT_ASSERT_EQUAL macro which can compare
C strings? Extra points if it can compare a 'char[]' and a 'char *'!
|