• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "unicode/localpointer.h"
18 #include "unicode/plurrule.h"
19 
20 /**
21  * Test basic functionality of various API functions
22  **/
23 class PluralRulesTest : public IntlTest {
24     void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
25 
26 private:
27     /**
28      * Performs tests on many API functions, see detailed comments in source code
29      **/
30     void testAPI();
31     void testGetUniqueKeywordValue();
32     void testGetSamples();
33     void testGetFixedDecimalSamples();
34     void testSamplesWithExponent();
35     void testSamplesWithCompactNotation();
36     void testWithin();
37     void testGetAllKeywordValues();
38     void testCompactDecimalPluralKeyword();
39     void testDoubleValue();
40     void testLongValue();
41     void testScientificPluralKeyword();
42     void testOrdinal();
43     void testSelect();
44     void testSelectRange();
45     void testAvailableLocales();
46     void testParseErrors();
47     void testFixedDecimal();
48     void testSelectTrailingZeros();
49     void testLocaleExtension();
50 
51     void assertRuleValue(const UnicodeString& rule, double expected);
52     void assertRuleKeyValue(const UnicodeString& rule, const UnicodeString& key,
53                             double expected);
54     void checkNewSamples(UnicodeString description,
55                          const LocalPointer<PluralRules> &test,
56                          UnicodeString keyword,
57                          UnicodeString samplesString,
58                          FixedDecimal firstInRange);
59     UnicodeString getPluralKeyword(const LocalPointer<PluralRules> &rules,
60                                    Locale locale, double number, const char16_t* skeleton);
61     void checkSelect(const LocalPointer<PluralRules> &rules, UErrorCode &status,
62                                   int32_t line, const char *keyword, ...);
63     void compareLocaleResults(const char* loc1, const char* loc2, const char* loc3);
64 };
65 
66 #endif /* #if !UCONFIG_NO_FORMATTING */
67 
68 #endif
69