]> git.saurik.com Git - apple/icu.git/blame - icuSources/tools/ctestfw/unicode/testlog.h
ICU-461.12.tar.gz
[apple/icu.git] / icuSources / tools / ctestfw / unicode / testlog.h
CommitLineData
374ca955
A
1/********************************************************************
2 * COPYRIGHT:
729e4ab9 3 * Copyright (c) 2004-2010, International Business Machines Corporation and
374ca955
A
4 * others. All Rights Reserved.
5 ********************************************************************/
6
7/* Created by grhoten 03/17/2004 */
8
9/* Base class for data driven tests */
10
11#ifndef U_TESTFW_TESTLOG
12#define U_TESTFW_TESTLOG
13
729e4ab9 14#include "unicode/errorcode.h"
374ca955 15#include "unicode/unistr.h"
73c04bcf 16#include "unicode/testtype.h"
374ca955
A
17
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.
21 */
73c04bcf 22class T_CTEST_EXPORT_API TestLog {
374ca955 23public:
73c04bcf 24 virtual ~TestLog();
374ca955 25 virtual void errln( const UnicodeString &message ) = 0;
729e4ab9 26 virtual void logln( const UnicodeString &message ) = 0;
46f4442e 27 virtual void dataerrln( const UnicodeString &message ) = 0;
374ca955
A
28 virtual const char* getTestDataPath(UErrorCode& err) = 0;
29};
30
729e4ab9
A
31class T_CTEST_EXPORT_API IcuTestErrorCode : public ErrorCode {
32public:
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, ...);
39protected:
40 virtual void handleFailure() const;
41private:
42 TestLog &testClass;
43 const char *const testName;
44};
374ca955
A
45
46#endif