]>
git.saurik.com Git - apple/icu.git/blob - icuSources/test/intltest/tsnmfmt.h
1 /********************************************************************
3 * Copyright (c) 1997-2003, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 ********************************************************************/
7 #ifndef _INTLTESTNUMBERFORMAT
8 #define _INTLTESTNUMBERFORMAT
11 #include "unicode/utypes.h"
13 #if !UCONFIG_NO_FORMATTING
15 #include "unicode/numfmt.h"
16 #include "unicode/locid.h"
21 * This test does round-trip testing (format -> parse -> format -> parse -> etc.) of
24 class IntlTestNumberFormat
: public IntlTest
{
25 void runIndexedTest( int32_t index
, UBool exec
, const char* &name
, char* par
= NULL
);
30 * call tryIt with many variations, called by testLocale
32 void testFormat(/* char* par */);
34 * perform tests using aNumber and fFormat, called in many variations
36 void tryIt(double aNumber
);
38 * perform tests using aNumber and fFormat, called in many variations
40 void tryIt(int32_t aNumber
);
42 * test NumberFormat::getAvailableLocales
44 void testAvailableLocales(/* char* par */);
46 * call testLocale for all locales
48 void monsterTest(/* char *par */);
50 * call testFormat for currency, percent and plain number instances
52 void testLocale(/* char *par, */const Locale
& locale
, const UnicodeString
& localeName
);
54 NumberFormat
* fFormat
;
60 virtual ~IntlTestNumberFormat();
63 * Return a random double that isn't too large.
65 static double getSafeDouble(double smallerThanMax
);
68 * Return a random double
70 static double randDouble();
73 * Return a random uint32_t
75 static uint32_t randLong();
78 * Return a random double 0 <= x < 1.0
80 static double randFraction()
82 return (double)randLong() / (double)0xFFFFFFFF;
87 #endif /* #if !UCONFIG_NO_FORMATTING */