ICU-3391 add assert* convenience overloads taking UnicodeString msg
X-SVN-Rev: 14684
This commit is contained in:
parent
40bd934b05
commit
9449f5b4fb
@ -1374,6 +1374,32 @@ UBool IntlTest::assertEquals(const char* message,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static char ASSERT_BUF[256];
|
||||
|
||||
static const char* extractToAssertBuf(const UnicodeString& message) {
|
||||
message.extract(0, 0x7FFFFFFF, ASSERT_BUF, sizeof(ASSERT_BUF)-1, 0);
|
||||
ASSERT_BUF[sizeof(ASSERT_BUF)-1] = 0;
|
||||
return ASSERT_BUF;
|
||||
}
|
||||
|
||||
UBool IntlTest::assertTrue(const UnicodeString& message, UBool condition) {
|
||||
return assertTrue(extractToAssertBuf(message), condition);
|
||||
}
|
||||
|
||||
UBool IntlTest::assertFalse(const UnicodeString& message, UBool condition) {
|
||||
return assertFalse(extractToAssertBuf(message), condition);
|
||||
}
|
||||
|
||||
UBool IntlTest::assertSuccess(const UnicodeString& message, UErrorCode ec) {
|
||||
return assertSuccess(extractToAssertBuf(message), ec);
|
||||
}
|
||||
|
||||
UBool IntlTest::assertEquals(const UnicodeString& message,
|
||||
const UnicodeString& expected,
|
||||
const UnicodeString& actual) {
|
||||
return assertEquals(extractToAssertBuf(message), expected, actual);
|
||||
}
|
||||
|
||||
/*
|
||||
* Hey, Emacs, please set the following:
|
||||
*
|
||||
|
@ -136,6 +136,11 @@ protected:
|
||||
UBool assertSuccess(const char* message, UErrorCode ec);
|
||||
UBool assertEquals(const char* message, const UnicodeString& expected,
|
||||
const UnicodeString& actual);
|
||||
UBool assertTrue(const UnicodeString& message, UBool condition);
|
||||
UBool assertFalse(const UnicodeString& message, UBool condition);
|
||||
UBool assertSuccess(const UnicodeString& message, UErrorCode ec);
|
||||
UBool assertEquals(const UnicodeString& message, const UnicodeString& expected,
|
||||
const UnicodeString& actual);
|
||||
|
||||
virtual void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ); // overide !
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user