]> granicus.if.org Git - icu/commitdiff
ICU-13267 Minor documentation and test changes.
authorShane Carr <shane@unicode.org>
Thu, 8 Nov 2018 00:16:47 +0000 (16:16 -0800)
committerShane F. Carr <shane@unicode.org>
Fri, 9 Nov 2018 00:13:39 +0000 (17:13 -0700)
icu4c/source/common/static_unicode_sets.h
icu4c/source/test/intltest/numbertest_api.cpp

index 5f18b3217eae2bb5909165bdb31443db14cebc42..0332ee663730cff7a30858bb56cd4ee305e6ea11 100644 (file)
@@ -1,7 +1,17 @@
 // © 2018 and later: Unicode, Inc. and others.
 // License & terms of use: http://www.unicode.org/copyright.html
 
+// This file contains utilities to deal with static-allocated UnicodeSets.
+//
+// Common use case: you write a "private static final" UnicodeSet in Java, and
+// want something similarly easy in C++.  Originally written for number
+// parsing, but this header can be used for other applications.
+//
+// Main entrypoint: `unisets::get(unisets::MY_SET_ID_HERE)`
+//
 // This file is in common instead of i18n because it is needed by ucurr.cpp.
+//
+// Author: sffc
 
 #include "unicode/utypes.h"
 
@@ -69,6 +79,13 @@ enum Key {
  *
  * Exported as U_COMMON_API for ucurr.cpp
  *
+ * This method is always safe and OK to chain: in the case of a memory or other
+ * error, it returns an empty set from static memory.
+ * 
+ * Example:
+ * 
+ *     UBool hasIgnorables = unisets::get(unisets::DEFAULT_IGNORABLES)->contains(...);
+ *
  * @param key The desired UnicodeSet according to the enum in this file.
  * @return The requested UnicodeSet. Guaranteed to be frozen and non-null, but
  *         may be empty if an error occurred during data loading.
@@ -99,6 +116,7 @@ U_COMMON_API Key chooseFrom(UnicodeString str, Key key1);
  */
 U_COMMON_API Key chooseFrom(UnicodeString str, Key key1, Key key2);
 
+// TODO: Load these from data: ICU-20108
 // Unused in C++:
 // Key chooseCurrency(UnicodeString str);
 // Used instead:
index 992464f357d4c97553e4941a27bb86d6f0b44ded..ae297595462537d77e9240f70ba24c2466b2d283 100644 (file)
@@ -2339,6 +2339,11 @@ void NumberFormatterApiTest::errors() {
 }
 
 void NumberFormatterApiTest::validRanges() {
+    if (quick) {
+        // Do not run this test except in exhaustive mode.
+        // (somewhat slow to check all permutations of settings)
+        return;
+    }
 
 #define EXPECTED_MAX_INT_FRAC_SIG 999