]> git.saurik.com Git - apple/icu.git/blame - icuSources/test/intltest/listformattertest.h
ICU-64252.0.1.tar.gz
[apple/icu.git] / icuSources / test / intltest / listformattertest.h
CommitLineData
f3c0d7a5
A
1// © 2016 and later: Unicode, Inc. and others.
2// License & terms of use: http://www.unicode.org/copyright.html
51004dcb
A
3/*
4*******************************************************************************
5*
57a6839d 6* Copyright (C) 2012-2013, International Business Machines
51004dcb
A
7* Corporation and others. All Rights Reserved.
8*
9*******************************************************************************
10* file name: listformattertest.cpp
f3c0d7a5 11* encoding: UTF-8
51004dcb
A
12* tab size: 8 (not used)
13* indentation:4
14*
15* created on: 2012aug27
16* created by: Umesh P. Nair
17*/
18
19#ifndef __LISTFORMATTERTEST_H__
20#define __LISTFORMATTERTEST_H__
21
3d1f044b 22#include "unicode/fpositer.h"
51004dcb
A
23#include "unicode/listformatter.h"
24#include "intltest.h"
3d1f044b 25#include "itformat.h"
51004dcb 26
3d1f044b
A
27#if !UCONFIG_NO_FORMATTING
28
29class ListFormatterTest : public IntlTestWithFieldPosition {
51004dcb
A
30 public:
31 ListFormatterTest();
32 virtual ~ListFormatterTest() {}
33
34 void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par=0);
35
36 void TestRoot();
37 void TestBogus();
38 void TestEnglish();
39 void TestEnglishUS();
f3c0d7a5
A
40 void TestEnglishGB();
41 void TestNynorsk();
42 void TestChineseTradHK();
51004dcb
A
43 void TestRussian();
44 void TestMalayalam();
45 void TestZulu();
46 void TestOutOfOrderPatterns();
57a6839d 47 void Test9946();
3d1f044b
A
48 void TestFieldPositionIteratorWontCrash();
49 void TestFieldPositionIteratorWith1Item();
50 void TestFieldPositionIteratorWith2Items();
51 void TestFieldPositionIteratorWith3Items();
52 void TestFieldPositionIteratorWith1ItemAndDataBefore();
53 void TestFieldPositionIteratorWith2ItemsAndDataBefore();
54 void TestFieldPositionIteratorWith3ItemsAndDataBefore();
55 void TestFieldPositionIteratorWith2ItemsPatternShift();
56 void TestFieldPositionIteratorWith3ItemsPatternShift();
57 void TestFormattedValue();
58 void TestDifferentStyles();
59 void TestBadStylesFail();
51004dcb
A
60
61 private:
3d1f044b
A
62 void CheckFormatting(
63 const ListFormatter* formatter,
64 UnicodeString data[],
65 int32_t data_size,
66 const UnicodeString& expected_result,
67 const char* testName);
68 void ExpectPositions(
69 FieldPositionIterator& iter,
70 int32_t *values,
71 int32_t tupleCount);
72 void RunTestFieldPositionIteratorWithNItems(
73 UnicodeString *data,
74 int32_t n,
75 int32_t *values,
76 int32_t tupleCount,
77 UnicodeString& appendTo,
78 const char16_t *expectedFormatted,
79 const char* testName);
80 void RunTestFieldPositionIteratorWithNItemsPatternShift(
81 UnicodeString *data,
82 int32_t n,
83 int32_t *values,
84 int32_t tupleCount,
85 UnicodeString& appendTo,
86 const char16_t *expectedFormatted,
87 const char* testName);
88 void RunTestFieldPositionIteratorWithFormatter(
89 ListFormatter* formatter,
90 UnicodeString *data,
91 int32_t n,
92 int32_t *values,
93 int32_t tupleCount,
94 UnicodeString& appendTo,
95 const char16_t *expectedFormatted,
96 const char* testName);
51004dcb
A
97 void CheckFourCases(
98 const char* locale_string,
99 UnicodeString one,
100 UnicodeString two,
101 UnicodeString three,
102 UnicodeString four,
3d1f044b
A
103 UnicodeString results[4],
104 const char* testName);
51004dcb
A
105 UBool RecordFourCases(
106 const Locale& locale,
107 UnicodeString one,
108 UnicodeString two,
109 UnicodeString three,
110 UnicodeString four,
3d1f044b
A
111 UnicodeString results[4],
112 const char* testName);
113 void DoTheRealListStyleTesting(
114 Locale locale,
115 UnicodeString items[],
116 int32_t itemCount,
117 const char* style,
118 const char* expected,
119 IcuTestErrorCode status);
51004dcb
A
120
121 private:
122 // Reused test data.
123 const UnicodeString prefix;
124 const UnicodeString one;
125 const UnicodeString two;
126 const UnicodeString three;
127 const UnicodeString four;
128};
129
3d1f044b
A
130#endif /* #if !UCONFIG_NO_FORMATTING */
131
51004dcb 132#endif