ICU-6344 disable search if break iteration is on

X-SVN-Rev: 24260
This commit is contained in:
Steven R. Loomis 2008-06-20 22:53:25 +00:00
parent 478fb8b161
commit 1a359a2fe6
12 changed files with 38 additions and 16 deletions

View file

@ -9,7 +9,7 @@
#include "unicode/utypes.h"
#if !UCONFIG_NO_COLLATION
#if !UCONFIG_NO_COLLATION && !UCONFIG_NO_BREAK_ITERATION
#include "unicode/brkiter.h"
#include "unicode/schriter.h"

View file

@ -9,7 +9,7 @@
#include "unicode/utypes.h"
#if !UCONFIG_NO_COLLATION
#if !UCONFIG_NO_COLLATION && !UCONFIG_NO_BREAK_ITERATION
#include "unicode/stsearch.h"
#include "usrchimp.h"

View file

@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (C) 2001-2005 IBM and others. All rights reserved.
* Copyright (C) 2001-2008 IBM and others. All rights reserved.
**********************************************************************
* Date Name Description
* 03/22/2000 helena Creation.
@ -17,7 +17,7 @@
* \brief C++ API: SearchIterator object.
*/
#if !UCONFIG_NO_COLLATION
#if !UCONFIG_NO_COLLATION && !UCONFIG_NO_BREAK_ITERATION
#include "unicode/uobject.h"
#include "unicode/unistr.h"

View file

@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (C) 2001-2007 IBM and others. All rights reserved.
* Copyright (C) 2001-2008 IBM and others. All rights reserved.
**********************************************************************
* Date Name Description
* 03/22/2000 helena Creation.
@ -17,7 +17,7 @@
* \brief C++ API: Service for searching text based on RuleBasedCollator.
*/
#if !UCONFIG_NO_COLLATION
#if !UCONFIG_NO_COLLATION && !UCONFIG_NO_BREAK_ITERATION
#include "unicode/tblcoll.h"
#include "unicode/coleitr.h"

View file

@ -11,7 +11,7 @@
#include "unicode/utypes.h"
#if !UCONFIG_NO_COLLATION
#if !UCONFIG_NO_COLLATION && !UCONFIG_NO_BREAK_ITERATION
#include "unicode/ucol.h"
#include "unicode/ucoleitr.h"
@ -761,6 +761,6 @@ U_INTERNAL UBool U_EXPORT2 usearch_searchBackwards(UStringSearch *strsrch,
int32_t *matchLimit,
UErrorCode *status);
#endif /* #if !UCONFIG_NO_COLLATION */
#endif /* #if !UCONFIG_NO_COLLATION && !UCONFIG_NO_BREAK_ITERATION */
#endif

View file

@ -9,7 +9,7 @@
#include "unicode/utypes.h"
#if !UCONFIG_NO_COLLATION
#if !UCONFIG_NO_COLLATION && !UCONFIG_NO_BREAK_ITERATION
#include "unicode/usearch.h"
#include "unicode/ustring.h"

View file

@ -44,8 +44,9 @@ void addCollTest(TestNode** root)
addCollIterTest(root);
addAllCollTest(root);
addMiscCollTest(root);
#if !UCONFIG_NO_BREAK_ITERATION
addSearchTest(root);
#endif
}

View file

@ -10,7 +10,7 @@
#include "unicode/utypes.h"
#if !UCONFIG_NO_COLLATION
#if !UCONFIG_NO_COLLATION && !UCONFIG_NO_BREAK_ITERATION
#include "unicode/usearch.h"
#include "unicode/ustring.h"

View file

@ -34,9 +34,13 @@
// public contructors and destructors --------------------------------------
StringSearchTest::StringSearchTest() :
StringSearchTest::StringSearchTest()
#if !UCONFIG_NO_BREAK_ITERATION
:
m_en_wordbreaker_(NULL), m_en_characterbreaker_(NULL)
#endif
{
#if !UCONFIG_NO_BREAK_ITERATION
UErrorCode status = U_ZERO_ERROR;
m_en_us_ = (RuleBasedCollator *)Collator::createInstance("en_US", status);
@ -79,10 +83,12 @@ StringSearchTest::StringSearchTest() :
m_en_characterbreaker_ = BreakIterator::createCharacterInstance(
Locale::getEnglish(), status);
#endif
#endif
}
StringSearchTest::~StringSearchTest()
{
#if !UCONFIG_NO_BREAK_ITERATION
delete m_en_us_;
delete m_fr_fr_;
delete m_de_;
@ -91,6 +97,7 @@ StringSearchTest::~StringSearchTest()
delete m_en_wordbreaker_;
delete m_en_characterbreaker_;
#endif
#endif
}
// public methods ----------------------------------------------------------
@ -98,6 +105,7 @@ StringSearchTest::~StringSearchTest()
void StringSearchTest::runIndexedTest(int32_t index, UBool exec,
const char* &name, char* )
{
#if !UCONFIG_NO_BREAK_ITERATION
UBool areBroken = FALSE;
if (m_en_us_ == NULL && m_fr_fr_ == NULL && m_de_ == NULL &&
m_es_ == NULL && m_en_wordbreaker_ == NULL &&
@ -157,8 +165,12 @@ void StringSearchTest::runIndexedTest(int32_t index, UBool exec,
CASE(36, TestDiacriticMatch)
default: name = ""; break;
}
#else
name="";
#endif
}
#if !UCONFIG_NO_BREAK_ITERATION
// private methods ------------------------------------------------------
RuleBasedCollator * StringSearchTest::getCollator(const char *collator)
@ -2362,4 +2374,6 @@ void StringSearchTest::TestCoverage(){
}
}
#endif /* !UCONFIG_NO_BREAK_ITERATION */
#endif /* #if !UCONFIG_NO_COLLATION */

View file

@ -9,7 +9,7 @@
#include "unicode/utypes.h"
#if !UCONFIG_NO_COLLATION
#if !UCONFIG_NO_COLLATION
#include "unicode/tblcoll.h"
#include "unicode/brkiter.h"
@ -27,7 +27,7 @@ public:
void runIndexedTest(int32_t index, UBool exec, const char* &name,
char* par = NULL);
#if !UCONFIG_NO_BREAK_ITERATION
private:
RuleBasedCollator *m_en_us_;
RuleBasedCollator *m_fr_fr_;
@ -89,6 +89,7 @@ private:
void TestSubclass();
void TestCoverage();
void TestDiacriticMatch();
#endif
};
#endif /* #if !UCONFIG_NO_COLLATION */

View file

@ -69,6 +69,7 @@ void SSearchTest::runIndexedTest( int32_t index, UBool exec, const char* &name,
{
if (exec) logln("TestSuite SSearchTest: ");
switch (index) {
#if !UCONFIG_NO_BREAK_ITERATION
case 0: name = "searchTest";
if (exec) searchTest();
break;
@ -80,13 +81,14 @@ void SSearchTest::runIndexedTest( int32_t index, UBool exec, const char* &name,
case 2: name = "monkeyTest";
if (exec) monkeyTest(params);
break;
#endif
default: name = "";
break; //needed to end loop
}
}
#if !UCONFIG_NO_BREAK_ITERATION
#define PATH_BUFFER_SIZE 2048
const char *SSearchTest::getPath(char buffer[2048], const char *filename) {
@ -1697,6 +1699,7 @@ void SSearchTest::monkeyTest(char *params)
ucol_close(coll);
}
#endif
#endif

View file

@ -28,6 +28,7 @@ public:
virtual ~SSearchTest();
virtual void runIndexedTest(int32_t index, UBool exec, const char* &name, char* params = NULL );
#if !UCONFIG_NO_BREAK_ITERATION
virtual void searchTest();
virtual void offsetTest();
@ -37,6 +38,8 @@ private:
virtual const char *getPath(char buffer[2048], const char *filename);
virtual int32_t monkeyTestCase(UCollator *coll, const UnicodeString &testCase, const UnicodeString &pattern, const UnicodeString &altPattern,
const char *name, const char *strength, uint32_t seed);
#endif
};
#endif