blob: 076a464467d2c852ebc56fe97fb1d27e003efc82 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
/********************************************************************
* COPYRIGHT:
* Copyright (c) 1997-2003, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
#ifndef _INTLTESTNUMBERFORMAT
#define _INTLTESTNUMBERFORMAT
#include "unicode/utypes.h"
#if !UCONFIG_NO_FORMATTING
#include "unicode/numfmt.h"
#include "unicode/locid.h"
#include "intltest.h"
/**
* This test does round-trip testing (format -> parse -> format -> parse -> etc.) of
* NumberFormat.
*/
class IntlTestNumberFormat: public IntlTest {
void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
private:
/**
* call tryIt with many variations, called by testLocale
**/
void testFormat(/* char* par */);
/**
* perform tests using aNumber and fFormat, called in many variations
**/
void tryIt(double aNumber);
/**
* perform tests using aNumber and fFormat, called in many variations
**/
void tryIt(int32_t aNumber);
/**
* test NumberFormat::getAvailableLocales
**/
void testAvailableLocales(/* char* par */);
/**
* call testLocale for all locales
**/
void monsterTest(/* char *par */);
/**
* call testFormat for currency, percent and plain number instances
**/
void testLocale(/* char *par, */const Locale& locale, const UnicodeString& localeName);
NumberFormat* fFormat;
UErrorCode fStatus;
Locale fLocale;
public:
virtual ~IntlTestNumberFormat();
/*
* Return a random double that isn't too large.
*/
static double getSafeDouble(double smallerThanMax);
/*
* Return a random double
**/
static double randDouble();
/*
* Return a random uint32_t
**/
static uint32_t randLong();
/**
* Return a random double 0 <= x < 1.0
**/
static double randFraction()
{
return (double)randLong() / (double)0xFFFFFFFF;
}
};
#endif /* #if !UCONFIG_NO_FORMATTING */
#endif
|