scuffed-code/icu4c/source/test/intltest/tsnmfmt.h

87 lines
2.0 KiB
C
Raw Normal View History

/********************************************************************
* COPYRIGHT:
* Copyright (c) 1997-2001, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
1999-08-16 21:50:52 +00:00
#ifndef _INTLTESTNUMBERFORMAT
#define _INTLTESTNUMBERFORMAT
#include <stdlib.h>
#include "unicode/numfmt.h"
#include "unicode/fmtable.h"
#include "unicode/locid.h"
#include "intltest.h"
1999-08-16 21:50:52 +00:00
/**
* 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 );
1999-08-16 21:50:52 +00:00
private:
/**
* call tryIt with many variations, called by testLocale
**/
void testFormat(/* char* par */);
1999-08-16 21:50:52 +00:00
/**
* 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 */);
1999-08-16 21:50:52 +00:00
/**
* call testLocale for all locales
**/
void monsterTest(/* char *par */);
1999-08-16 21:50:52 +00:00
/**
* call testFormat for currency, percent and plain number instances
**/
void testLocale(/* char *par, */const Locale& locale, const UnicodeString& localeName);
1999-08-16 21:50:52 +00:00
NumberFormat* fFormat;
UErrorCode fStatus;
Locale fLocale;
1999-08-16 21:50:52 +00:00
public:
virtual ~IntlTestNumberFormat() {}
/*
* Return a random double that isn't too large.
*/
static double IntlTestNumberFormat::getSafeDouble(double smallerThanMax);
/*
* Return a random double
**/
static double randDouble();
/*
* Return a random uint32_t
**/
static uint32_t randLong();
1999-08-16 21:50:52 +00:00
/**
* Return a random double 0 <= x < 1.0
**/
static double randFraction()
{
return (double)randLong() / (double)0xFFFFFFFF;
}
1999-08-16 21:50:52 +00:00
};
#endif