]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/test/cintltst/putiltst.c
ICU-491.11.1.tar.gz
[apple/icu.git] / icuSources / test / cintltst / putiltst.c
index 84a519501cf2bd2fb7cf32e9406aca690da80257..8d18f6cf56209cda9b5f494f70966de26f1cdf71 100644 (file)
@@ -1,6 +1,6 @@
 /********************************************************************
  * 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);
@@ -185,14 +202,13 @@ static void TestPUtilAPI(void){
     }
 }
 
-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;
 
@@ -280,15 +296,10 @@ static void TestVersion()
     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[] = {
@@ -643,23 +654,11 @@ static void toolutil_findDirname(void)
       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]));
@@ -691,6 +690,7 @@ static void toolutil_findDirname(void)
 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: