1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /********************************************************************
4  * COPYRIGHT:
5  * Copyright (c) 2010-2012, International Business Machines Corporation and
6  * others. All Rights Reserved.
7  ********************************************************************/
8 
9 //
10 //   file:  dcfmtest.h
11 //
12 //   Data driven decimal formatter test.
13 //      Includes testing of both parsing and formatting.
14 //      Tests are in the text file dcfmtest.txt, in the source/test/testdata/ directory.
15 //
16 
17 #ifndef DCFMTEST_H
18 #define DCFMTEST_H
19 
20 #include "unicode/utypes.h"
21 #if !UCONFIG_NO_REGULAR_EXPRESSIONS
22 
23 #include "intltest.h"
24 
25 
26 class DecimalFormatTest: public IntlTest {
27 public:
28 
29     DecimalFormatTest();
30     virtual ~DecimalFormatTest();
31 
32     virtual void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = NULL );
33 
34     // The following are test functions that are visible from the intltest test framework.
35     virtual void DataDrivenTests();
36 
37     // The following functions are internal to the decimal format tests.
38     virtual UChar *ReadAndConvertFile(const char *fileName, int32_t &len, UErrorCode &status);
39     virtual const char *getPath(char buffer[2048], const char *filename);
40     virtual void execParseTest(int32_t lineNum,
41                               const UnicodeString &inputText,
42                               const UnicodeString &expectedType,
43                               const UnicodeString &expectedDecimal,
44                               UErrorCode &status);
45 
46 private:
47     enum EFormatInputType {
48         kFormattable,
49         kStringPiece
50     };
51 
52 public:
53     virtual void execFormatTest(int32_t lineNum,
54                                const UnicodeString &pattern,
55                                const UnicodeString &round,
56                                const UnicodeString &input,
57                                const UnicodeString &expected,
58                                EFormatInputType inType,
59                                UErrorCode &status);
60 };
61 
62 #endif   // !UCONFIG_NO_REGULAR_EXPRESSIONS
63 #endif
64