]>
git.saurik.com Git - apple/icu.git/blob - icuSources/test/intltest/tsnmfmt.h
1 /********************************************************************
3 * Copyright (c) 1997-2001, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 ********************************************************************/
7 #ifndef _INTLTESTNUMBERFORMAT
8 #define _INTLTESTNUMBERFORMAT
13 #include "unicode/utypes.h"
15 #if !UCONFIG_NO_FORMATTING
17 #include "unicode/numfmt.h"
18 #include "unicode/fmtable.h"
19 #include "unicode/locid.h"
24 * This test does round-trip testing (format -> parse -> format -> parse -> etc.) of
27 class IntlTestNumberFormat
: public IntlTest
{
28 void runIndexedTest( int32_t index
, UBool exec
, const char* &name
, char* par
= NULL
);
33 * call tryIt with many variations, called by testLocale
35 void testFormat(/* char* par */);
37 * perform tests using aNumber and fFormat, called in many variations
39 void tryIt(double aNumber
);
41 * perform tests using aNumber and fFormat, called in many variations
43 void tryIt(int32_t aNumber
);
45 * test NumberFormat::getAvailableLocales
47 void testAvailableLocales(/* char* par */);
49 * call testLocale for all locales
51 void monsterTest(/* char *par */);
53 * call testFormat for currency, percent and plain number instances
55 void testLocale(/* char *par, */const Locale
& locale
, const UnicodeString
& localeName
);
57 NumberFormat
* fFormat
;
63 virtual ~IntlTestNumberFormat() {}
66 * Return a random double that isn't too large.
68 static double getSafeDouble(double smallerThanMax
);
71 * Return a random double
73 static double randDouble();
76 * Return a random uint32_t
78 static uint32_t randLong();
81 * Return a random double 0 <= x < 1.0
83 static double randFraction()
85 return (double)randLong() / (double)0xFFFFFFFF;
90 #endif /* #if !UCONFIG_NO_FORMATTING */