]> granicus.if.org Git - icu/commitdiff
ICU-9839 Punctuation exemplar type support. Code is added, but not working because...
authorYoshito Umaoka <y.umaoka@gmail.com>
Fri, 18 Jan 2013 16:29:02 +0000 (16:29 +0000)
committerYoshito Umaoka <y.umaoka@gmail.com>
Fri, 18 Jan 2013 16:29:02 +0000 (16:29 +0000)
X-SVN-Rev: 33062

icu4c/source/i18n/ulocdata.c
icu4c/source/i18n/unicode/ulocdata.h
icu4c/source/test/cintltst/cloctst.c
icu4c/source/test/cintltst/cloctst.h

index 19f3bf42b614e16066b06472ba7de7d7b0937054..5034bb7a2c2685d5e599d5cdaeb714058b86e40b 100644 (file)
@@ -1,7 +1,7 @@
 /*
 ******************************************************************************
 *                                                                            *
-* Copyright (C) 2003-2012, International Business Machines                   *
+* Copyright (C) 2003-2013, International Business Machines                   *
 *                Corporation and others. All Rights Reserved.                *
 *                                                                            *
 ******************************************************************************
@@ -102,7 +102,8 @@ ulocdata_getExemplarSet(ULocaleData *uld, USet *fillIn,
 
     static const char* const exemplarSetTypes[] = { "ExemplarCharacters", 
                                                     "AuxExemplarCharacters", 
-                                                    "ExemplarCharactersIndex"};
+                                                    "ExemplarCharactersIndex",
+                                                    "ExemplarCharactersPunctuation"};
     const UChar *exemplarChars = NULL;
     int32_t len = 0;
     UErrorCode localStatus = U_ZERO_ERROR;
index d9dd79e5208fc1d83205212fccbaffaffe96bb82..2dd2c12a3e2763e21c04f552bcbdfd789a9dc8d2 100644 (file)
@@ -1,7 +1,7 @@
 /*
 ******************************************************************************
 *                                                                            *
-* Copyright (C) 2003-2012, International Business Machines                   *
+* Copyright (C) 2003-2013, International Business Machines                   *
 *                Corporation and others. All Rights Reserved.                *
 *                                                                            *
 ******************************************************************************
@@ -45,8 +45,10 @@ typedef enum ULocaleDataExemplarSetType  {
     ULOCDATA_ES_AUXILIARY=1,
     /** Index Character set @stable ICU 4.8 */
     ULOCDATA_ES_INDEX=2,
+    /** Punctuation set @draft ICU 51 */
+    ULOCDATA_ES_PUNCTUATION=3,
     /** One higher than the last valid type @stable ICU 3.4 */
-    ULOCDATA_ES_COUNT=3
+    ULOCDATA_ES_COUNT=4
 } ULocaleDataExemplarSetType;
 
 /** The possible types of delimiters.
index e3c6d717ace6ed39e4b6c35df62e70d968302dac..81171da69b5789f01d5b5c7c2c868ae823574aed 100644 (file)
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT:
- * Copyright (c) 1997-2012, International Business Machines Corporation and
+ * Copyright (c) 1997-2013, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 /*****************************************************************************
@@ -244,6 +244,7 @@ void addLocaleTest(TestNode** root)
     TESTCASE(TestForLanguageTag);
     TESTCASE(TestTrailingNull);
     TESTCASE(TestUnicodeDefines);
+    TESTCASE(TestEnglishExemplarCharacters);
 }
 
 
@@ -2509,6 +2510,39 @@ static void TestGetLocale(void) {
     }
 #endif
 }
+static void TestEnglishExemplarCharacters(void) {
+    UErrorCode status = U_ZERO_ERROR;
+    int i;
+    USet *exSet = NULL;
+    UChar testChars[] = {
+        0x61,   /* standard */
+        0xE1,   /* auxiliary */
+        0x41,   /* index */
+        0x2D    /* punctuation */
+    };
+    ULocaleData *uld = ulocdata_open("en", &status);
+    if (U_FAILURE(status)) {
+        log_err("ulocdata_open() failed\n");
+        return;
+    }
+
+    for (i = 0; i < ULOCDATA_ES_COUNT; i++) {
+        exSet = ulocdata_getExemplarSet(uld, exSet, 0, (ULocaleDataExemplarSetType)i, &status);
+        if (U_FAILURE(status)) {
+            /* until pucntuation data problem is resolved */
+            /* log_err_status(status, "ulocdata_getExemplarSet() for type %d failed\n", i); */
+            log_verbose("ulocdata_getExemplarSet() for type %d failed\n", i);
+            status = U_ZERO_ERROR;
+            continue;
+        }
+        if (!uset_contains(exSet, (UChar32)testChars[i])) {
+            log_err("Character U+%04X is not included in exemplar type %d\n", testChars[i], i);
+        }
+    }
+
+    uset_close(exSet);
+    ulocdata_close(uld);
+}
 
 static void TestNonexistentLanguageExemplars(void) {
     /* JB 4068 - Nonexistent language */
index a544f31a02ce5412524e7b7b6b7da3fc278e4596..ac313b3eb9a74bdb48411af1e0144d855f4c440b 100644 (file)
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT:
- * Copyright (c) 1997-2010, International Business Machines Corporation and
+ * Copyright (c) 1997-2013, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 /********************************************************************************
@@ -122,4 +122,10 @@ static void TestLikelySubtags(void);
  */
 static void TestForLanguageTag(void);
 static void TestToLanguageTag(void);
+
+/**
+ * locale data
+ */
+static void TestEnglishExemplarCharacters(void);
+
 #endif