2017-01-20 00:20:31 +00:00
|
|
|
// © 2016 and later: Unicode, Inc. and others.
|
2016-06-15 18:58:17 +00:00
|
|
|
// License & terms of use: http://www.unicode.org/copyright.html
|
2007-07-27 03:25:38 +00:00
|
|
|
/*************************************************************************
|
2016-05-31 21:45:07 +00:00
|
|
|
* Copyright (c) 1999-2016, International Business Machines
|
|
|
|
* Corporation and others. All Rights Reserved.
|
2007-07-27 03:25:38 +00:00
|
|
|
*************************************************************************
|
|
|
|
* Date Name Description
|
|
|
|
* 12/15/99 Madhu Creation.
|
|
|
|
* 01/12/2000 Madhu Updated for changed API and added new tests
|
|
|
|
************************************************************************/
|
2000-01-17 20:59:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
#ifndef RBBITEST_H
|
|
|
|
#define RBBITEST_H
|
|
|
|
|
2002-09-21 00:43:14 +00:00
|
|
|
#include "unicode/utypes.h"
|
|
|
|
|
|
|
|
#if !UCONFIG_NO_BREAK_ITERATION
|
2000-01-17 20:59:08 +00:00
|
|
|
|
2018-03-27 05:03:10 +00:00
|
|
|
#include <memory>
|
|
|
|
|
2000-01-17 20:59:08 +00:00
|
|
|
#include "intltest.h"
|
|
|
|
#include "unicode/brkiter.h"
|
2016-03-07 20:26:37 +00:00
|
|
|
#include "unicode/rbbi.h"
|
2007-05-29 22:56:20 +00:00
|
|
|
|
2003-05-27 16:29:25 +00:00
|
|
|
class Enumeration;
|
|
|
|
class BITestData;
|
2003-05-16 22:05:35 +00:00
|
|
|
struct TestParams;
|
2003-05-27 16:29:25 +00:00
|
|
|
class RBBIMonkeyKind;
|
2000-01-17 20:59:08 +00:00
|
|
|
|
2007-05-29 22:56:20 +00:00
|
|
|
U_NAMESPACE_BEGIN
|
|
|
|
class UVector32;
|
|
|
|
U_NAMESPACE_END
|
|
|
|
|
2000-01-17 20:59:08 +00:00
|
|
|
/**
|
|
|
|
* Test the RuleBasedBreakIterator class giving different rules
|
|
|
|
*/
|
|
|
|
class RBBITest: public IntlTest {
|
|
|
|
public:
|
2005-03-23 02:13:53 +00:00
|
|
|
|
2002-08-27 19:10:11 +00:00
|
|
|
RBBITest();
|
2002-08-28 15:55:37 +00:00
|
|
|
virtual ~RBBITest();
|
2002-08-27 19:10:11 +00:00
|
|
|
|
2000-08-14 21:42:36 +00:00
|
|
|
void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
|
2005-03-23 02:13:53 +00:00
|
|
|
|
2002-08-27 19:10:11 +00:00
|
|
|
void TestGetAvailableLocales();
|
|
|
|
void TestGetDisplayName();
|
|
|
|
void TestEndBehaviour();
|
|
|
|
void TestBug4153072();
|
|
|
|
void TestJapaneseLineBreak();
|
|
|
|
void TestThaiLineBreak();
|
2005-03-23 02:13:53 +00:00
|
|
|
void TestMixedThaiLineBreak();
|
|
|
|
void TestMaiyamok();
|
2016-05-14 00:34:18 +00:00
|
|
|
void TestMonkey();
|
2000-01-17 20:59:08 +00:00
|
|
|
|
2003-05-16 22:05:35 +00:00
|
|
|
void TestExtended();
|
2007-05-29 22:56:20 +00:00
|
|
|
UChar *ReadAndConvertFile(const char *fileName, int &ulen, const char *encoding, UErrorCode &status);
|
2014-05-17 00:44:39 +00:00
|
|
|
void executeTest(TestParams *, UErrorCode &status);
|
2003-05-16 22:05:35 +00:00
|
|
|
|
2003-11-05 23:50:39 +00:00
|
|
|
void TestWordBreaks();
|
|
|
|
void TestWordBoundary();
|
|
|
|
void TestLineBreaks();
|
|
|
|
void TestSentBreaks();
|
2004-06-09 18:12:01 +00:00
|
|
|
void TestBug3818();
|
2004-10-21 01:03:01 +00:00
|
|
|
void TestJapaneseWordBreak();
|
2006-03-29 23:33:02 +00:00
|
|
|
void TestTrieDict();
|
2007-05-29 22:56:20 +00:00
|
|
|
void TestUnicodeFiles();
|
2007-07-10 18:11:43 +00:00
|
|
|
void TestBug5775();
|
2009-04-22 07:53:50 +00:00
|
|
|
void TestTailoredBreaks();
|
2009-09-10 23:17:38 +00:00
|
|
|
void TestDictRules();
|
2010-07-23 00:15:37 +00:00
|
|
|
void TestBug5532();
|
2013-03-01 00:26:35 +00:00
|
|
|
void TestBug9983();
|
2016-05-14 00:34:18 +00:00
|
|
|
void TestBug7547();
|
2016-10-10 21:49:01 +00:00
|
|
|
void TestBug12797();
|
2017-01-18 19:42:33 +00:00
|
|
|
void TestBug12918();
|
2017-02-13 21:04:32 +00:00
|
|
|
void TestBug12932();
|
2017-03-23 00:20:20 +00:00
|
|
|
void TestEmoji();
|
2017-07-31 20:20:37 +00:00
|
|
|
void TestBug12519();
|
2018-02-03 19:10:50 +00:00
|
|
|
void TestBug12677();
|
2018-02-08 01:42:04 +00:00
|
|
|
void TestTableRedundancies();
|
2018-02-27 22:53:26 +00:00
|
|
|
void TestBug13447();
|
2018-03-27 05:03:10 +00:00
|
|
|
void TestReverse();
|
|
|
|
void TestReverse(std::unique_ptr<RuleBasedBreakIterator>bi);
|
2018-04-09 21:42:14 +00:00
|
|
|
void TestBug13692();
|
2007-05-29 22:56:20 +00:00
|
|
|
|
2005-03-23 02:13:53 +00:00
|
|
|
void TestDebug();
|
2011-12-08 22:37:24 +00:00
|
|
|
void TestProperties();
|
2005-03-23 02:13:53 +00:00
|
|
|
|
2000-01-17 20:59:08 +00:00
|
|
|
/***********************/
|
|
|
|
private:
|
|
|
|
/**
|
|
|
|
* internal methods to prepare test data
|
|
|
|
**/
|
2005-03-23 02:13:53 +00:00
|
|
|
|
2005-07-08 01:57:58 +00:00
|
|
|
void RunMonkey(BreakIterator *bi, RBBIMonkeyKind &mk, const char *name, uint32_t seed,
|
|
|
|
int32_t loopCount, UBool useUText);
|
2003-05-27 16:29:25 +00:00
|
|
|
|
2007-05-29 22:56:20 +00:00
|
|
|
// Run one of the Unicode Consortium boundary test data files.
|
2007-05-30 22:34:39 +00:00
|
|
|
void runUnicodeTestData(const char *fileName, RuleBasedBreakIterator *bi);
|
2007-05-29 22:56:20 +00:00
|
|
|
|
|
|
|
// Run a single test case from one of the Unicode Consortium test files.
|
2007-05-30 22:34:39 +00:00
|
|
|
void checkUnicodeTestCase(const char *testFileName, int lineNumber,
|
2007-05-29 22:56:20 +00:00
|
|
|
const UnicodeString &testString,
|
|
|
|
UVector32 *breakPositions,
|
|
|
|
RuleBasedBreakIterator *bi);
|
2009-04-22 07:53:50 +00:00
|
|
|
|
|
|
|
// Run the actual tests for TestTailoredBreaks()
|
|
|
|
void TBTest(BreakIterator* brkitr, int type, const char *locale, const char* escapedText,
|
|
|
|
const int32_t *expectOffsets, int32_t expectOffsetsCount);
|
2014-12-03 23:43:47 +00:00
|
|
|
|
|
|
|
/** Filter for test cases from the Unicode test data files.
|
|
|
|
* Some need to be skipped because ICU is unable to fully implement the
|
|
|
|
* Unicode boundary specifications.
|
|
|
|
* @param testCase the test data string.
|
|
|
|
* @param fileName the Unicode test data file name.
|
|
|
|
* @return FALSE if the test case should be run, TRUE if it should be skipped.
|
|
|
|
*/
|
|
|
|
UBool testCaseIsKnownIssue(const UnicodeString &testCase, const char *fileName);
|
2016-05-14 00:34:18 +00:00
|
|
|
|
|
|
|
// Test parameters, from the test framework and test invocation.
|
|
|
|
const char* fTestParams;
|
2000-01-17 20:59:08 +00:00
|
|
|
};
|
|
|
|
|
2002-09-21 00:43:14 +00:00
|
|
|
#endif /* #if !UCONFIG_NO_BREAK_ITERATION */
|
2000-01-17 20:59:08 +00:00
|
|
|
|
|
|
|
#endif
|