1 /********************************************************************
3 * Copyright (c) 2004-2010, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 ********************************************************************/
7 /* Created by grhoten 03/17/2004 */
9 /* Base class for data driven tests */
11 #ifndef U_TESTFW_TESTLOG
12 #define U_TESTFW_TESTLOG
14 #include "unicode/errorcode.h"
15 #include "unicode/unistr.h"
16 #include "unicode/testtype.h"
18 /** Facilitates internal logging of data driven test service
19 * It would be interesting to develop this into a full
20 * fledged control system as in Java.
22 class T_CTEST_EXPORT_API TestLog
{
25 virtual void errln( const UnicodeString
&message
) = 0;
26 virtual void logln( const UnicodeString
&message
) = 0;
27 virtual void dataerrln( const UnicodeString
&message
) = 0;
28 virtual const char* getTestDataPath(UErrorCode
& err
) = 0;
31 class T_CTEST_EXPORT_API IcuTestErrorCode
: public ErrorCode
{
33 IcuTestErrorCode(TestLog
&callingTestClass
, const char *callingTestName
) :
34 testClass(callingTestClass
), testName(callingTestName
) {}
35 virtual ~IcuTestErrorCode();
36 // Returns TRUE if isFailure().
37 UBool
logIfFailureAndReset(const char *fmt
, ...);
38 UBool
logDataIfFailureAndReset(const char *fmt
, ...);
40 virtual void handleFailure() const;
43 const char *const testName
;