2004-03-23 06:37:36 +00:00
|
|
|
/********************************************************************
|
|
|
|
* COPYRIGHT:
|
2010-02-24 16:17:03 +00:00
|
|
|
* Copyright (c) 2004-2010, International Business Machines Corporation and
|
2004-03-23 06:37:36 +00:00
|
|
|
* others. All Rights Reserved.
|
|
|
|
********************************************************************/
|
|
|
|
|
|
|
|
/* Created by grhoten 03/17/2004 */
|
|
|
|
|
|
|
|
/* Base class for data driven tests */
|
|
|
|
|
|
|
|
#ifndef U_TESTFW_TESTLOG
|
|
|
|
#define U_TESTFW_TESTLOG
|
|
|
|
|
2009-11-13 19:25:21 +00:00
|
|
|
#include "unicode/errorcode.h"
|
2004-03-23 06:37:36 +00:00
|
|
|
#include "unicode/unistr.h"
|
2006-03-26 10:24:57 +00:00
|
|
|
#include "unicode/testtype.h"
|
2004-03-23 06:37:36 +00:00
|
|
|
|
|
|
|
/** Facilitates internal logging of data driven test service
|
|
|
|
* It would be interesting to develop this into a full
|
|
|
|
* fledged control system as in Java.
|
|
|
|
*/
|
2006-03-26 10:24:57 +00:00
|
|
|
class T_CTEST_EXPORT_API TestLog {
|
2004-03-23 06:37:36 +00:00
|
|
|
public:
|
2006-03-25 23:27:09 +00:00
|
|
|
virtual ~TestLog();
|
2004-03-23 06:37:36 +00:00
|
|
|
virtual void errln( const UnicodeString &message ) = 0;
|
2009-11-10 16:01:28 +00:00
|
|
|
virtual void logln( const UnicodeString &message ) = 0;
|
2008-04-10 23:19:16 +00:00
|
|
|
virtual void dataerrln( const UnicodeString &message ) = 0;
|
2004-03-23 06:37:36 +00:00
|
|
|
virtual const char* getTestDataPath(UErrorCode& err) = 0;
|
|
|
|
};
|
|
|
|
|
2009-11-13 19:25:21 +00:00
|
|
|
class T_CTEST_EXPORT_API IcuTestErrorCode : public ErrorCode {
|
|
|
|
public:
|
|
|
|
IcuTestErrorCode(TestLog &callingTestClass, const char *callingTestName) :
|
|
|
|
testClass(callingTestClass), testName(callingTestName) {}
|
|
|
|
virtual ~IcuTestErrorCode();
|
|
|
|
// Returns TRUE if isFailure().
|
2009-11-20 06:28:25 +00:00
|
|
|
UBool logIfFailureAndReset(const char *fmt, ...);
|
2010-02-24 16:17:03 +00:00
|
|
|
UBool logDataIfFailureAndReset(const char *fmt, ...);
|
2009-11-13 19:25:21 +00:00
|
|
|
protected:
|
|
|
|
virtual void handleFailure() const;
|
|
|
|
private:
|
|
|
|
TestLog &testClass;
|
|
|
|
const char *const testName;
|
|
|
|
};
|
2004-03-23 06:37:36 +00:00
|
|
|
|
|
|
|
#endif
|