1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 *******************************************************************************
6 * Copyright (C) 2012-2013, International Business Machines
7 * Corporation and others. All Rights Reserved.
9 *******************************************************************************
10 * file name: listformattertest.cpp
12 * tab size: 8 (not used)
15 * created on: 2012aug27
16 * created by: Umesh P. Nair
19 #ifndef __LISTFORMATTERTEST_H__
20 #define __LISTFORMATTERTEST_H__
22 #include "unicode/fpositer.h"
23 #include "unicode/listformatter.h"
27 #if !UCONFIG_NO_FORMATTING
29 class ListFormatterTest
: public IntlTestWithFieldPosition
{
32 virtual ~ListFormatterTest() {}
34 void runIndexedTest(int32_t index
, UBool exec
, const char *&name
, char *par
=0);
42 void TestChineseTradHK();
46 void TestOutOfOrderPatterns();
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();
63 const ListFormatter
* formatter
,
66 const UnicodeString
& expected_result
,
67 const char* testName
);
69 FieldPositionIterator
& iter
,
72 void RunTestFieldPositionIteratorWithNItems(
77 UnicodeString
& appendTo
,
78 const char16_t *expectedFormatted
,
79 const char* testName
);
80 void RunTestFieldPositionIteratorWithNItemsPatternShift(
85 UnicodeString
& appendTo
,
86 const char16_t *expectedFormatted
,
87 const char* testName
);
88 void RunTestFieldPositionIteratorWithFormatter(
89 ListFormatter
* formatter
,
94 UnicodeString
& appendTo
,
95 const char16_t *expectedFormatted
,
96 const char* testName
);
98 const char* locale_string
,
103 UnicodeString results
[4],
104 const char* testName
);
105 UBool
RecordFourCases(
106 const Locale
& locale
,
111 UnicodeString results
[4],
112 const char* testName
);
113 void DoTheRealListStyleTesting(
115 UnicodeString items
[],
118 const char* expected
,
119 IcuTestErrorCode status
);
123 const UnicodeString prefix
;
124 const UnicodeString one
;
125 const UnicodeString two
;
126 const UnicodeString three
;
127 const UnicodeString four
;
130 #endif /* #if !UCONFIG_NO_FORMATTING */