1 // © 2016 and later: Unicode, Inc. and others. 2 // License & terms of use: http://www.unicode.org/copyright.html 3 /******************************************************************** 4 * COPYRIGHT: 5 * Copyright (c) 1997-2013, International Business Machines Corporation and 6 * others. All Rights Reserved. 7 ********************************************************************/ 8 9 #ifndef _PluralRulesTest 10 #define _PluralRulesTest 11 12 #include "unicode/utypes.h" 13 14 #if !UCONFIG_NO_FORMATTING 15 16 #include "intltest.h" 17 #include "number_decimalquantity.h" 18 #include "unicode/localpointer.h" 19 #include "unicode/plurrule.h" 20 21 /** 22 * Test basic functionality of various API functions 23 **/ 24 class PluralRulesTest : public IntlTest { 25 void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override; 26 27 private: 28 /** 29 * Performs tests on many API functions, see detailed comments in source code 30 **/ 31 void testAPI(); 32 void testGetUniqueKeywordValue(); 33 void testGetSamples(); 34 void testGetDecimalQuantitySamples(); 35 void testGetOrAddSamplesFromString(); 36 void testGetOrAddSamplesFromStringCompactNotation(); 37 void testSamplesWithExponent(); 38 void testSamplesWithCompactNotation(); 39 void testWithin(); 40 void testGetAllKeywordValues(); 41 void testCompactDecimalPluralKeyword(); 42 void testDoubleValue(); 43 void testLongValue(); 44 void testScientificPluralKeyword(); 45 void testOrdinal(); 46 void testSelect(); 47 void testSelectRange(); 48 void testAvailableLocales(); 49 void testParseErrors(); 50 void testFixedDecimal(); 51 void testSelectTrailingZeros(); 52 void testLocaleExtension(); 53 void testDoubleEqualSign(); 54 void test22638LongNumberValue(); 55 56 void assertRuleValue(const UnicodeString& rule, double expected); 57 void assertRuleKeyValue(const UnicodeString& rule, const UnicodeString& key, 58 double expected); 59 void checkNewSamples(UnicodeString description, 60 const LocalPointer<PluralRules> &test, 61 UnicodeString keyword, 62 UnicodeString samplesString, 63 ::icu::number::impl::DecimalQuantity firstInRange); 64 UnicodeString getPluralKeyword(const LocalPointer<PluralRules> &rules, 65 Locale locale, double number, const char16_t* skeleton); 66 void checkSelect(const LocalPointer<PluralRules> &rules, UErrorCode &status, 67 int32_t line, const char *keyword, ...); 68 void compareLocaleResults(const char* loc1, const char* loc2, const char* loc3); 69 }; 70 71 #endif /* #if !UCONFIG_NO_FORMATTING */ 72 73 #endif 74