]>
git.saurik.com Git - apple/icu.git/blob - icuSources/test/intltest/tstdtmod.h
1 /********************************************************************
3 * Copyright (c) 2002, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 ********************************************************************/
7 /* Created by weiv 05/09/2002 */
9 /* Base class for data driven tests */
11 #ifndef INTLTST_TESTMODULE
12 #define INTLTST_TESTMODULE
14 #include "unicode/utypes.h"
15 #include "unicode/unistr.h"
17 #include "unicode/ures.h"
21 /* This class abstracts the actual organization of the
22 * data for data driven tests
29 /** Facilitates internal logging of data driven test service
30 * It would be interesting to develop this into a full
31 * fledged control system as in Java.
33 class TestLog
: public IntlTest
{
37 /** Main data driven test class. Corresponds to one named data
38 * unit (such as a resource bundle. It is instantiated using
39 * a factory method getTestDataModule
41 class TestDataModule
{
50 * @param name name of the test module. Usually name of a resource bundle or a XML file
51 * @param log a logging class, used for internal error reporting.
52 * @param status if something goes wrong, status will be set
53 * @return a TestDataModule object. Use it to get test data from it
55 static TestDataModule
*getTestDataModule(const char* name
, TestLog
& log
, UErrorCode
&status
);
56 virtual ~TestDataModule();
59 TestDataModule(const char* name
, TestLog
& log
, UErrorCode
& status
);
62 /** Name of this TestData module.
65 const char * getName() const;
67 /** Get a pointer to an object owned DataMap that contains more information on this module
68 * Usual fields are "Description", "LongDescription", "Settings". Also, if containing a
69 * field "Headers" these will be used as the default headers, so that you don't have to
70 * to specify per test headers.
71 * @param info pass in a const DataMap pointer. If no info, it will be set to NULL
73 virtual UBool
getInfo(const DataMap
*& info
, UErrorCode
&status
) const = 0;
75 /** Create a test data object from an index. Helpful for integrating tests with current
76 * intltest framework which addresses the tests by index.
77 * @param index index of the test to be instantiated
78 * @return an instantiated TestData object, ready to provide settings and cases for
81 virtual TestData
* createTestData(int32_t index
, UErrorCode
&status
) const = 0;
83 /** Create a test data object from a name.
84 * @param name name of the test to be instantiated
85 * @return an instantiated TestData object, ready to provide settings and cases for
88 virtual TestData
* createTestData(const char* name
, UErrorCode
&status
) const = 0;
91 class RBTestDataModule
: public TestDataModule
{
93 virtual ~RBTestDataModule();
96 RBTestDataModule(const char* name
, TestLog
& log
, UErrorCode
& status
);
99 virtual UBool
getInfo(const DataMap
*& info
, UErrorCode
&status
) const;
101 virtual TestData
* createTestData(int32_t index
, UErrorCode
&status
) const;
102 virtual TestData
* createTestData(const char* name
, UErrorCode
&status
) const;
105 UResourceBundle
*getTestBundle(const char* bundleName
, UErrorCode
&status
);
108 UResourceBundle
*fModuleBundle
;
109 UResourceBundle
*fTestData
;
110 UResourceBundle
*fInfoRB
;
111 UBool fDataTestValid
;
114 /* const char* fTestName;*/ /* See name */
115 int32_t fNumberOfTests
;