ICU-6344 uconfigtest / hdrtest fixes

X-SVN-Rev: 24157
This commit is contained in:
Steven R. Loomis 2008-06-11 21:52:29 +00:00
parent 4f9498e168
commit d59b5c5e4c
11 changed files with 88 additions and 20 deletions

View File

@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (C) 2002-2007, International Business Machines
* Copyright (C) 2002-2008, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* file name: uconfig.h
@ -15,6 +15,7 @@
#ifndef __UCONFIG_H__
#define __UCONFIG_H__
/*!
* \file
* \brief Switches for excluding parts of ICU library code modules.
@ -34,6 +35,18 @@
* @stable ICU 2.4
*/
/**
* \def UCONFIG_USE_LOCAL
* If this switch is defined, ICU will attempt to load a header file named "uconfig_local.h"
* prior to determining default settings for uconfig variables.
*
* @internal ICU 4.0
*
*/
#if defined(UCONFIG_USE_LOCAL)
#include "uconfig_local.h"
#endif
/**
* \def UCONFIG_ONLY_COLLATION
* This switch turns off modules that are not needed for collation.

View File

@ -10,7 +10,7 @@
#include "unicode/utypes.h"
#if !UCONFIG_NO_TRANSLITERATION
#if !UCONFIG_NO_TRANSLITERATION && !UCONFIG_NO_BREAK_ITERATION
#include "unicode/unifilt.h"
#include "unicode/uchar.h"

View File

@ -12,7 +12,7 @@
#include "unicode/utypes.h"
#if !UCONFIG_NO_TRANSLITERATION
#if !UCONFIG_NO_TRANSLITERATION && !UCONFIG_NO_BREAK_ITERATION
#include "unicode/translit.h"

View File

@ -12,6 +12,14 @@
#ifndef __MSGFMT_IMPL_H__
#define __MSGFMT_IMPL_H__
#include "unicode/utypes.h"
#if !UCONFIG_NO_FORMATTING
#include "unicode/msgfmt.h"
#include "uvector.h"
#include "unicode/strenum.h"
U_NAMESPACE_BEGIN
class FormatNameEnumeration : public StringEnumeration {
@ -31,3 +39,5 @@ private:
U_NAMESPACE_END
#endif
#endif

View File

@ -18,10 +18,10 @@
#include "unicode/plurrule.h"
#include "plurrule_impl.h"
U_NAMESPACE_BEGIN
#if !UCONFIG_NO_FORMATTING
U_NAMESPACE_BEGIN
U_CDECL_BEGIN
static void U_CALLCONV
deleteHashStrings(void *obj) {

View File

@ -1579,12 +1579,17 @@ UBool Transliterator::initializeRegistry(UErrorCode &status) {
TitlecaseTransliterator* tempTitlecaseTranslit = new TitlecaseTransliterator();
UnicodeNameTransliterator* tempUnicodeTranslit = new UnicodeNameTransliterator();
NameUnicodeTransliterator* tempNameUnicodeTranslit = new NameUnicodeTransliterator();
BreakTransliterator* tempBreakTranslit = new BreakTransliterator();
#if !UCONFIG_NO_BREAK_ITERATION
// TODO: could or should these transliterators be referenced polymorphically once constructed?
BreakTransliterator* tempBreakTranslit = new BreakTransliterator();
#endif
// Check for null pointers
if (tempNullTranslit == NULL || tempLowercaseTranslit == NULL || tempUppercaseTranslit == NULL ||
tempTitlecaseTranslit == NULL || tempUnicodeTranslit == NULL ||
tempNameUnicodeTranslit == NULL || tempBreakTranslit == NULL)
#if !UCONFIG_NO_BREAK_ITERATION
tempBreakTranslit == NULL ||
#endif
tempNameUnicodeTranslit == NULL )
{
delete tempNullTranslit;
delete tempLowercaseTranslit;
@ -1592,8 +1597,9 @@ UBool Transliterator::initializeRegistry(UErrorCode &status) {
delete tempTitlecaseTranslit;
delete tempUnicodeTranslit;
delete tempNameUnicodeTranslit;
#if !UCONFIG_NO_BREAK_ITERATION
delete tempBreakTranslit;
#endif
// Since there was an error, remove registry
delete registry;
registry = NULL;
@ -1608,7 +1614,9 @@ UBool Transliterator::initializeRegistry(UErrorCode &status) {
registry->put(tempTitlecaseTranslit, TRUE, status);
registry->put(tempUnicodeTranslit, TRUE, status);
registry->put(tempNameUnicodeTranslit, TRUE, status);
#if !UCONFIG_NO_BREAK_ITERATION
registry->put(tempBreakTranslit, FALSE, status); // FALSE means invisible.
#endif
RemoveTransliterator::registerIDs(); // Must be within mutex
EscapeTransliterator::registerIDs();

View File

@ -2810,9 +2810,11 @@ U_CAPI void U_EXPORT2 usearch_close(UStringSearch *strsrch)
ucol_close((UCollator *)strsrch->collator);
}
#if !UCONFIG_NO_BREAK_ITERATION
if (strsrch->search->internalBreakIter) {
ubrk_close(strsrch->search->internalBreakIter);
}
#endif
uprv_free(strsrch->search);
uprv_free(strsrch);

View File

@ -1,5 +1,5 @@
##
## Copyright (c) 1999-2006, International Business Machines Corporation and
## Copyright (c) 1999-2008, International Business Machines Corporation and
## others. All Rights Reserved.
##
##
@ -23,15 +23,33 @@
##
##
## Source directory information
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = ../..
subdir = test/hdrtst
include $(shell icu-config --incfile)
srcdir=@srcdir@
DIRS=$(prefix)/include/unicode
LDIRS=$(prefix)/include/layout
ECHO_T=@ECHO_T@
ECHO_C=@ECHO_C@
ECHO_N=@ECHO_N@
all:
@echo Please read this Makefile for more information.
@echo run \'$(MAKE) check\' to run the test
E_NUM=8
E_D="[1/$(E_NUM)] Deprecated: "
E_C="[2/$(E_NUM)] C : "
E_CXX="[3/$(E_NUM)] C++: "
E_CXX_L="[4/$(E_NUM)] C++ layout: "
E_DRF="[5/$(E_NUM)] Hide Draft: "
E_DEP="[6/$(E_NUM)] Hide Deprecated: "
E_INT="[7/$(E_NUM)] Hide Internal: "
E_OBS="[8/$(E_NUM)] Hide Obsolete: "
check: dtest ctest cpptest lotest doclean drafttest deprtest internaltest obsoletetest
@echo "All header tests have finished. If deprecation #errors appeared, "
@ -50,7 +68,7 @@ cpptest:
@echo 'the number after the hyphen (-) refers to the exit code - should be zero!'
@for file in `ls $(prefix)/include/unicode/*.h | fgrep -v -f $(srcdir)/pfiles.txt`; do \
incfile=`basename $$file .h` ; \
echo -n "C++ unicode/$$incfile.h - " ; \
echo $(ECHO_N) "$(E_CXX) unicode/$$incfile.h - $(ECHO_C)" ; \
echo '#include "'unicode/$$incfile'.h"' > ht_$$incfile.cpp ; \
echo 'void junk(){}' >> ht_$$incfile.cpp ; \
$(COMPILE.cc) -c $(cppflags) ht_$$incfile.cpp ; \
@ -64,7 +82,7 @@ lotest:
@echo 'the number after the hyphen (-) refers to the exit code - should be zero!'
@for file in $(prefix)/include/layout/*.h; do \
incfile=`basename $$file .h` ; \
echo -n "C++ layout/$$incfile.h - " ; \
echo $(ECHO_N) "$(E_CXX_L) layout/$$incfile.h - $(ECHO_C)" ; \
echo '#include "'layout/$$incfile'.h"' > ht_$$incfile.cpp ; \
echo 'void junk(){}' >> ht_$$incfile.cpp ; \
$(COMPILE.cc) -c $(cppflags) -I$(prefix)/include/layout ht_$$incfile.cpp ; \
@ -78,7 +96,7 @@ dtest:
@for stub in `cat $(srcdir)/dfiles.txt | grep -v '^#'` ; do \
file=unicode/$$stub \
incfile=`basename $$file .h` ; \
echo -n "C++ unicode/$$incfile.h - " ; \
echo $(ECHO_N) "$(E_D) unicode/$$incfile.h - $(ECHO_C)" ; \
echo '#include "'unicode/$$incfile'.h"' > ht_$$incfile.cpp ; \
echo 'void junk(){}' >> ht_$$incfile.cpp ; \
echo > ht_dep.junk ; \
@ -88,6 +106,7 @@ dtest:
fgrep -q "$$incfile.h header is obsolete" ht_dep.junk || echo "** FAIL Header unicode/$$incfile.h is not obsoleted properly" ; \
rm -f unicode/$$stub ; \
done
@echo "$(E_D): Done. (It is possible there are no deprecated headers at the moment.)"
# < ht_dep.junk && ; \
@ -100,7 +119,7 @@ ctest:
@echo 'the number after the hyphen (-) refers to the exit code - should be zero!'
@for file in `ls $(prefix)/include/unicode/*.h | fgrep -v -f $(srcdir)/cxxfiles.txt | tee cfiles.txt`; do \
incfile=`basename $$file .h` ; \
echo -n "C unicode/$$incfile.h - " ; \
echo $(ECHO_N) "$(E_C) unicode/$$incfile.h - $(ECHO_C)" ; \
echo '#include "'unicode/$$incfile'.h"' > ht_$$incfile.c ; \
echo 'void junk(void);' >> ht_$$incfile.c ; \
echo 'void junk(){}' >> ht_$$incfile.c ; \
@ -116,7 +135,7 @@ drafttest:
@echo 'the number after the hyphen (-) refers to the exit code - should be zero!'
@for file in `ls $(prefix)/include/unicode/*.h | fgrep -v -f $(srcdir)/pfiles.txt`; do \
incfile=`basename $$file .h` ; \
echo -n " unicode/$$incfile.h - " ; \
echo $(ECHO_N) "$(E_DRF) unicode/$$incfile.h - $(ECHO_C)" ; \
echo '#define U_HIDE_DRAFT_API' > hd_$$incfile.c; \
echo '#include "'unicode/$$incfile'.h"' >> ht_$$incfile.c ; \
echo 'void junk(void);' >> hd_$$incfile.c ; \
@ -133,7 +152,7 @@ deprtest:
@echo 'the number after the hyphen (-) refers to the exit code - should be zero!'
@for file in `ls $(prefix)/include/unicode/*.h | fgrep -v -f $(srcdir)/pfiles.txt`; do \
incfile=`basename $$file .h` ; \
echo -n " unicode/$$incfile.h - " ; \
echo $(ECHO_N) "$(E_DEP) unicode/$$incfile.h - $(ECHO_C)" ; \
echo '#define U_HIDE_DEPRECATED_API' > hdp_$$incfile.c; \
echo '#include "'unicode/$$incfile'.h"' >> hdp_$$incfile.c ; \
echo 'void junk(void);' >> hdp_$$incfile.c ; \
@ -150,7 +169,7 @@ internaltest:
@echo 'the number after the hyphen (-) refers to the exit code - should be zero!'
@for file in `ls $(prefix)/include/unicode/*.h | fgrep -v -f $(srcdir)/pfiles.txt`; do \
incfile=`basename $$file .h` ; \
echo -n " unicode/$$incfile.h - " ; \
echo $(ECHO_N) "$(E_INT) unicode/$$incfile.h - $(ECHO_C)" ; \
echo '#define U_HIDE_INTERNAL_API' > hin_$$incfile.c; \
echo '#include "'unicode/$$incfile'.h"' >> hin_$$incfile.c ; \
echo 'void junk(void);' >> hin_$$incfile.c ; \
@ -167,7 +186,7 @@ obsoletetest:
@echo 'the number after the hyphen (-) refers to the exit code - should be zero!'
@for file in `ls $(prefix)/include/unicode/*.h | fgrep -v -f $(srcdir)/pfiles.txt`; do \
incfile=`basename $$file .h` ; \
echo -n " unicode/$$incfile.h - " ; \
echo $(ECHO_N) "$(E_OBS) unicode/$$incfile.h - $(ECHO_C)" ; \
echo '#define U_HIDE_OBSOLETE_API' > hob_$$incfile.c; \
echo '#include "'unicode/$$incfile'.h"' >> hob_$$incfile.c ; \
echo 'void junk(void);' >> hob_$$incfile.c ; \
@ -183,6 +202,11 @@ clean:
distclean: clean
-@rm -f Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
.PHONY: doclean check all cpptest lotest dtest ctest clean distclean

View File

@ -2140,6 +2140,7 @@ void LocaleTest::TestCanonicalization(void)
void LocaleTest::TestCurrencyByDate(void)
{
#if !UCONFIG_NO_FORMATTING
UErrorCode status = U_ZERO_ERROR;
UDate date = uprv_getUTCtime();
UChar TMP[4];
@ -2452,5 +2453,5 @@ void LocaleTest::TestCurrencyByDate(void)
errln("Fail: en_US_Q didn't fallback to en_US");
}
status = U_ZERO_ERROR; // reset
#endif
}

View File

@ -7,6 +7,9 @@
#include "unicode/utypes.h"
#if !UCONFIG_NO_COLLATION
#include "unicode/unistr.h"
#include "unicode/putil.h"
#include "unicode/usearch.h"
@ -1482,6 +1485,7 @@ static int32_t getIntParam(UnicodeString name, UnicodeString &params, int32_t d
}
#endif
#if !UCONFIG_NO_COLLATION
int32_t SSearchTest::monkeyTestCase(UCollator *coll, const UnicodeString &testCase, const UnicodeString &pattern, const UnicodeString &altPattern,
const char *name, const char *strength, uint32_t seed)
{
@ -1543,6 +1547,7 @@ int32_t SSearchTest::monkeyTestCase(UCollator *coll, const UnicodeString &testCa
return notFoundCount;
}
#endif
void SSearchTest::monkeyTest(char *params)
{
@ -1686,3 +1691,4 @@ void SSearchTest::monkeyTest(char *params)
}
#endif

View File

@ -14,6 +14,8 @@
#include "intltest.h"
#if !UCONFIG_NO_COLLATION
//
// Test of the function usearch_search()
//
@ -38,3 +40,5 @@ private:
};
#endif
#endif