]>
git.saurik.com Git - apple/icu.git/blob - icuSources/test/intltest/tsnmfmt.h
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /********************************************************************
5 * Copyright (c) 1997-2003, International Business Machines Corporation and
6 * others. All Rights Reserved.
7 ********************************************************************/
9 #ifndef _INTLTESTNUMBERFORMAT
10 #define _INTLTESTNUMBERFORMAT
13 #include "unicode/utypes.h"
15 #if !UCONFIG_NO_FORMATTING
17 #include "unicode/numfmt.h"
18 #include "unicode/locid.h"
23 * This test does round-trip testing (format -> parse -> format -> parse -> etc.) of
26 class IntlTestNumberFormat
: public IntlTest
{
27 void runIndexedTest( int32_t index
, UBool exec
, const char* &name
, char* par
= NULL
);
32 * call tryIt with many variations, called by testLocale
34 void testFormat(/* char* par */);
36 * perform tests using aNumber and fFormat, called in many variations
38 void tryIt(double aNumber
);
40 * perform tests using aNumber and fFormat, called in many variations
42 void tryIt(int32_t aNumber
);
44 * test NumberFormat::getAvailableLocales
46 void testAvailableLocales(/* char* par */);
48 * call testLocale for all locales
50 void monsterTest(/* char *par */);
52 * call testFormat for currency, percent and plain number instances
54 void testLocale(/* char *par, */const Locale
& locale
, const UnicodeString
& localeName
);
56 NumberFormat
* fFormat
;
62 virtual ~IntlTestNumberFormat();
65 * Return a random double that isn't too large.
67 static double getSafeDouble(double smallerThanMax
);
70 * Return a random double
72 static double randDouble();
75 * Return a random uint32_t
77 static uint32_t randLong();
80 * Return a random double 0 <= x < 1.0
82 static double randFraction()
84 return (double)randLong() / (double)0xFFFFFFFF;
89 #endif /* #if !UCONFIG_NO_FORMATTING */