/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1998-2010, International Business Machines Corporation and
+ * Copyright (c) 1998-2011, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/*
#include "uinvchar.h"
#include <stdio.h>
+/* See the comments on U_SIGNED_RIGHT_SHIFT_IS_ARITHMETIC. */
+static void TestSignedRightShiftIsArithmetic() {
+ int32_t x=0xfff5fff3;
+ int32_t m=-1;
+ int32_t x4=x>>4;
+ int32_t m1=m>>1;
+ UBool signedRightShiftIsArithmetic= x4==0xffff5fff && m1==-1;
+ if(signedRightShiftIsArithmetic==U_SIGNED_RIGHT_SHIFT_IS_ARITHMETIC) {
+ log_info("signed right shift is Arithmetic Shift Right: %d\n",
+ signedRightShiftIsArithmetic);
+ } else {
+ log_err("error: unexpected signed right shift is Arithmetic Shift Right: %d\n"
+ " You need to change the value of U_SIGNED_RIGHT_SHIFT_IS_ARITHMETIC "
+ "for your platform.\n",
+ signedRightShiftIsArithmetic);
+ }
+}
static UBool compareWithNAN(double x, double y);
static void doAssert(double expect, double got, const char *message);
}
}
-static void TestVersion()
+static void TestVersion(void)
{
UVersionInfo versionArray = {0x01, 0x00, 0x02, 0x02};
UVersionInfo versionArray2 = {0x01, 0x00, 0x02, 0x02};
char versionString[17]; /* xxx.xxx.xxx.xxx\0 */
UChar versionUString[] = { 0x0031, 0x002E, 0x0030, 0x002E,
0x0032, 0x002E, 0x0038, 0x0000 }; /* 1.0.2.8 */
- UBool isModified = FALSE;
UVersionInfo version;
UErrorCode status = U_ZERO_ERROR;
u_getDataVersion(version, &status);
if (U_FAILURE(status)) {
log_data_err("ERROR: Unable to get data version. %s\n", u_errorName(status));
- } else {
- u_isDataOlder(version, &isModified, &status);
- if (U_FAILURE(status)) {
- log_err("ERROR: Unable to compare data version. %s\n", u_errorName(status));
- }
}
}
-static void TestCompareVersions()
+static void TestCompareVersions(void)
{
/* use a 1d array to be palatable to java */
const char *testCases[] = {
U_BUFFER_OVERFLOW_ERROR,
NULL
},
- {
- "pkgdata",
- 1,
- U_BUFFER_OVERFLOW_ERROR,
- NULL
- },
{
"pkgdata",
2,
U_ZERO_ERROR,
- "."
- },
- {
- "pkgdata",
- 20,
- U_ZERO_ERROR,
- "."
+ ""
}
};
int32_t count=(sizeof(testCases)/sizeof(testCases[0]));
static void addToolUtilTests(TestNode** root) {
addTest(root, &toolutil_findBasename, "putiltst/toolutil/findBasename");
addTest(root, &toolutil_findDirname, "putiltst/toolutil/findDirname");
+ addTest(root, &TestSignedRightShiftIsArithmetic, "putiltst/toolutil/TestSignedRightShiftIsArithmetic");
/*
Not yet tested: