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