mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-13 08:53:20 +00:00
ICU-5445 Fix some compiler warnings.
X-SVN-Rev: 22043
This commit is contained in:
parent
7b023cc660
commit
211578fa68
6 changed files with 203 additions and 203 deletions
|
@ -1,6 +1,6 @@
|
|||
/********************************************************************
|
||||
* COPYRIGHT:
|
||||
* Copyright (c) 1997-2006, International Business Machines Corporation and
|
||||
* Copyright (c) 1997-2007, International Business Machines Corporation and
|
||||
* others. All Rights Reserved.
|
||||
********************************************************************/
|
||||
/* file name: cbididat.c
|
||||
|
@ -18,13 +18,13 @@
|
|||
#include "cbiditst.h"
|
||||
|
||||
const char * const
|
||||
dirPropNames[dirPropCount]={
|
||||
dirPropNames[U_CHAR_DIRECTION_COUNT]={
|
||||
"L", "R", "EN", "ES", "ET", "AN", "CS", "B", "S", "WS", "ON",
|
||||
"LRE", "LRO", "AL", "RLE", "RLO", "PDF", "NSM", "BN"
|
||||
};
|
||||
|
||||
UChar
|
||||
charFromDirProp[dirPropCount]={
|
||||
charFromDirProp[U_CHAR_DIRECTION_COUNT]={
|
||||
/* L R EN ES ET AN CS B S WS ON */
|
||||
0x61, 0x5d0, 0x30, 0x2f, 0x25, 0x660, 0x2c, 0xa, 0x9, 0x20, 0x26,
|
||||
/* LRE LRO AL RLE RLO PDF NSM BN */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/********************************************************************
|
||||
* COPYRIGHT:
|
||||
* Copyright (c) 1997-2006, International Business Machines Corporation and
|
||||
* Copyright (c) 1997-2007, International Business Machines Corporation and
|
||||
* others. All Rights Reserved.
|
||||
********************************************************************/
|
||||
/* file name: cbiditst.cpp
|
||||
|
@ -2028,7 +2028,7 @@ getBiDiObject(void) {
|
|||
#define MAKE_ITEMS(val) val, #val
|
||||
|
||||
static const struct {
|
||||
uint32_t value;
|
||||
UBiDiReorderingMode value;
|
||||
const char* description;
|
||||
}
|
||||
modes[] = {
|
||||
|
@ -2037,7 +2037,11 @@ modes[] = {
|
|||
{ MAKE_ITEMS(UBIDI_REORDER_NUMBERS_SPECIAL) },
|
||||
{ MAKE_ITEMS(UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL) },
|
||||
{ MAKE_ITEMS(UBIDI_REORDER_INVERSE_NUMBERS_AS_L) }
|
||||
},
|
||||
};
|
||||
static const struct {
|
||||
uint32_t value;
|
||||
const char* description;
|
||||
}
|
||||
options[] = {
|
||||
{ MAKE_ITEMS(UBIDI_OPTION_INSERT_MARKS) },
|
||||
{ MAKE_ITEMS(0) }
|
||||
|
@ -2615,7 +2619,8 @@ testReorderingMode() {
|
|||
UBiDi *pBiDi = NULL, *pBiDi2 = NULL, *pBiDi3 = NULL;
|
||||
UErrorCode rc;
|
||||
int tc, mode, option, level;
|
||||
uint32_t modeValue, modeBack, optionValue, optionBack;
|
||||
uint32_t modeBack, optionValue, optionBack;
|
||||
UBiDiReorderingMode modeValue;
|
||||
int32_t srcLen, destLen, index;
|
||||
const char *expectedChars;
|
||||
UBool testOK = TRUE;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/********************************************************************
|
||||
* COPYRIGHT:
|
||||
* Copyright (c) 1997-2006, International Business Machines Corporation and
|
||||
* Copyright (c) 1997-2007, International Business Machines Corporation and
|
||||
* others. All Rights Reserved.
|
||||
********************************************************************/
|
||||
/* file name: cbiditst.h
|
||||
|
@ -32,34 +32,31 @@ extern "C" {
|
|||
is easier with the same names for the BiDi types in the code as there.
|
||||
See UCharDirection in uchar.h .
|
||||
*/
|
||||
enum {
|
||||
L= U_LEFT_TO_RIGHT,
|
||||
R= U_RIGHT_TO_LEFT,
|
||||
EN= U_EUROPEAN_NUMBER,
|
||||
ES= U_EUROPEAN_NUMBER_SEPARATOR,
|
||||
ET= U_EUROPEAN_NUMBER_TERMINATOR,
|
||||
AN= U_ARABIC_NUMBER,
|
||||
CS= U_COMMON_NUMBER_SEPARATOR,
|
||||
B= U_BLOCK_SEPARATOR,
|
||||
S= U_SEGMENT_SEPARATOR,
|
||||
WS= U_WHITE_SPACE_NEUTRAL,
|
||||
ON= U_OTHER_NEUTRAL,
|
||||
LRE=U_LEFT_TO_RIGHT_EMBEDDING,
|
||||
LRO=U_LEFT_TO_RIGHT_OVERRIDE,
|
||||
AL= U_RIGHT_TO_LEFT_ARABIC,
|
||||
RLE=U_RIGHT_TO_LEFT_EMBEDDING,
|
||||
RLO=U_RIGHT_TO_LEFT_OVERRIDE,
|
||||
PDF=U_POP_DIRECTIONAL_FORMAT,
|
||||
NSM=U_DIR_NON_SPACING_MARK,
|
||||
BN= U_BOUNDARY_NEUTRAL,
|
||||
dirPropCount
|
||||
};
|
||||
#define L U_LEFT_TO_RIGHT
|
||||
#define R U_RIGHT_TO_LEFT
|
||||
#define EN U_EUROPEAN_NUMBER
|
||||
#define ES U_EUROPEAN_NUMBER_SEPARATOR
|
||||
#define ET U_EUROPEAN_NUMBER_TERMINATOR
|
||||
#define AN U_ARABIC_NUMBER
|
||||
#define CS U_COMMON_NUMBER_SEPARATOR
|
||||
#define B U_BLOCK_SEPARATOR
|
||||
#define S U_SEGMENT_SEPARATOR
|
||||
#define WS U_WHITE_SPACE_NEUTRAL
|
||||
#define ON U_OTHER_NEUTRAL
|
||||
#define LRE U_LEFT_TO_RIGHT_EMBEDDING
|
||||
#define LRO U_LEFT_TO_RIGHT_OVERRIDE
|
||||
#define AL U_RIGHT_TO_LEFT_ARABIC
|
||||
#define RLE U_RIGHT_TO_LEFT_EMBEDDING
|
||||
#define RLO U_RIGHT_TO_LEFT_OVERRIDE
|
||||
#define PDF U_POP_DIRECTIONAL_FORMAT
|
||||
#define NSM U_DIR_NON_SPACING_MARK
|
||||
#define BN U_BOUNDARY_NEUTRAL
|
||||
|
||||
extern const char * const
|
||||
dirPropNames[dirPropCount];
|
||||
dirPropNames[U_CHAR_DIRECTION_COUNT];
|
||||
|
||||
extern UChar
|
||||
charFromDirProp[dirPropCount];
|
||||
charFromDirProp[U_CHAR_DIRECTION_COUNT];
|
||||
|
||||
typedef struct {
|
||||
const uint8_t *text;
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
#define MAX_TOKEN_LEN 16
|
||||
|
||||
typedef int tst_strcoll(void *collator, const int object,
|
||||
typedef UCollationResult tst_strcoll(void *collator, const int object,
|
||||
const UChar *source, const int sLen,
|
||||
const UChar *target, const int tLen);
|
||||
|
||||
|
@ -153,7 +153,7 @@ const static char shifted[][20] = {
|
|||
};
|
||||
|
||||
const static UCollationResult shiftedTert[] = {
|
||||
0,
|
||||
UCOL_EQUAL,
|
||||
UCOL_EQUAL,
|
||||
UCOL_EQUAL,
|
||||
UCOL_LESS,
|
||||
|
@ -2035,20 +2035,18 @@ static void TestCase(void)
|
|||
|
||||
const static UCollationResult caseTestResults[][9] =
|
||||
{
|
||||
{ UCOL_LESS, UCOL_LESS, UCOL_LESS, 0, UCOL_LESS, UCOL_LESS, 0, 0, UCOL_LESS },
|
||||
{ UCOL_GREATER, UCOL_LESS, UCOL_LESS, 0, UCOL_LESS, UCOL_LESS, 0, 0, UCOL_GREATER },
|
||||
{ UCOL_LESS, UCOL_LESS, UCOL_LESS, 0, UCOL_GREATER, UCOL_LESS, 0, 0, UCOL_LESS },
|
||||
{ UCOL_GREATER, UCOL_LESS, UCOL_GREATER, 0, UCOL_LESS, UCOL_LESS, 0, 0, UCOL_GREATER }
|
||||
|
||||
{ UCOL_LESS, UCOL_LESS, UCOL_LESS, UCOL_EQUAL, UCOL_LESS, UCOL_LESS, UCOL_EQUAL, UCOL_EQUAL, UCOL_LESS },
|
||||
{ UCOL_GREATER, UCOL_LESS, UCOL_LESS, UCOL_EQUAL, UCOL_LESS, UCOL_LESS, UCOL_EQUAL, UCOL_EQUAL, UCOL_GREATER },
|
||||
{ UCOL_LESS, UCOL_LESS, UCOL_LESS, UCOL_EQUAL, UCOL_GREATER, UCOL_LESS, UCOL_EQUAL, UCOL_EQUAL, UCOL_LESS },
|
||||
{ UCOL_GREATER, UCOL_LESS, UCOL_GREATER, UCOL_EQUAL, UCOL_LESS, UCOL_LESS, UCOL_EQUAL, UCOL_EQUAL, UCOL_GREATER }
|
||||
};
|
||||
|
||||
const static UColAttributeValue caseTestAttributes[][2] =
|
||||
{
|
||||
{ UCOL_LOWER_FIRST, UCOL_OFF},
|
||||
{ UCOL_UPPER_FIRST, UCOL_OFF},
|
||||
{ UCOL_LOWER_FIRST, UCOL_ON},
|
||||
{ UCOL_UPPER_FIRST, UCOL_ON}
|
||||
|
||||
{ UCOL_LOWER_FIRST, UCOL_OFF},
|
||||
{ UCOL_UPPER_FIRST, UCOL_OFF},
|
||||
{ UCOL_LOWER_FIRST, UCOL_ON},
|
||||
{ UCOL_UPPER_FIRST, UCOL_ON}
|
||||
};
|
||||
int32_t i,j,k;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
****************************************************************************
|
||||
* Copyright (c) 1997-2006, International Business Machines Corporation and *
|
||||
* Copyright (c) 1997-2007, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
****************************************************************************
|
||||
*/
|
||||
|
@ -65,11 +65,11 @@ static int64_t ranMax;
|
|||
static void initRandom(int64_t min, int64_t max)
|
||||
{
|
||||
uint64_t interval = max - min;
|
||||
|
||||
|
||||
ranMin = min;
|
||||
ranMax = max;
|
||||
ranInt = 0;
|
||||
|
||||
|
||||
if (interval < U_INT64_MIN) {
|
||||
ranInt = interval;
|
||||
}
|
||||
|
@ -78,70 +78,70 @@ static void initRandom(int64_t min, int64_t max)
|
|||
static int64_t randomInRange(void)
|
||||
{
|
||||
int64_t value;
|
||||
|
||||
|
||||
if (ranInt != 0) {
|
||||
value = randomInt64() % ranInt;
|
||||
|
||||
|
||||
if (value < 0) {
|
||||
value = -value;
|
||||
}
|
||||
|
||||
|
||||
value += ranMin;
|
||||
} else {
|
||||
do {
|
||||
value = randomInt64();
|
||||
} while (value < ranMin || value > ranMax);
|
||||
}
|
||||
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
static void roundTripTest(int64_t value, int32_t scale)
|
||||
|
||||
static void roundTripTest(int64_t value, UDateTimeScale scale)
|
||||
{
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
int64_t rt = utmscale_toInt64(utmscale_fromInt64(value, scale, &status), scale, &status);
|
||||
|
||||
|
||||
if (rt != value) {
|
||||
log_err("Round-trip error: time scale = %d, value = %lld, round-trip = %lld.\n", scale, value, rt);
|
||||
}
|
||||
}
|
||||
|
||||
static void toLimitTest(int64_t toLimit, int64_t fromLimit, int32_t scale)
|
||||
static void toLimitTest(int64_t toLimit, int64_t fromLimit, UDateTimeScale scale)
|
||||
{
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
int64_t result = utmscale_toInt64(toLimit, scale, &status);
|
||||
|
||||
|
||||
if (result != fromLimit) {
|
||||
log_err("toLimit failure: scale = %d, toLimit = %lld , utmscale_toInt64(toLimit, scale, &status) = %lld, fromLimit = %lld.\n",
|
||||
scale, toLimit, result, fromLimit);
|
||||
}
|
||||
}
|
||||
|
||||
static void epochOffsetTest(int64_t epochOffset, int64_t units, int32_t scale)
|
||||
static void epochOffsetTest(int64_t epochOffset, int64_t units, UDateTimeScale scale)
|
||||
{
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
int64_t universal = 0;
|
||||
int64_t universalEpoch = epochOffset * units;
|
||||
int64_t local = utmscale_toInt64(universalEpoch, scale, &status);
|
||||
|
||||
|
||||
if (local != 0) {
|
||||
log_err("utmscale_toInt64(epochOffset, scale, &status): scale = %d epochOffset = %lld, result = %lld.\n", scale, epochOffset, local);
|
||||
}
|
||||
|
||||
|
||||
local = utmscale_toInt64(0, scale, &status);
|
||||
|
||||
|
||||
if (local != -epochOffset) {
|
||||
log_err("utmscale_toInt64(0, scale): scale = %d, result = %lld.\n", scale, local);
|
||||
}
|
||||
|
||||
|
||||
universal = utmscale_fromInt64(-epochOffset, scale, &status);
|
||||
|
||||
|
||||
if (universal != 0) {
|
||||
log_err("from(-epochOffest, scale): scale = %d, epochOffset = %lld, result = %lld.\n", scale, epochOffset, universal);
|
||||
}
|
||||
|
||||
|
||||
universal = utmscale_fromInt64(0, scale, &status);
|
||||
|
||||
|
||||
if (universal != universalEpoch) {
|
||||
log_err("utmscale_fromInt64(0, scale): scale = %d, result = %lld.\n", scale, universal);
|
||||
}
|
||||
|
@ -153,10 +153,10 @@ static void TestEpochOffsets(void)
|
|||
int32_t scale;
|
||||
|
||||
for (scale = 0; scale < UDTS_MAX_SCALE; scale += 1) {
|
||||
int64_t units = utmscale_getTimeScaleValue(scale, UTSV_UNITS_VALUE, &status);
|
||||
int64_t epochOffset = utmscale_getTimeScaleValue(scale, UTSV_EPOCH_OFFSET_VALUE, &status);
|
||||
|
||||
epochOffsetTest(epochOffset, units, scale);
|
||||
int64_t units = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_UNITS_VALUE, &status);
|
||||
int64_t epochOffset = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_EPOCH_OFFSET_VALUE, &status);
|
||||
|
||||
epochOffsetTest(epochOffset, units, (UDateTimeScale)scale);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -166,11 +166,11 @@ static void TestFromLimits(void)
|
|||
int32_t scale;
|
||||
|
||||
for (scale = 0; scale < UDTS_MAX_SCALE; scale += 1) {
|
||||
int64_t fromMin = utmscale_getTimeScaleValue(scale, UTSV_FROM_MIN_VALUE, &status);
|
||||
int64_t fromMax = utmscale_getTimeScaleValue(scale, UTSV_FROM_MAX_VALUE, &status);
|
||||
|
||||
roundTripTest(fromMin, scale);
|
||||
roundTripTest(fromMax, scale);
|
||||
int64_t fromMin = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_FROM_MIN_VALUE, &status);
|
||||
int64_t fromMax = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_FROM_MAX_VALUE, &status);
|
||||
|
||||
roundTripTest(fromMin, (UDateTimeScale)scale);
|
||||
roundTripTest(fromMax, (UDateTimeScale)scale);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -180,13 +180,13 @@ static void TestToLimits(void)
|
|||
int32_t scale;
|
||||
|
||||
for (scale = 0; scale < UDTS_MAX_SCALE; scale += 1) {
|
||||
int64_t fromMin = utmscale_getTimeScaleValue(scale, UTSV_FROM_MIN_VALUE, &status);
|
||||
int64_t fromMax = utmscale_getTimeScaleValue(scale, UTSV_FROM_MAX_VALUE, &status);
|
||||
int64_t toMin = utmscale_getTimeScaleValue(scale, UTSV_TO_MIN_VALUE, &status);
|
||||
int64_t toMax = utmscale_getTimeScaleValue(scale, UTSV_TO_MAX_VALUE, &status);
|
||||
|
||||
toLimitTest(toMin, fromMin, scale);
|
||||
toLimitTest(toMax, fromMax, scale);
|
||||
int64_t fromMin = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_FROM_MIN_VALUE, &status);
|
||||
int64_t fromMax = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_FROM_MAX_VALUE, &status);
|
||||
int64_t toMin = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_TO_MIN_VALUE, &status);
|
||||
int64_t toMax = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_TO_MAX_VALUE, &status);
|
||||
|
||||
toLimitTest(toMin, fromMin, (UDateTimeScale)scale);
|
||||
toLimitTest(toMax, fromMax, (UDateTimeScale)scale);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -195,54 +195,54 @@ static void TestFromInt64(void)
|
|||
int32_t scale;
|
||||
int64_t result;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
||||
|
||||
result = utmscale_fromInt64(0, -1, &status);
|
||||
if (status != U_ILLEGAL_ARGUMENT_ERROR) {
|
||||
log_err("utmscale_fromInt64(0, -1, status) did not set status to U_ILLEGAL_ARGUMENT_ERROR.\n");
|
||||
}
|
||||
|
||||
|
||||
for (scale = 0; scale < UDTS_MAX_SCALE; scale += 1) {
|
||||
int64_t fromMin, fromMax;
|
||||
|
||||
|
||||
status = U_ZERO_ERROR;
|
||||
fromMin = utmscale_getTimeScaleValue(scale, UTSV_FROM_MIN_VALUE, &status);
|
||||
fromMax = utmscale_getTimeScaleValue(scale, UTSV_FROM_MAX_VALUE, &status);
|
||||
|
||||
fromMin = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_FROM_MIN_VALUE, &status);
|
||||
fromMax = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_FROM_MAX_VALUE, &status);
|
||||
|
||||
status = U_ZERO_ERROR;
|
||||
result = utmscale_fromInt64(0, scale, &status);
|
||||
result = utmscale_fromInt64(0, (UDateTimeScale)scale, &status);
|
||||
if (status == U_ILLEGAL_ARGUMENT_ERROR) {
|
||||
log_err("utmscale_fromInt64(0, %d, &status) generated U_ILLEGAL_ARGUMENT_ERROR.\n", scale);
|
||||
}
|
||||
|
||||
|
||||
status = U_ZERO_ERROR;
|
||||
result = utmscale_fromInt64(fromMin, scale, &status);
|
||||
result = utmscale_fromInt64(fromMin, (UDateTimeScale)scale, &status);
|
||||
if (status == U_ILLEGAL_ARGUMENT_ERROR) {
|
||||
log_err("utmscale_fromInt64(fromMin, %d, &status) generated U_ILLEGAL_ARGUMENT_ERROR.\n", scale);
|
||||
}
|
||||
|
||||
if (fromMin > U_INT64_MIN) {
|
||||
|
||||
if (fromMin > U_INT64_MIN) {
|
||||
status = U_ZERO_ERROR;
|
||||
result = utmscale_fromInt64(fromMin - 1, scale, &status);
|
||||
result = utmscale_fromInt64(fromMin - 1, (UDateTimeScale)scale, &status);
|
||||
if (status != U_ILLEGAL_ARGUMENT_ERROR) {
|
||||
log_err("utmscale_fromInt64(fromMin - 1, %d, &status) did not generate U_ILLEGAL_ARGUMENT_ERROR.\n", scale);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
status = U_ZERO_ERROR;
|
||||
result = utmscale_fromInt64(fromMax, scale, &status);
|
||||
result = utmscale_fromInt64(fromMax, (UDateTimeScale)scale, &status);
|
||||
if (status == U_ILLEGAL_ARGUMENT_ERROR) {
|
||||
log_err("utmscale_fromInt64(fromMax, %d, &status) generated U_ILLEGAL_ARGUMENT_ERROR.\n", scale);
|
||||
}
|
||||
|
||||
|
||||
if (fromMax < U_INT64_MAX) {
|
||||
status = U_ZERO_ERROR;
|
||||
result = utmscale_fromInt64(fromMax + 1, scale, &status);
|
||||
result = utmscale_fromInt64(fromMax + 1, (UDateTimeScale)scale, &status);
|
||||
if (status != U_ILLEGAL_ARGUMENT_ERROR) {
|
||||
log_err("utmscale_fromInt64(fromMax + 1, %d, &status) didn't generate U_ILLEGAL_ARGUMENT_ERROR.\n", scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
status = U_ZERO_ERROR;
|
||||
result = utmscale_fromInt64(0, UDTS_MAX_SCALE, &status);
|
||||
if (status != U_ILLEGAL_ARGUMENT_ERROR) {
|
||||
|
@ -255,55 +255,55 @@ static void TestToInt64(void)
|
|||
int32_t scale;
|
||||
int64_t result;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
||||
|
||||
result = utmscale_toInt64(0, -1, &status);
|
||||
if (status != U_ILLEGAL_ARGUMENT_ERROR) {
|
||||
log_err("utmscale_toInt64(0, -1, &status) did not generate U_ILLEGAL_ARGUMENT_ERROR.\n");
|
||||
}
|
||||
|
||||
|
||||
for (scale = 0; scale < UDTS_MAX_SCALE; scale += 1) {
|
||||
int64_t toMin, toMax;
|
||||
|
||||
|
||||
status = U_ZERO_ERROR;
|
||||
toMin = utmscale_getTimeScaleValue(scale, UTSV_TO_MIN_VALUE, &status);
|
||||
toMax = utmscale_getTimeScaleValue(scale, UTSV_TO_MAX_VALUE, &status);
|
||||
|
||||
status = U_ZERO_ERROR;
|
||||
result = utmscale_toInt64(0, scale, &status);
|
||||
result = utmscale_toInt64(0, (UDateTimeScale)scale, &status);
|
||||
if (status == U_ILLEGAL_ARGUMENT_ERROR) {
|
||||
log_err("utmscale_toInt64(0, %d, &status) generated U_ILLEGAL_ARGUMENT_ERROR.\n", scale);
|
||||
}
|
||||
|
||||
|
||||
status = U_ZERO_ERROR;
|
||||
result = utmscale_toInt64(toMin, scale, &status);
|
||||
result = utmscale_toInt64(toMin, (UDateTimeScale)scale, &status);
|
||||
if (status == U_ILLEGAL_ARGUMENT_ERROR) {
|
||||
log_err("utmscale_toInt64(toMin, %d, &status) generated U_ILLEGAL_ARGUMENT_ERROR.\n", scale);
|
||||
}
|
||||
|
||||
|
||||
if (toMin > U_INT64_MIN) {
|
||||
status = U_ZERO_ERROR;
|
||||
result = utmscale_toInt64(toMin - 1, scale, &status);
|
||||
result = utmscale_toInt64(toMin - 1, (UDateTimeScale)scale, &status);
|
||||
if (status != U_ILLEGAL_ARGUMENT_ERROR) {
|
||||
log_err("utmscale_toInt64(toMin - 1, %d, &status) did not generate U_ILLEGAL_ARGUMENT_ERROR.\n", scale);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
status = U_ZERO_ERROR;
|
||||
result = utmscale_toInt64(toMax, scale, &status);
|
||||
result = utmscale_toInt64(toMax, (UDateTimeScale)scale, &status);
|
||||
if (status == U_ILLEGAL_ARGUMENT_ERROR) {
|
||||
log_err("utmscale_toInt64(toMax, %d, &status) generated U_ILLEGAL_ARGUMENT_ERROR.\n", scale);
|
||||
}
|
||||
|
||||
|
||||
if (toMax < U_INT64_MAX) {
|
||||
status = U_ZERO_ERROR;
|
||||
result = utmscale_toInt64(toMax + 1, scale, &status);
|
||||
result = utmscale_toInt64(toMax + 1, (UDateTimeScale)scale, &status);
|
||||
if (status != U_ILLEGAL_ARGUMENT_ERROR) {
|
||||
log_err("utmscale_toInt64(toMax + 1, %d, &status) did not generate U_ILLEGAL_ARGUMENT_ERROR.\n", scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
status = U_ZERO_ERROR;
|
||||
result = utmscale_toInt64(0, UDTS_MAX_SCALE, &status);
|
||||
if (status != U_ILLEGAL_ARGUMENT_ERROR) {
|
||||
|
@ -328,18 +328,18 @@ static void TestMonkey(void)
|
|||
{
|
||||
int32_t scale;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
||||
|
||||
for (scale = 0; scale < UDTS_MAX_SCALE; scale += 1) {
|
||||
int64_t fromMin = utmscale_getTimeScaleValue(scale, UTSV_FROM_MIN_VALUE, &status);
|
||||
int64_t fromMax = utmscale_getTimeScaleValue(scale, UTSV_FROM_MAX_VALUE, &status);
|
||||
int64_t fromMin = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_FROM_MIN_VALUE, &status);
|
||||
int64_t fromMax = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_FROM_MAX_VALUE, &status);
|
||||
int32_t i;
|
||||
|
||||
|
||||
initRandom(fromMin, fromMax);
|
||||
|
||||
|
||||
for (i = 0; i < LOOP_COUNT; i += 1) {
|
||||
int64_t value = randomInRange();
|
||||
|
||||
roundTripTest(value, scale);
|
||||
|
||||
roundTripTest(value, (UDateTimeScale)scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-2006, International Business Machines
|
||||
* Copyright (C) 1999-2007, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
|
@ -80,7 +80,7 @@ main(int argc, char* argv[]) {
|
|||
"\toptions:\n"
|
||||
"\t\t-h or -? or --help this usage text\n"
|
||||
"\t\t-d or --destdir destination directory, followed by the path\n"
|
||||
"\t\t-r or --genres generate resource file testtable32.txt instead of UData test \n",
|
||||
"\t\t-r or --genres generate resource file testtable32.txt instead of UData test \n"
|
||||
"\t\t-j or --javastuff generate Java source for DebugUtilities. \n",
|
||||
argv[0]);
|
||||
return argc<0 ? U_ILLEGAL_ARGUMENT_ERROR : U_ZERO_ERROR;
|
||||
|
@ -139,14 +139,14 @@ createData(const char* outputDirectory, UErrorCode *errorCode) {
|
|||
|
||||
static int
|
||||
outputJavaStuff(const char* progname, const char *outputDir) {
|
||||
int32_t i,t,count;
|
||||
int32_t i,t,count;
|
||||
char file[512];
|
||||
FILE *out;
|
||||
|
||||
uprv_strcpy(file,outputDir);
|
||||
if(*outputDir && /* don't put a trailing slash if outputDir is empty */
|
||||
file[strlen(file)-1]!=U_FILE_SEP_CHAR) {
|
||||
uprv_strcat(file,U_FILE_SEP_STRING);
|
||||
file[strlen(file)-1]!=U_FILE_SEP_CHAR) {
|
||||
uprv_strcat(file,U_FILE_SEP_STRING);
|
||||
}
|
||||
uprv_strcat(file,"DebugUtilitiesData.java");
|
||||
out = fopen(file, "w");
|
||||
|
@ -154,93 +154,93 @@ outputJavaStuff(const char* progname, const char *outputDir) {
|
|||
printf("%s: Generating %s\n", progname, file);
|
||||
if(out == NULL) {
|
||||
fprintf(stderr, "%s: Couldn't create resource test file %s\n",
|
||||
progname, file);
|
||||
progname, file);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
fprintf(out, "/** Copyright (C) 2007, International Business Machines Corporation and Others. All Rights Reserved. **/\n\n");
|
||||
fprintf(out, "/* NOTE: this file is AUTOMATICALLY GENERATED by gentest. */\n\n");
|
||||
fprintf(out, "package com.ibm.icu.dev.test.util;\n\n");
|
||||
fprintf(out, "public class DebugUtilitiesData extends Object {\n");
|
||||
fprintf(out, " public static final String ICU4C_VERSION=\"%s\";\n", U_ICU_VERSION);
|
||||
for(t=0;t<UDBG_ENUM_COUNT;t++) {
|
||||
fprintf(out, " public static final int %s = %d;\n", udbg_enumName(UDBG_UDebugEnumType,t), t);
|
||||
}
|
||||
fprintf(out, " public static final String [] TYPES = { \n");
|
||||
for(t=0;t<UDBG_ENUM_COUNT;t++) {
|
||||
fprintf(out, " \"%s\", /* %d */\n", udbg_enumName(UDBG_UDebugEnumType,t), t);
|
||||
}
|
||||
fprintf(out, " };\n\n");
|
||||
fprintf(out, "package com.ibm.icu.dev.test.util;\n\n");
|
||||
fprintf(out, "public class DebugUtilitiesData extends Object {\n");
|
||||
fprintf(out, " public static final String ICU4C_VERSION=\"%s\";\n", U_ICU_VERSION);
|
||||
for(t=0;t<UDBG_ENUM_COUNT;t++) {
|
||||
fprintf(out, " public static final int %s = %d;\n", udbg_enumName(UDBG_UDebugEnumType,t), t);
|
||||
}
|
||||
fprintf(out, " public static final String [] TYPES = { \n");
|
||||
for(t=0;t<UDBG_ENUM_COUNT;t++) {
|
||||
fprintf(out, " \"%s\", /* %d */\n", udbg_enumName(UDBG_UDebugEnumType,t), t);
|
||||
}
|
||||
fprintf(out, " };\n\n");
|
||||
|
||||
fprintf(out, " public static final String [][] NAMES = { \n");
|
||||
for(t=0;t<UDBG_ENUM_COUNT;t++) {
|
||||
count = udbg_enumCount((UDebugEnumType)t);
|
||||
fprintf(out, " /* %s */\n", udbg_enumName(UDBG_UDebugEnumType,t), t);
|
||||
fprintf(out, " { \n");
|
||||
for(i=0;i<count;i++) {
|
||||
fprintf(out,
|
||||
" \"%s\", /* %d */ \n", udbg_enumName((UDebugEnumType)t,i), i);
|
||||
}
|
||||
fprintf(out, " },\n");
|
||||
}
|
||||
fprintf(out, " };\n\n");
|
||||
fprintf(out, " public static final String [][] NAMES = { \n");
|
||||
for(t=0;t<UDBG_ENUM_COUNT;t++) {
|
||||
count = udbg_enumCount((UDebugEnumType)t);
|
||||
fprintf(out, " /* %s, %d */\n", udbg_enumName(UDBG_UDebugEnumType,t), t);
|
||||
fprintf(out, " { \n");
|
||||
for(i=0;i<count;i++) {
|
||||
fprintf(out,
|
||||
" \"%s\", /* %d */ \n", udbg_enumName((UDebugEnumType)t,i), i);
|
||||
}
|
||||
fprintf(out, " },\n");
|
||||
}
|
||||
fprintf(out, " };\n\n");
|
||||
|
||||
fprintf(out, " public static final int [][] VALUES = { \n");
|
||||
for(t=0;t<UDBG_ENUM_COUNT;t++) {
|
||||
count = udbg_enumCount((UDebugEnumType)t);
|
||||
fprintf(out, " /* %s */\n", udbg_enumName(UDBG_UDebugEnumType,t), t);
|
||||
fprintf(out, " { \n");
|
||||
for(i=0;i<count;i++) {
|
||||
fprintf(out,
|
||||
" ");
|
||||
switch(t) {
|
||||
case UDBG_UCalendarDateFields:
|
||||
case UDBG_UCalendarMonths:
|
||||
fprintf(out, "com.ibm.icu.util.Calendar.%s, /* %d */", udbg_enumName((UDebugEnumType)t,i), i);
|
||||
break;
|
||||
case UDBG_UDebugEnumType:
|
||||
default:
|
||||
fprintf(out,"%d, /* %s */", i, udbg_enumName((UDebugEnumType)t,i));
|
||||
}
|
||||
fprintf(out,"\n");
|
||||
}
|
||||
fprintf(out, " },\n");
|
||||
}
|
||||
fprintf(out, " };\n\n");
|
||||
fprintf(out, "}\n");
|
||||
|
||||
fclose(out);
|
||||
|
||||
return 0;
|
||||
fprintf(out, " public static final int [][] VALUES = { \n");
|
||||
for(t=0;t<UDBG_ENUM_COUNT;t++) {
|
||||
count = udbg_enumCount((UDebugEnumType)t);
|
||||
fprintf(out, " /* %s, %d */\n", udbg_enumName(UDBG_UDebugEnumType,t), t);
|
||||
fprintf(out, " { \n");
|
||||
for(i=0;i<count;i++) {
|
||||
fprintf(out,
|
||||
" ");
|
||||
switch(t) {
|
||||
case UDBG_UCalendarDateFields:
|
||||
case UDBG_UCalendarMonths:
|
||||
fprintf(out, "com.ibm.icu.util.Calendar.%s, /* %d */", udbg_enumName((UDebugEnumType)t,i), i);
|
||||
break;
|
||||
case UDBG_UDebugEnumType:
|
||||
default:
|
||||
fprintf(out,"%d, /* %s */", i, udbg_enumName((UDebugEnumType)t,i));
|
||||
}
|
||||
fprintf(out,"\n");
|
||||
}
|
||||
fprintf(out, " },\n");
|
||||
}
|
||||
fprintf(out, " };\n\n");
|
||||
fprintf(out, "}\n");
|
||||
|
||||
#if 0
|
||||
int32_t count = udbg_enumCount((UDebugEnumType)t);
|
||||
if(count == -1) {
|
||||
fprintf(stderr,"%s: enumCount(%d) returned -1\n", progname, count);
|
||||
return 1;
|
||||
}
|
||||
for(t=0;t<=UDBG_ENUM_COUNT;t++) {
|
||||
int32_t count = udbg_enumCount((UDebugEnumType)t);
|
||||
if(count == -1) {
|
||||
fprintf(stderr,"%s: enumCount(%d) returned -1\n", progname, count);
|
||||
return 1;
|
||||
}
|
||||
for(i=0;i<=count;i++) {
|
||||
if(i<count) {
|
||||
if( i!=udbg_enumArrayValue((UDebugEnumType)t, i)) {
|
||||
fprintf(stderr, "%s: FAIL: udbg_enumArrayValue(%d,%d) returned %d, expected %d\n", progname, t, i, udbg_enumArrayValue((UDebugEnumType)t,i), i);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "%s: udbg_enumArrayValue(%d,%d) = %s, returned %d\n", progname, t, i,
|
||||
udbg_enumName((UDebugEnumType)t,i), udbg_enumArrayValue((UDebugEnumType)t,i));
|
||||
}
|
||||
if(udbg_enumExpectedCount((UDebugEnumType)t) != count) {
|
||||
fprintf(stderr, "%s: FAIL: udbg_enumExpectedCount(%d): %d, != UCAL_FIELD_COUNT=%d \n", progname, t, udbg_enumExpectedCount((UDebugEnumType)t), count);
|
||||
return 1;
|
||||
} else {
|
||||
fprintf(stderr, "%s: udbg_ucal_fieldCount: %d, UCAL_FIELD_COUNT=udbg_enumCount %d ", progname, udbg_enumExpectedCount((UDebugEnumType)t), count);
|
||||
}
|
||||
}
|
||||
fclose(out);
|
||||
|
||||
return 0;
|
||||
|
||||
#if 0
|
||||
int32_t count = udbg_enumCount((UDebugEnumType)t);
|
||||
if(count == -1) {
|
||||
fprintf(stderr,"%s: enumCount(%d) returned -1\n", progname, count);
|
||||
return 1;
|
||||
}
|
||||
for(t=0;t<=UDBG_ENUM_COUNT;t++) {
|
||||
int32_t count = udbg_enumCount((UDebugEnumType)t);
|
||||
if(count == -1) {
|
||||
fprintf(stderr,"%s: enumCount(%d) returned -1\n", progname, count);
|
||||
return 1;
|
||||
}
|
||||
for(i=0;i<=count;i++) {
|
||||
if(i<count) {
|
||||
if( i!=udbg_enumArrayValue((UDebugEnumType)t, i)) {
|
||||
fprintf(stderr, "%s: FAIL: udbg_enumArrayValue(%d,%d) returned %d, expected %d\n", progname, t, i, udbg_enumArrayValue((UDebugEnumType)t,i), i);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "%s: udbg_enumArrayValue(%d,%d) = %s, returned %d\n", progname, t, i,
|
||||
udbg_enumName((UDebugEnumType)t,i), udbg_enumArrayValue((UDebugEnumType)t,i));
|
||||
}
|
||||
if(udbg_enumExpectedCount((UDebugEnumType)t) != count) {
|
||||
fprintf(stderr, "%s: FAIL: udbg_enumExpectedCount(%d): %d, != UCAL_FIELD_COUNT=%d \n", progname, t, udbg_enumExpectedCount((UDebugEnumType)t), count);
|
||||
return 1;
|
||||
} else {
|
||||
fprintf(stderr, "%s: udbg_ucal_fieldCount: %d, UCAL_FIELD_COUNT=udbg_enumCount %d ", progname, udbg_enumExpectedCount((UDebugEnumType)t), count);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue