diff options
author | Andreas Rottmann <a.rottmann@gmx.at> | 2010-05-27 18:23:17 +0200 |
---|---|---|
committer | Andreas Rottmann <a.rottmann@gmx.at> | 2010-05-27 18:23:17 +0200 |
commit | bd6adfa17d453e4c486e36fed4c5779db90a8a0e (patch) | |
tree | 9798677560d5f99061afe9f0db105a8c97f2438a /tests | |
parent | 79ca645d222db2e158784642c3b464a47bea26f3 (diff) | |
parent | 3e0814cd9862b89c7a39672672937477bd87ddfb (diff) |
Merge commit 'upstream/0.9.3'
Diffstat (limited to 'tests')
379 files changed, 20736 insertions, 9064 deletions
diff --git a/tests/Makefile.gnulib b/tests/Makefile.gnulib index f86db50..a59d9d4 100644 --- a/tests/Makefile.gnulib +++ b/tests/Makefile.gnulib @@ -1,6 +1,6 @@ ## DO NOT EDIT! GENERATED AUTOMATICALLY! ## Process this file with automake to produce Makefile.in. -# Copyright (C) 2002-2009 Free Software Foundation, Inc. +# Copyright (C) 2002-2010 Free Software Foundation, Inc. # # This file is free software, distributed under the terms of the GNU # General Public License. As a special exception to the GNU General @@ -10,10 +10,11 @@ # # Generated by gnulib-tool. -AUTOMAKE_OPTIONS = 1.5 foreign +AUTOMAKE_OPTIONS = 1.5 foreign subdir-objects -SUBDIRS = +SUBDIRS = . TESTS = +XFAIL_TESTS = TESTS_ENVIRONMENT = noinst_PROGRAMS = check_PROGRAMS = @@ -30,6 +31,7 @@ DISTCLEANFILES = MAINTAINERCLEANFILES = AM_CPPFLAGS = \ + -D@gltests_WITNESS@=1 \ -I. -I$(srcdir) \ -I.. -I$(srcdir)/.. \ -I../lib -I$(srcdir)/../lib @@ -42,6 +44,8 @@ libtests_a_DEPENDENCIES = $(gltests_LIBOBJS) EXTRA_libtests_a_SOURCES = AM_LIBTOOLFLAGS = --preserve-dup-deps +TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)' + ## begin gnulib module alloca-opt-tests TESTS += test-alloca-opt @@ -51,40 +55,80 @@ EXTRA_DIST += test-alloca-opt.c ## end gnulib module alloca-opt-tests +## begin gnulib module arg-nonnull + +# The BUILT_SOURCES created by this Makefile snippet are not used via #include +# statements but through direct file reference. Therefore this snippet must be +# present in all Makefile.am that need it. This is ensured by the applicability +# 'all' defined above. + +BUILT_SOURCES += arg-nonnull.h +# The arg-nonnull.h that gets inserted into generated .h files is the same as +# build-aux/arg-nonnull.h, except that it has the copyright header cut off. +arg-nonnull.h: $(top_srcdir)/build-aux/arg-nonnull.h + $(AM_V_GEN)rm -f $@-t $@ && \ + sed -n -e '/GL_ARG_NONNULL/,$$p' \ + < $(top_srcdir)/build-aux/arg-nonnull.h \ + > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t + +ARG_NONNULL_H=arg-nonnull.h + +EXTRA_DIST += $(top_srcdir)/build-aux/arg-nonnull.h + +## end gnulib module arg-nonnull + ## begin gnulib module array-mergesort-tests TESTS += test-array-mergesort check_PROGRAMS += test-array-mergesort -EXTRA_DIST += test-array-mergesort.c +EXTRA_DIST += test-array-mergesort.c macros.h ## end gnulib module array-mergesort-tests +## begin gnulib module c++defs + +# The BUILT_SOURCES created by this Makefile snippet are not used via #include +# statements but through direct file reference. Therefore this snippet must be +# present in all Makefile.am that need it. This is ensured by the applicability +# 'all' defined above. + +BUILT_SOURCES += c++defs.h +# The c++defs.h that gets inserted into generated .h files is the same as +# build-aux/c++defs.h, except that it has the copyright header cut off. +c++defs.h: $(top_srcdir)/build-aux/c++defs.h + $(AM_V_GEN)rm -f $@-t $@ && \ + sed -n -e '/_GL_CXXDEFS/,$$p' \ + < $(top_srcdir)/build-aux/c++defs.h \ + > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += c++defs.h c++defs.h-t + +CXXDEFS_H=c++defs.h + +EXTRA_DIST += $(top_srcdir)/build-aux/c++defs.h + +## end gnulib module c++defs + ## begin gnulib module c-ctype-tests TESTS += test-c-ctype check_PROGRAMS += test-c-ctype -EXTRA_DIST += test-c-ctype.c +EXTRA_DIST += test-c-ctype.c macros.h ## end gnulib module c-ctype-tests ## begin gnulib module c-strcase-tests TESTS += test-c-strcase.sh -TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' LOCALE_TR_UTF8='@LOCALE_TR_UTF8@' +TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_TR_UTF8='@LOCALE_TR_UTF8@' check_PROGRAMS += test-c-strcasecmp test-c-strncasecmp -EXTRA_DIST += test-c-strcase.sh test-c-strcasecmp.c test-c-strncasecmp.c +EXTRA_DIST += test-c-strcase.sh test-c-strcasecmp.c test-c-strncasecmp.c macros.h ## end gnulib module c-strcase-tests -## begin gnulib module dup2-tests - -TESTS += test-dup2 -check_PROGRAMS += test-dup2 -EXTRA_DIST += test-dup2.c - -## end gnulib module dup2-tests - ## begin gnulib module environ-tests TESTS += test-environ @@ -114,52 +158,18 @@ EXTRA_libtests_a_SOURCES += error.c ## begin gnulib module exitfail +libtests_a_SOURCES += exitfail.c -EXTRA_DIST += exitfail.c exitfail.h - -EXTRA_libtests_a_SOURCES += exitfail.c +EXTRA_DIST += exitfail.h ## end gnulib module exitfail -## begin gnulib module fcntl - -BUILT_SOURCES += $(FCNTL_H) - -# We need the following in order to create <fcntl.h> when the system -# doesn't have one that works with the given compiler. -fcntl.h: fcntl.in.h - rm -f $@-t $@ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''NEXT_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \ - -e 's|@''GNULIB_OPEN''@|$(GNULIB_OPEN)|g' \ - -e 's|@''REPLACE_OPEN''@|$(REPLACE_OPEN)|g' \ - < $(srcdir)/fcntl.in.h; \ - } > $@-t - mv $@-t $@ -MOSTLYCLEANFILES += fcntl.h fcntl.h-t - -EXTRA_DIST += fcntl.in.h - -## end gnulib module fcntl - -## begin gnulib module fcntl-tests - -TESTS += test-fcntl -check_PROGRAMS += test-fcntl - -EXTRA_DIST += test-fcntl.c - -## end gnulib module fcntl-tests - ## begin gnulib module frexpl-nolibm-tests TESTS += test-frexpl-nolibm check_PROGRAMS += test-frexpl-nolibm test_frexpl_nolibm_SOURCES = test-frexpl.c - -EXTRA_DIST += test-frexpl.c +EXTRA_DIST += test-frexpl.c signature.h macros.h ## end gnulib module frexpl-nolibm-tests @@ -172,19 +182,36 @@ EXTRA_DIST += test-fseterr.c ## end gnulib module fseterr-tests +## begin gnulib module getpagesize + + +EXTRA_DIST += getpagesize.c + +EXTRA_libtests_a_SOURCES += getpagesize.c + +## end gnulib module getpagesize + ## begin gnulib module gettext-h libtests_a_SOURCES += gettext.h ## end gnulib module gettext-h +## begin gnulib module iconv-h-tests + +TESTS += test-iconv-h +check_PROGRAMS += test-iconv-h +EXTRA_DIST += test-iconv-h.c + +## end gnulib module iconv-h-tests + ## begin gnulib module iconv-tests TESTS += test-iconv check_PROGRAMS += test-iconv test_iconv_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += test-iconv.c +EXTRA_DIST += test-iconv.c signature.h macros.h ## end gnulib module iconv-tests @@ -200,7 +227,7 @@ EXTRA_DIST += intprops.h TESTS += test-isnand-nolibm check_PROGRAMS += test-isnand-nolibm -EXTRA_DIST += test-isnand-nolibm.c test-isnand.h nan.h +EXTRA_DIST += test-isnand-nolibm.c test-isnand.h nan.h macros.h ## end gnulib module isnand-nolibm-tests @@ -209,7 +236,7 @@ EXTRA_DIST += test-isnand-nolibm.c test-isnand.h nan.h TESTS += test-isnanf-nolibm check_PROGRAMS += test-isnanf-nolibm -EXTRA_DIST += test-isnanf-nolibm.c test-isnanf.h nan.h +EXTRA_DIST += test-isnanf-nolibm.c test-isnanf.h nan.h macros.h ## end gnulib module isnanf-nolibm-tests @@ -218,24 +245,31 @@ EXTRA_DIST += test-isnanf-nolibm.c test-isnanf.h nan.h TESTS += test-isnanl-nolibm check_PROGRAMS += test-isnanl-nolibm -EXTRA_DIST += test-isnanl-nolibm.c test-isnanl.h nan.h +EXTRA_DIST += test-isnanl-nolibm.c test-isnanl.h nan.h macros.h ## end gnulib module isnanl-nolibm-tests ## begin gnulib module locale -BUILT_SOURCES += $(LOCALE_H) +BUILT_SOURCES += locale.h # We need the following in order to create <locale.h> when the system # doesn't have one that provides all definitions. -locale.h: locale.in.h - rm -f $@-t $@ +locale.h: locale.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) + $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''NEXT_LOCALE_H''@|$(NEXT_LOCALE_H)|g' \ + -e 's|@''GNULIB_DUPLOCALE''@|$(GNULIB_DUPLOCALE)|g' \ + -e 's|@''HAVE_DUPLOCALE''@|$(HAVE_DUPLOCALE)|g' \ + -e 's|@''HAVE_XLOCALE_H''@|$(HAVE_XLOCALE_H)|g' \ + -e 's|@''REPLACE_DUPLOCALE''@|$(REPLACE_DUPLOCALE)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/locale.in.h; \ - } > $@-t + } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += locale.h locale.h-t @@ -247,7 +281,6 @@ EXTRA_DIST += locale.in.h TESTS += test-locale check_PROGRAMS += test-locale - EXTRA_DIST += test-locale.c ## end gnulib module locale-tests @@ -258,10 +291,19 @@ TESTS += test-localename check_PROGRAMS += test-localename test_localename_LDADD = $(LDADD) @INTL_MACOSX_LIBS@ -EXTRA_DIST += test-localename.c +EXTRA_DIST += test-localename.c macros.h ## end gnulib module localename-tests +## begin gnulib module lock-tests + +TESTS += test-lock +check_PROGRAMS += test-lock +test_lock_LDADD = $(LDADD) @LIBMULTITHREAD@ @YIELD_LIB@ +EXTRA_DIST += test-lock.c + +## end gnulib module lock-tests + ## begin gnulib module malloca-tests TESTS += test-malloca @@ -275,7 +317,6 @@ EXTRA_DIST += test-malloca.c TESTS += test-math check_PROGRAMS += test-math - EXTRA_DIST += test-math.c ## end gnulib module math-tests @@ -284,24 +325,23 @@ EXTRA_DIST += test-math.c TESTS += test-mbrtowc1.sh test-mbrtowc2.sh test-mbrtowc3.sh test-mbrtowc4.sh TESTS_ENVIRONMENT += \ - EXEEXT='@EXEEXT@' \ LOCALE_FR='@LOCALE_FR@' \ LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \ LOCALE_JA='@LOCALE_JA@' \ LOCALE_ZH_CN='@LOCALE_ZH_CN@' check_PROGRAMS += test-mbrtowc -EXTRA_DIST += test-mbrtowc1.sh test-mbrtowc2.sh test-mbrtowc3.sh test-mbrtowc4.sh test-mbrtowc.c +EXTRA_DIST += test-mbrtowc1.sh test-mbrtowc2.sh test-mbrtowc3.sh test-mbrtowc4.sh test-mbrtowc.c signature.h macros.h ## end gnulib module mbrtowc-tests ## begin gnulib module mbsinit-tests TESTS += test-mbsinit.sh -TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' +TESTS_ENVIRONMENT += LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' check_PROGRAMS += test-mbsinit -EXTRA_DIST += test-mbsinit.sh test-mbsinit.c +EXTRA_DIST += test-mbsinit.sh test-mbsinit.c signature.h macros.h ## end gnulib module mbsinit-tests @@ -309,34 +349,15 @@ EXTRA_DIST += test-mbsinit.sh test-mbsinit.c TESTS += test-memchr check_PROGRAMS += test-memchr -EXTRA_DIST += test-memchr.c zerosize-ptr.h +EXTRA_DIST += test-memchr.c zerosize-ptr.h signature.h macros.h ## end gnulib module memchr-tests -## begin gnulib module open - - -EXTRA_DIST += open.c - -EXTRA_libtests_a_SOURCES += open.c - -## end gnulib module open - -## begin gnulib module open-tests - -TESTS += test-open -check_PROGRAMS += test-open - -EXTRA_DIST += test-open.c - -## end gnulib module open-tests - ## begin gnulib module printf-frexp-tests TESTS += test-printf-frexp check_PROGRAMS += test-printf-frexp - -EXTRA_DIST += test-printf-frexp.c +EXTRA_DIST += test-printf-frexp.c macros.h ## end gnulib module printf-frexp-tests @@ -344,8 +365,7 @@ EXTRA_DIST += test-printf-frexp.c TESTS += test-printf-frexpl check_PROGRAMS += test-printf-frexpl - -EXTRA_DIST += test-printf-frexpl.c +EXTRA_DIST += test-printf-frexpl.c macros.h ## end gnulib module printf-frexpl-tests @@ -355,6 +375,15 @@ libtests_a_SOURCES += progname.h progname.c ## end gnulib module progname +## begin gnulib module putenv + + +EXTRA_DIST += putenv.c + +EXTRA_libtests_a_SOURCES += putenv.c + +## end gnulib module putenv + ## begin gnulib module setenv @@ -364,12 +393,20 @@ EXTRA_libtests_a_SOURCES += setenv.c ## end gnulib module setenv +## begin gnulib module setenv-tests + +TESTS += test-setenv +check_PROGRAMS += test-setenv +EXTRA_DIST += test-setenv.c signature.h macros.h + +## end gnulib module setenv-tests + ## begin gnulib module signbit-tests TESTS += test-signbit check_PROGRAMS += test-signbit -EXTRA_DIST += test-signbit.c +EXTRA_DIST += test-signbit.c macros.h ## end gnulib module signbit-tests @@ -377,7 +414,6 @@ EXTRA_DIST += test-signbit.c TESTS += test-stdbool check_PROGRAMS += test-stdbool - EXTRA_DIST += test-stdbool.c ## end gnulib module stdbool-tests @@ -386,7 +422,6 @@ EXTRA_DIST += test-stdbool.c TESTS += test-stddef check_PROGRAMS += test-stddef - EXTRA_DIST += test-stddef.c ## end gnulib module stddef-tests @@ -395,7 +430,6 @@ EXTRA_DIST += test-stddef.c TESTS += test-stdint check_PROGRAMS += test-stdint - EXTRA_DIST += test-stdint.c ## end gnulib module stdint-tests @@ -404,7 +438,6 @@ EXTRA_DIST += test-stdint.c TESTS += test-stdlib check_PROGRAMS += test-stdlib - EXTRA_DIST += test-stdlib.c ## end gnulib module stdlib-tests @@ -422,7 +455,7 @@ EXTRA_libtests_a_SOURCES += strerror.c TESTS += test-strerror check_PROGRAMS += test-strerror -EXTRA_DIST += test-strerror.c +EXTRA_DIST += test-strerror.c signature.h macros.h ## end gnulib module strerror-tests @@ -432,7 +465,7 @@ TESTS += test-striconveh check_PROGRAMS += test-striconveh test_striconveh_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += test-striconveh.c +EXTRA_DIST += test-striconveh.c macros.h ## end gnulib module striconveh-tests @@ -442,7 +475,7 @@ TESTS += test-striconveha check_PROGRAMS += test-striconveha test_striconveha_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += test-striconveha.c +EXTRA_DIST += test-striconveha.c macros.h ## end gnulib module striconveha-tests @@ -450,18 +483,31 @@ EXTRA_DIST += test-striconveha.c TESTS += test-string check_PROGRAMS += test-string - EXTRA_DIST += test-string.c ## end gnulib module string-tests +## begin gnulib module strncat-tests + +TESTS += test-strncat +check_PROGRAMS += test-strncat +EXTRA_DIST += test-strncat.c unistr/test-strncat.h zerosize-ptr.h signature.h macros.h + +## end gnulib module strncat-tests + +## begin gnulib module thread + +libtests_a_SOURCES += glthread/thread.h glthread/thread.c + +## end gnulib module thread + ## begin gnulib module unicase/cased-tests TESTS += test-cased check_PROGRAMS += test-cased test_cased_SOURCES = unicase/test-cased.c -EXTRA_DIST += unicase/test-cased.c unicase/test-predicate-part1.h unicase/test-predicate-part2.h +EXTRA_DIST += unicase/test-cased.c unicase/test-predicate-part1.h unicase/test-predicate-part2.h macros.h ## end gnulib module unicase/cased-tests @@ -471,18 +517,18 @@ TESTS += test-ignorable check_PROGRAMS += test-ignorable test_ignorable_SOURCES = unicase/test-ignorable.c -EXTRA_DIST += unicase/test-ignorable.c unicase/test-predicate-part1.h unicase/test-predicate-part2.h +EXTRA_DIST += unicase/test-ignorable.c unicase/test-predicate-part1.h unicase/test-predicate-part2.h macros.h ## end gnulib module unicase/ignorable-tests ## begin gnulib module unicase/locale-language-tests TESTS += unicase/test-locale-language.sh -TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_JA='@LOCALE_JA@' LOCALE_TR_UTF8='@LOCALE_TR_UTF8@' LOCALE_ZH_CN='@LOCALE_ZH_CN@' +TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_JA='@LOCALE_JA@' LOCALE_TR_UTF8='@LOCALE_TR_UTF8@' LOCALE_ZH_CN='@LOCALE_ZH_CN@' check_PROGRAMS += test-locale-language test_locale_language_SOURCES = unicase/test-locale-language.c test_locale_language_LDADD = $(LDADD) @INTL_MACOSX_LIBS@ -EXTRA_DIST += unicase/test-locale-language.sh unicase/test-locale-language.c +EXTRA_DIST += unicase/test-locale-language.sh unicase/test-locale-language.c macros.h ## end gnulib module unicase/locale-language-tests @@ -492,7 +538,7 @@ TESTS += test-uc_tolower check_PROGRAMS += test-uc_tolower test_uc_tolower_SOURCES = unicase/test-uc_tolower.c -EXTRA_DIST += unicase/test-uc_tolower.c unicase/test-mapping-part1.h unicase/test-mapping-part2.h +EXTRA_DIST += unicase/test-uc_tolower.c unicase/test-mapping-part1.h unicase/test-mapping-part2.h macros.h ## end gnulib module unicase/tolower-tests @@ -502,7 +548,7 @@ TESTS += test-uc_totitle check_PROGRAMS += test-uc_totitle test_uc_totitle_SOURCES = unicase/test-uc_totitle.c -EXTRA_DIST += unicase/test-uc_totitle.c unicase/test-mapping-part1.h unicase/test-mapping-part2.h +EXTRA_DIST += unicase/test-uc_totitle.c unicase/test-mapping-part1.h unicase/test-mapping-part2.h macros.h ## end gnulib module unicase/totitle-tests @@ -512,7 +558,7 @@ TESTS += test-uc_toupper check_PROGRAMS += test-uc_toupper test_uc_toupper_SOURCES = unicase/test-uc_toupper.c -EXTRA_DIST += unicase/test-uc_toupper.c unicase/test-mapping-part1.h unicase/test-mapping-part2.h +EXTRA_DIST += unicase/test-uc_toupper.c unicase/test-mapping-part1.h unicase/test-mapping-part2.h macros.h ## end gnulib module unicase/toupper-tests @@ -522,7 +568,7 @@ TESTS += test-u16-casecmp check_PROGRAMS += test-u16-casecmp test_u16_casecmp_SOURCES = unicase/test-u16-casecmp.c -EXTRA_DIST += unicase/test-u16-casecmp.c unicase/test-casecmp.h +EXTRA_DIST += unicase/test-u16-casecmp.c unicase/test-casecmp.h macros.h ## end gnulib module unicase/u16-casecmp-tests @@ -533,7 +579,7 @@ check_PROGRAMS += test-u16-casecoll test_u16_casecoll_SOURCES = unicase/test-u16-casecoll.c test_u16_casecoll_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unicase/test-u16-casecoll.c unicase/test-casecmp.h +EXTRA_DIST += unicase/test-u16-casecoll.c unicase/test-casecmp.h macros.h ## end gnulib module unicase/u16-casecoll-tests @@ -543,7 +589,7 @@ TESTS += test-u16-casefold check_PROGRAMS += test-u16-casefold test_u16_casefold_SOURCES = unicase/test-u16-casefold.c -EXTRA_DIST += unicase/test-u16-casefold.c +EXTRA_DIST += unicase/test-u16-casefold.c macros.h ## end gnulib module unicase/u16-casefold-tests @@ -553,7 +599,7 @@ TESTS += test-u16-is-cased check_PROGRAMS += test-u16-is-cased test_u16_is_cased_SOURCES = unicase/test-u16-is-cased.c -EXTRA_DIST += unicase/test-u16-is-cased.c unicase/test-is-cased.h +EXTRA_DIST += unicase/test-u16-is-cased.c unicase/test-is-cased.h macros.h ## end gnulib module unicase/u16-is-cased-tests @@ -563,7 +609,7 @@ TESTS += test-u16-is-casefolded check_PROGRAMS += test-u16-is-casefolded test_u16_is_casefolded_SOURCES = unicase/test-u16-is-casefolded.c -EXTRA_DIST += unicase/test-u16-is-casefolded.c unicase/test-is-casefolded.h +EXTRA_DIST += unicase/test-u16-is-casefolded.c unicase/test-is-casefolded.h macros.h ## end gnulib module unicase/u16-is-casefolded-tests @@ -573,7 +619,7 @@ TESTS += test-u16-is-lowercase check_PROGRAMS += test-u16-is-lowercase test_u16_is_lowercase_SOURCES = unicase/test-u16-is-lowercase.c -EXTRA_DIST += unicase/test-u16-is-lowercase.c unicase/test-is-lowercase.h +EXTRA_DIST += unicase/test-u16-is-lowercase.c unicase/test-is-lowercase.h macros.h ## end gnulib module unicase/u16-is-lowercase-tests @@ -583,7 +629,7 @@ TESTS += test-u16-is-titlecase check_PROGRAMS += test-u16-is-titlecase test_u16_is_titlecase_SOURCES = unicase/test-u16-is-titlecase.c -EXTRA_DIST += unicase/test-u16-is-titlecase.c unicase/test-is-titlecase.h +EXTRA_DIST += unicase/test-u16-is-titlecase.c unicase/test-is-titlecase.h macros.h ## end gnulib module unicase/u16-is-titlecase-tests @@ -593,7 +639,7 @@ TESTS += test-u16-is-uppercase check_PROGRAMS += test-u16-is-uppercase test_u16_is_uppercase_SOURCES = unicase/test-u16-is-uppercase.c -EXTRA_DIST += unicase/test-u16-is-uppercase.c unicase/test-is-uppercase.h +EXTRA_DIST += unicase/test-u16-is-uppercase.c unicase/test-is-uppercase.h macros.h ## end gnulib module unicase/u16-is-uppercase-tests @@ -603,7 +649,7 @@ TESTS += test-u16-tolower check_PROGRAMS += test-u16-tolower test_u16_tolower_SOURCES = unicase/test-u16-tolower.c -EXTRA_DIST += unicase/test-u16-tolower.c +EXTRA_DIST += unicase/test-u16-tolower.c macros.h ## end gnulib module unicase/u16-tolower-tests @@ -613,7 +659,7 @@ TESTS += test-u16-totitle check_PROGRAMS += test-u16-totitle test_u16_totitle_SOURCES = unicase/test-u16-totitle.c -EXTRA_DIST += unicase/test-u16-totitle.c +EXTRA_DIST += unicase/test-u16-totitle.c macros.h ## end gnulib module unicase/u16-totitle-tests @@ -623,7 +669,7 @@ TESTS += test-u16-toupper check_PROGRAMS += test-u16-toupper test_u16_toupper_SOURCES = unicase/test-u16-toupper.c -EXTRA_DIST += unicase/test-u16-toupper.c +EXTRA_DIST += unicase/test-u16-toupper.c macros.h ## end gnulib module unicase/u16-toupper-tests @@ -633,7 +679,7 @@ TESTS += test-u32-casecmp check_PROGRAMS += test-u32-casecmp test_u32_casecmp_SOURCES = unicase/test-u32-casecmp.c -EXTRA_DIST += unicase/test-u32-casecmp.c unicase/test-casecmp.h +EXTRA_DIST += unicase/test-u32-casecmp.c unicase/test-casecmp.h macros.h ## end gnulib module unicase/u32-casecmp-tests @@ -644,7 +690,7 @@ check_PROGRAMS += test-u32-casecoll test_u32_casecoll_SOURCES = unicase/test-u32-casecoll.c test_u32_casecoll_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unicase/test-u32-casecoll.c unicase/test-casecmp.h +EXTRA_DIST += unicase/test-u32-casecoll.c unicase/test-casecmp.h macros.h ## end gnulib module unicase/u32-casecoll-tests @@ -654,7 +700,7 @@ TESTS += test-u32-casefold check_PROGRAMS += test-u32-casefold test_u32_casefold_SOURCES = unicase/test-u32-casefold.c -EXTRA_DIST += unicase/test-u32-casefold.c +EXTRA_DIST += unicase/test-u32-casefold.c macros.h ## end gnulib module unicase/u32-casefold-tests @@ -664,7 +710,7 @@ TESTS += test-u32-is-cased check_PROGRAMS += test-u32-is-cased test_u32_is_cased_SOURCES = unicase/test-u32-is-cased.c -EXTRA_DIST += unicase/test-u32-is-cased.c unicase/test-is-cased.h +EXTRA_DIST += unicase/test-u32-is-cased.c unicase/test-is-cased.h macros.h ## end gnulib module unicase/u32-is-cased-tests @@ -674,7 +720,7 @@ TESTS += test-u32-is-casefolded check_PROGRAMS += test-u32-is-casefolded test_u32_is_casefolded_SOURCES = unicase/test-u32-is-casefolded.c -EXTRA_DIST += unicase/test-u32-is-casefolded.c unicase/test-is-casefolded.h +EXTRA_DIST += unicase/test-u32-is-casefolded.c unicase/test-is-casefolded.h macros.h ## end gnulib module unicase/u32-is-casefolded-tests @@ -684,7 +730,7 @@ TESTS += test-u32-is-lowercase check_PROGRAMS += test-u32-is-lowercase test_u32_is_lowercase_SOURCES = unicase/test-u32-is-lowercase.c -EXTRA_DIST += unicase/test-u32-is-lowercase.c unicase/test-is-lowercase.h +EXTRA_DIST += unicase/test-u32-is-lowercase.c unicase/test-is-lowercase.h macros.h ## end gnulib module unicase/u32-is-lowercase-tests @@ -694,7 +740,7 @@ TESTS += test-u32-is-titlecase check_PROGRAMS += test-u32-is-titlecase test_u32_is_titlecase_SOURCES = unicase/test-u32-is-titlecase.c -EXTRA_DIST += unicase/test-u32-is-titlecase.c unicase/test-is-titlecase.h +EXTRA_DIST += unicase/test-u32-is-titlecase.c unicase/test-is-titlecase.h macros.h ## end gnulib module unicase/u32-is-titlecase-tests @@ -704,7 +750,7 @@ TESTS += test-u32-is-uppercase check_PROGRAMS += test-u32-is-uppercase test_u32_is_uppercase_SOURCES = unicase/test-u32-is-uppercase.c -EXTRA_DIST += unicase/test-u32-is-uppercase.c unicase/test-is-uppercase.h +EXTRA_DIST += unicase/test-u32-is-uppercase.c unicase/test-is-uppercase.h macros.h ## end gnulib module unicase/u32-is-uppercase-tests @@ -714,7 +760,7 @@ TESTS += test-u32-tolower check_PROGRAMS += test-u32-tolower test_u32_tolower_SOURCES = unicase/test-u32-tolower.c -EXTRA_DIST += unicase/test-u32-tolower.c +EXTRA_DIST += unicase/test-u32-tolower.c macros.h ## end gnulib module unicase/u32-tolower-tests @@ -724,7 +770,7 @@ TESTS += test-u32-totitle check_PROGRAMS += test-u32-totitle test_u32_totitle_SOURCES = unicase/test-u32-totitle.c -EXTRA_DIST += unicase/test-u32-totitle.c +EXTRA_DIST += unicase/test-u32-totitle.c macros.h ## end gnulib module unicase/u32-totitle-tests @@ -734,7 +780,7 @@ TESTS += test-u32-toupper check_PROGRAMS += test-u32-toupper test_u32_toupper_SOURCES = unicase/test-u32-toupper.c -EXTRA_DIST += unicase/test-u32-toupper.c +EXTRA_DIST += unicase/test-u32-toupper.c macros.h ## end gnulib module unicase/u32-toupper-tests @@ -744,7 +790,7 @@ TESTS += test-u8-casecmp check_PROGRAMS += test-u8-casecmp test_u8_casecmp_SOURCES = unicase/test-u8-casecmp.c -EXTRA_DIST += unicase/test-u8-casecmp.c unicase/test-casecmp.h +EXTRA_DIST += unicase/test-u8-casecmp.c unicase/test-casecmp.h macros.h ## end gnulib module unicase/u8-casecmp-tests @@ -755,7 +801,7 @@ check_PROGRAMS += test-u8-casecoll test_u8_casecoll_SOURCES = unicase/test-u8-casecoll.c test_u8_casecoll_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unicase/test-u8-casecoll.c unicase/test-casecmp.h +EXTRA_DIST += unicase/test-u8-casecoll.c unicase/test-casecmp.h macros.h ## end gnulib module unicase/u8-casecoll-tests @@ -765,7 +811,7 @@ TESTS += test-u8-casefold check_PROGRAMS += test-u8-casefold test_u8_casefold_SOURCES = unicase/test-u8-casefold.c -EXTRA_DIST += unicase/test-u8-casefold.c +EXTRA_DIST += unicase/test-u8-casefold.c macros.h ## end gnulib module unicase/u8-casefold-tests @@ -775,7 +821,7 @@ TESTS += test-u8-is-cased check_PROGRAMS += test-u8-is-cased test_u8_is_cased_SOURCES = unicase/test-u8-is-cased.c -EXTRA_DIST += unicase/test-u8-is-cased.c unicase/test-is-cased.h +EXTRA_DIST += unicase/test-u8-is-cased.c unicase/test-is-cased.h macros.h ## end gnulib module unicase/u8-is-cased-tests @@ -785,7 +831,7 @@ TESTS += test-u8-is-casefolded check_PROGRAMS += test-u8-is-casefolded test_u8_is_casefolded_SOURCES = unicase/test-u8-is-casefolded.c -EXTRA_DIST += unicase/test-u8-is-casefolded.c unicase/test-is-casefolded.h +EXTRA_DIST += unicase/test-u8-is-casefolded.c unicase/test-is-casefolded.h macros.h ## end gnulib module unicase/u8-is-casefolded-tests @@ -795,7 +841,7 @@ TESTS += test-u8-is-lowercase check_PROGRAMS += test-u8-is-lowercase test_u8_is_lowercase_SOURCES = unicase/test-u8-is-lowercase.c -EXTRA_DIST += unicase/test-u8-is-lowercase.c unicase/test-is-lowercase.h +EXTRA_DIST += unicase/test-u8-is-lowercase.c unicase/test-is-lowercase.h macros.h ## end gnulib module unicase/u8-is-lowercase-tests @@ -805,7 +851,7 @@ TESTS += test-u8-is-titlecase check_PROGRAMS += test-u8-is-titlecase test_u8_is_titlecase_SOURCES = unicase/test-u8-is-titlecase.c -EXTRA_DIST += unicase/test-u8-is-titlecase.c unicase/test-is-titlecase.h +EXTRA_DIST += unicase/test-u8-is-titlecase.c unicase/test-is-titlecase.h macros.h ## end gnulib module unicase/u8-is-titlecase-tests @@ -815,7 +861,7 @@ TESTS += test-u8-is-uppercase check_PROGRAMS += test-u8-is-uppercase test_u8_is_uppercase_SOURCES = unicase/test-u8-is-uppercase.c -EXTRA_DIST += unicase/test-u8-is-uppercase.c unicase/test-is-uppercase.h +EXTRA_DIST += unicase/test-u8-is-uppercase.c unicase/test-is-uppercase.h macros.h ## end gnulib module unicase/u8-is-uppercase-tests @@ -825,7 +871,7 @@ TESTS += test-u8-tolower check_PROGRAMS += test-u8-tolower test_u8_tolower_SOURCES = unicase/test-u8-tolower.c -EXTRA_DIST += unicase/test-u8-tolower.c +EXTRA_DIST += unicase/test-u8-tolower.c macros.h ## end gnulib module unicase/u8-tolower-tests @@ -835,7 +881,7 @@ TESTS += test-u8-totitle check_PROGRAMS += test-u8-totitle test_u8_totitle_SOURCES = unicase/test-u8-totitle.c -EXTRA_DIST += unicase/test-u8-totitle.c +EXTRA_DIST += unicase/test-u8-totitle.c macros.h ## end gnulib module unicase/u8-totitle-tests @@ -845,7 +891,7 @@ TESTS += test-u8-toupper check_PROGRAMS += test-u8-toupper test_u8_toupper_SOURCES = unicase/test-u8-toupper.c -EXTRA_DIST += unicase/test-u8-toupper.c +EXTRA_DIST += unicase/test-u8-toupper.c macros.h ## end gnulib module unicase/u8-toupper-tests @@ -853,14 +899,13 @@ EXTRA_DIST += unicase/test-u8-toupper.c TESTS += unicase/test-ulc-casecmp1.sh unicase/test-ulc-casecmp2.sh TESTS_ENVIRONMENT += \ - EXEEXT='@EXEEXT@' \ LOCALE_FR='@LOCALE_FR@' \ LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' check_PROGRAMS += test-ulc-casecmp test_ulc_casecmp_SOURCES = unicase/test-ulc-casecmp.c test_ulc_casecmp_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unicase/test-ulc-casecmp1.sh unicase/test-ulc-casecmp2.sh unicase/test-ulc-casecmp.c unicase/test-casecmp.h +EXTRA_DIST += unicase/test-ulc-casecmp1.sh unicase/test-ulc-casecmp2.sh unicase/test-ulc-casecmp.c unicase/test-casecmp.h macros.h ## end gnulib module unicase/ulc-casecmp-tests @@ -868,14 +913,13 @@ EXTRA_DIST += unicase/test-ulc-casecmp1.sh unicase/test-ulc-casecmp2.sh unicase/ TESTS += unicase/test-ulc-casecoll1.sh unicase/test-ulc-casecoll2.sh TESTS_ENVIRONMENT += \ - EXEEXT='@EXEEXT@' \ LOCALE_FR='@LOCALE_FR@' \ LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' check_PROGRAMS += test-ulc-casecoll test_ulc_casecoll_SOURCES = unicase/test-ulc-casecoll.c test_ulc_casecoll_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unicase/test-ulc-casecoll1.sh unicase/test-ulc-casecoll2.sh unicase/test-ulc-casecoll.c unicase/test-casecmp.h +EXTRA_DIST += unicase/test-ulc-casecoll1.sh unicase/test-ulc-casecoll2.sh unicase/test-ulc-casecoll.c unicase/test-casecmp.h macros.h ## end gnulib module unicase/ulc-casecoll-tests @@ -886,7 +930,7 @@ check_PROGRAMS += test-u16-conv-from-enc test_u16_conv_from_enc_SOURCES = uniconv/test-u16-conv-from-enc.c test_u16_conv_from_enc_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += uniconv/test-u16-conv-from-enc.c +EXTRA_DIST += uniconv/test-u16-conv-from-enc.c macros.h ## end gnulib module uniconv/u16-conv-from-enc-tests @@ -897,7 +941,7 @@ check_PROGRAMS += test-u16-conv-to-enc test_u16_conv_to_enc_SOURCES = uniconv/test-u16-conv-to-enc.c test_u16_conv_to_enc_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += uniconv/test-u16-conv-to-enc.c +EXTRA_DIST += uniconv/test-u16-conv-to-enc.c macros.h ## end gnulib module uniconv/u16-conv-to-enc-tests @@ -908,7 +952,7 @@ check_PROGRAMS += test-u16-strconv-from-enc test_u16_strconv_from_enc_SOURCES = uniconv/test-u16-strconv-from-enc.c test_u16_strconv_from_enc_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += uniconv/test-u16-strconv-from-enc.c +EXTRA_DIST += uniconv/test-u16-strconv-from-enc.c macros.h ## end gnulib module uniconv/u16-strconv-from-enc-tests @@ -919,7 +963,7 @@ check_PROGRAMS += test-u16-strconv-to-enc test_u16_strconv_to_enc_SOURCES = uniconv/test-u16-strconv-to-enc.c test_u16_strconv_to_enc_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += uniconv/test-u16-strconv-to-enc.c +EXTRA_DIST += uniconv/test-u16-strconv-to-enc.c macros.h ## end gnulib module uniconv/u16-strconv-to-enc-tests @@ -930,7 +974,7 @@ check_PROGRAMS += test-u32-conv-from-enc test_u32_conv_from_enc_SOURCES = uniconv/test-u32-conv-from-enc.c test_u32_conv_from_enc_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += uniconv/test-u32-conv-from-enc.c +EXTRA_DIST += uniconv/test-u32-conv-from-enc.c macros.h ## end gnulib module uniconv/u32-conv-from-enc-tests @@ -941,7 +985,7 @@ check_PROGRAMS += test-u32-conv-to-enc test_u32_conv_to_enc_SOURCES = uniconv/test-u32-conv-to-enc.c test_u32_conv_to_enc_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += uniconv/test-u32-conv-to-enc.c +EXTRA_DIST += uniconv/test-u32-conv-to-enc.c macros.h ## end gnulib module uniconv/u32-conv-to-enc-tests @@ -952,7 +996,7 @@ check_PROGRAMS += test-u32-strconv-from-enc test_u32_strconv_from_enc_SOURCES = uniconv/test-u32-strconv-from-enc.c test_u32_strconv_from_enc_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += uniconv/test-u32-strconv-from-enc.c +EXTRA_DIST += uniconv/test-u32-strconv-from-enc.c macros.h ## end gnulib module uniconv/u32-strconv-from-enc-tests @@ -963,7 +1007,7 @@ check_PROGRAMS += test-u32-strconv-to-enc test_u32_strconv_to_enc_SOURCES = uniconv/test-u32-strconv-to-enc.c test_u32_strconv_to_enc_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += uniconv/test-u32-strconv-to-enc.c +EXTRA_DIST += uniconv/test-u32-strconv-to-enc.c macros.h ## end gnulib module uniconv/u32-strconv-to-enc-tests @@ -974,7 +1018,7 @@ check_PROGRAMS += test-u8-conv-from-enc test_u8_conv_from_enc_SOURCES = uniconv/test-u8-conv-from-enc.c test_u8_conv_from_enc_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += uniconv/test-u8-conv-from-enc.c +EXTRA_DIST += uniconv/test-u8-conv-from-enc.c macros.h ## end gnulib module uniconv/u8-conv-from-enc-tests @@ -985,7 +1029,7 @@ check_PROGRAMS += test-u8-conv-to-enc test_u8_conv_to_enc_SOURCES = uniconv/test-u8-conv-to-enc.c test_u8_conv_to_enc_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += uniconv/test-u8-conv-to-enc.c +EXTRA_DIST += uniconv/test-u8-conv-to-enc.c macros.h ## end gnulib module uniconv/u8-conv-to-enc-tests @@ -996,7 +1040,7 @@ check_PROGRAMS += test-u8-strconv-from-enc test_u8_strconv_from_enc_SOURCES = uniconv/test-u8-strconv-from-enc.c test_u8_strconv_from_enc_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += uniconv/test-u8-strconv-from-enc.c +EXTRA_DIST += uniconv/test-u8-strconv-from-enc.c macros.h ## end gnulib module uniconv/u8-strconv-from-enc-tests @@ -1007,7 +1051,7 @@ check_PROGRAMS += test-u8-strconv-to-enc test_u8_strconv_to_enc_SOURCES = uniconv/test-u8-strconv-to-enc.c test_u8_strconv_to_enc_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += uniconv/test-u8-strconv-to-enc.c +EXTRA_DIST += uniconv/test-u8-strconv-to-enc.c macros.h ## end gnulib module uniconv/u8-strconv-to-enc-tests @@ -1017,7 +1061,7 @@ TESTS += test-bidi_byname check_PROGRAMS += test-bidi_byname test_bidi_byname_SOURCES = unictype/test-bidi_byname.c -EXTRA_DIST += unictype/test-bidi_byname.c +EXTRA_DIST += unictype/test-bidi_byname.c macros.h ## end gnulib module unictype/bidicategory-byname-tests @@ -1027,7 +1071,7 @@ TESTS += test-bidi_name check_PROGRAMS += test-bidi_name test_bidi_name_SOURCES = unictype/test-bidi_name.c -EXTRA_DIST += unictype/test-bidi_name.c +EXTRA_DIST += unictype/test-bidi_name.c macros.h ## end gnulib module unictype/bidicategory-name-tests @@ -1037,7 +1081,7 @@ TESTS += test-bidi_of check_PROGRAMS += test-bidi_of test_bidi_of_SOURCES = unictype/test-bidi_of.c -EXTRA_DIST += unictype/test-bidi_of.c +EXTRA_DIST += unictype/test-bidi_of.c macros.h ## end gnulib module unictype/bidicategory-of-tests @@ -1047,7 +1091,7 @@ TESTS += test-bidi_test check_PROGRAMS += test-bidi_test test_bidi_test_SOURCES = unictype/test-bidi_test.c -EXTRA_DIST += unictype/test-bidi_test.c +EXTRA_DIST += unictype/test-bidi_test.c macros.h ## end gnulib module unictype/bidicategory-test-tests @@ -1057,7 +1101,7 @@ TESTS += test-block_list check_PROGRAMS += test-block_list test_block_list_SOURCES = unictype/test-block_list.c -EXTRA_DIST += unictype/test-block_list.c +EXTRA_DIST += unictype/test-block_list.c macros.h ## end gnulib module unictype/block-list-tests @@ -1067,7 +1111,7 @@ TESTS += test-block_of check_PROGRAMS += test-block_of test_block_of_SOURCES = unictype/test-block_of.c -EXTRA_DIST += unictype/test-block_of.c +EXTRA_DIST += unictype/test-block_of.c macros.h ## end gnulib module unictype/block-of-tests @@ -1077,7 +1121,7 @@ TESTS += test-block_test check_PROGRAMS += test-block_test test_block_test_SOURCES = unictype/test-block_test.c -EXTRA_DIST += unictype/test-block_test.c +EXTRA_DIST += unictype/test-block_test.c macros.h ## end gnulib module unictype/block-test-tests @@ -1087,7 +1131,7 @@ TESTS += test-categ_C check_PROGRAMS += test-categ_C test_categ_C_SOURCES = unictype/test-categ_C.c -EXTRA_DIST += unictype/test-categ_C.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_C.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-C-tests @@ -1097,7 +1141,7 @@ TESTS += test-categ_Cc check_PROGRAMS += test-categ_Cc test_categ_Cc_SOURCES = unictype/test-categ_Cc.c -EXTRA_DIST += unictype/test-categ_Cc.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Cc.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Cc-tests @@ -1107,7 +1151,7 @@ TESTS += test-categ_Cf check_PROGRAMS += test-categ_Cf test_categ_Cf_SOURCES = unictype/test-categ_Cf.c -EXTRA_DIST += unictype/test-categ_Cf.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Cf.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Cf-tests @@ -1117,7 +1161,7 @@ TESTS += test-categ_Cn check_PROGRAMS += test-categ_Cn test_categ_Cn_SOURCES = unictype/test-categ_Cn.c -EXTRA_DIST += unictype/test-categ_Cn.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Cn.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Cn-tests @@ -1127,7 +1171,7 @@ TESTS += test-categ_Co check_PROGRAMS += test-categ_Co test_categ_Co_SOURCES = unictype/test-categ_Co.c -EXTRA_DIST += unictype/test-categ_Co.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Co.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Co-tests @@ -1137,7 +1181,7 @@ TESTS += test-categ_Cs check_PROGRAMS += test-categ_Cs test_categ_Cs_SOURCES = unictype/test-categ_Cs.c -EXTRA_DIST += unictype/test-categ_Cs.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Cs.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Cs-tests @@ -1147,7 +1191,7 @@ TESTS += test-categ_L check_PROGRAMS += test-categ_L test_categ_L_SOURCES = unictype/test-categ_L.c -EXTRA_DIST += unictype/test-categ_L.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_L.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-L-tests @@ -1157,7 +1201,7 @@ TESTS += test-categ_Ll check_PROGRAMS += test-categ_Ll test_categ_Ll_SOURCES = unictype/test-categ_Ll.c -EXTRA_DIST += unictype/test-categ_Ll.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Ll.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Ll-tests @@ -1167,7 +1211,7 @@ TESTS += test-categ_Lm check_PROGRAMS += test-categ_Lm test_categ_Lm_SOURCES = unictype/test-categ_Lm.c -EXTRA_DIST += unictype/test-categ_Lm.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Lm.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Lm-tests @@ -1177,7 +1221,7 @@ TESTS += test-categ_Lo check_PROGRAMS += test-categ_Lo test_categ_Lo_SOURCES = unictype/test-categ_Lo.c -EXTRA_DIST += unictype/test-categ_Lo.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Lo.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Lo-tests @@ -1187,7 +1231,7 @@ TESTS += test-categ_Lt check_PROGRAMS += test-categ_Lt test_categ_Lt_SOURCES = unictype/test-categ_Lt.c -EXTRA_DIST += unictype/test-categ_Lt.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Lt.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Lt-tests @@ -1197,7 +1241,7 @@ TESTS += test-categ_Lu check_PROGRAMS += test-categ_Lu test_categ_Lu_SOURCES = unictype/test-categ_Lu.c -EXTRA_DIST += unictype/test-categ_Lu.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Lu.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Lu-tests @@ -1207,7 +1251,7 @@ TESTS += test-categ_M check_PROGRAMS += test-categ_M test_categ_M_SOURCES = unictype/test-categ_M.c -EXTRA_DIST += unictype/test-categ_M.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_M.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-M-tests @@ -1217,7 +1261,7 @@ TESTS += test-categ_Mc check_PROGRAMS += test-categ_Mc test_categ_Mc_SOURCES = unictype/test-categ_Mc.c -EXTRA_DIST += unictype/test-categ_Mc.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Mc.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Mc-tests @@ -1227,7 +1271,7 @@ TESTS += test-categ_Me check_PROGRAMS += test-categ_Me test_categ_Me_SOURCES = unictype/test-categ_Me.c -EXTRA_DIST += unictype/test-categ_Me.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Me.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Me-tests @@ -1237,7 +1281,7 @@ TESTS += test-categ_Mn check_PROGRAMS += test-categ_Mn test_categ_Mn_SOURCES = unictype/test-categ_Mn.c -EXTRA_DIST += unictype/test-categ_Mn.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Mn.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Mn-tests @@ -1247,7 +1291,7 @@ TESTS += test-categ_N check_PROGRAMS += test-categ_N test_categ_N_SOURCES = unictype/test-categ_N.c -EXTRA_DIST += unictype/test-categ_N.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_N.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-N-tests @@ -1257,7 +1301,7 @@ TESTS += test-categ_Nd check_PROGRAMS += test-categ_Nd test_categ_Nd_SOURCES = unictype/test-categ_Nd.c -EXTRA_DIST += unictype/test-categ_Nd.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Nd.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Nd-tests @@ -1267,7 +1311,7 @@ TESTS += test-categ_Nl check_PROGRAMS += test-categ_Nl test_categ_Nl_SOURCES = unictype/test-categ_Nl.c -EXTRA_DIST += unictype/test-categ_Nl.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Nl.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Nl-tests @@ -1277,7 +1321,7 @@ TESTS += test-categ_No check_PROGRAMS += test-categ_No test_categ_No_SOURCES = unictype/test-categ_No.c -EXTRA_DIST += unictype/test-categ_No.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_No.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-No-tests @@ -1287,7 +1331,7 @@ TESTS += test-categ_P check_PROGRAMS += test-categ_P test_categ_P_SOURCES = unictype/test-categ_P.c -EXTRA_DIST += unictype/test-categ_P.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_P.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-P-tests @@ -1297,7 +1341,7 @@ TESTS += test-categ_Pc check_PROGRAMS += test-categ_Pc test_categ_Pc_SOURCES = unictype/test-categ_Pc.c -EXTRA_DIST += unictype/test-categ_Pc.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Pc.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Pc-tests @@ -1307,7 +1351,7 @@ TESTS += test-categ_Pd check_PROGRAMS += test-categ_Pd test_categ_Pd_SOURCES = unictype/test-categ_Pd.c -EXTRA_DIST += unictype/test-categ_Pd.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Pd.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Pd-tests @@ -1317,7 +1361,7 @@ TESTS += test-categ_Pe check_PROGRAMS += test-categ_Pe test_categ_Pe_SOURCES = unictype/test-categ_Pe.c -EXTRA_DIST += unictype/test-categ_Pe.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Pe.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Pe-tests @@ -1327,7 +1371,7 @@ TESTS += test-categ_Pf check_PROGRAMS += test-categ_Pf test_categ_Pf_SOURCES = unictype/test-categ_Pf.c -EXTRA_DIST += unictype/test-categ_Pf.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Pf.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Pf-tests @@ -1337,7 +1381,7 @@ TESTS += test-categ_Pi check_PROGRAMS += test-categ_Pi test_categ_Pi_SOURCES = unictype/test-categ_Pi.c -EXTRA_DIST += unictype/test-categ_Pi.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Pi.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Pi-tests @@ -1347,7 +1391,7 @@ TESTS += test-categ_Po check_PROGRAMS += test-categ_Po test_categ_Po_SOURCES = unictype/test-categ_Po.c -EXTRA_DIST += unictype/test-categ_Po.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Po.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Po-tests @@ -1357,7 +1401,7 @@ TESTS += test-categ_Ps check_PROGRAMS += test-categ_Ps test_categ_Ps_SOURCES = unictype/test-categ_Ps.c -EXTRA_DIST += unictype/test-categ_Ps.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Ps.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Ps-tests @@ -1367,7 +1411,7 @@ TESTS += test-categ_S check_PROGRAMS += test-categ_S test_categ_S_SOURCES = unictype/test-categ_S.c -EXTRA_DIST += unictype/test-categ_S.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_S.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-S-tests @@ -1377,7 +1421,7 @@ TESTS += test-categ_Sc check_PROGRAMS += test-categ_Sc test_categ_Sc_SOURCES = unictype/test-categ_Sc.c -EXTRA_DIST += unictype/test-categ_Sc.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Sc.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Sc-tests @@ -1387,7 +1431,7 @@ TESTS += test-categ_Sk check_PROGRAMS += test-categ_Sk test_categ_Sk_SOURCES = unictype/test-categ_Sk.c -EXTRA_DIST += unictype/test-categ_Sk.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Sk.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Sk-tests @@ -1397,7 +1441,7 @@ TESTS += test-categ_Sm check_PROGRAMS += test-categ_Sm test_categ_Sm_SOURCES = unictype/test-categ_Sm.c -EXTRA_DIST += unictype/test-categ_Sm.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Sm.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Sm-tests @@ -1407,7 +1451,7 @@ TESTS += test-categ_So check_PROGRAMS += test-categ_So test_categ_So_SOURCES = unictype/test-categ_So.c -EXTRA_DIST += unictype/test-categ_So.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_So.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-So-tests @@ -1417,7 +1461,7 @@ TESTS += test-categ_Z check_PROGRAMS += test-categ_Z test_categ_Z_SOURCES = unictype/test-categ_Z.c -EXTRA_DIST += unictype/test-categ_Z.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Z.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Z-tests @@ -1427,7 +1471,7 @@ TESTS += test-categ_Zl check_PROGRAMS += test-categ_Zl test_categ_Zl_SOURCES = unictype/test-categ_Zl.c -EXTRA_DIST += unictype/test-categ_Zl.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Zl.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Zl-tests @@ -1437,7 +1481,7 @@ TESTS += test-categ_Zp check_PROGRAMS += test-categ_Zp test_categ_Zp_SOURCES = unictype/test-categ_Zp.c -EXTRA_DIST += unictype/test-categ_Zp.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Zp.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Zp-tests @@ -1447,7 +1491,7 @@ TESTS += test-categ_Zs check_PROGRAMS += test-categ_Zs test_categ_Zs_SOURCES = unictype/test-categ_Zs.c -EXTRA_DIST += unictype/test-categ_Zs.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-categ_Zs.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/category-Zs-tests @@ -1457,7 +1501,7 @@ TESTS += test-categ_and_not check_PROGRAMS += test-categ_and_not test_categ_and_not_SOURCES = unictype/test-categ_and_not.c -EXTRA_DIST += unictype/test-categ_and_not.c +EXTRA_DIST += unictype/test-categ_and_not.c macros.h ## end gnulib module unictype/category-and-not-tests @@ -1467,7 +1511,7 @@ TESTS += test-categ_and check_PROGRAMS += test-categ_and test_categ_and_SOURCES = unictype/test-categ_and.c -EXTRA_DIST += unictype/test-categ_and.c +EXTRA_DIST += unictype/test-categ_and.c macros.h ## end gnulib module unictype/category-and-tests @@ -1477,7 +1521,7 @@ TESTS += test-categ_byname check_PROGRAMS += test-categ_byname test_categ_byname_SOURCES = unictype/test-categ_byname.c -EXTRA_DIST += unictype/test-categ_byname.c +EXTRA_DIST += unictype/test-categ_byname.c macros.h ## end gnulib module unictype/category-byname-tests @@ -1487,7 +1531,7 @@ TESTS += test-categ_name check_PROGRAMS += test-categ_name test_categ_name_SOURCES = unictype/test-categ_name.c -EXTRA_DIST += unictype/test-categ_name.c +EXTRA_DIST += unictype/test-categ_name.c macros.h ## end gnulib module unictype/category-name-tests @@ -1499,7 +1543,7 @@ check_PROGRAMS += test-categ_none test_categ_none_SOURCES = unictype/test-categ_none.c endif -EXTRA_DIST += unictype/test-categ_none.c +EXTRA_DIST += unictype/test-categ_none.c macros.h ## end gnulib module unictype/category-none-tests @@ -1509,7 +1553,7 @@ TESTS += test-categ_of check_PROGRAMS += test-categ_of test_categ_of_SOURCES = unictype/test-categ_of.c -EXTRA_DIST += unictype/test-categ_of.c +EXTRA_DIST += unictype/test-categ_of.c macros.h ## end gnulib module unictype/category-of-tests @@ -1519,7 +1563,7 @@ TESTS += test-categ_or check_PROGRAMS += test-categ_or test_categ_or_SOURCES = unictype/test-categ_or.c -EXTRA_DIST += unictype/test-categ_or.c +EXTRA_DIST += unictype/test-categ_or.c macros.h ## end gnulib module unictype/category-or-tests @@ -1529,7 +1573,7 @@ TESTS += test-categ_test_withtable check_PROGRAMS += test-categ_test_withtable test_categ_test_withtable_SOURCES = unictype/test-categ_test_withtable.c -EXTRA_DIST += unictype/test-categ_test_withtable.c +EXTRA_DIST += unictype/test-categ_test_withtable.c macros.h ## end gnulib module unictype/category-test-withtable-tests @@ -1539,7 +1583,7 @@ TESTS += test-combining check_PROGRAMS += test-combining test_combining_SOURCES = unictype/test-combining.c -EXTRA_DIST += unictype/test-combining.c +EXTRA_DIST += unictype/test-combining.c macros.h ## end gnulib module unictype/combining-class-tests @@ -1549,7 +1593,7 @@ TESTS += test-ctype_alnum check_PROGRAMS += test-ctype_alnum test_ctype_alnum_SOURCES = unictype/test-ctype_alnum.c -EXTRA_DIST += unictype/test-ctype_alnum.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-ctype_alnum.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/ctype-alnum-tests @@ -1559,7 +1603,7 @@ TESTS += test-ctype_alpha check_PROGRAMS += test-ctype_alpha test_ctype_alpha_SOURCES = unictype/test-ctype_alpha.c -EXTRA_DIST += unictype/test-ctype_alpha.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-ctype_alpha.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/ctype-alpha-tests @@ -1569,7 +1613,7 @@ TESTS += test-ctype_blank check_PROGRAMS += test-ctype_blank test_ctype_blank_SOURCES = unictype/test-ctype_blank.c -EXTRA_DIST += unictype/test-ctype_blank.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-ctype_blank.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/ctype-blank-tests @@ -1579,7 +1623,7 @@ TESTS += test-ctype_cntrl check_PROGRAMS += test-ctype_cntrl test_ctype_cntrl_SOURCES = unictype/test-ctype_cntrl.c -EXTRA_DIST += unictype/test-ctype_cntrl.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-ctype_cntrl.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/ctype-cntrl-tests @@ -1589,7 +1633,7 @@ TESTS += test-ctype_digit check_PROGRAMS += test-ctype_digit test_ctype_digit_SOURCES = unictype/test-ctype_digit.c -EXTRA_DIST += unictype/test-ctype_digit.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-ctype_digit.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/ctype-digit-tests @@ -1599,7 +1643,7 @@ TESTS += test-ctype_graph check_PROGRAMS += test-ctype_graph test_ctype_graph_SOURCES = unictype/test-ctype_graph.c -EXTRA_DIST += unictype/test-ctype_graph.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-ctype_graph.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/ctype-graph-tests @@ -1609,7 +1653,7 @@ TESTS += test-ctype_lower check_PROGRAMS += test-ctype_lower test_ctype_lower_SOURCES = unictype/test-ctype_lower.c -EXTRA_DIST += unictype/test-ctype_lower.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-ctype_lower.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/ctype-lower-tests @@ -1619,7 +1663,7 @@ TESTS += test-ctype_print check_PROGRAMS += test-ctype_print test_ctype_print_SOURCES = unictype/test-ctype_print.c -EXTRA_DIST += unictype/test-ctype_print.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-ctype_print.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/ctype-print-tests @@ -1629,7 +1673,7 @@ TESTS += test-ctype_punct check_PROGRAMS += test-ctype_punct test_ctype_punct_SOURCES = unictype/test-ctype_punct.c -EXTRA_DIST += unictype/test-ctype_punct.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-ctype_punct.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/ctype-punct-tests @@ -1639,7 +1683,7 @@ TESTS += test-ctype_space check_PROGRAMS += test-ctype_space test_ctype_space_SOURCES = unictype/test-ctype_space.c -EXTRA_DIST += unictype/test-ctype_space.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-ctype_space.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/ctype-space-tests @@ -1649,7 +1693,7 @@ TESTS += test-ctype_upper check_PROGRAMS += test-ctype_upper test_ctype_upper_SOURCES = unictype/test-ctype_upper.c -EXTRA_DIST += unictype/test-ctype_upper.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-ctype_upper.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/ctype-upper-tests @@ -1659,7 +1703,7 @@ TESTS += test-ctype_xdigit check_PROGRAMS += test-ctype_xdigit test_ctype_xdigit_SOURCES = unictype/test-ctype_xdigit.c -EXTRA_DIST += unictype/test-ctype_xdigit.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-ctype_xdigit.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/ctype-xdigit-tests @@ -1669,7 +1713,7 @@ TESTS += test-decdigit check_PROGRAMS += test-decdigit test_decdigit_SOURCES = unictype/test-decdigit.c -EXTRA_DIST += unictype/test-decdigit.c unictype/test-decdigit.h +EXTRA_DIST += unictype/test-decdigit.c unictype/test-decdigit.h macros.h ## end gnulib module unictype/decimal-digit-tests @@ -1679,7 +1723,7 @@ TESTS += test-digit check_PROGRAMS += test-digit test_digit_SOURCES = unictype/test-digit.c -EXTRA_DIST += unictype/test-digit.c unictype/test-digit.h +EXTRA_DIST += unictype/test-digit.c unictype/test-digit.h macros.h ## end gnulib module unictype/digit-tests @@ -1689,7 +1733,7 @@ TESTS += test-mirror check_PROGRAMS += test-mirror test_mirror_SOURCES = unictype/test-mirror.c -EXTRA_DIST += unictype/test-mirror.c +EXTRA_DIST += unictype/test-mirror.c macros.h ## end gnulib module unictype/mirror-tests @@ -1699,7 +1743,7 @@ TESTS += test-numeric check_PROGRAMS += test-numeric test_numeric_SOURCES = unictype/test-numeric.c -EXTRA_DIST += unictype/test-numeric.c unictype/test-numeric.h +EXTRA_DIST += unictype/test-numeric.c unictype/test-numeric.h macros.h ## end gnulib module unictype/numeric-tests @@ -1709,7 +1753,7 @@ TESTS += test-pr_alphabetic check_PROGRAMS += test-pr_alphabetic test_pr_alphabetic_SOURCES = unictype/test-pr_alphabetic.c -EXTRA_DIST += unictype/test-pr_alphabetic.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_alphabetic.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-alphabetic-tests @@ -1719,7 +1763,7 @@ TESTS += test-pr_ascii_hex_digit check_PROGRAMS += test-pr_ascii_hex_digit test_pr_ascii_hex_digit_SOURCES = unictype/test-pr_ascii_hex_digit.c -EXTRA_DIST += unictype/test-pr_ascii_hex_digit.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_ascii_hex_digit.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-ascii-hex-digit-tests @@ -1729,7 +1773,7 @@ TESTS += test-pr_bidi_arabic_digit check_PROGRAMS += test-pr_bidi_arabic_digit test_pr_bidi_arabic_digit_SOURCES = unictype/test-pr_bidi_arabic_digit.c -EXTRA_DIST += unictype/test-pr_bidi_arabic_digit.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_bidi_arabic_digit.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-bidi-arabic-digit-tests @@ -1739,7 +1783,7 @@ TESTS += test-pr_bidi_arabic_right_to_left check_PROGRAMS += test-pr_bidi_arabic_right_to_left test_pr_bidi_arabic_right_to_left_SOURCES = unictype/test-pr_bidi_arabic_right_to_left.c -EXTRA_DIST += unictype/test-pr_bidi_arabic_right_to_left.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_bidi_arabic_right_to_left.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-bidi-arabic-right-to-left-tests @@ -1749,7 +1793,7 @@ TESTS += test-pr_bidi_block_separator check_PROGRAMS += test-pr_bidi_block_separator test_pr_bidi_block_separator_SOURCES = unictype/test-pr_bidi_block_separator.c -EXTRA_DIST += unictype/test-pr_bidi_block_separator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_bidi_block_separator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-bidi-block-separator-tests @@ -1759,7 +1803,7 @@ TESTS += test-pr_bidi_boundary_neutral check_PROGRAMS += test-pr_bidi_boundary_neutral test_pr_bidi_boundary_neutral_SOURCES = unictype/test-pr_bidi_boundary_neutral.c -EXTRA_DIST += unictype/test-pr_bidi_boundary_neutral.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_bidi_boundary_neutral.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-bidi-boundary-neutral-tests @@ -1769,7 +1813,7 @@ TESTS += test-pr_bidi_common_separator check_PROGRAMS += test-pr_bidi_common_separator test_pr_bidi_common_separator_SOURCES = unictype/test-pr_bidi_common_separator.c -EXTRA_DIST += unictype/test-pr_bidi_common_separator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_bidi_common_separator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-bidi-common-separator-tests @@ -1779,7 +1823,7 @@ TESTS += test-pr_bidi_control check_PROGRAMS += test-pr_bidi_control test_pr_bidi_control_SOURCES = unictype/test-pr_bidi_control.c -EXTRA_DIST += unictype/test-pr_bidi_control.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_bidi_control.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-bidi-control-tests @@ -1789,7 +1833,7 @@ TESTS += test-pr_bidi_embedding_or_override check_PROGRAMS += test-pr_bidi_embedding_or_override test_pr_bidi_embedding_or_override_SOURCES = unictype/test-pr_bidi_embedding_or_override.c -EXTRA_DIST += unictype/test-pr_bidi_embedding_or_override.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_bidi_embedding_or_override.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-bidi-embedding-or-override-tests @@ -1799,7 +1843,7 @@ TESTS += test-pr_bidi_eur_num_separator check_PROGRAMS += test-pr_bidi_eur_num_separator test_pr_bidi_eur_num_separator_SOURCES = unictype/test-pr_bidi_eur_num_separator.c -EXTRA_DIST += unictype/test-pr_bidi_eur_num_separator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_bidi_eur_num_separator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-bidi-eur-num-separator-tests @@ -1809,7 +1853,7 @@ TESTS += test-pr_bidi_eur_num_terminator check_PROGRAMS += test-pr_bidi_eur_num_terminator test_pr_bidi_eur_num_terminator_SOURCES = unictype/test-pr_bidi_eur_num_terminator.c -EXTRA_DIST += unictype/test-pr_bidi_eur_num_terminator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_bidi_eur_num_terminator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-bidi-eur-num-terminator-tests @@ -1819,7 +1863,7 @@ TESTS += test-pr_bidi_european_digit check_PROGRAMS += test-pr_bidi_european_digit test_pr_bidi_european_digit_SOURCES = unictype/test-pr_bidi_european_digit.c -EXTRA_DIST += unictype/test-pr_bidi_european_digit.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_bidi_european_digit.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-bidi-european-digit-tests @@ -1829,7 +1873,7 @@ TESTS += test-pr_bidi_hebrew_right_to_left check_PROGRAMS += test-pr_bidi_hebrew_right_to_left test_pr_bidi_hebrew_right_to_left_SOURCES = unictype/test-pr_bidi_hebrew_right_to_left.c -EXTRA_DIST += unictype/test-pr_bidi_hebrew_right_to_left.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_bidi_hebrew_right_to_left.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-bidi-hebrew-right-to-left-tests @@ -1839,7 +1883,7 @@ TESTS += test-pr_bidi_left_to_right check_PROGRAMS += test-pr_bidi_left_to_right test_pr_bidi_left_to_right_SOURCES = unictype/test-pr_bidi_left_to_right.c -EXTRA_DIST += unictype/test-pr_bidi_left_to_right.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_bidi_left_to_right.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-bidi-left-to-right-tests @@ -1849,7 +1893,7 @@ TESTS += test-pr_bidi_non_spacing_mark check_PROGRAMS += test-pr_bidi_non_spacing_mark test_pr_bidi_non_spacing_mark_SOURCES = unictype/test-pr_bidi_non_spacing_mark.c -EXTRA_DIST += unictype/test-pr_bidi_non_spacing_mark.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_bidi_non_spacing_mark.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-bidi-non-spacing-mark-tests @@ -1859,7 +1903,7 @@ TESTS += test-pr_bidi_other_neutral check_PROGRAMS += test-pr_bidi_other_neutral test_pr_bidi_other_neutral_SOURCES = unictype/test-pr_bidi_other_neutral.c -EXTRA_DIST += unictype/test-pr_bidi_other_neutral.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_bidi_other_neutral.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-bidi-other-neutral-tests @@ -1869,7 +1913,7 @@ TESTS += test-pr_bidi_pdf check_PROGRAMS += test-pr_bidi_pdf test_pr_bidi_pdf_SOURCES = unictype/test-pr_bidi_pdf.c -EXTRA_DIST += unictype/test-pr_bidi_pdf.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_bidi_pdf.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-bidi-pdf-tests @@ -1879,7 +1923,7 @@ TESTS += test-pr_bidi_segment_separator check_PROGRAMS += test-pr_bidi_segment_separator test_pr_bidi_segment_separator_SOURCES = unictype/test-pr_bidi_segment_separator.c -EXTRA_DIST += unictype/test-pr_bidi_segment_separator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_bidi_segment_separator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-bidi-segment-separator-tests @@ -1889,7 +1933,7 @@ TESTS += test-pr_bidi_whitespace check_PROGRAMS += test-pr_bidi_whitespace test_pr_bidi_whitespace_SOURCES = unictype/test-pr_bidi_whitespace.c -EXTRA_DIST += unictype/test-pr_bidi_whitespace.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_bidi_whitespace.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-bidi-whitespace-tests @@ -1899,7 +1943,7 @@ TESTS += test-pr_byname check_PROGRAMS += test-pr_byname test_pr_byname_SOURCES = unictype/test-pr_byname.c -EXTRA_DIST += unictype/test-pr_byname.c +EXTRA_DIST += unictype/test-pr_byname.c macros.h ## end gnulib module unictype/property-byname-tests @@ -1909,7 +1953,7 @@ TESTS += test-pr_combining check_PROGRAMS += test-pr_combining test_pr_combining_SOURCES = unictype/test-pr_combining.c -EXTRA_DIST += unictype/test-pr_combining.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_combining.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-combining-tests @@ -1919,7 +1963,7 @@ TESTS += test-pr_composite check_PROGRAMS += test-pr_composite test_pr_composite_SOURCES = unictype/test-pr_composite.c -EXTRA_DIST += unictype/test-pr_composite.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_composite.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-composite-tests @@ -1929,7 +1973,7 @@ TESTS += test-pr_currency_symbol check_PROGRAMS += test-pr_currency_symbol test_pr_currency_symbol_SOURCES = unictype/test-pr_currency_symbol.c -EXTRA_DIST += unictype/test-pr_currency_symbol.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_currency_symbol.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-currency-symbol-tests @@ -1939,7 +1983,7 @@ TESTS += test-pr_dash check_PROGRAMS += test-pr_dash test_pr_dash_SOURCES = unictype/test-pr_dash.c -EXTRA_DIST += unictype/test-pr_dash.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_dash.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-dash-tests @@ -1949,7 +1993,7 @@ TESTS += test-pr_decimal_digit check_PROGRAMS += test-pr_decimal_digit test_pr_decimal_digit_SOURCES = unictype/test-pr_decimal_digit.c -EXTRA_DIST += unictype/test-pr_decimal_digit.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_decimal_digit.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-decimal-digit-tests @@ -1959,7 +2003,7 @@ TESTS += test-pr_default_ignorable_code_point check_PROGRAMS += test-pr_default_ignorable_code_point test_pr_default_ignorable_code_point_SOURCES = unictype/test-pr_default_ignorable_code_point.c -EXTRA_DIST += unictype/test-pr_default_ignorable_code_point.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_default_ignorable_code_point.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-default-ignorable-code-point-tests @@ -1969,7 +2013,7 @@ TESTS += test-pr_deprecated check_PROGRAMS += test-pr_deprecated test_pr_deprecated_SOURCES = unictype/test-pr_deprecated.c -EXTRA_DIST += unictype/test-pr_deprecated.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_deprecated.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-deprecated-tests @@ -1979,7 +2023,7 @@ TESTS += test-pr_diacritic check_PROGRAMS += test-pr_diacritic test_pr_diacritic_SOURCES = unictype/test-pr_diacritic.c -EXTRA_DIST += unictype/test-pr_diacritic.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_diacritic.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-diacritic-tests @@ -1989,7 +2033,7 @@ TESTS += test-pr_extender check_PROGRAMS += test-pr_extender test_pr_extender_SOURCES = unictype/test-pr_extender.c -EXTRA_DIST += unictype/test-pr_extender.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_extender.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-extender-tests @@ -1999,7 +2043,7 @@ TESTS += test-pr_format_control check_PROGRAMS += test-pr_format_control test_pr_format_control_SOURCES = unictype/test-pr_format_control.c -EXTRA_DIST += unictype/test-pr_format_control.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_format_control.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-format-control-tests @@ -2009,7 +2053,7 @@ TESTS += test-pr_grapheme_base check_PROGRAMS += test-pr_grapheme_base test_pr_grapheme_base_SOURCES = unictype/test-pr_grapheme_base.c -EXTRA_DIST += unictype/test-pr_grapheme_base.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_grapheme_base.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-grapheme-base-tests @@ -2019,7 +2063,7 @@ TESTS += test-pr_grapheme_extend check_PROGRAMS += test-pr_grapheme_extend test_pr_grapheme_extend_SOURCES = unictype/test-pr_grapheme_extend.c -EXTRA_DIST += unictype/test-pr_grapheme_extend.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_grapheme_extend.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-grapheme-extend-tests @@ -2029,7 +2073,7 @@ TESTS += test-pr_grapheme_link check_PROGRAMS += test-pr_grapheme_link test_pr_grapheme_link_SOURCES = unictype/test-pr_grapheme_link.c -EXTRA_DIST += unictype/test-pr_grapheme_link.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_grapheme_link.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-grapheme-link-tests @@ -2039,7 +2083,7 @@ TESTS += test-pr_hex_digit check_PROGRAMS += test-pr_hex_digit test_pr_hex_digit_SOURCES = unictype/test-pr_hex_digit.c -EXTRA_DIST += unictype/test-pr_hex_digit.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_hex_digit.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-hex-digit-tests @@ -2049,7 +2093,7 @@ TESTS += test-pr_hyphen check_PROGRAMS += test-pr_hyphen test_pr_hyphen_SOURCES = unictype/test-pr_hyphen.c -EXTRA_DIST += unictype/test-pr_hyphen.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_hyphen.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-hyphen-tests @@ -2059,7 +2103,7 @@ TESTS += test-pr_id_continue check_PROGRAMS += test-pr_id_continue test_pr_id_continue_SOURCES = unictype/test-pr_id_continue.c -EXTRA_DIST += unictype/test-pr_id_continue.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_id_continue.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-id-continue-tests @@ -2069,7 +2113,7 @@ TESTS += test-pr_id_start check_PROGRAMS += test-pr_id_start test_pr_id_start_SOURCES = unictype/test-pr_id_start.c -EXTRA_DIST += unictype/test-pr_id_start.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_id_start.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-id-start-tests @@ -2079,7 +2123,7 @@ TESTS += test-pr_ideographic check_PROGRAMS += test-pr_ideographic test_pr_ideographic_SOURCES = unictype/test-pr_ideographic.c -EXTRA_DIST += unictype/test-pr_ideographic.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_ideographic.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-ideographic-tests @@ -2089,7 +2133,7 @@ TESTS += test-pr_ids_binary_operator check_PROGRAMS += test-pr_ids_binary_operator test_pr_ids_binary_operator_SOURCES = unictype/test-pr_ids_binary_operator.c -EXTRA_DIST += unictype/test-pr_ids_binary_operator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_ids_binary_operator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-ids-binary-operator-tests @@ -2099,7 +2143,7 @@ TESTS += test-pr_ids_trinary_operator check_PROGRAMS += test-pr_ids_trinary_operator test_pr_ids_trinary_operator_SOURCES = unictype/test-pr_ids_trinary_operator.c -EXTRA_DIST += unictype/test-pr_ids_trinary_operator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_ids_trinary_operator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-ids-trinary-operator-tests @@ -2109,7 +2153,7 @@ TESTS += test-pr_ignorable_control check_PROGRAMS += test-pr_ignorable_control test_pr_ignorable_control_SOURCES = unictype/test-pr_ignorable_control.c -EXTRA_DIST += unictype/test-pr_ignorable_control.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_ignorable_control.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-ignorable-control-tests @@ -2119,7 +2163,7 @@ TESTS += test-pr_iso_control check_PROGRAMS += test-pr_iso_control test_pr_iso_control_SOURCES = unictype/test-pr_iso_control.c -EXTRA_DIST += unictype/test-pr_iso_control.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_iso_control.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-iso-control-tests @@ -2129,7 +2173,7 @@ TESTS += test-pr_join_control check_PROGRAMS += test-pr_join_control test_pr_join_control_SOURCES = unictype/test-pr_join_control.c -EXTRA_DIST += unictype/test-pr_join_control.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_join_control.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-join-control-tests @@ -2139,7 +2183,7 @@ TESTS += test-pr_left_of_pair check_PROGRAMS += test-pr_left_of_pair test_pr_left_of_pair_SOURCES = unictype/test-pr_left_of_pair.c -EXTRA_DIST += unictype/test-pr_left_of_pair.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_left_of_pair.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-left-of-pair-tests @@ -2149,7 +2193,7 @@ TESTS += test-pr_line_separator check_PROGRAMS += test-pr_line_separator test_pr_line_separator_SOURCES = unictype/test-pr_line_separator.c -EXTRA_DIST += unictype/test-pr_line_separator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_line_separator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-line-separator-tests @@ -2159,7 +2203,7 @@ TESTS += test-pr_logical_order_exception check_PROGRAMS += test-pr_logical_order_exception test_pr_logical_order_exception_SOURCES = unictype/test-pr_logical_order_exception.c -EXTRA_DIST += unictype/test-pr_logical_order_exception.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_logical_order_exception.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-logical-order-exception-tests @@ -2169,7 +2213,7 @@ TESTS += test-pr_lowercase check_PROGRAMS += test-pr_lowercase test_pr_lowercase_SOURCES = unictype/test-pr_lowercase.c -EXTRA_DIST += unictype/test-pr_lowercase.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_lowercase.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-lowercase-tests @@ -2179,7 +2223,7 @@ TESTS += test-pr_math check_PROGRAMS += test-pr_math test_pr_math_SOURCES = unictype/test-pr_math.c -EXTRA_DIST += unictype/test-pr_math.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_math.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-math-tests @@ -2189,7 +2233,7 @@ TESTS += test-pr_non_break check_PROGRAMS += test-pr_non_break test_pr_non_break_SOURCES = unictype/test-pr_non_break.c -EXTRA_DIST += unictype/test-pr_non_break.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_non_break.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-non-break-tests @@ -2199,7 +2243,7 @@ TESTS += test-pr_not_a_character check_PROGRAMS += test-pr_not_a_character test_pr_not_a_character_SOURCES = unictype/test-pr_not_a_character.c -EXTRA_DIST += unictype/test-pr_not_a_character.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_not_a_character.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-not-a-character-tests @@ -2209,7 +2253,7 @@ TESTS += test-pr_numeric check_PROGRAMS += test-pr_numeric test_pr_numeric_SOURCES = unictype/test-pr_numeric.c -EXTRA_DIST += unictype/test-pr_numeric.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_numeric.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-numeric-tests @@ -2219,7 +2263,7 @@ TESTS += test-pr_other_alphabetic check_PROGRAMS += test-pr_other_alphabetic test_pr_other_alphabetic_SOURCES = unictype/test-pr_other_alphabetic.c -EXTRA_DIST += unictype/test-pr_other_alphabetic.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_other_alphabetic.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-other-alphabetic-tests @@ -2229,7 +2273,7 @@ TESTS += test-pr_other_default_ignorable_code_point check_PROGRAMS += test-pr_other_default_ignorable_code_point test_pr_other_default_ignorable_code_point_SOURCES = unictype/test-pr_other_default_ignorable_code_point.c -EXTRA_DIST += unictype/test-pr_other_default_ignorable_code_point.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_other_default_ignorable_code_point.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-other-default-ignorable-code-point-tests @@ -2239,7 +2283,7 @@ TESTS += test-pr_other_grapheme_extend check_PROGRAMS += test-pr_other_grapheme_extend test_pr_other_grapheme_extend_SOURCES = unictype/test-pr_other_grapheme_extend.c -EXTRA_DIST += unictype/test-pr_other_grapheme_extend.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_other_grapheme_extend.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-other-grapheme-extend-tests @@ -2249,7 +2293,7 @@ TESTS += test-pr_other_id_continue check_PROGRAMS += test-pr_other_id_continue test_pr_other_id_continue_SOURCES = unictype/test-pr_other_id_continue.c -EXTRA_DIST += unictype/test-pr_other_id_continue.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_other_id_continue.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-other-id-continue-tests @@ -2259,7 +2303,7 @@ TESTS += test-pr_other_id_start check_PROGRAMS += test-pr_other_id_start test_pr_other_id_start_SOURCES = unictype/test-pr_other_id_start.c -EXTRA_DIST += unictype/test-pr_other_id_start.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_other_id_start.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-other-id-start-tests @@ -2269,7 +2313,7 @@ TESTS += test-pr_other_lowercase check_PROGRAMS += test-pr_other_lowercase test_pr_other_lowercase_SOURCES = unictype/test-pr_other_lowercase.c -EXTRA_DIST += unictype/test-pr_other_lowercase.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_other_lowercase.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-other-lowercase-tests @@ -2279,7 +2323,7 @@ TESTS += test-pr_other_math check_PROGRAMS += test-pr_other_math test_pr_other_math_SOURCES = unictype/test-pr_other_math.c -EXTRA_DIST += unictype/test-pr_other_math.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_other_math.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-other-math-tests @@ -2289,7 +2333,7 @@ TESTS += test-pr_other_uppercase check_PROGRAMS += test-pr_other_uppercase test_pr_other_uppercase_SOURCES = unictype/test-pr_other_uppercase.c -EXTRA_DIST += unictype/test-pr_other_uppercase.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_other_uppercase.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-other-uppercase-tests @@ -2299,7 +2343,7 @@ TESTS += test-pr_paired_punctuation check_PROGRAMS += test-pr_paired_punctuation test_pr_paired_punctuation_SOURCES = unictype/test-pr_paired_punctuation.c -EXTRA_DIST += unictype/test-pr_paired_punctuation.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_paired_punctuation.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-paired-punctuation-tests @@ -2309,7 +2353,7 @@ TESTS += test-pr_paragraph_separator check_PROGRAMS += test-pr_paragraph_separator test_pr_paragraph_separator_SOURCES = unictype/test-pr_paragraph_separator.c -EXTRA_DIST += unictype/test-pr_paragraph_separator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_paragraph_separator.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-paragraph-separator-tests @@ -2319,7 +2363,7 @@ TESTS += test-pr_pattern_syntax check_PROGRAMS += test-pr_pattern_syntax test_pr_pattern_syntax_SOURCES = unictype/test-pr_pattern_syntax.c -EXTRA_DIST += unictype/test-pr_pattern_syntax.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_pattern_syntax.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-pattern-syntax-tests @@ -2329,7 +2373,7 @@ TESTS += test-pr_pattern_white_space check_PROGRAMS += test-pr_pattern_white_space test_pr_pattern_white_space_SOURCES = unictype/test-pr_pattern_white_space.c -EXTRA_DIST += unictype/test-pr_pattern_white_space.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_pattern_white_space.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-pattern-white-space-tests @@ -2339,7 +2383,7 @@ TESTS += test-pr_private_use check_PROGRAMS += test-pr_private_use test_pr_private_use_SOURCES = unictype/test-pr_private_use.c -EXTRA_DIST += unictype/test-pr_private_use.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_private_use.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-private-use-tests @@ -2349,7 +2393,7 @@ TESTS += test-pr_punctuation check_PROGRAMS += test-pr_punctuation test_pr_punctuation_SOURCES = unictype/test-pr_punctuation.c -EXTRA_DIST += unictype/test-pr_punctuation.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_punctuation.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-punctuation-tests @@ -2359,7 +2403,7 @@ TESTS += test-pr_quotation_mark check_PROGRAMS += test-pr_quotation_mark test_pr_quotation_mark_SOURCES = unictype/test-pr_quotation_mark.c -EXTRA_DIST += unictype/test-pr_quotation_mark.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_quotation_mark.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-quotation-mark-tests @@ -2369,7 +2413,7 @@ TESTS += test-pr_radical check_PROGRAMS += test-pr_radical test_pr_radical_SOURCES = unictype/test-pr_radical.c -EXTRA_DIST += unictype/test-pr_radical.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_radical.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-radical-tests @@ -2379,7 +2423,7 @@ TESTS += test-pr_sentence_terminal check_PROGRAMS += test-pr_sentence_terminal test_pr_sentence_terminal_SOURCES = unictype/test-pr_sentence_terminal.c -EXTRA_DIST += unictype/test-pr_sentence_terminal.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_sentence_terminal.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-sentence-terminal-tests @@ -2389,7 +2433,7 @@ TESTS += test-pr_soft_dotted check_PROGRAMS += test-pr_soft_dotted test_pr_soft_dotted_SOURCES = unictype/test-pr_soft_dotted.c -EXTRA_DIST += unictype/test-pr_soft_dotted.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_soft_dotted.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-soft-dotted-tests @@ -2399,7 +2443,7 @@ TESTS += test-pr_space check_PROGRAMS += test-pr_space test_pr_space_SOURCES = unictype/test-pr_space.c -EXTRA_DIST += unictype/test-pr_space.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_space.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-space-tests @@ -2409,7 +2453,7 @@ TESTS += test-pr_terminal_punctuation check_PROGRAMS += test-pr_terminal_punctuation test_pr_terminal_punctuation_SOURCES = unictype/test-pr_terminal_punctuation.c -EXTRA_DIST += unictype/test-pr_terminal_punctuation.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_terminal_punctuation.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-terminal-punctuation-tests @@ -2419,7 +2463,7 @@ TESTS += test-pr_test check_PROGRAMS += test-pr_test test_pr_test_SOURCES = unictype/test-pr_test.c -EXTRA_DIST += unictype/test-pr_test.c +EXTRA_DIST += unictype/test-pr_test.c macros.h ## end gnulib module unictype/property-test-tests @@ -2429,7 +2473,7 @@ TESTS += test-pr_titlecase check_PROGRAMS += test-pr_titlecase test_pr_titlecase_SOURCES = unictype/test-pr_titlecase.c -EXTRA_DIST += unictype/test-pr_titlecase.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_titlecase.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-titlecase-tests @@ -2439,7 +2483,7 @@ TESTS += test-pr_unassigned_code_value check_PROGRAMS += test-pr_unassigned_code_value test_pr_unassigned_code_value_SOURCES = unictype/test-pr_unassigned_code_value.c -EXTRA_DIST += unictype/test-pr_unassigned_code_value.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_unassigned_code_value.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-unassigned-code-value-tests @@ -2449,7 +2493,7 @@ TESTS += test-pr_unified_ideograph check_PROGRAMS += test-pr_unified_ideograph test_pr_unified_ideograph_SOURCES = unictype/test-pr_unified_ideograph.c -EXTRA_DIST += unictype/test-pr_unified_ideograph.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_unified_ideograph.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-unified-ideograph-tests @@ -2459,7 +2503,7 @@ TESTS += test-pr_uppercase check_PROGRAMS += test-pr_uppercase test_pr_uppercase_SOURCES = unictype/test-pr_uppercase.c -EXTRA_DIST += unictype/test-pr_uppercase.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_uppercase.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-uppercase-tests @@ -2469,7 +2513,7 @@ TESTS += test-pr_variation_selector check_PROGRAMS += test-pr_variation_selector test_pr_variation_selector_SOURCES = unictype/test-pr_variation_selector.c -EXTRA_DIST += unictype/test-pr_variation_selector.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_variation_selector.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-variation-selector-tests @@ -2479,7 +2523,7 @@ TESTS += test-pr_white_space check_PROGRAMS += test-pr_white_space test_pr_white_space_SOURCES = unictype/test-pr_white_space.c -EXTRA_DIST += unictype/test-pr_white_space.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_white_space.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-white-space-tests @@ -2489,7 +2533,7 @@ TESTS += test-pr_xid_continue check_PROGRAMS += test-pr_xid_continue test_pr_xid_continue_SOURCES = unictype/test-pr_xid_continue.c -EXTRA_DIST += unictype/test-pr_xid_continue.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_xid_continue.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-xid-continue-tests @@ -2499,7 +2543,7 @@ TESTS += test-pr_xid_start check_PROGRAMS += test-pr_xid_start test_pr_xid_start_SOURCES = unictype/test-pr_xid_start.c -EXTRA_DIST += unictype/test-pr_xid_start.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_xid_start.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-xid-start-tests @@ -2509,7 +2553,7 @@ TESTS += test-pr_zero_width check_PROGRAMS += test-pr_zero_width test_pr_zero_width_SOURCES = unictype/test-pr_zero_width.c -EXTRA_DIST += unictype/test-pr_zero_width.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-pr_zero_width.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/property-zero-width-tests @@ -2519,7 +2563,7 @@ TESTS += test-scripts check_PROGRAMS += test-scripts test_scripts_SOURCES = unictype/test-scripts.c -EXTRA_DIST += unictype/test-scripts.c +EXTRA_DIST += unictype/test-scripts.c macros.h ## end gnulib module unictype/scripts-tests @@ -2529,7 +2573,7 @@ TESTS += test-sy_c_ident check_PROGRAMS += test-sy_c_ident test_sy_c_ident_SOURCES = unictype/test-sy_c_ident.c -EXTRA_DIST += unictype/test-sy_c_ident.c +EXTRA_DIST += unictype/test-sy_c_ident.c macros.h ## end gnulib module unictype/syntax-c-ident-tests @@ -2539,7 +2583,7 @@ TESTS += test-sy_c_whitespace check_PROGRAMS += test-sy_c_whitespace test_sy_c_whitespace_SOURCES = unictype/test-sy_c_whitespace.c -EXTRA_DIST += unictype/test-sy_c_whitespace.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-sy_c_whitespace.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/syntax-c-whitespace-tests @@ -2549,7 +2593,7 @@ TESTS += test-sy_java_ident check_PROGRAMS += test-sy_java_ident test_sy_java_ident_SOURCES = unictype/test-sy_java_ident.c -EXTRA_DIST += unictype/test-sy_java_ident.c +EXTRA_DIST += unictype/test-sy_java_ident.c macros.h ## end gnulib module unictype/syntax-java-ident-tests @@ -2559,7 +2603,7 @@ TESTS += test-sy_java_whitespace check_PROGRAMS += test-sy_java_whitespace test_sy_java_whitespace_SOURCES = unictype/test-sy_java_whitespace.c -EXTRA_DIST += unictype/test-sy_java_whitespace.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h +EXTRA_DIST += unictype/test-sy_java_whitespace.c unictype/test-predicate-part1.h unictype/test-predicate-part2.h macros.h ## end gnulib module unictype/syntax-java-whitespace-tests @@ -2569,7 +2613,7 @@ TESTS += test-u16-possible-linebreaks check_PROGRAMS += test-u16-possible-linebreaks test_u16_possible_linebreaks_SOURCES = unilbrk/test-u16-possible-linebreaks.c -EXTRA_DIST += unilbrk/test-u16-possible-linebreaks.c +EXTRA_DIST += unilbrk/test-u16-possible-linebreaks.c macros.h ## end gnulib module unilbrk/u16-possible-linebreaks-tests @@ -2579,7 +2623,7 @@ TESTS += test-u16-width-linebreaks check_PROGRAMS += test-u16-width-linebreaks test_u16_width_linebreaks_SOURCES = unilbrk/test-u16-width-linebreaks.c -EXTRA_DIST += unilbrk/test-u16-width-linebreaks.c +EXTRA_DIST += unilbrk/test-u16-width-linebreaks.c macros.h ## end gnulib module unilbrk/u16-width-linebreaks-tests @@ -2589,7 +2633,7 @@ TESTS += test-u32-possible-linebreaks check_PROGRAMS += test-u32-possible-linebreaks test_u32_possible_linebreaks_SOURCES = unilbrk/test-u32-possible-linebreaks.c -EXTRA_DIST += unilbrk/test-u32-possible-linebreaks.c +EXTRA_DIST += unilbrk/test-u32-possible-linebreaks.c macros.h ## end gnulib module unilbrk/u32-possible-linebreaks-tests @@ -2599,7 +2643,7 @@ TESTS += test-u32-width-linebreaks check_PROGRAMS += test-u32-width-linebreaks test_u32_width_linebreaks_SOURCES = unilbrk/test-u32-width-linebreaks.c -EXTRA_DIST += unilbrk/test-u32-width-linebreaks.c +EXTRA_DIST += unilbrk/test-u32-width-linebreaks.c macros.h ## end gnulib module unilbrk/u32-width-linebreaks-tests @@ -2609,7 +2653,7 @@ TESTS += test-u8-possible-linebreaks check_PROGRAMS += test-u8-possible-linebreaks test_u8_possible_linebreaks_SOURCES = unilbrk/test-u8-possible-linebreaks.c -EXTRA_DIST += unilbrk/test-u8-possible-linebreaks.c +EXTRA_DIST += unilbrk/test-u8-possible-linebreaks.c macros.h ## end gnulib module unilbrk/u8-possible-linebreaks-tests @@ -2619,7 +2663,7 @@ TESTS += test-u8-width-linebreaks check_PROGRAMS += test-u8-width-linebreaks test_u8_width_linebreaks_SOURCES = unilbrk/test-u8-width-linebreaks.c -EXTRA_DIST += unilbrk/test-u8-width-linebreaks.c +EXTRA_DIST += unilbrk/test-u8-width-linebreaks.c macros.h ## end gnulib module unilbrk/u8-width-linebreaks-tests @@ -2630,7 +2674,7 @@ check_PROGRAMS += test-ulc-possible-linebreaks test_ulc_possible_linebreaks_SOURCES = unilbrk/test-ulc-possible-linebreaks.c test_ulc_possible_linebreaks_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unilbrk/test-ulc-possible-linebreaks.c +EXTRA_DIST += unilbrk/test-ulc-possible-linebreaks.c macros.h ## end gnulib module unilbrk/ulc-possible-linebreaks-tests @@ -2641,14 +2685,13 @@ check_PROGRAMS += test-ulc-width-linebreaks test_ulc_width_linebreaks_SOURCES = unilbrk/test-ulc-width-linebreaks.c test_ulc_width_linebreaks_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unilbrk/test-ulc-width-linebreaks.c +EXTRA_DIST += unilbrk/test-ulc-width-linebreaks.c macros.h ## end gnulib module unilbrk/ulc-width-linebreaks-tests ## begin gnulib module uniname/uniname-tests TESTS += uniname/test-uninames.sh -TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)' check_PROGRAMS += test-uninames test_uninames_SOURCES = uniname/test-uninames.c test_uninames_LDADD = $(LDADD) @LIBINTL@ @@ -2663,7 +2706,7 @@ TESTS += test-canonical-decomposition check_PROGRAMS += test-canonical-decomposition test_canonical_decomposition_SOURCES = uninorm/test-canonical-decomposition.c -EXTRA_DIST += uninorm/test-canonical-decomposition.c +EXTRA_DIST += uninorm/test-canonical-decomposition.c macros.h ## end gnulib module uninorm/canonical-decomposition-tests @@ -2673,7 +2716,7 @@ TESTS += test-compat-decomposition check_PROGRAMS += test-compat-decomposition test_compat_decomposition_SOURCES = uninorm/test-compat-decomposition.c -EXTRA_DIST += uninorm/test-compat-decomposition.c +EXTRA_DIST += uninorm/test-compat-decomposition.c macros.h ## end gnulib module uninorm/compat-decomposition-tests @@ -2683,7 +2726,7 @@ TESTS += test-composition check_PROGRAMS += test-composition test_composition_SOURCES = uninorm/test-composition.c -EXTRA_DIST += uninorm/test-composition.c +EXTRA_DIST += uninorm/test-composition.c macros.h ## end gnulib module uninorm/composition-tests @@ -2693,7 +2736,7 @@ TESTS += test-decomposing-form check_PROGRAMS += test-decomposing-form test_decomposing_form_SOURCES = uninorm/test-decomposing-form.c -EXTRA_DIST += uninorm/test-decomposing-form.c +EXTRA_DIST += uninorm/test-decomposing-form.c macros.h ## end gnulib module uninorm/decomposing-form-tests @@ -2703,7 +2746,7 @@ TESTS += test-decomposition check_PROGRAMS += test-decomposition test_decomposition_SOURCES = uninorm/test-decomposition.c -EXTRA_DIST += uninorm/test-decomposition.c +EXTRA_DIST += uninorm/test-decomposition.c macros.h ## end gnulib module uninorm/decomposition-tests @@ -2713,7 +2756,7 @@ TESTS += test-uninorm-filter-nfc check_PROGRAMS += test-uninorm-filter-nfc test_uninorm_filter_nfc_SOURCES = uninorm/test-uninorm-filter-nfc.c -EXTRA_DIST += uninorm/test-uninorm-filter-nfc.c +EXTRA_DIST += uninorm/test-uninorm-filter-nfc.c macros.h ## end gnulib module uninorm/filter-tests @@ -2730,7 +2773,7 @@ test_u32_nfc_big_SOURCES = \ uninorm/test-u32-nfc-big.c \ uninorm/test-u32-normalize-big.c test_u32_nfc_big_LDADD = $(LDADD) @LIBINTL@ -EXTRA_DIST += uninorm/test-nfc.c uninorm/test-u8-nfc.c uninorm/test-u16-nfc.c uninorm/test-u32-nfc.c uninorm/test-u32-nfc-big.sh uninorm/test-u32-nfc-big.c uninorm/test-u32-normalize-big.h uninorm/test-u32-normalize-big.c uninorm/NormalizationTest.txt +EXTRA_DIST += uninorm/test-nfc.c uninorm/test-u8-nfc.c uninorm/test-u16-nfc.c uninorm/test-u32-nfc.c uninorm/test-u32-nfc-big.sh uninorm/test-u32-nfc-big.c uninorm/test-u32-normalize-big.h uninorm/test-u32-normalize-big.c uninorm/NormalizationTest.txt macros.h ## end gnulib module uninorm/nfc-tests @@ -2748,7 +2791,7 @@ test_u32_nfd_big_SOURCES = \ uninorm/test-u32-normalize-big.c test_u32_nfd_big_LDADD = $(LDADD) @LIBINTL@ -EXTRA_DIST += uninorm/test-nfd.c uninorm/test-u8-nfd.c uninorm/test-u16-nfd.c uninorm/test-u32-nfd.c uninorm/test-u32-nfd-big.sh uninorm/test-u32-nfd-big.c uninorm/test-u32-normalize-big.h uninorm/test-u32-normalize-big.c uninorm/NormalizationTest.txt +EXTRA_DIST += uninorm/test-nfd.c uninorm/test-u8-nfd.c uninorm/test-u16-nfd.c uninorm/test-u32-nfd.c uninorm/test-u32-nfd-big.sh uninorm/test-u32-nfd-big.c uninorm/test-u32-normalize-big.h uninorm/test-u32-normalize-big.c uninorm/NormalizationTest.txt macros.h ## end gnulib module uninorm/nfd-tests @@ -2766,7 +2809,7 @@ test_u32_nfkc_big_SOURCES = \ uninorm/test-u32-normalize-big.c test_u32_nfkc_big_LDADD = $(LDADD) @LIBINTL@ -EXTRA_DIST += uninorm/test-nfkc.c uninorm/test-u8-nfkc.c uninorm/test-u16-nfkc.c uninorm/test-u32-nfkc.c uninorm/test-u32-nfkc-big.sh uninorm/test-u32-nfkc-big.c uninorm/test-u32-normalize-big.h uninorm/test-u32-normalize-big.c uninorm/NormalizationTest.txt +EXTRA_DIST += uninorm/test-nfkc.c uninorm/test-u8-nfkc.c uninorm/test-u16-nfkc.c uninorm/test-u32-nfkc.c uninorm/test-u32-nfkc-big.sh uninorm/test-u32-nfkc-big.c uninorm/test-u32-normalize-big.h uninorm/test-u32-normalize-big.c uninorm/NormalizationTest.txt macros.h ## end gnulib module uninorm/nfkc-tests @@ -2784,7 +2827,7 @@ test_u32_nfkd_big_SOURCES = \ uninorm/test-u32-normalize-big.c test_u32_nfkd_big_LDADD = $(LDADD) @LIBINTL@ -EXTRA_DIST += uninorm/test-nfkd.c uninorm/test-u8-nfkd.c uninorm/test-u16-nfkd.c uninorm/test-u32-nfkd.c uninorm/test-u32-nfkd-big.sh uninorm/test-u32-nfkd-big.c uninorm/test-u32-normalize-big.h uninorm/test-u32-normalize-big.c uninorm/NormalizationTest.txt +EXTRA_DIST += uninorm/test-nfkd.c uninorm/test-u8-nfkd.c uninorm/test-u16-nfkd.c uninorm/test-u32-nfkd.c uninorm/test-u32-nfkd-big.sh uninorm/test-u32-nfkd-big.c uninorm/test-u32-normalize-big.h uninorm/test-u32-normalize-big.c uninorm/NormalizationTest.txt macros.h ## end gnulib module uninorm/nfkd-tests @@ -2794,7 +2837,7 @@ TESTS += test-u16-normcmp check_PROGRAMS += test-u16-normcmp test_u16_normcmp_SOURCES = uninorm/test-u16-normcmp.c -EXTRA_DIST += uninorm/test-u16-normcmp.c uninorm/test-u16-normcmp.h +EXTRA_DIST += uninorm/test-u16-normcmp.c uninorm/test-u16-normcmp.h macros.h ## end gnulib module uninorm/u16-normcmp-tests @@ -2805,7 +2848,7 @@ check_PROGRAMS += test-u16-normcoll test_u16_normcoll_SOURCES = uninorm/test-u16-normcoll.c test_u16_normcoll_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += uninorm/test-u16-normcoll.c uninorm/test-u16-normcmp.h +EXTRA_DIST += uninorm/test-u16-normcoll.c uninorm/test-u16-normcmp.h macros.h ## end gnulib module uninorm/u16-normcoll-tests @@ -2815,7 +2858,7 @@ TESTS += test-u32-normcmp check_PROGRAMS += test-u32-normcmp test_u32_normcmp_SOURCES = uninorm/test-u32-normcmp.c -EXTRA_DIST += uninorm/test-u32-normcmp.c uninorm/test-u32-normcmp.h +EXTRA_DIST += uninorm/test-u32-normcmp.c uninorm/test-u32-normcmp.h macros.h ## end gnulib module uninorm/u32-normcmp-tests @@ -2826,7 +2869,7 @@ check_PROGRAMS += test-u32-normcoll test_u32_normcoll_SOURCES = uninorm/test-u32-normcoll.c test_u32_normcoll_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += uninorm/test-u32-normcoll.c uninorm/test-u32-normcmp.h +EXTRA_DIST += uninorm/test-u32-normcoll.c uninorm/test-u32-normcmp.h macros.h ## end gnulib module uninorm/u32-normcoll-tests @@ -2836,7 +2879,7 @@ TESTS += test-u8-normcmp check_PROGRAMS += test-u8-normcmp test_u8_normcmp_SOURCES = uninorm/test-u8-normcmp.c -EXTRA_DIST += uninorm/test-u8-normcmp.c uninorm/test-u8-normcmp.h +EXTRA_DIST += uninorm/test-u8-normcmp.c uninorm/test-u8-normcmp.h macros.h ## end gnulib module uninorm/u8-normcmp-tests @@ -2847,7 +2890,7 @@ check_PROGRAMS += test-u8-normcoll test_u8_normcoll_SOURCES = uninorm/test-u8-normcoll.c test_u8_normcoll_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += uninorm/test-u8-normcoll.c uninorm/test-u8-normcmp.h +EXTRA_DIST += uninorm/test-u8-normcoll.c uninorm/test-u8-normcmp.h macros.h ## end gnulib module uninorm/u8-normcoll-tests @@ -2855,7 +2898,6 @@ EXTRA_DIST += uninorm/test-u8-normcoll.c uninorm/test-u8-normcmp.h TESTS += test-unistd check_PROGRAMS += test-unistd - EXTRA_DIST += test-unistd.c ## end gnulib module unistd-tests @@ -2866,14 +2908,14 @@ TESTS += test-u16-asnprintf1 check_PROGRAMS += test-u16-asnprintf1 test_u16_asnprintf1_SOURCES = unistdio/test-u16-asnprintf1.c test_u16_asnprintf1_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unistdio/test-u16-asnprintf1.c unistdio/test-u16-asnprintf1.h unistdio/test-u16-printf1.h +EXTRA_DIST += unistdio/test-u16-asnprintf1.c unistdio/test-u16-asnprintf1.h unistdio/test-u16-printf1.h macros.h ## end gnulib module unistdio/u16-asnprintf-tests ## begin gnulib module unistdio/u16-vasnprintf-tests TESTS += test-u16-vasnprintf1 unistdio/test-u16-vasnprintf2.sh unistdio/test-u16-vasnprintf3.sh -TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' +TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' check_PROGRAMS += test-u16-vasnprintf1 test-u16-vasnprintf2 test-u16-vasnprintf3 test_u16_vasnprintf1_SOURCES = unistdio/test-u16-vasnprintf1.c test_u16_vasnprintf1_LDADD = $(LDADD) @LIBICONV@ @@ -2881,7 +2923,7 @@ test_u16_vasnprintf2_SOURCES = unistdio/test-u16-vasnprintf2.c test_u16_vasnprintf2_LDADD = $(LDADD) @LIBICONV@ test_u16_vasnprintf3_SOURCES = unistdio/test-u16-vasnprintf3.c test_u16_vasnprintf3_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unistdio/test-u16-vasnprintf1.c unistdio/test-u16-asnprintf1.h unistdio/test-u16-printf1.h unistdio/test-u16-vasnprintf2.sh unistdio/test-u16-vasnprintf2.c unistdio/test-u16-vasnprintf3.sh unistdio/test-u16-vasnprintf3.c +EXTRA_DIST += unistdio/test-u16-vasnprintf1.c unistdio/test-u16-asnprintf1.h unistdio/test-u16-printf1.h unistdio/test-u16-vasnprintf2.sh unistdio/test-u16-vasnprintf2.c unistdio/test-u16-vasnprintf3.sh unistdio/test-u16-vasnprintf3.c macros.h ## end gnulib module unistdio/u16-vasnprintf-tests @@ -2891,7 +2933,7 @@ TESTS += test-u16-vasprintf1 check_PROGRAMS += test-u16-vasprintf1 test_u16_vasprintf1_SOURCES = unistdio/test-u16-vasprintf1.c test_u16_vasprintf1_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unistdio/test-u16-vasprintf1.c unistdio/test-u16-printf1.h +EXTRA_DIST += unistdio/test-u16-vasprintf1.c unistdio/test-u16-printf1.h macros.h ## end gnulib module unistdio/u16-vasprintf-tests @@ -2901,7 +2943,7 @@ TESTS += test-u16-vsnprintf1 check_PROGRAMS += test-u16-vsnprintf1 test_u16_vsnprintf1_SOURCES = unistdio/test-u16-vsnprintf1.c test_u16_vsnprintf1_LDADD = $(LDADD) @LIBINTL@ @LIBICONV@ -EXTRA_DIST += unistdio/test-u16-vsnprintf1.c unistdio/test-u16-printf1.h +EXTRA_DIST += unistdio/test-u16-vsnprintf1.c unistdio/test-u16-printf1.h macros.h ## end gnulib module unistdio/u16-vsnprintf-tests @@ -2911,7 +2953,7 @@ TESTS += test-u16-vsprintf1 check_PROGRAMS += test-u16-vsprintf1 test_u16_vsprintf1_SOURCES = unistdio/test-u16-vsprintf1.c test_u16_vsprintf1_LDADD = $(LDADD) @LIBINTL@ @LIBICONV@ -EXTRA_DIST += unistdio/test-u16-vsprintf1.c unistdio/test-u16-printf1.h +EXTRA_DIST += unistdio/test-u16-vsprintf1.c unistdio/test-u16-printf1.h macros.h ## end gnulib module unistdio/u16-vsprintf-tests @@ -2921,14 +2963,14 @@ TESTS += test-u32-asnprintf1 check_PROGRAMS += test-u32-asnprintf1 test_u32_asnprintf1_SOURCES = unistdio/test-u32-asnprintf1.c test_u32_asnprintf1_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unistdio/test-u32-asnprintf1.c unistdio/test-u32-asnprintf1.h unistdio/test-u32-printf1.h +EXTRA_DIST += unistdio/test-u32-asnprintf1.c unistdio/test-u32-asnprintf1.h unistdio/test-u32-printf1.h macros.h ## end gnulib module unistdio/u32-asnprintf-tests ## begin gnulib module unistdio/u32-vasnprintf-tests TESTS += test-u32-vasnprintf1 unistdio/test-u32-vasnprintf2.sh unistdio/test-u32-vasnprintf3.sh -TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' +TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' check_PROGRAMS += test-u32-vasnprintf1 test-u32-vasnprintf2 test-u32-vasnprintf3 test_u32_vasnprintf1_SOURCES = unistdio/test-u32-vasnprintf1.c test_u32_vasnprintf1_LDADD = $(LDADD) @LIBICONV@ @@ -2936,7 +2978,7 @@ test_u32_vasnprintf2_SOURCES = unistdio/test-u32-vasnprintf2.c test_u32_vasnprintf2_LDADD = $(LDADD) @LIBICONV@ test_u32_vasnprintf3_SOURCES = unistdio/test-u32-vasnprintf3.c test_u32_vasnprintf3_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unistdio/test-u32-vasnprintf1.c unistdio/test-u32-asnprintf1.h unistdio/test-u32-printf1.h unistdio/test-u32-vasnprintf2.sh unistdio/test-u32-vasnprintf2.c unistdio/test-u32-vasnprintf3.sh unistdio/test-u32-vasnprintf3.c +EXTRA_DIST += unistdio/test-u32-vasnprintf1.c unistdio/test-u32-asnprintf1.h unistdio/test-u32-printf1.h unistdio/test-u32-vasnprintf2.sh unistdio/test-u32-vasnprintf2.c unistdio/test-u32-vasnprintf3.sh unistdio/test-u32-vasnprintf3.c macros.h ## end gnulib module unistdio/u32-vasnprintf-tests @@ -2946,7 +2988,7 @@ TESTS += test-u32-vasprintf1 check_PROGRAMS += test-u32-vasprintf1 test_u32_vasprintf1_SOURCES = unistdio/test-u32-vasprintf1.c test_u32_vasprintf1_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unistdio/test-u32-vasprintf1.c unistdio/test-u32-printf1.h +EXTRA_DIST += unistdio/test-u32-vasprintf1.c unistdio/test-u32-printf1.h macros.h ## end gnulib module unistdio/u32-vasprintf-tests @@ -2956,7 +2998,7 @@ TESTS += test-u32-vsnprintf1 check_PROGRAMS += test-u32-vsnprintf1 test_u32_vsnprintf1_SOURCES = unistdio/test-u32-vsnprintf1.c test_u32_vsnprintf1_LDADD = $(LDADD) @LIBINTL@ @LIBICONV@ -EXTRA_DIST += unistdio/test-u32-vsnprintf1.c unistdio/test-u32-printf1.h +EXTRA_DIST += unistdio/test-u32-vsnprintf1.c unistdio/test-u32-printf1.h macros.h ## end gnulib module unistdio/u32-vsnprintf-tests @@ -2966,7 +3008,7 @@ TESTS += test-u32-vsprintf1 check_PROGRAMS += test-u32-vsprintf1 test_u32_vsprintf1_SOURCES = unistdio/test-u32-vsprintf1.c test_u32_vsprintf1_LDADD = $(LDADD) @LIBINTL@ @LIBICONV@ -EXTRA_DIST += unistdio/test-u32-vsprintf1.c unistdio/test-u32-printf1.h +EXTRA_DIST += unistdio/test-u32-vsprintf1.c unistdio/test-u32-printf1.h macros.h ## end gnulib module unistdio/u32-vsprintf-tests @@ -2976,14 +3018,14 @@ TESTS += test-u8-asnprintf1 check_PROGRAMS += test-u8-asnprintf1 test_u8_asnprintf1_SOURCES = unistdio/test-u8-asnprintf1.c test_u8_asnprintf1_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unistdio/test-u8-asnprintf1.c unistdio/test-u8-asnprintf1.h unistdio/test-u8-printf1.h +EXTRA_DIST += unistdio/test-u8-asnprintf1.c unistdio/test-u8-asnprintf1.h unistdio/test-u8-printf1.h macros.h ## end gnulib module unistdio/u8-asnprintf-tests ## begin gnulib module unistdio/u8-vasnprintf-tests TESTS += test-u8-vasnprintf1 unistdio/test-u8-vasnprintf2.sh unistdio/test-u8-vasnprintf3.sh -TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' +TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' check_PROGRAMS += test-u8-vasnprintf1 test-u8-vasnprintf2 test-u8-vasnprintf3 test_u8_vasnprintf1_SOURCES = unistdio/test-u8-vasnprintf1.c test_u8_vasnprintf1_LDADD = $(LDADD) @LIBICONV@ @@ -2991,7 +3033,7 @@ test_u8_vasnprintf2_SOURCES = unistdio/test-u8-vasnprintf2.c test_u8_vasnprintf2_LDADD = $(LDADD) @LIBICONV@ test_u8_vasnprintf3_SOURCES = unistdio/test-u8-vasnprintf3.c test_u8_vasnprintf3_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unistdio/test-u8-vasnprintf1.c unistdio/test-u8-asnprintf1.h unistdio/test-u8-printf1.h unistdio/test-u8-vasnprintf2.sh unistdio/test-u8-vasnprintf2.c unistdio/test-u8-vasnprintf3.sh unistdio/test-u8-vasnprintf3.c +EXTRA_DIST += unistdio/test-u8-vasnprintf1.c unistdio/test-u8-asnprintf1.h unistdio/test-u8-printf1.h unistdio/test-u8-vasnprintf2.sh unistdio/test-u8-vasnprintf2.c unistdio/test-u8-vasnprintf3.sh unistdio/test-u8-vasnprintf3.c macros.h ## end gnulib module unistdio/u8-vasnprintf-tests @@ -3001,7 +3043,7 @@ TESTS += test-u8-vasprintf1 check_PROGRAMS += test-u8-vasprintf1 test_u8_vasprintf1_SOURCES = unistdio/test-u8-vasprintf1.c test_u8_vasprintf1_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unistdio/test-u8-vasprintf1.c unistdio/test-u8-printf1.h +EXTRA_DIST += unistdio/test-u8-vasprintf1.c unistdio/test-u8-printf1.h macros.h ## end gnulib module unistdio/u8-vasprintf-tests @@ -3011,7 +3053,7 @@ TESTS += test-u8-vsnprintf1 check_PROGRAMS += test-u8-vsnprintf1 test_u8_vsnprintf1_SOURCES = unistdio/test-u8-vsnprintf1.c test_u8_vsnprintf1_LDADD = $(LDADD) @LIBINTL@ @LIBICONV@ -EXTRA_DIST += unistdio/test-u8-vsnprintf1.c unistdio/test-u8-printf1.h +EXTRA_DIST += unistdio/test-u8-vsnprintf1.c unistdio/test-u8-printf1.h macros.h ## end gnulib module unistdio/u8-vsnprintf-tests @@ -3021,7 +3063,7 @@ TESTS += test-u8-vsprintf1 check_PROGRAMS += test-u8-vsprintf1 test_u8_vsprintf1_SOURCES = unistdio/test-u8-vsprintf1.c test_u8_vsprintf1_LDADD = $(LDADD) @LIBINTL@ @LIBICONV@ -EXTRA_DIST += unistdio/test-u8-vsprintf1.c unistdio/test-u8-printf1.h +EXTRA_DIST += unistdio/test-u8-vsprintf1.c unistdio/test-u8-printf1.h macros.h ## end gnulib module unistdio/u8-vsprintf-tests @@ -3031,14 +3073,14 @@ TESTS += test-ulc-asnprintf1 check_PROGRAMS += test-ulc-asnprintf1 test_ulc_asnprintf1_SOURCES = unistdio/test-ulc-asnprintf1.c test_ulc_asnprintf1_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unistdio/test-ulc-asnprintf1.c unistdio/test-ulc-asnprintf1.h unistdio/test-ulc-printf1.h +EXTRA_DIST += unistdio/test-ulc-asnprintf1.c unistdio/test-ulc-asnprintf1.h unistdio/test-ulc-printf1.h macros.h ## end gnulib module unistdio/ulc-asnprintf-tests ## begin gnulib module unistdio/ulc-vasnprintf-tests TESTS += test-ulc-vasnprintf1 unistdio/test-ulc-vasnprintf2.sh unistdio/test-ulc-vasnprintf3.sh -TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' +TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' check_PROGRAMS += test-ulc-vasnprintf1 test-ulc-vasnprintf2 test-ulc-vasnprintf3 test_ulc_vasnprintf1_SOURCES = unistdio/test-ulc-vasnprintf1.c test_ulc_vasnprintf1_LDADD = $(LDADD) @LIBICONV@ @@ -3046,7 +3088,7 @@ test_ulc_vasnprintf2_SOURCES = unistdio/test-ulc-vasnprintf2.c test_ulc_vasnprintf2_LDADD = $(LDADD) @LIBICONV@ test_ulc_vasnprintf3_SOURCES = unistdio/test-ulc-vasnprintf3.c test_ulc_vasnprintf3_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unistdio/test-ulc-vasnprintf1.c unistdio/test-ulc-asnprintf1.h unistdio/test-ulc-printf1.h unistdio/test-ulc-vasnprintf2.sh unistdio/test-ulc-vasnprintf2.c unistdio/test-ulc-vasnprintf3.sh unistdio/test-ulc-vasnprintf3.c +EXTRA_DIST += unistdio/test-ulc-vasnprintf1.c unistdio/test-ulc-asnprintf1.h unistdio/test-ulc-printf1.h unistdio/test-ulc-vasnprintf2.sh unistdio/test-ulc-vasnprintf2.c unistdio/test-ulc-vasnprintf3.sh unistdio/test-ulc-vasnprintf3.c macros.h ## end gnulib module unistdio/ulc-vasnprintf-tests @@ -3056,7 +3098,7 @@ TESTS += test-ulc-vasprintf1 check_PROGRAMS += test-ulc-vasprintf1 test_ulc_vasprintf1_SOURCES = unistdio/test-ulc-vasprintf1.c test_ulc_vasprintf1_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += unistdio/test-ulc-vasprintf1.c unistdio/test-ulc-printf1.h +EXTRA_DIST += unistdio/test-ulc-vasprintf1.c unistdio/test-ulc-printf1.h macros.h ## end gnulib module unistdio/ulc-vasprintf-tests @@ -3066,7 +3108,7 @@ TESTS += test-ulc-vsnprintf1 check_PROGRAMS += test-ulc-vsnprintf1 test_ulc_vsnprintf1_SOURCES = unistdio/test-ulc-vsnprintf1.c test_ulc_vsnprintf1_LDADD = $(LDADD) @LIBINTL@ @LIBICONV@ -EXTRA_DIST += unistdio/test-ulc-vsnprintf1.c unistdio/test-ulc-printf1.h +EXTRA_DIST += unistdio/test-ulc-vsnprintf1.c unistdio/test-ulc-printf1.h macros.h ## end gnulib module unistdio/ulc-vsnprintf-tests @@ -3076,17 +3118,884 @@ TESTS += test-ulc-vsprintf1 check_PROGRAMS += test-ulc-vsprintf1 test_ulc_vsprintf1_SOURCES = unistdio/test-ulc-vsprintf1.c test_ulc_vsprintf1_LDADD = $(LDADD) @LIBINTL@ @LIBICONV@ -EXTRA_DIST += unistdio/test-ulc-vsprintf1.c unistdio/test-ulc-printf1.h +EXTRA_DIST += unistdio/test-ulc-vsprintf1.c unistdio/test-ulc-printf1.h macros.h ## end gnulib module unistdio/ulc-vsprintf-tests +## begin gnulib module unistr/u16-check-tests + +TESTS += test-u16-check +check_PROGRAMS += test-u16-check +test_u16_check_SOURCES = unistr/test-u16-check.c +EXTRA_DIST += unistr/test-u16-check.c macros.h + +## end gnulib module unistr/u16-check-tests + +## begin gnulib module unistr/u16-chr-tests + +TESTS += test-u16-chr +check_PROGRAMS += test-u16-chr +test_u16_chr_SOURCES = unistr/test-u16-chr.c +EXTRA_DIST += unistr/test-u16-chr.c unistr/test-chr.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u16-chr-tests + +## begin gnulib module unistr/u16-cmp-tests + +TESTS += test-u16-cmp +check_PROGRAMS += test-u16-cmp +test_u16_cmp_SOURCES = unistr/test-u16-cmp.c +EXTRA_DIST += unistr/test-u16-cmp.c unistr/test-cmp.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u16-cmp-tests + +## begin gnulib module unistr/u16-cmp2-tests + +TESTS += test-u16-cmp2 +check_PROGRAMS += test-u16-cmp2 +test_u16_cmp2_SOURCES = unistr/test-u16-cmp2.c +EXTRA_DIST += unistr/test-u16-cmp2.c unistr/test-cmp2.h macros.h + +## end gnulib module unistr/u16-cmp2-tests + +## begin gnulib module unistr/u16-cpy-alloc-tests + +TESTS += test-u16-cpy-alloc +check_PROGRAMS += test-u16-cpy-alloc +test_u16_cpy_alloc_SOURCES = unistr/test-u16-cpy-alloc.c +EXTRA_DIST += unistr/test-u16-cpy-alloc.c unistr/test-cpy-alloc.h macros.h + +## end gnulib module unistr/u16-cpy-alloc-tests + +## begin gnulib module unistr/u16-cpy-tests + +TESTS += test-u16-cpy +check_PROGRAMS += test-u16-cpy +test_u16_cpy_SOURCES = unistr/test-u16-cpy.c +EXTRA_DIST += unistr/test-u16-cpy.c unistr/test-cpy.h macros.h + +## end gnulib module unistr/u16-cpy-tests + +## begin gnulib module unistr/u16-mblen-tests + +TESTS += test-u16-mblen +check_PROGRAMS += test-u16-mblen +test_u16_mblen_SOURCES = unistr/test-u16-mblen.c +EXTRA_DIST += unistr/test-u16-mblen.c macros.h + +## end gnulib module unistr/u16-mblen-tests + +## begin gnulib module unistr/u16-mbsnlen-tests + +TESTS += test-u16-mbsnlen +check_PROGRAMS += test-u16-mbsnlen +test_u16_mbsnlen_SOURCES = unistr/test-u16-mbsnlen.c +EXTRA_DIST += unistr/test-u16-mbsnlen.c macros.h + +## end gnulib module unistr/u16-mbsnlen-tests + +## begin gnulib module unistr/u16-mbtouc-tests + +TESTS += test-u16-mbtouc +check_PROGRAMS += test-u16-mbtouc +test_u16_mbtouc_SOURCES = unistr/test-u16-mbtouc.c +EXTRA_DIST += unistr/test-u16-mbtouc.c unistr/test-u16-mbtouc.h macros.h + +## end gnulib module unistr/u16-mbtouc-tests + +## begin gnulib module unistr/u16-mbtouc-unsafe-tests + +TESTS += test-u16-mbtouc-unsafe +check_PROGRAMS += test-u16-mbtouc-unsafe +test_u16_mbtouc_unsafe_SOURCES = unistr/test-u16-mbtouc-unsafe.c +EXTRA_DIST += unistr/test-u16-mbtouc-unsafe.c unistr/test-u16-mbtouc.h macros.h + +## end gnulib module unistr/u16-mbtouc-unsafe-tests + +## begin gnulib module unistr/u16-mbtoucr-tests + +TESTS += test-u16-mbtoucr +check_PROGRAMS += test-u16-mbtoucr +test_u16_mbtoucr_SOURCES = unistr/test-u16-mbtoucr.c +EXTRA_DIST += unistr/test-u16-mbtoucr.c macros.h + +## end gnulib module unistr/u16-mbtoucr-tests + +## begin gnulib module unistr/u16-move-tests + +TESTS += test-u16-move +check_PROGRAMS += test-u16-move +test_u16_move_SOURCES = unistr/test-u16-move.c +EXTRA_DIST += unistr/test-u16-move.c unistr/test-move.h macros.h + +## end gnulib module unistr/u16-move-tests + +## begin gnulib module unistr/u16-next-tests + +TESTS += test-u16-next +check_PROGRAMS += test-u16-next +test_u16_next_SOURCES = unistr/test-u16-next.c +EXTRA_DIST += unistr/test-u16-next.c macros.h + +## end gnulib module unistr/u16-next-tests + +## begin gnulib module unistr/u16-prev-tests + +TESTS += test-u16-prev +check_PROGRAMS += test-u16-prev +test_u16_prev_SOURCES = unistr/test-u16-prev.c +EXTRA_DIST += unistr/test-u16-prev.c macros.h + +## end gnulib module unistr/u16-prev-tests + +## begin gnulib module unistr/u16-set-tests + +TESTS += test-u16-set +check_PROGRAMS += test-u16-set +test_u16_set_SOURCES = unistr/test-u16-set.c +EXTRA_DIST += unistr/test-u16-set.c unistr/test-set.h macros.h + +## end gnulib module unistr/u16-set-tests + +## begin gnulib module unistr/u16-stpcpy-tests + +TESTS += test-u16-stpcpy +check_PROGRAMS += test-u16-stpcpy +test_u16_stpcpy_SOURCES = unistr/test-u16-stpcpy.c +EXTRA_DIST += unistr/test-u16-stpcpy.c unistr/test-stpcpy.h macros.h + +## end gnulib module unistr/u16-stpcpy-tests + +## begin gnulib module unistr/u16-stpncpy-tests + +TESTS += test-u16-stpncpy +check_PROGRAMS += test-u16-stpncpy +test_u16_stpncpy_SOURCES = unistr/test-u16-stpncpy.c +EXTRA_DIST += unistr/test-u16-stpncpy.c unistr/test-stpncpy.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u16-stpncpy-tests + +## begin gnulib module unistr/u16-strcat-tests + +TESTS += test-u16-strcat +check_PROGRAMS += test-u16-strcat +test_u16_strcat_SOURCES = unistr/test-u16-strcat.c +EXTRA_DIST += unistr/test-u16-strcat.c unistr/test-strcat.h macros.h + +## end gnulib module unistr/u16-strcat-tests + +## begin gnulib module unistr/u16-strcmp-tests + +TESTS += test-u16-strcmp +check_PROGRAMS += test-u16-strcmp +test_u16_strcmp_SOURCES = unistr/test-u16-strcmp.c +EXTRA_DIST += unistr/test-u16-strcmp.c unistr/test-u16-strcmp.h unistr/test-strcmp.h macros.h + +## end gnulib module unistr/u16-strcmp-tests + +## begin gnulib module unistr/u16-strcoll-tests + +TESTS += test-u16-strcoll +check_PROGRAMS += test-u16-strcoll +test_u16_strcoll_SOURCES = unistr/test-u16-strcoll.c +test_u16_strcoll_LDADD = $(LDADD) @LIBICONV@ +EXTRA_DIST += unistr/test-u16-strcoll.c unistr/test-u16-strcmp.h unistr/test-strcmp.h macros.h + +## end gnulib module unistr/u16-strcoll-tests + +## begin gnulib module unistr/u16-strcpy-tests + +TESTS += test-u16-strcpy +check_PROGRAMS += test-u16-strcpy +test_u16_strcpy_SOURCES = unistr/test-u16-strcpy.c +EXTRA_DIST += unistr/test-u16-strcpy.c unistr/test-strcpy.h macros.h + +## end gnulib module unistr/u16-strcpy-tests + +## begin gnulib module unistr/u16-strdup-tests + +TESTS += test-u16-strdup +check_PROGRAMS += test-u16-strdup +test_u16_strdup_SOURCES = unistr/test-u16-strdup.c +EXTRA_DIST += unistr/test-u16-strdup.c unistr/test-strdup.h macros.h + +## end gnulib module unistr/u16-strdup-tests + +## begin gnulib module unistr/u16-strlen-tests + +TESTS += test-u16-strlen +check_PROGRAMS += test-u16-strlen +test_u16_strlen_SOURCES = unistr/test-u16-strlen.c +EXTRA_DIST += unistr/test-u16-strlen.c macros.h + +## end gnulib module unistr/u16-strlen-tests + +## begin gnulib module unistr/u16-strmblen-tests + +TESTS += test-u16-strmblen +check_PROGRAMS += test-u16-strmblen +test_u16_strmblen_SOURCES = unistr/test-u16-strmblen.c +EXTRA_DIST += unistr/test-u16-strmblen.c macros.h + +## end gnulib module unistr/u16-strmblen-tests + +## begin gnulib module unistr/u16-strmbtouc-tests + +TESTS += test-u16-strmbtouc +check_PROGRAMS += test-u16-strmbtouc +test_u16_strmbtouc_SOURCES = unistr/test-u16-strmbtouc.c +EXTRA_DIST += unistr/test-u16-strmbtouc.c macros.h + +## end gnulib module unistr/u16-strmbtouc-tests + +## begin gnulib module unistr/u16-strncat-tests + +TESTS += test-u16-strncat +check_PROGRAMS += test-u16-strncat +test_u16_strncat_SOURCES = unistr/test-u16-strncat.c +EXTRA_DIST += unistr/test-u16-strncat.c unistr/test-strncat.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u16-strncat-tests + +## begin gnulib module unistr/u16-strncmp-tests + +TESTS += test-u16-strncmp +check_PROGRAMS += test-u16-strncmp +test_u16_strncmp_SOURCES = unistr/test-u16-strncmp.c +EXTRA_DIST += unistr/test-u16-strncmp.c unistr/test-strncmp.h macros.h + +## end gnulib module unistr/u16-strncmp-tests + +## begin gnulib module unistr/u16-strncpy-tests + +TESTS += test-u16-strncpy +check_PROGRAMS += test-u16-strncpy +test_u16_strncpy_SOURCES = unistr/test-u16-strncpy.c +EXTRA_DIST += unistr/test-u16-strncpy.c unistr/test-strncpy.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u16-strncpy-tests + +## begin gnulib module unistr/u16-strnlen-tests + +TESTS += test-u16-strnlen +check_PROGRAMS += test-u16-strnlen +test_u16_strnlen_SOURCES = unistr/test-u16-strnlen.c +EXTRA_DIST += unistr/test-u16-strnlen.c unistr/test-strnlen.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u16-strnlen-tests + +## begin gnulib module unistr/u16-to-u32-tests + +TESTS += test-u16-to-u32 +check_PROGRAMS += test-u16-to-u32 +test_u16_to_u32_SOURCES = unistr/test-u16-to-u32.c +EXTRA_DIST += unistr/test-u16-to-u32.c macros.h + +## end gnulib module unistr/u16-to-u32-tests + +## begin gnulib module unistr/u16-to-u8-tests + +TESTS += test-u16-to-u8 +check_PROGRAMS += test-u16-to-u8 +test_u16_to_u8_SOURCES = unistr/test-u16-to-u8.c +EXTRA_DIST += unistr/test-u16-to-u8.c macros.h + +## end gnulib module unistr/u16-to-u8-tests + +## begin gnulib module unistr/u16-uctomb-tests + +TESTS += test-u16-uctomb +check_PROGRAMS += test-u16-uctomb +test_u16_uctomb_SOURCES = unistr/test-u16-uctomb.c +EXTRA_DIST += unistr/test-u16-uctomb.c macros.h + +## end gnulib module unistr/u16-uctomb-tests + +## begin gnulib module unistr/u32-check-tests + +TESTS += test-u32-check +check_PROGRAMS += test-u32-check +test_u32_check_SOURCES = unistr/test-u32-check.c +EXTRA_DIST += unistr/test-u32-check.c macros.h + +## end gnulib module unistr/u32-check-tests + +## begin gnulib module unistr/u32-chr-tests + +TESTS += test-u32-chr +check_PROGRAMS += test-u32-chr +test_u32_chr_SOURCES = unistr/test-u32-chr.c +EXTRA_DIST += unistr/test-u32-chr.c unistr/test-chr.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u32-chr-tests + +## begin gnulib module unistr/u32-cmp-tests + +TESTS += test-u32-cmp +check_PROGRAMS += test-u32-cmp +test_u32_cmp_SOURCES = unistr/test-u32-cmp.c +EXTRA_DIST += unistr/test-u32-cmp.c unistr/test-cmp.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u32-cmp-tests + +## begin gnulib module unistr/u32-cmp2-tests + +TESTS += test-u32-cmp2 +check_PROGRAMS += test-u32-cmp2 +test_u32_cmp2_SOURCES = unistr/test-u32-cmp2.c +EXTRA_DIST += unistr/test-u32-cmp2.c unistr/test-cmp2.h macros.h + +## end gnulib module unistr/u32-cmp2-tests + +## begin gnulib module unistr/u32-cpy-alloc-tests + +TESTS += test-u32-cpy-alloc +check_PROGRAMS += test-u32-cpy-alloc +test_u32_cpy_alloc_SOURCES = unistr/test-u32-cpy-alloc.c +EXTRA_DIST += unistr/test-u32-cpy-alloc.c unistr/test-cpy-alloc.h macros.h + +## end gnulib module unistr/u32-cpy-alloc-tests + +## begin gnulib module unistr/u32-cpy-tests + +TESTS += test-u32-cpy +check_PROGRAMS += test-u32-cpy +test_u32_cpy_SOURCES = unistr/test-u32-cpy.c +EXTRA_DIST += unistr/test-u32-cpy.c unistr/test-cpy.h macros.h + +## end gnulib module unistr/u32-cpy-tests + +## begin gnulib module unistr/u32-mblen-tests + +TESTS += test-u32-mblen +check_PROGRAMS += test-u32-mblen +test_u32_mblen_SOURCES = unistr/test-u32-mblen.c +EXTRA_DIST += unistr/test-u32-mblen.c macros.h + +## end gnulib module unistr/u32-mblen-tests + +## begin gnulib module unistr/u32-mbsnlen-tests + +TESTS += test-u32-mbsnlen +check_PROGRAMS += test-u32-mbsnlen +test_u32_mbsnlen_SOURCES = unistr/test-u32-mbsnlen.c +EXTRA_DIST += unistr/test-u32-mbsnlen.c macros.h + +## end gnulib module unistr/u32-mbsnlen-tests + +## begin gnulib module unistr/u32-mbtouc-tests + +TESTS += test-u32-mbtouc +check_PROGRAMS += test-u32-mbtouc +test_u32_mbtouc_SOURCES = unistr/test-u32-mbtouc.c +EXTRA_DIST += unistr/test-u32-mbtouc.c unistr/test-u32-mbtouc.h macros.h + +## end gnulib module unistr/u32-mbtouc-tests + +## begin gnulib module unistr/u32-mbtouc-unsafe-tests + +TESTS += test-u32-mbtouc-unsafe +check_PROGRAMS += test-u32-mbtouc-unsafe +test_u32_mbtouc_unsafe_SOURCES = unistr/test-u32-mbtouc-unsafe.c +EXTRA_DIST += unistr/test-u32-mbtouc-unsafe.c unistr/test-u32-mbtouc.h macros.h + +## end gnulib module unistr/u32-mbtouc-unsafe-tests + +## begin gnulib module unistr/u32-mbtoucr-tests + +TESTS += test-u32-mbtoucr +check_PROGRAMS += test-u32-mbtoucr +test_u32_mbtoucr_SOURCES = unistr/test-u32-mbtoucr.c +EXTRA_DIST += unistr/test-u32-mbtoucr.c macros.h + +## end gnulib module unistr/u32-mbtoucr-tests + +## begin gnulib module unistr/u32-move-tests + +TESTS += test-u32-move +check_PROGRAMS += test-u32-move +test_u32_move_SOURCES = unistr/test-u32-move.c +EXTRA_DIST += unistr/test-u32-move.c unistr/test-move.h macros.h + +## end gnulib module unistr/u32-move-tests + +## begin gnulib module unistr/u32-next-tests + +TESTS += test-u32-next +check_PROGRAMS += test-u32-next +test_u32_next_SOURCES = unistr/test-u32-next.c +EXTRA_DIST += unistr/test-u32-next.c macros.h + +## end gnulib module unistr/u32-next-tests + +## begin gnulib module unistr/u32-prev-tests + +TESTS += test-u32-prev +check_PROGRAMS += test-u32-prev +test_u32_prev_SOURCES = unistr/test-u32-prev.c +EXTRA_DIST += unistr/test-u32-prev.c macros.h + +## end gnulib module unistr/u32-prev-tests + +## begin gnulib module unistr/u32-set-tests + +TESTS += test-u32-set +check_PROGRAMS += test-u32-set +test_u32_set_SOURCES = unistr/test-u32-set.c +EXTRA_DIST += unistr/test-u32-set.c unistr/test-set.h macros.h + +## end gnulib module unistr/u32-set-tests + +## begin gnulib module unistr/u32-stpcpy-tests + +TESTS += test-u32-stpcpy +check_PROGRAMS += test-u32-stpcpy +test_u32_stpcpy_SOURCES = unistr/test-u32-stpcpy.c +EXTRA_DIST += unistr/test-u32-stpcpy.c unistr/test-stpcpy.h macros.h + +## end gnulib module unistr/u32-stpcpy-tests + +## begin gnulib module unistr/u32-stpncpy-tests + +TESTS += test-u32-stpncpy +check_PROGRAMS += test-u32-stpncpy +test_u32_stpncpy_SOURCES = unistr/test-u32-stpncpy.c +EXTRA_DIST += unistr/test-u32-stpncpy.c unistr/test-stpncpy.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u32-stpncpy-tests + +## begin gnulib module unistr/u32-strcat-tests + +TESTS += test-u32-strcat +check_PROGRAMS += test-u32-strcat +test_u32_strcat_SOURCES = unistr/test-u32-strcat.c +EXTRA_DIST += unistr/test-u32-strcat.c unistr/test-strcat.h macros.h + +## end gnulib module unistr/u32-strcat-tests + +## begin gnulib module unistr/u32-strcmp-tests + +TESTS += test-u32-strcmp +check_PROGRAMS += test-u32-strcmp +test_u32_strcmp_SOURCES = unistr/test-u32-strcmp.c +EXTRA_DIST += unistr/test-u32-strcmp.c unistr/test-u32-strcmp.h unistr/test-strcmp.h macros.h + +## end gnulib module unistr/u32-strcmp-tests + +## begin gnulib module unistr/u32-strcoll-tests + +TESTS += test-u32-strcoll +check_PROGRAMS += test-u32-strcoll +test_u32_strcoll_SOURCES = unistr/test-u32-strcoll.c +test_u32_strcoll_LDADD = $(LDADD) @LIBICONV@ +EXTRA_DIST += unistr/test-u32-strcoll.c unistr/test-u32-strcmp.h unistr/test-strcmp.h macros.h + +## end gnulib module unistr/u32-strcoll-tests + +## begin gnulib module unistr/u32-strcpy-tests + +TESTS += test-u32-strcpy +check_PROGRAMS += test-u32-strcpy +test_u32_strcpy_SOURCES = unistr/test-u32-strcpy.c +EXTRA_DIST += unistr/test-u32-strcpy.c unistr/test-strcpy.h macros.h + +## end gnulib module unistr/u32-strcpy-tests + +## begin gnulib module unistr/u32-strdup-tests + +TESTS += test-u32-strdup +check_PROGRAMS += test-u32-strdup +test_u32_strdup_SOURCES = unistr/test-u32-strdup.c +EXTRA_DIST += unistr/test-u32-strdup.c unistr/test-strdup.h macros.h + +## end gnulib module unistr/u32-strdup-tests + +## begin gnulib module unistr/u32-strlen-tests + +TESTS += test-u32-strlen +check_PROGRAMS += test-u32-strlen +test_u32_strlen_SOURCES = unistr/test-u32-strlen.c +EXTRA_DIST += unistr/test-u32-strlen.c macros.h + +## end gnulib module unistr/u32-strlen-tests + +## begin gnulib module unistr/u32-strmblen-tests + +TESTS += test-u32-strmblen +check_PROGRAMS += test-u32-strmblen +test_u32_strmblen_SOURCES = unistr/test-u32-strmblen.c +EXTRA_DIST += unistr/test-u32-strmblen.c macros.h + +## end gnulib module unistr/u32-strmblen-tests + +## begin gnulib module unistr/u32-strmbtouc-tests + +TESTS += test-u32-strmbtouc +check_PROGRAMS += test-u32-strmbtouc +test_u32_strmbtouc_SOURCES = unistr/test-u32-strmbtouc.c +EXTRA_DIST += unistr/test-u32-strmbtouc.c macros.h + +## end gnulib module unistr/u32-strmbtouc-tests + +## begin gnulib module unistr/u32-strncat-tests + +TESTS += test-u32-strncat +check_PROGRAMS += test-u32-strncat +test_u32_strncat_SOURCES = unistr/test-u32-strncat.c +EXTRA_DIST += unistr/test-u32-strncat.c unistr/test-strncat.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u32-strncat-tests + +## begin gnulib module unistr/u32-strncmp-tests + +TESTS += test-u32-strncmp +check_PROGRAMS += test-u32-strncmp +test_u32_strncmp_SOURCES = unistr/test-u32-strncmp.c +EXTRA_DIST += unistr/test-u32-strncmp.c unistr/test-strncmp.h macros.h + +## end gnulib module unistr/u32-strncmp-tests + +## begin gnulib module unistr/u32-strncpy-tests + +TESTS += test-u32-strncpy +check_PROGRAMS += test-u32-strncpy +test_u32_strncpy_SOURCES = unistr/test-u32-strncpy.c +EXTRA_DIST += unistr/test-u32-strncpy.c unistr/test-strncpy.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u32-strncpy-tests + +## begin gnulib module unistr/u32-strnlen-tests + +TESTS += test-u32-strnlen +check_PROGRAMS += test-u32-strnlen +test_u32_strnlen_SOURCES = unistr/test-u32-strnlen.c +EXTRA_DIST += unistr/test-u32-strnlen.c unistr/test-strnlen.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u32-strnlen-tests + +## begin gnulib module unistr/u32-to-u16-tests + +TESTS += test-u32-to-u16 +check_PROGRAMS += test-u32-to-u16 +test_u32_to_u16_SOURCES = unistr/test-u32-to-u16.c +EXTRA_DIST += unistr/test-u32-to-u16.c macros.h + +## end gnulib module unistr/u32-to-u16-tests + +## begin gnulib module unistr/u32-to-u8-tests + +TESTS += test-u32-to-u8 +check_PROGRAMS += test-u32-to-u8 +test_u32_to_u8_SOURCES = unistr/test-u32-to-u8.c +EXTRA_DIST += unistr/test-u32-to-u8.c macros.h + +## end gnulib module unistr/u32-to-u8-tests + +## begin gnulib module unistr/u32-uctomb-tests + +TESTS += test-u32-uctomb +check_PROGRAMS += test-u32-uctomb +test_u32_uctomb_SOURCES = unistr/test-u32-uctomb.c +EXTRA_DIST += unistr/test-u32-uctomb.c macros.h + +## end gnulib module unistr/u32-uctomb-tests + +## begin gnulib module unistr/u8-check-tests + +TESTS += test-u8-check +check_PROGRAMS += test-u8-check +test_u8_check_SOURCES = unistr/test-u8-check.c +EXTRA_DIST += unistr/test-u8-check.c macros.h + +## end gnulib module unistr/u8-check-tests + +## begin gnulib module unistr/u8-chr-tests + +TESTS += test-u8-chr +check_PROGRAMS += test-u8-chr +test_u8_chr_SOURCES = unistr/test-u8-chr.c +EXTRA_DIST += unistr/test-u8-chr.c unistr/test-chr.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u8-chr-tests + +## begin gnulib module unistr/u8-cmp-tests + +TESTS += test-u8-cmp +check_PROGRAMS += test-u8-cmp +test_u8_cmp_SOURCES = unistr/test-u8-cmp.c +EXTRA_DIST += unistr/test-u8-cmp.c unistr/test-cmp.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u8-cmp-tests + +## begin gnulib module unistr/u8-cmp2-tests + +TESTS += test-u8-cmp2 +check_PROGRAMS += test-u8-cmp2 +test_u8_cmp2_SOURCES = unistr/test-u8-cmp2.c +EXTRA_DIST += unistr/test-u8-cmp2.c unistr/test-cmp2.h macros.h + +## end gnulib module unistr/u8-cmp2-tests + +## begin gnulib module unistr/u8-cpy-alloc-tests + +TESTS += test-u8-cpy-alloc +check_PROGRAMS += test-u8-cpy-alloc +test_u8_cpy_alloc_SOURCES = unistr/test-u8-cpy-alloc.c +EXTRA_DIST += unistr/test-u8-cpy-alloc.c unistr/test-cpy-alloc.h macros.h + +## end gnulib module unistr/u8-cpy-alloc-tests + +## begin gnulib module unistr/u8-cpy-tests + +TESTS += test-u8-cpy +check_PROGRAMS += test-u8-cpy +test_u8_cpy_SOURCES = unistr/test-u8-cpy.c +EXTRA_DIST += unistr/test-u8-cpy.c unistr/test-cpy.h macros.h + +## end gnulib module unistr/u8-cpy-tests + +## begin gnulib module unistr/u8-mblen-tests + +TESTS += test-u8-mblen +check_PROGRAMS += test-u8-mblen +test_u8_mblen_SOURCES = unistr/test-u8-mblen.c +EXTRA_DIST += unistr/test-u8-mblen.c macros.h + +## end gnulib module unistr/u8-mblen-tests + +## begin gnulib module unistr/u8-mbsnlen-tests + +TESTS += test-u8-mbsnlen +check_PROGRAMS += test-u8-mbsnlen +test_u8_mbsnlen_SOURCES = unistr/test-u8-mbsnlen.c +EXTRA_DIST += unistr/test-u8-mbsnlen.c macros.h + +## end gnulib module unistr/u8-mbsnlen-tests + +## begin gnulib module unistr/u8-mbtouc-tests + +TESTS += test-u8-mbtouc +check_PROGRAMS += test-u8-mbtouc +test_u8_mbtouc_SOURCES = unistr/test-u8-mbtouc.c +EXTRA_DIST += unistr/test-u8-mbtouc.c unistr/test-u8-mbtouc.h macros.h + +## end gnulib module unistr/u8-mbtouc-tests + +## begin gnulib module unistr/u8-mbtouc-unsafe-tests + +TESTS += test-u8-mbtouc-unsafe +check_PROGRAMS += test-u8-mbtouc-unsafe +test_u8_mbtouc_unsafe_SOURCES = unistr/test-u8-mbtouc-unsafe.c +EXTRA_DIST += unistr/test-u8-mbtouc-unsafe.c unistr/test-u8-mbtouc.h macros.h + +## end gnulib module unistr/u8-mbtouc-unsafe-tests + +## begin gnulib module unistr/u8-mbtoucr-tests + +TESTS += test-u8-mbtoucr +check_PROGRAMS += test-u8-mbtoucr +test_u8_mbtoucr_SOURCES = unistr/test-u8-mbtoucr.c +EXTRA_DIST += unistr/test-u8-mbtoucr.c macros.h + +## end gnulib module unistr/u8-mbtoucr-tests + +## begin gnulib module unistr/u8-move-tests + +TESTS += test-u8-move +check_PROGRAMS += test-u8-move +test_u8_move_SOURCES = unistr/test-u8-move.c +EXTRA_DIST += unistr/test-u8-move.c unistr/test-move.h macros.h + +## end gnulib module unistr/u8-move-tests + +## begin gnulib module unistr/u8-next-tests + +TESTS += test-u8-next +check_PROGRAMS += test-u8-next +test_u8_next_SOURCES = unistr/test-u8-next.c +EXTRA_DIST += unistr/test-u8-next.c macros.h + +## end gnulib module unistr/u8-next-tests + +## begin gnulib module unistr/u8-prev-tests + +TESTS += test-u8-prev +check_PROGRAMS += test-u8-prev +test_u8_prev_SOURCES = unistr/test-u8-prev.c +EXTRA_DIST += unistr/test-u8-prev.c macros.h + +## end gnulib module unistr/u8-prev-tests + +## begin gnulib module unistr/u8-set-tests + +TESTS += test-u8-set +check_PROGRAMS += test-u8-set +test_u8_set_SOURCES = unistr/test-u8-set.c +EXTRA_DIST += unistr/test-u8-set.c unistr/test-set.h macros.h + +## end gnulib module unistr/u8-set-tests + +## begin gnulib module unistr/u8-stpcpy-tests + +TESTS += test-u8-stpcpy +check_PROGRAMS += test-u8-stpcpy +test_u8_stpcpy_SOURCES = unistr/test-u8-stpcpy.c +EXTRA_DIST += unistr/test-u8-stpcpy.c unistr/test-stpcpy.h macros.h + +## end gnulib module unistr/u8-stpcpy-tests + +## begin gnulib module unistr/u8-stpncpy-tests + +TESTS += test-u8-stpncpy +check_PROGRAMS += test-u8-stpncpy +test_u8_stpncpy_SOURCES = unistr/test-u8-stpncpy.c +EXTRA_DIST += unistr/test-u8-stpncpy.c unistr/test-stpncpy.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u8-stpncpy-tests + +## begin gnulib module unistr/u8-strcat-tests + +TESTS += test-u8-strcat +check_PROGRAMS += test-u8-strcat +test_u8_strcat_SOURCES = unistr/test-u8-strcat.c +EXTRA_DIST += unistr/test-u8-strcat.c unistr/test-strcat.h macros.h + +## end gnulib module unistr/u8-strcat-tests + +## begin gnulib module unistr/u8-strcmp-tests + +TESTS += test-u8-strcmp +check_PROGRAMS += test-u8-strcmp +test_u8_strcmp_SOURCES = unistr/test-u8-strcmp.c +EXTRA_DIST += unistr/test-u8-strcmp.c unistr/test-u8-strcmp.h unistr/test-strcmp.h macros.h + +## end gnulib module unistr/u8-strcmp-tests + +## begin gnulib module unistr/u8-strcoll-tests + +TESTS += test-u8-strcoll +check_PROGRAMS += test-u8-strcoll +test_u8_strcoll_SOURCES = unistr/test-u8-strcoll.c +test_u8_strcoll_LDADD = $(LDADD) @LIBICONV@ +EXTRA_DIST += unistr/test-u8-strcoll.c unistr/test-u8-strcmp.h unistr/test-strcmp.h macros.h + +## end gnulib module unistr/u8-strcoll-tests + +## begin gnulib module unistr/u8-strcpy-tests + +TESTS += test-u8-strcpy +check_PROGRAMS += test-u8-strcpy +test_u8_strcpy_SOURCES = unistr/test-u8-strcpy.c +EXTRA_DIST += unistr/test-u8-strcpy.c unistr/test-strcpy.h macros.h + +## end gnulib module unistr/u8-strcpy-tests + +## begin gnulib module unistr/u8-strdup-tests + +TESTS += test-u8-strdup +check_PROGRAMS += test-u8-strdup +test_u8_strdup_SOURCES = unistr/test-u8-strdup.c +EXTRA_DIST += unistr/test-u8-strdup.c unistr/test-strdup.h macros.h + +## end gnulib module unistr/u8-strdup-tests + +## begin gnulib module unistr/u8-strlen-tests + +TESTS += test-u8-strlen +check_PROGRAMS += test-u8-strlen +test_u8_strlen_SOURCES = unistr/test-u8-strlen.c +EXTRA_DIST += unistr/test-u8-strlen.c macros.h + +## end gnulib module unistr/u8-strlen-tests + +## begin gnulib module unistr/u8-strmblen-tests + +TESTS += test-u8-strmblen +check_PROGRAMS += test-u8-strmblen +test_u8_strmblen_SOURCES = unistr/test-u8-strmblen.c +EXTRA_DIST += unistr/test-u8-strmblen.c macros.h + +## end gnulib module unistr/u8-strmblen-tests + +## begin gnulib module unistr/u8-strmbtouc-tests + +TESTS += test-u8-strmbtouc +check_PROGRAMS += test-u8-strmbtouc +test_u8_strmbtouc_SOURCES = unistr/test-u8-strmbtouc.c +EXTRA_DIST += unistr/test-u8-strmbtouc.c macros.h + +## end gnulib module unistr/u8-strmbtouc-tests + +## begin gnulib module unistr/u8-strncat-tests + +TESTS += test-u8-strncat +check_PROGRAMS += test-u8-strncat +test_u8_strncat_SOURCES = unistr/test-u8-strncat.c +EXTRA_DIST += unistr/test-u8-strncat.c unistr/test-strncat.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u8-strncat-tests + +## begin gnulib module unistr/u8-strncmp-tests + +TESTS += test-u8-strncmp +check_PROGRAMS += test-u8-strncmp +test_u8_strncmp_SOURCES = unistr/test-u8-strncmp.c +EXTRA_DIST += unistr/test-u8-strncmp.c unistr/test-strncmp.h macros.h + +## end gnulib module unistr/u8-strncmp-tests + +## begin gnulib module unistr/u8-strncpy-tests + +TESTS += test-u8-strncpy +check_PROGRAMS += test-u8-strncpy +test_u8_strncpy_SOURCES = unistr/test-u8-strncpy.c +EXTRA_DIST += unistr/test-u8-strncpy.c unistr/test-strncpy.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u8-strncpy-tests + +## begin gnulib module unistr/u8-strnlen-tests + +TESTS += test-u8-strnlen +check_PROGRAMS += test-u8-strnlen +test_u8_strnlen_SOURCES = unistr/test-u8-strnlen.c +EXTRA_DIST += unistr/test-u8-strnlen.c unistr/test-strnlen.h zerosize-ptr.h macros.h + +## end gnulib module unistr/u8-strnlen-tests + +## begin gnulib module unistr/u8-to-u16-tests + +TESTS += test-u8-to-u16 +check_PROGRAMS += test-u8-to-u16 +test_u8_to_u16_SOURCES = unistr/test-u8-to-u16.c +EXTRA_DIST += unistr/test-u8-to-u16.c macros.h + +## end gnulib module unistr/u8-to-u16-tests + +## begin gnulib module unistr/u8-to-u32-tests + +TESTS += test-u8-to-u32 +check_PROGRAMS += test-u8-to-u32 +test_u8_to_u32_SOURCES = unistr/test-u8-to-u32.c +EXTRA_DIST += unistr/test-u8-to-u32.c macros.h + +## end gnulib module unistr/u8-to-u32-tests + +## begin gnulib module unistr/u8-uctomb-tests + +TESTS += test-u8-uctomb +check_PROGRAMS += test-u8-uctomb +test_u8_uctomb_SOURCES = unistr/test-u8-uctomb.c +EXTRA_DIST += unistr/test-u8-uctomb.c macros.h + +## end gnulib module unistr/u8-uctomb-tests + ## begin gnulib module uniwbrk/u16-wordbreaks-tests TESTS += test-u16-wordbreaks check_PROGRAMS += test-u16-wordbreaks test_u16_wordbreaks_SOURCES = uniwbrk/test-u16-wordbreaks.c -EXTRA_DIST += uniwbrk/test-u16-wordbreaks.c +EXTRA_DIST += uniwbrk/test-u16-wordbreaks.c macros.h ## end gnulib module uniwbrk/u16-wordbreaks-tests @@ -3096,7 +4005,7 @@ TESTS += test-u32-wordbreaks check_PROGRAMS += test-u32-wordbreaks test_u32_wordbreaks_SOURCES = uniwbrk/test-u32-wordbreaks.c -EXTRA_DIST += uniwbrk/test-u32-wordbreaks.c +EXTRA_DIST += uniwbrk/test-u32-wordbreaks.c macros.h ## end gnulib module uniwbrk/u32-wordbreaks-tests @@ -3106,19 +4015,19 @@ TESTS += test-u8-wordbreaks check_PROGRAMS += test-u8-wordbreaks test_u8_wordbreaks_SOURCES = uniwbrk/test-u8-wordbreaks.c -EXTRA_DIST += uniwbrk/test-u8-wordbreaks.c +EXTRA_DIST += uniwbrk/test-u8-wordbreaks.c macros.h ## end gnulib module uniwbrk/u8-wordbreaks-tests ## begin gnulib module uniwbrk/ulc-wordbreaks-tests TESTS += uniwbrk/test-ulc-wordbreaks.sh -TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' +TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' check_PROGRAMS += test-ulc-wordbreaks test_ulc_wordbreaks_SOURCES = uniwbrk/test-ulc-wordbreaks.c test_ulc_wordbreaks_LDADD = $(LDADD) @LIBICONV@ -EXTRA_DIST += uniwbrk/test-ulc-wordbreaks.sh uniwbrk/test-ulc-wordbreaks.c +EXTRA_DIST += uniwbrk/test-ulc-wordbreaks.sh uniwbrk/test-ulc-wordbreaks.c macros.h ## end gnulib module uniwbrk/ulc-wordbreaks-tests @@ -3128,7 +4037,7 @@ TESTS += test-u16-strwidth check_PROGRAMS += test-u16-strwidth test_u16_strwidth_SOURCES = uniwidth/test-u16-strwidth.c -EXTRA_DIST += uniwidth/test-u16-strwidth.c +EXTRA_DIST += uniwidth/test-u16-strwidth.c macros.h ## end gnulib module uniwidth/u16-strwidth-tests @@ -3138,7 +4047,7 @@ TESTS += test-u16-width check_PROGRAMS += test-u16-width test_u16_width_SOURCES = uniwidth/test-u16-width.c -EXTRA_DIST += uniwidth/test-u16-width.c +EXTRA_DIST += uniwidth/test-u16-width.c macros.h ## end gnulib module uniwidth/u16-width-tests @@ -3148,7 +4057,7 @@ TESTS += test-u32-strwidth check_PROGRAMS += test-u32-strwidth test_u32_strwidth_SOURCES = uniwidth/test-u32-strwidth.c -EXTRA_DIST += uniwidth/test-u32-strwidth.c +EXTRA_DIST += uniwidth/test-u32-strwidth.c macros.h ## end gnulib module uniwidth/u32-strwidth-tests @@ -3158,7 +4067,7 @@ TESTS += test-u32-width check_PROGRAMS += test-u32-width test_u32_width_SOURCES = uniwidth/test-u32-width.c -EXTRA_DIST += uniwidth/test-u32-width.c +EXTRA_DIST += uniwidth/test-u32-width.c macros.h ## end gnulib module uniwidth/u32-width-tests @@ -3168,7 +4077,7 @@ TESTS += test-u8-strwidth check_PROGRAMS += test-u8-strwidth test_u8_strwidth_SOURCES = uniwidth/test-u8-strwidth.c -EXTRA_DIST += uniwidth/test-u8-strwidth.c +EXTRA_DIST += uniwidth/test-u8-strwidth.c macros.h ## end gnulib module uniwidth/u8-strwidth-tests @@ -3178,19 +4087,18 @@ TESTS += test-u8-width check_PROGRAMS += test-u8-width test_u8_width_SOURCES = uniwidth/test-u8-width.c -EXTRA_DIST += uniwidth/test-u8-width.c +EXTRA_DIST += uniwidth/test-u8-width.c macros.h ## end gnulib module uniwidth/u8-width-tests ## begin gnulib module uniwidth/width-tests TESTS += test-uc_width uniwidth/test-uc_width2.sh -TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' check_PROGRAMS += test-uc_width test-uc_width2 test_uc_width_SOURCES = uniwidth/test-uc_width.c test_uc_width2_SOURCES = uniwidth/test-uc_width2.c -EXTRA_DIST += uniwidth/test-uc_width.c uniwidth/test-uc_width2.c uniwidth/test-uc_width2.sh +EXTRA_DIST += uniwidth/test-uc_width.c uniwidth/test-uc_width2.c uniwidth/test-uc_width2.sh macros.h ## end gnulib module uniwidth/width-tests @@ -3203,11 +4111,62 @@ EXTRA_libtests_a_SOURCES += unsetenv.c ## end gnulib module unsetenv +## begin gnulib module unsetenv-tests + +TESTS += test-unsetenv +check_PROGRAMS += test-unsetenv +EXTRA_DIST += test-unsetenv.c signature.h macros.h + +## end gnulib module unsetenv-tests + +## begin gnulib module unused-parameter + +# The BUILT_SOURCES created by this Makefile snippet are not used via #include +# statements but through direct file reference. Therefore this snippet must be +# present in all Makefile.am that need it. This is ensured by the applicability +# 'all' defined above. + +BUILT_SOURCES += unused-parameter.h +# The unused-parameter.h that gets inserted into generated .h files is the same +# as build-aux/unused-parameter.h, except that it has the copyright header cut +# off. +unused-parameter.h: $(top_srcdir)/build-aux/unused-parameter.h + $(AM_V_GEN)rm -f $@-t $@ && \ + sed -n -e '/GL_UNUSED_PARAMETER/,$$p' \ + < $(top_srcdir)/build-aux/unused-parameter.h \ + > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += unused-parameter.h unused-parameter.h-t + +UNUSED_PARAMETER_H=unused-parameter.h + +EXTRA_DIST += $(top_srcdir)/build-aux/unused-parameter.h + +## end gnulib module unused-parameter + +## begin gnulib module warn-on-use + +BUILT_SOURCES += warn-on-use.h +# The warn-on-use.h that gets inserted into generated .h files is the same as +# build-aux/warn-on-use.h, except that it has the copyright header cut off. +warn-on-use.h: $(top_srcdir)/build-aux/warn-on-use.h + $(AM_V_GEN)rm -f $@-t $@ && \ + sed -n -e '/^.ifndef/,$$p' \ + < $(top_srcdir)/build-aux/warn-on-use.h \ + > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t + +WARN_ON_USE_H=warn-on-use.h + +EXTRA_DIST += $(top_srcdir)/build-aux/warn-on-use.h + +## end gnulib module warn-on-use + ## begin gnulib module wchar-tests TESTS += test-wchar check_PROGRAMS += test-wchar - EXTRA_DIST += test-wchar.c ## end gnulib module wchar-tests @@ -3225,8 +4184,7 @@ EXTRA_libtests_a_SOURCES += wctob.c TESTS += test-wctype check_PROGRAMS += test-wctype - -EXTRA_DIST += test-wctype.c +EXTRA_DIST += test-wctype.c macros.h ## end gnulib module wctype-tests @@ -3235,7 +4193,7 @@ EXTRA_DIST += test-wctype.c TESTS += test-wcwidth check_PROGRAMS += test-wcwidth -EXTRA_DIST += test-wcwidth.c +EXTRA_DIST += test-wcwidth.c signature.h macros.h ## end gnulib module wcwidth-tests @@ -3254,6 +4212,21 @@ libtests_a_SOURCES += xalloc-die.c ## end gnulib module xalloc-die +## begin gnulib module xalloc-die-tests + +TESTS += test-xalloc-die.sh +check_PROGRAMS += test-xalloc-die +test_xalloc_die_LDADD = $(LDADD) @LIBINTL@ +EXTRA_DIST += test-xalloc-die.c test-xalloc-die.sh init.sh + +## end gnulib module xalloc-die-tests + +## begin gnulib module yield + +libtests_a_SOURCES += glthread/yield.h + +## end gnulib module yield + # Clean up after Solaris cc. clean-local: rm -rf SunWS_cache diff --git a/tests/Makefile.in b/tests/Makefile.in index b1d9e4a..0983281 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -15,7 +15,7 @@ @SET_MAKE@ -# Copyright (C) 2002-2009 Free Software Foundation, Inc. +# Copyright (C) 2002-2010 Free Software Foundation, Inc. # # This file is free software, distributed under the terms of the GNU # General Public License. As a special exception to the GNU General @@ -49,43 +49,44 @@ host_triplet = @host@ DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.gnulib $(srcdir)/Makefile.in TESTS = test-alloca-opt$(EXEEXT) test-array-mergesort$(EXEEXT) \ - test-c-ctype$(EXEEXT) test-c-strcase.sh test-dup2$(EXEEXT) \ - test-environ$(EXEEXT) test-errno$(EXEEXT) test-fcntl$(EXEEXT) \ - test-frexpl-nolibm$(EXEEXT) test-fseterr$(EXEEXT) \ + test-c-ctype$(EXEEXT) test-c-strcase.sh test-environ$(EXEEXT) \ + test-errno$(EXEEXT) test-frexpl-nolibm$(EXEEXT) \ + test-fseterr$(EXEEXT) test-iconv-h$(EXEEXT) \ test-iconv$(EXEEXT) test-isnand-nolibm$(EXEEXT) \ test-isnanf-nolibm$(EXEEXT) test-isnanl-nolibm$(EXEEXT) \ test-locale$(EXEEXT) test-localename$(EXEEXT) \ - test-malloca$(EXEEXT) test-math$(EXEEXT) test-mbrtowc1.sh \ - test-mbrtowc2.sh test-mbrtowc3.sh test-mbrtowc4.sh \ - test-mbsinit.sh test-memchr$(EXEEXT) test-open$(EXEEXT) \ + test-lock$(EXEEXT) test-malloca$(EXEEXT) test-math$(EXEEXT) \ + test-mbrtowc1.sh test-mbrtowc2.sh test-mbrtowc3.sh \ + test-mbrtowc4.sh test-mbsinit.sh test-memchr$(EXEEXT) \ test-printf-frexp$(EXEEXT) test-printf-frexpl$(EXEEXT) \ - test-signbit$(EXEEXT) test-stdbool$(EXEEXT) \ - test-stddef$(EXEEXT) test-stdint$(EXEEXT) test-stdlib$(EXEEXT) \ + test-setenv$(EXEEXT) test-signbit$(EXEEXT) \ + test-stdbool$(EXEEXT) test-stddef$(EXEEXT) \ + test-stdint$(EXEEXT) test-stdlib$(EXEEXT) \ test-strerror$(EXEEXT) test-striconveh$(EXEEXT) \ test-striconveha$(EXEEXT) test-string$(EXEEXT) \ - test-cased$(EXEEXT) test-ignorable$(EXEEXT) \ - unicase/test-locale-language.sh test-uc_tolower$(EXEEXT) \ - test-uc_totitle$(EXEEXT) test-uc_toupper$(EXEEXT) \ - test-u16-casecmp$(EXEEXT) test-u16-casecoll$(EXEEXT) \ - test-u16-casefold$(EXEEXT) test-u16-is-cased$(EXEEXT) \ - test-u16-is-casefolded$(EXEEXT) test-u16-is-lowercase$(EXEEXT) \ - test-u16-is-titlecase$(EXEEXT) test-u16-is-uppercase$(EXEEXT) \ - test-u16-tolower$(EXEEXT) test-u16-totitle$(EXEEXT) \ - test-u16-toupper$(EXEEXT) test-u32-casecmp$(EXEEXT) \ - test-u32-casecoll$(EXEEXT) test-u32-casefold$(EXEEXT) \ - test-u32-is-cased$(EXEEXT) test-u32-is-casefolded$(EXEEXT) \ - test-u32-is-lowercase$(EXEEXT) test-u32-is-titlecase$(EXEEXT) \ - test-u32-is-uppercase$(EXEEXT) test-u32-tolower$(EXEEXT) \ - test-u32-totitle$(EXEEXT) test-u32-toupper$(EXEEXT) \ - test-u8-casecmp$(EXEEXT) test-u8-casecoll$(EXEEXT) \ - test-u8-casefold$(EXEEXT) test-u8-is-cased$(EXEEXT) \ - test-u8-is-casefolded$(EXEEXT) test-u8-is-lowercase$(EXEEXT) \ - test-u8-is-titlecase$(EXEEXT) test-u8-is-uppercase$(EXEEXT) \ - test-u8-tolower$(EXEEXT) test-u8-totitle$(EXEEXT) \ - test-u8-toupper$(EXEEXT) unicase/test-ulc-casecmp1.sh \ - unicase/test-ulc-casecmp2.sh unicase/test-ulc-casecoll1.sh \ - unicase/test-ulc-casecoll2.sh test-u16-conv-from-enc$(EXEEXT) \ - test-u16-conv-to-enc$(EXEEXT) \ + test-strncat$(EXEEXT) test-cased$(EXEEXT) \ + test-ignorable$(EXEEXT) unicase/test-locale-language.sh \ + test-uc_tolower$(EXEEXT) test-uc_totitle$(EXEEXT) \ + test-uc_toupper$(EXEEXT) test-u16-casecmp$(EXEEXT) \ + test-u16-casecoll$(EXEEXT) test-u16-casefold$(EXEEXT) \ + test-u16-is-cased$(EXEEXT) test-u16-is-casefolded$(EXEEXT) \ + test-u16-is-lowercase$(EXEEXT) test-u16-is-titlecase$(EXEEXT) \ + test-u16-is-uppercase$(EXEEXT) test-u16-tolower$(EXEEXT) \ + test-u16-totitle$(EXEEXT) test-u16-toupper$(EXEEXT) \ + test-u32-casecmp$(EXEEXT) test-u32-casecoll$(EXEEXT) \ + test-u32-casefold$(EXEEXT) test-u32-is-cased$(EXEEXT) \ + test-u32-is-casefolded$(EXEEXT) test-u32-is-lowercase$(EXEEXT) \ + test-u32-is-titlecase$(EXEEXT) test-u32-is-uppercase$(EXEEXT) \ + test-u32-tolower$(EXEEXT) test-u32-totitle$(EXEEXT) \ + test-u32-toupper$(EXEEXT) test-u8-casecmp$(EXEEXT) \ + test-u8-casecoll$(EXEEXT) test-u8-casefold$(EXEEXT) \ + test-u8-is-cased$(EXEEXT) test-u8-is-casefolded$(EXEEXT) \ + test-u8-is-lowercase$(EXEEXT) test-u8-is-titlecase$(EXEEXT) \ + test-u8-is-uppercase$(EXEEXT) test-u8-tolower$(EXEEXT) \ + test-u8-totitle$(EXEEXT) test-u8-toupper$(EXEEXT) \ + unicase/test-ulc-casecmp1.sh unicase/test-ulc-casecmp2.sh \ + unicase/test-ulc-casecoll1.sh unicase/test-ulc-casecoll2.sh \ + test-u16-conv-from-enc$(EXEEXT) test-u16-conv-to-enc$(EXEEXT) \ test-u16-strconv-from-enc$(EXEEXT) \ test-u16-strconv-to-enc$(EXEEXT) \ test-u32-conv-from-enc$(EXEEXT) test-u32-conv-to-enc$(EXEEXT) \ @@ -224,52 +225,103 @@ TESTS = test-alloca-opt$(EXEEXT) test-array-mergesort$(EXEEXT) \ unistdio/test-ulc-vasnprintf2.sh \ unistdio/test-ulc-vasnprintf3.sh test-ulc-vasprintf1$(EXEEXT) \ test-ulc-vsnprintf1$(EXEEXT) test-ulc-vsprintf1$(EXEEXT) \ + test-u16-check$(EXEEXT) test-u16-chr$(EXEEXT) \ + test-u16-cmp$(EXEEXT) test-u16-cmp2$(EXEEXT) \ + test-u16-cpy-alloc$(EXEEXT) test-u16-cpy$(EXEEXT) \ + test-u16-mblen$(EXEEXT) test-u16-mbsnlen$(EXEEXT) \ + test-u16-mbtouc$(EXEEXT) test-u16-mbtouc-unsafe$(EXEEXT) \ + test-u16-mbtoucr$(EXEEXT) test-u16-move$(EXEEXT) \ + test-u16-next$(EXEEXT) test-u16-prev$(EXEEXT) \ + test-u16-set$(EXEEXT) test-u16-stpcpy$(EXEEXT) \ + test-u16-stpncpy$(EXEEXT) test-u16-strcat$(EXEEXT) \ + test-u16-strcmp$(EXEEXT) test-u16-strcoll$(EXEEXT) \ + test-u16-strcpy$(EXEEXT) test-u16-strdup$(EXEEXT) \ + test-u16-strlen$(EXEEXT) test-u16-strmblen$(EXEEXT) \ + test-u16-strmbtouc$(EXEEXT) test-u16-strncat$(EXEEXT) \ + test-u16-strncmp$(EXEEXT) test-u16-strncpy$(EXEEXT) \ + test-u16-strnlen$(EXEEXT) test-u16-to-u32$(EXEEXT) \ + test-u16-to-u8$(EXEEXT) test-u16-uctomb$(EXEEXT) \ + test-u32-check$(EXEEXT) test-u32-chr$(EXEEXT) \ + test-u32-cmp$(EXEEXT) test-u32-cmp2$(EXEEXT) \ + test-u32-cpy-alloc$(EXEEXT) test-u32-cpy$(EXEEXT) \ + test-u32-mblen$(EXEEXT) test-u32-mbsnlen$(EXEEXT) \ + test-u32-mbtouc$(EXEEXT) test-u32-mbtouc-unsafe$(EXEEXT) \ + test-u32-mbtoucr$(EXEEXT) test-u32-move$(EXEEXT) \ + test-u32-next$(EXEEXT) test-u32-prev$(EXEEXT) \ + test-u32-set$(EXEEXT) test-u32-stpcpy$(EXEEXT) \ + test-u32-stpncpy$(EXEEXT) test-u32-strcat$(EXEEXT) \ + test-u32-strcmp$(EXEEXT) test-u32-strcoll$(EXEEXT) \ + test-u32-strcpy$(EXEEXT) test-u32-strdup$(EXEEXT) \ + test-u32-strlen$(EXEEXT) test-u32-strmblen$(EXEEXT) \ + test-u32-strmbtouc$(EXEEXT) test-u32-strncat$(EXEEXT) \ + test-u32-strncmp$(EXEEXT) test-u32-strncpy$(EXEEXT) \ + test-u32-strnlen$(EXEEXT) test-u32-to-u16$(EXEEXT) \ + test-u32-to-u8$(EXEEXT) test-u32-uctomb$(EXEEXT) \ + test-u8-check$(EXEEXT) test-u8-chr$(EXEEXT) \ + test-u8-cmp$(EXEEXT) test-u8-cmp2$(EXEEXT) \ + test-u8-cpy-alloc$(EXEEXT) test-u8-cpy$(EXEEXT) \ + test-u8-mblen$(EXEEXT) test-u8-mbsnlen$(EXEEXT) \ + test-u8-mbtouc$(EXEEXT) test-u8-mbtouc-unsafe$(EXEEXT) \ + test-u8-mbtoucr$(EXEEXT) test-u8-move$(EXEEXT) \ + test-u8-next$(EXEEXT) test-u8-prev$(EXEEXT) \ + test-u8-set$(EXEEXT) test-u8-stpcpy$(EXEEXT) \ + test-u8-stpncpy$(EXEEXT) test-u8-strcat$(EXEEXT) \ + test-u8-strcmp$(EXEEXT) test-u8-strcoll$(EXEEXT) \ + test-u8-strcpy$(EXEEXT) test-u8-strdup$(EXEEXT) \ + test-u8-strlen$(EXEEXT) test-u8-strmblen$(EXEEXT) \ + test-u8-strmbtouc$(EXEEXT) test-u8-strncat$(EXEEXT) \ + test-u8-strncmp$(EXEEXT) test-u8-strncpy$(EXEEXT) \ + test-u8-strnlen$(EXEEXT) test-u8-to-u16$(EXEEXT) \ + test-u8-to-u32$(EXEEXT) test-u8-uctomb$(EXEEXT) \ test-u16-wordbreaks$(EXEEXT) test-u32-wordbreaks$(EXEEXT) \ test-u8-wordbreaks$(EXEEXT) uniwbrk/test-ulc-wordbreaks.sh \ test-u16-strwidth$(EXEEXT) test-u16-width$(EXEEXT) \ test-u32-strwidth$(EXEEXT) test-u32-width$(EXEEXT) \ test-u8-strwidth$(EXEEXT) test-u8-width$(EXEEXT) \ test-uc_width$(EXEEXT) uniwidth/test-uc_width2.sh \ - test-wchar$(EXEEXT) test-wctype$(EXEEXT) test-wcwidth$(EXEEXT) + test-unsetenv$(EXEEXT) test-wchar$(EXEEXT) \ + test-wctype$(EXEEXT) test-wcwidth$(EXEEXT) test-xalloc-die.sh +XFAIL_TESTS = noinst_PROGRAMS = check_PROGRAMS = test-alloca-opt$(EXEEXT) \ test-array-mergesort$(EXEEXT) test-c-ctype$(EXEEXT) \ test-c-strcasecmp$(EXEEXT) test-c-strncasecmp$(EXEEXT) \ - test-dup2$(EXEEXT) test-environ$(EXEEXT) test-errno$(EXEEXT) \ - test-fcntl$(EXEEXT) test-frexpl-nolibm$(EXEEXT) \ - test-fseterr$(EXEEXT) test-iconv$(EXEEXT) \ + test-environ$(EXEEXT) test-errno$(EXEEXT) \ + test-frexpl-nolibm$(EXEEXT) test-fseterr$(EXEEXT) \ + test-iconv-h$(EXEEXT) test-iconv$(EXEEXT) \ test-isnand-nolibm$(EXEEXT) test-isnanf-nolibm$(EXEEXT) \ test-isnanl-nolibm$(EXEEXT) test-locale$(EXEEXT) \ - test-localename$(EXEEXT) test-malloca$(EXEEXT) \ - test-math$(EXEEXT) test-mbrtowc$(EXEEXT) test-mbsinit$(EXEEXT) \ - test-memchr$(EXEEXT) test-open$(EXEEXT) \ + test-localename$(EXEEXT) test-lock$(EXEEXT) \ + test-malloca$(EXEEXT) test-math$(EXEEXT) test-mbrtowc$(EXEEXT) \ + test-mbsinit$(EXEEXT) test-memchr$(EXEEXT) \ test-printf-frexp$(EXEEXT) test-printf-frexpl$(EXEEXT) \ - test-signbit$(EXEEXT) test-stdbool$(EXEEXT) \ - test-stddef$(EXEEXT) test-stdint$(EXEEXT) test-stdlib$(EXEEXT) \ + test-setenv$(EXEEXT) test-signbit$(EXEEXT) \ + test-stdbool$(EXEEXT) test-stddef$(EXEEXT) \ + test-stdint$(EXEEXT) test-stdlib$(EXEEXT) \ test-strerror$(EXEEXT) test-striconveh$(EXEEXT) \ test-striconveha$(EXEEXT) test-string$(EXEEXT) \ - test-cased$(EXEEXT) test-ignorable$(EXEEXT) \ - test-locale-language$(EXEEXT) test-uc_tolower$(EXEEXT) \ - test-uc_totitle$(EXEEXT) test-uc_toupper$(EXEEXT) \ - test-u16-casecmp$(EXEEXT) test-u16-casecoll$(EXEEXT) \ - test-u16-casefold$(EXEEXT) test-u16-is-cased$(EXEEXT) \ - test-u16-is-casefolded$(EXEEXT) test-u16-is-lowercase$(EXEEXT) \ - test-u16-is-titlecase$(EXEEXT) test-u16-is-uppercase$(EXEEXT) \ - test-u16-tolower$(EXEEXT) test-u16-totitle$(EXEEXT) \ - test-u16-toupper$(EXEEXT) test-u32-casecmp$(EXEEXT) \ - test-u32-casecoll$(EXEEXT) test-u32-casefold$(EXEEXT) \ - test-u32-is-cased$(EXEEXT) test-u32-is-casefolded$(EXEEXT) \ - test-u32-is-lowercase$(EXEEXT) test-u32-is-titlecase$(EXEEXT) \ - test-u32-is-uppercase$(EXEEXT) test-u32-tolower$(EXEEXT) \ - test-u32-totitle$(EXEEXT) test-u32-toupper$(EXEEXT) \ - test-u8-casecmp$(EXEEXT) test-u8-casecoll$(EXEEXT) \ - test-u8-casefold$(EXEEXT) test-u8-is-cased$(EXEEXT) \ - test-u8-is-casefolded$(EXEEXT) test-u8-is-lowercase$(EXEEXT) \ - test-u8-is-titlecase$(EXEEXT) test-u8-is-uppercase$(EXEEXT) \ - test-u8-tolower$(EXEEXT) test-u8-totitle$(EXEEXT) \ - test-u8-toupper$(EXEEXT) test-ulc-casecmp$(EXEEXT) \ - test-ulc-casecoll$(EXEEXT) test-u16-conv-from-enc$(EXEEXT) \ - test-u16-conv-to-enc$(EXEEXT) \ + test-strncat$(EXEEXT) test-cased$(EXEEXT) \ + test-ignorable$(EXEEXT) test-locale-language$(EXEEXT) \ + test-uc_tolower$(EXEEXT) test-uc_totitle$(EXEEXT) \ + test-uc_toupper$(EXEEXT) test-u16-casecmp$(EXEEXT) \ + test-u16-casecoll$(EXEEXT) test-u16-casefold$(EXEEXT) \ + test-u16-is-cased$(EXEEXT) test-u16-is-casefolded$(EXEEXT) \ + test-u16-is-lowercase$(EXEEXT) test-u16-is-titlecase$(EXEEXT) \ + test-u16-is-uppercase$(EXEEXT) test-u16-tolower$(EXEEXT) \ + test-u16-totitle$(EXEEXT) test-u16-toupper$(EXEEXT) \ + test-u32-casecmp$(EXEEXT) test-u32-casecoll$(EXEEXT) \ + test-u32-casefold$(EXEEXT) test-u32-is-cased$(EXEEXT) \ + test-u32-is-casefolded$(EXEEXT) test-u32-is-lowercase$(EXEEXT) \ + test-u32-is-titlecase$(EXEEXT) test-u32-is-uppercase$(EXEEXT) \ + test-u32-tolower$(EXEEXT) test-u32-totitle$(EXEEXT) \ + test-u32-toupper$(EXEEXT) test-u8-casecmp$(EXEEXT) \ + test-u8-casecoll$(EXEEXT) test-u8-casefold$(EXEEXT) \ + test-u8-is-cased$(EXEEXT) test-u8-is-casefolded$(EXEEXT) \ + test-u8-is-lowercase$(EXEEXT) test-u8-is-titlecase$(EXEEXT) \ + test-u8-is-uppercase$(EXEEXT) test-u8-tolower$(EXEEXT) \ + test-u8-totitle$(EXEEXT) test-u8-toupper$(EXEEXT) \ + test-ulc-casecmp$(EXEEXT) test-ulc-casecoll$(EXEEXT) \ + test-u16-conv-from-enc$(EXEEXT) test-u16-conv-to-enc$(EXEEXT) \ test-u16-strconv-from-enc$(EXEEXT) \ test-u16-strconv-to-enc$(EXEEXT) \ test-u32-conv-from-enc$(EXEEXT) test-u32-conv-to-enc$(EXEEXT) \ @@ -406,13 +458,63 @@ check_PROGRAMS = test-alloca-opt$(EXEEXT) \ test-ulc-vasnprintf1$(EXEEXT) test-ulc-vasnprintf2$(EXEEXT) \ test-ulc-vasnprintf3$(EXEEXT) test-ulc-vasprintf1$(EXEEXT) \ test-ulc-vsnprintf1$(EXEEXT) test-ulc-vsprintf1$(EXEEXT) \ + test-u16-check$(EXEEXT) test-u16-chr$(EXEEXT) \ + test-u16-cmp$(EXEEXT) test-u16-cmp2$(EXEEXT) \ + test-u16-cpy-alloc$(EXEEXT) test-u16-cpy$(EXEEXT) \ + test-u16-mblen$(EXEEXT) test-u16-mbsnlen$(EXEEXT) \ + test-u16-mbtouc$(EXEEXT) test-u16-mbtouc-unsafe$(EXEEXT) \ + test-u16-mbtoucr$(EXEEXT) test-u16-move$(EXEEXT) \ + test-u16-next$(EXEEXT) test-u16-prev$(EXEEXT) \ + test-u16-set$(EXEEXT) test-u16-stpcpy$(EXEEXT) \ + test-u16-stpncpy$(EXEEXT) test-u16-strcat$(EXEEXT) \ + test-u16-strcmp$(EXEEXT) test-u16-strcoll$(EXEEXT) \ + test-u16-strcpy$(EXEEXT) test-u16-strdup$(EXEEXT) \ + test-u16-strlen$(EXEEXT) test-u16-strmblen$(EXEEXT) \ + test-u16-strmbtouc$(EXEEXT) test-u16-strncat$(EXEEXT) \ + test-u16-strncmp$(EXEEXT) test-u16-strncpy$(EXEEXT) \ + test-u16-strnlen$(EXEEXT) test-u16-to-u32$(EXEEXT) \ + test-u16-to-u8$(EXEEXT) test-u16-uctomb$(EXEEXT) \ + test-u32-check$(EXEEXT) test-u32-chr$(EXEEXT) \ + test-u32-cmp$(EXEEXT) test-u32-cmp2$(EXEEXT) \ + test-u32-cpy-alloc$(EXEEXT) test-u32-cpy$(EXEEXT) \ + test-u32-mblen$(EXEEXT) test-u32-mbsnlen$(EXEEXT) \ + test-u32-mbtouc$(EXEEXT) test-u32-mbtouc-unsafe$(EXEEXT) \ + test-u32-mbtoucr$(EXEEXT) test-u32-move$(EXEEXT) \ + test-u32-next$(EXEEXT) test-u32-prev$(EXEEXT) \ + test-u32-set$(EXEEXT) test-u32-stpcpy$(EXEEXT) \ + test-u32-stpncpy$(EXEEXT) test-u32-strcat$(EXEEXT) \ + test-u32-strcmp$(EXEEXT) test-u32-strcoll$(EXEEXT) \ + test-u32-strcpy$(EXEEXT) test-u32-strdup$(EXEEXT) \ + test-u32-strlen$(EXEEXT) test-u32-strmblen$(EXEEXT) \ + test-u32-strmbtouc$(EXEEXT) test-u32-strncat$(EXEEXT) \ + test-u32-strncmp$(EXEEXT) test-u32-strncpy$(EXEEXT) \ + test-u32-strnlen$(EXEEXT) test-u32-to-u16$(EXEEXT) \ + test-u32-to-u8$(EXEEXT) test-u32-uctomb$(EXEEXT) \ + test-u8-check$(EXEEXT) test-u8-chr$(EXEEXT) \ + test-u8-cmp$(EXEEXT) test-u8-cmp2$(EXEEXT) \ + test-u8-cpy-alloc$(EXEEXT) test-u8-cpy$(EXEEXT) \ + test-u8-mblen$(EXEEXT) test-u8-mbsnlen$(EXEEXT) \ + test-u8-mbtouc$(EXEEXT) test-u8-mbtouc-unsafe$(EXEEXT) \ + test-u8-mbtoucr$(EXEEXT) test-u8-move$(EXEEXT) \ + test-u8-next$(EXEEXT) test-u8-prev$(EXEEXT) \ + test-u8-set$(EXEEXT) test-u8-stpcpy$(EXEEXT) \ + test-u8-stpncpy$(EXEEXT) test-u8-strcat$(EXEEXT) \ + test-u8-strcmp$(EXEEXT) test-u8-strcoll$(EXEEXT) \ + test-u8-strcpy$(EXEEXT) test-u8-strdup$(EXEEXT) \ + test-u8-strlen$(EXEEXT) test-u8-strmblen$(EXEEXT) \ + test-u8-strmbtouc$(EXEEXT) test-u8-strncat$(EXEEXT) \ + test-u8-strncmp$(EXEEXT) test-u8-strncpy$(EXEEXT) \ + test-u8-strnlen$(EXEEXT) test-u8-to-u16$(EXEEXT) \ + test-u8-to-u32$(EXEEXT) test-u8-uctomb$(EXEEXT) \ test-u16-wordbreaks$(EXEEXT) test-u32-wordbreaks$(EXEEXT) \ test-u8-wordbreaks$(EXEEXT) test-ulc-wordbreaks$(EXEEXT) \ test-u16-strwidth$(EXEEXT) test-u16-width$(EXEEXT) \ test-u32-strwidth$(EXEEXT) test-u32-width$(EXEEXT) \ test-u8-strwidth$(EXEEXT) test-u8-width$(EXEEXT) \ test-uc_width$(EXEEXT) test-uc_width2$(EXEEXT) \ - test-wchar$(EXEEXT) test-wctype$(EXEEXT) test-wcwidth$(EXEEXT) + test-unsetenv$(EXEEXT) test-wchar$(EXEEXT) \ + test-wctype$(EXEEXT) test-wcwidth$(EXEEXT) \ + test-xalloc-die$(EXEEXT) @WOE32DLL_FALSE@am__append_1 = test-categ_none @WOE32DLL_FALSE@am__append_2 = test-categ_none subdir = tests @@ -420,17 +522,15 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/gnulib-m4/00gnulib.m4 \ $(top_srcdir)/gnulib-m4/alloca.m4 \ $(top_srcdir)/gnulib-m4/codeset.m4 \ - $(top_srcdir)/gnulib-m4/dup2.m4 \ $(top_srcdir)/gnulib-m4/eealloc.m4 \ $(top_srcdir)/gnulib-m4/environ.m4 \ $(top_srcdir)/gnulib-m4/errno_h.m4 \ $(top_srcdir)/gnulib-m4/error.m4 \ - $(top_srcdir)/gnulib-m4/exitfail.m4 \ $(top_srcdir)/gnulib-m4/exponentd.m4 \ $(top_srcdir)/gnulib-m4/exponentf.m4 \ $(top_srcdir)/gnulib-m4/exponentl.m4 \ $(top_srcdir)/gnulib-m4/extensions.m4 \ - $(top_srcdir)/gnulib-m4/fcntl_h.m4 \ + $(top_srcdir)/gnulib-m4/fcntl-o.m4 \ $(top_srcdir)/gnulib-m4/float_h.m4 \ $(top_srcdir)/gnulib-m4/fpieee.m4 \ $(top_srcdir)/gnulib-m4/frexp.m4 \ @@ -462,6 +562,7 @@ am__aclocal_m4_deps = $(top_srcdir)/gnulib-m4/00gnulib.m4 \ $(top_srcdir)/gnulib-m4/locale-zh.m4 \ $(top_srcdir)/gnulib-m4/locale_h.m4 \ $(top_srcdir)/gnulib-m4/localename.m4 \ + $(top_srcdir)/gnulib-m4/lock.m4 \ $(top_srcdir)/gnulib-m4/longlong.m4 \ $(top_srcdir)/gnulib-m4/malloc.m4 \ $(top_srcdir)/gnulib-m4/malloca.m4 \ @@ -474,13 +575,12 @@ am__aclocal_m4_deps = $(top_srcdir)/gnulib-m4/00gnulib.m4 \ $(top_srcdir)/gnulib-m4/memchr.m4 \ $(top_srcdir)/gnulib-m4/minmax.m4 \ $(top_srcdir)/gnulib-m4/mmap-anon.m4 \ - $(top_srcdir)/gnulib-m4/mode_t.m4 \ $(top_srcdir)/gnulib-m4/multiarch.m4 \ $(top_srcdir)/gnulib-m4/nocrash.m4 \ - $(top_srcdir)/gnulib-m4/open.m4 \ $(top_srcdir)/gnulib-m4/printf-frexp.m4 \ $(top_srcdir)/gnulib-m4/printf-frexpl.m4 \ $(top_srcdir)/gnulib-m4/printf.m4 \ + $(top_srcdir)/gnulib-m4/putenv.m4 \ $(top_srcdir)/gnulib-m4/relocatable-lib.m4 \ $(top_srcdir)/gnulib-m4/setenv.m4 \ $(top_srcdir)/gnulib-m4/signbit.m4 \ @@ -492,16 +592,21 @@ am__aclocal_m4_deps = $(top_srcdir)/gnulib-m4/00gnulib.m4 \ $(top_srcdir)/gnulib-m4/stdlib_h.m4 \ $(top_srcdir)/gnulib-m4/strerror.m4 \ $(top_srcdir)/gnulib-m4/string_h.m4 \ + $(top_srcdir)/gnulib-m4/strncat.m4 \ + $(top_srcdir)/gnulib-m4/thread.m4 \ + $(top_srcdir)/gnulib-m4/threadlib.m4 \ $(top_srcdir)/gnulib-m4/unistd_h.m4 \ $(top_srcdir)/gnulib-m4/vasnprintf.m4 \ - $(top_srcdir)/gnulib-m4/wchar.m4 \ + $(top_srcdir)/gnulib-m4/warn-on-use.m4 \ + $(top_srcdir)/gnulib-m4/wchar_h.m4 \ $(top_srcdir)/gnulib-m4/wchar_t.m4 \ $(top_srcdir)/gnulib-m4/wctob.m4 \ - $(top_srcdir)/gnulib-m4/wctype.m4 \ + $(top_srcdir)/gnulib-m4/wctype_h.m4 \ $(top_srcdir)/gnulib-m4/wcwidth.m4 \ $(top_srcdir)/gnulib-m4/wint_t.m4 \ $(top_srcdir)/gnulib-m4/xalloc.m4 \ - $(top_srcdir)/gnulib-m4/xsize.m4 $(top_srcdir)/m4/exported.m4 \ + $(top_srcdir)/gnulib-m4/xsize.m4 \ + $(top_srcdir)/gnulib-m4/yield.m4 $(top_srcdir)/m4/exported.m4 \ $(top_srcdir)/m4/init-package-version.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ @@ -523,7 +628,9 @@ am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ libtests_a_AR = $(AR) $(ARFLAGS) am__DEPENDENCIES_1 = -am_libtests_a_OBJECTS = progname.$(OBJEXT) xalloc-die.$(OBJEXT) +am__dirstamp = $(am__leading_dot)dirstamp +am_libtests_a_OBJECTS = exitfail.$(OBJEXT) progname.$(OBJEXT) \ + glthread/thread.$(OBJEXT) xalloc-die.$(OBJEXT) libtests_a_OBJECTS = $(am_libtests_a_OBJECTS) @WOE32DLL_FALSE@am__EXEEXT_1 = test-categ_none$(EXEEXT) PROGRAMS = $(noinst_PROGRAMS) @@ -540,7 +647,6 @@ test_array_mergesort_OBJECTS = test-array-mergesort.$(OBJEXT) test_array_mergesort_LDADD = $(LDADD) test_array_mergesort_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) -am__dirstamp = $(am__leading_dot)dirstamp am_test_bidi_byname_OBJECTS = unictype/test-bidi_byname.$(OBJEXT) test_bidi_byname_OBJECTS = $(am_test_bidi_byname_OBJECTS) test_bidi_byname_LDADD = $(LDADD) @@ -930,11 +1036,6 @@ test_digit_OBJECTS = $(am_test_digit_OBJECTS) test_digit_LDADD = $(LDADD) test_digit_DEPENDENCIES = libtests.a ../lib/libunistring.la libtests.a \ $(am__DEPENDENCIES_1) -test_dup2_SOURCES = test-dup2.c -test_dup2_OBJECTS = test-dup2.$(OBJEXT) -test_dup2_LDADD = $(LDADD) -test_dup2_DEPENDENCIES = libtests.a ../lib/libunistring.la libtests.a \ - $(am__DEPENDENCIES_1) test_environ_SOURCES = test-environ.c test_environ_OBJECTS = test-environ.$(OBJEXT) test_environ_LDADD = $(LDADD) @@ -945,11 +1046,6 @@ test_errno_OBJECTS = test-errno.$(OBJEXT) test_errno_LDADD = $(LDADD) test_errno_DEPENDENCIES = libtests.a ../lib/libunistring.la libtests.a \ $(am__DEPENDENCIES_1) -test_fcntl_SOURCES = test-fcntl.c -test_fcntl_OBJECTS = test-fcntl.$(OBJEXT) -test_fcntl_LDADD = $(LDADD) -test_fcntl_DEPENDENCIES = libtests.a ../lib/libunistring.la libtests.a \ - $(am__DEPENDENCIES_1) am_test_frexpl_nolibm_OBJECTS = test-frexpl.$(OBJEXT) test_frexpl_nolibm_OBJECTS = $(am_test_frexpl_nolibm_OBJECTS) test_frexpl_nolibm_LDADD = $(LDADD) @@ -965,6 +1061,11 @@ test_iconv_OBJECTS = test-iconv.$(OBJEXT) am__DEPENDENCIES_2 = libtests.a ../lib/libunistring.la libtests.a \ $(am__DEPENDENCIES_1) test_iconv_DEPENDENCIES = $(am__DEPENDENCIES_2) +test_iconv_h_SOURCES = test-iconv-h.c +test_iconv_h_OBJECTS = test-iconv-h.$(OBJEXT) +test_iconv_h_LDADD = $(LDADD) +test_iconv_h_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_ignorable_OBJECTS = unicase/test-ignorable.$(OBJEXT) test_ignorable_OBJECTS = $(am_test_ignorable_OBJECTS) test_ignorable_LDADD = $(LDADD) @@ -997,6 +1098,9 @@ test_locale_language_DEPENDENCIES = $(am__DEPENDENCIES_2) test_localename_SOURCES = test-localename.c test_localename_OBJECTS = test-localename.$(OBJEXT) test_localename_DEPENDENCIES = $(am__DEPENDENCIES_2) +test_lock_SOURCES = test-lock.c +test_lock_OBJECTS = test-lock.$(OBJEXT) +test_lock_DEPENDENCIES = $(am__DEPENDENCIES_2) test_malloca_SOURCES = test-malloca.c test_malloca_OBJECTS = test-malloca.$(OBJEXT) test_malloca_LDADD = $(LDADD) @@ -1060,11 +1164,6 @@ test_numeric_OBJECTS = $(am_test_numeric_OBJECTS) test_numeric_LDADD = $(LDADD) test_numeric_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) -test_open_SOURCES = test-open.c -test_open_OBJECTS = test-open.$(OBJEXT) -test_open_LDADD = $(LDADD) -test_open_DEPENDENCIES = libtests.a ../lib/libunistring.la libtests.a \ - $(am__DEPENDENCIES_1) am_test_pr_alphabetic_OBJECTS = unictype/test-pr_alphabetic.$(OBJEXT) test_pr_alphabetic_OBJECTS = $(am_test_pr_alphabetic_OBJECTS) test_pr_alphabetic_LDADD = $(LDADD) @@ -1580,6 +1679,11 @@ test_scripts_OBJECTS = $(am_test_scripts_OBJECTS) test_scripts_LDADD = $(LDADD) test_scripts_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) +test_setenv_SOURCES = test-setenv.c +test_setenv_OBJECTS = test-setenv.$(OBJEXT) +test_setenv_LDADD = $(LDADD) +test_setenv_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) test_signbit_SOURCES = test-signbit.c test_signbit_OBJECTS = test-signbit.$(OBJEXT) test_signbit_LDADD = $(LDADD) @@ -1621,6 +1725,11 @@ test_string_OBJECTS = test-string.$(OBJEXT) test_string_LDADD = $(LDADD) test_string_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) +test_strncat_SOURCES = test-strncat.c +test_strncat_OBJECTS = test-strncat.$(OBJEXT) +test_strncat_LDADD = $(LDADD) +test_strncat_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_sy_c_ident_OBJECTS = unictype/test-sy_c_ident.$(OBJEXT) test_sy_c_ident_OBJECTS = $(am_test_sy_c_ident_OBJECTS) test_sy_c_ident_LDADD = $(LDADD) @@ -1661,6 +1770,26 @@ test_u16_casefold_OBJECTS = $(am_test_u16_casefold_OBJECTS) test_u16_casefold_LDADD = $(LDADD) test_u16_casefold_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) +am_test_u16_check_OBJECTS = unistr/test-u16-check.$(OBJEXT) +test_u16_check_OBJECTS = $(am_test_u16_check_OBJECTS) +test_u16_check_LDADD = $(LDADD) +test_u16_check_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_chr_OBJECTS = unistr/test-u16-chr.$(OBJEXT) +test_u16_chr_OBJECTS = $(am_test_u16_chr_OBJECTS) +test_u16_chr_LDADD = $(LDADD) +test_u16_chr_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_cmp_OBJECTS = unistr/test-u16-cmp.$(OBJEXT) +test_u16_cmp_OBJECTS = $(am_test_u16_cmp_OBJECTS) +test_u16_cmp_LDADD = $(LDADD) +test_u16_cmp_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_cmp2_OBJECTS = unistr/test-u16-cmp2.$(OBJEXT) +test_u16_cmp2_OBJECTS = $(am_test_u16_cmp2_OBJECTS) +test_u16_cmp2_LDADD = $(LDADD) +test_u16_cmp2_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u16_conv_from_enc_OBJECTS = \ uniconv/test-u16-conv-from-enc.$(OBJEXT) test_u16_conv_from_enc_OBJECTS = $(am_test_u16_conv_from_enc_OBJECTS) @@ -1669,6 +1798,16 @@ am_test_u16_conv_to_enc_OBJECTS = \ uniconv/test-u16-conv-to-enc.$(OBJEXT) test_u16_conv_to_enc_OBJECTS = $(am_test_u16_conv_to_enc_OBJECTS) test_u16_conv_to_enc_DEPENDENCIES = $(am__DEPENDENCIES_2) +am_test_u16_cpy_OBJECTS = unistr/test-u16-cpy.$(OBJEXT) +test_u16_cpy_OBJECTS = $(am_test_u16_cpy_OBJECTS) +test_u16_cpy_LDADD = $(LDADD) +test_u16_cpy_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_cpy_alloc_OBJECTS = unistr/test-u16-cpy-alloc.$(OBJEXT) +test_u16_cpy_alloc_OBJECTS = $(am_test_u16_cpy_alloc_OBJECTS) +test_u16_cpy_alloc_LDADD = $(LDADD) +test_u16_cpy_alloc_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u16_is_cased_OBJECTS = unicase/test-u16-is-cased.$(OBJEXT) test_u16_is_cased_OBJECTS = $(am_test_u16_is_cased_OBJECTS) test_u16_is_cased_LDADD = $(LDADD) @@ -1698,6 +1837,42 @@ test_u16_is_uppercase_OBJECTS = $(am_test_u16_is_uppercase_OBJECTS) test_u16_is_uppercase_LDADD = $(LDADD) test_u16_is_uppercase_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) +am_test_u16_mblen_OBJECTS = unistr/test-u16-mblen.$(OBJEXT) +test_u16_mblen_OBJECTS = $(am_test_u16_mblen_OBJECTS) +test_u16_mblen_LDADD = $(LDADD) +test_u16_mblen_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_mbsnlen_OBJECTS = unistr/test-u16-mbsnlen.$(OBJEXT) +test_u16_mbsnlen_OBJECTS = $(am_test_u16_mbsnlen_OBJECTS) +test_u16_mbsnlen_LDADD = $(LDADD) +test_u16_mbsnlen_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_mbtouc_OBJECTS = unistr/test-u16-mbtouc.$(OBJEXT) +test_u16_mbtouc_OBJECTS = $(am_test_u16_mbtouc_OBJECTS) +test_u16_mbtouc_LDADD = $(LDADD) +test_u16_mbtouc_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_mbtouc_unsafe_OBJECTS = \ + unistr/test-u16-mbtouc-unsafe.$(OBJEXT) +test_u16_mbtouc_unsafe_OBJECTS = $(am_test_u16_mbtouc_unsafe_OBJECTS) +test_u16_mbtouc_unsafe_LDADD = $(LDADD) +test_u16_mbtouc_unsafe_DEPENDENCIES = libtests.a \ + ../lib/libunistring.la libtests.a $(am__DEPENDENCIES_1) +am_test_u16_mbtoucr_OBJECTS = unistr/test-u16-mbtoucr.$(OBJEXT) +test_u16_mbtoucr_OBJECTS = $(am_test_u16_mbtoucr_OBJECTS) +test_u16_mbtoucr_LDADD = $(LDADD) +test_u16_mbtoucr_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_move_OBJECTS = unistr/test-u16-move.$(OBJEXT) +test_u16_move_OBJECTS = $(am_test_u16_move_OBJECTS) +test_u16_move_LDADD = $(LDADD) +test_u16_move_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_next_OBJECTS = unistr/test-u16-next.$(OBJEXT) +test_u16_next_OBJECTS = $(am_test_u16_next_OBJECTS) +test_u16_next_LDADD = $(LDADD) +test_u16_next_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u16_normcmp_OBJECTS = uninorm/test-u16-normcmp.$(OBJEXT) test_u16_normcmp_OBJECTS = $(am_test_u16_normcmp_OBJECTS) test_u16_normcmp_LDADD = $(LDADD) @@ -1713,6 +1888,39 @@ test_u16_possible_linebreaks_OBJECTS = \ test_u16_possible_linebreaks_LDADD = $(LDADD) test_u16_possible_linebreaks_DEPENDENCIES = libtests.a \ ../lib/libunistring.la libtests.a $(am__DEPENDENCIES_1) +am_test_u16_prev_OBJECTS = unistr/test-u16-prev.$(OBJEXT) +test_u16_prev_OBJECTS = $(am_test_u16_prev_OBJECTS) +test_u16_prev_LDADD = $(LDADD) +test_u16_prev_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_set_OBJECTS = unistr/test-u16-set.$(OBJEXT) +test_u16_set_OBJECTS = $(am_test_u16_set_OBJECTS) +test_u16_set_LDADD = $(LDADD) +test_u16_set_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_stpcpy_OBJECTS = unistr/test-u16-stpcpy.$(OBJEXT) +test_u16_stpcpy_OBJECTS = $(am_test_u16_stpcpy_OBJECTS) +test_u16_stpcpy_LDADD = $(LDADD) +test_u16_stpcpy_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_stpncpy_OBJECTS = unistr/test-u16-stpncpy.$(OBJEXT) +test_u16_stpncpy_OBJECTS = $(am_test_u16_stpncpy_OBJECTS) +test_u16_stpncpy_LDADD = $(LDADD) +test_u16_stpncpy_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_strcat_OBJECTS = unistr/test-u16-strcat.$(OBJEXT) +test_u16_strcat_OBJECTS = $(am_test_u16_strcat_OBJECTS) +test_u16_strcat_LDADD = $(LDADD) +test_u16_strcat_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_strcmp_OBJECTS = unistr/test-u16-strcmp.$(OBJEXT) +test_u16_strcmp_OBJECTS = $(am_test_u16_strcmp_OBJECTS) +test_u16_strcmp_LDADD = $(LDADD) +test_u16_strcmp_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_strcoll_OBJECTS = unistr/test-u16-strcoll.$(OBJEXT) +test_u16_strcoll_OBJECTS = $(am_test_u16_strcoll_OBJECTS) +test_u16_strcoll_DEPENDENCIES = $(am__DEPENDENCIES_2) am_test_u16_strconv_from_enc_OBJECTS = \ uniconv/test-u16-strconv-from-enc.$(OBJEXT) test_u16_strconv_from_enc_OBJECTS = \ @@ -1723,11 +1931,66 @@ am_test_u16_strconv_to_enc_OBJECTS = \ test_u16_strconv_to_enc_OBJECTS = \ $(am_test_u16_strconv_to_enc_OBJECTS) test_u16_strconv_to_enc_DEPENDENCIES = $(am__DEPENDENCIES_2) +am_test_u16_strcpy_OBJECTS = unistr/test-u16-strcpy.$(OBJEXT) +test_u16_strcpy_OBJECTS = $(am_test_u16_strcpy_OBJECTS) +test_u16_strcpy_LDADD = $(LDADD) +test_u16_strcpy_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_strdup_OBJECTS = unistr/test-u16-strdup.$(OBJEXT) +test_u16_strdup_OBJECTS = $(am_test_u16_strdup_OBJECTS) +test_u16_strdup_LDADD = $(LDADD) +test_u16_strdup_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_strlen_OBJECTS = unistr/test-u16-strlen.$(OBJEXT) +test_u16_strlen_OBJECTS = $(am_test_u16_strlen_OBJECTS) +test_u16_strlen_LDADD = $(LDADD) +test_u16_strlen_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_strmblen_OBJECTS = unistr/test-u16-strmblen.$(OBJEXT) +test_u16_strmblen_OBJECTS = $(am_test_u16_strmblen_OBJECTS) +test_u16_strmblen_LDADD = $(LDADD) +test_u16_strmblen_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_strmbtouc_OBJECTS = unistr/test-u16-strmbtouc.$(OBJEXT) +test_u16_strmbtouc_OBJECTS = $(am_test_u16_strmbtouc_OBJECTS) +test_u16_strmbtouc_LDADD = $(LDADD) +test_u16_strmbtouc_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_strncat_OBJECTS = unistr/test-u16-strncat.$(OBJEXT) +test_u16_strncat_OBJECTS = $(am_test_u16_strncat_OBJECTS) +test_u16_strncat_LDADD = $(LDADD) +test_u16_strncat_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_strncmp_OBJECTS = unistr/test-u16-strncmp.$(OBJEXT) +test_u16_strncmp_OBJECTS = $(am_test_u16_strncmp_OBJECTS) +test_u16_strncmp_LDADD = $(LDADD) +test_u16_strncmp_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_strncpy_OBJECTS = unistr/test-u16-strncpy.$(OBJEXT) +test_u16_strncpy_OBJECTS = $(am_test_u16_strncpy_OBJECTS) +test_u16_strncpy_LDADD = $(LDADD) +test_u16_strncpy_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_strnlen_OBJECTS = unistr/test-u16-strnlen.$(OBJEXT) +test_u16_strnlen_OBJECTS = $(am_test_u16_strnlen_OBJECTS) +test_u16_strnlen_LDADD = $(LDADD) +test_u16_strnlen_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u16_strwidth_OBJECTS = uniwidth/test-u16-strwidth.$(OBJEXT) test_u16_strwidth_OBJECTS = $(am_test_u16_strwidth_OBJECTS) test_u16_strwidth_LDADD = $(LDADD) test_u16_strwidth_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) +am_test_u16_to_u32_OBJECTS = unistr/test-u16-to-u32.$(OBJEXT) +test_u16_to_u32_OBJECTS = $(am_test_u16_to_u32_OBJECTS) +test_u16_to_u32_LDADD = $(LDADD) +test_u16_to_u32_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u16_to_u8_OBJECTS = unistr/test-u16-to-u8.$(OBJEXT) +test_u16_to_u8_OBJECTS = $(am_test_u16_to_u8_OBJECTS) +test_u16_to_u8_LDADD = $(LDADD) +test_u16_to_u8_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u16_tolower_OBJECTS = unicase/test-u16-tolower.$(OBJEXT) test_u16_tolower_OBJECTS = $(am_test_u16_tolower_OBJECTS) test_u16_tolower_LDADD = $(LDADD) @@ -1743,6 +2006,11 @@ test_u16_toupper_OBJECTS = $(am_test_u16_toupper_OBJECTS) test_u16_toupper_LDADD = $(LDADD) test_u16_toupper_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) +am_test_u16_uctomb_OBJECTS = unistr/test-u16-uctomb.$(OBJEXT) +test_u16_uctomb_OBJECTS = $(am_test_u16_uctomb_OBJECTS) +test_u16_uctomb_LDADD = $(LDADD) +test_u16_uctomb_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u16_vasnprintf1_OBJECTS = \ unistdio/test-u16-vasnprintf1.$(OBJEXT) test_u16_vasnprintf1_OBJECTS = $(am_test_u16_vasnprintf1_OBJECTS) @@ -1801,6 +2069,26 @@ test_u32_casefold_OBJECTS = $(am_test_u32_casefold_OBJECTS) test_u32_casefold_LDADD = $(LDADD) test_u32_casefold_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) +am_test_u32_check_OBJECTS = unistr/test-u32-check.$(OBJEXT) +test_u32_check_OBJECTS = $(am_test_u32_check_OBJECTS) +test_u32_check_LDADD = $(LDADD) +test_u32_check_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_chr_OBJECTS = unistr/test-u32-chr.$(OBJEXT) +test_u32_chr_OBJECTS = $(am_test_u32_chr_OBJECTS) +test_u32_chr_LDADD = $(LDADD) +test_u32_chr_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_cmp_OBJECTS = unistr/test-u32-cmp.$(OBJEXT) +test_u32_cmp_OBJECTS = $(am_test_u32_cmp_OBJECTS) +test_u32_cmp_LDADD = $(LDADD) +test_u32_cmp_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_cmp2_OBJECTS = unistr/test-u32-cmp2.$(OBJEXT) +test_u32_cmp2_OBJECTS = $(am_test_u32_cmp2_OBJECTS) +test_u32_cmp2_LDADD = $(LDADD) +test_u32_cmp2_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u32_conv_from_enc_OBJECTS = \ uniconv/test-u32-conv-from-enc.$(OBJEXT) test_u32_conv_from_enc_OBJECTS = $(am_test_u32_conv_from_enc_OBJECTS) @@ -1809,6 +2097,16 @@ am_test_u32_conv_to_enc_OBJECTS = \ uniconv/test-u32-conv-to-enc.$(OBJEXT) test_u32_conv_to_enc_OBJECTS = $(am_test_u32_conv_to_enc_OBJECTS) test_u32_conv_to_enc_DEPENDENCIES = $(am__DEPENDENCIES_2) +am_test_u32_cpy_OBJECTS = unistr/test-u32-cpy.$(OBJEXT) +test_u32_cpy_OBJECTS = $(am_test_u32_cpy_OBJECTS) +test_u32_cpy_LDADD = $(LDADD) +test_u32_cpy_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_cpy_alloc_OBJECTS = unistr/test-u32-cpy-alloc.$(OBJEXT) +test_u32_cpy_alloc_OBJECTS = $(am_test_u32_cpy_alloc_OBJECTS) +test_u32_cpy_alloc_LDADD = $(LDADD) +test_u32_cpy_alloc_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u32_is_cased_OBJECTS = unicase/test-u32-is-cased.$(OBJEXT) test_u32_is_cased_OBJECTS = $(am_test_u32_is_cased_OBJECTS) test_u32_is_cased_LDADD = $(LDADD) @@ -1838,6 +2136,42 @@ test_u32_is_uppercase_OBJECTS = $(am_test_u32_is_uppercase_OBJECTS) test_u32_is_uppercase_LDADD = $(LDADD) test_u32_is_uppercase_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) +am_test_u32_mblen_OBJECTS = unistr/test-u32-mblen.$(OBJEXT) +test_u32_mblen_OBJECTS = $(am_test_u32_mblen_OBJECTS) +test_u32_mblen_LDADD = $(LDADD) +test_u32_mblen_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_mbsnlen_OBJECTS = unistr/test-u32-mbsnlen.$(OBJEXT) +test_u32_mbsnlen_OBJECTS = $(am_test_u32_mbsnlen_OBJECTS) +test_u32_mbsnlen_LDADD = $(LDADD) +test_u32_mbsnlen_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_mbtouc_OBJECTS = unistr/test-u32-mbtouc.$(OBJEXT) +test_u32_mbtouc_OBJECTS = $(am_test_u32_mbtouc_OBJECTS) +test_u32_mbtouc_LDADD = $(LDADD) +test_u32_mbtouc_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_mbtouc_unsafe_OBJECTS = \ + unistr/test-u32-mbtouc-unsafe.$(OBJEXT) +test_u32_mbtouc_unsafe_OBJECTS = $(am_test_u32_mbtouc_unsafe_OBJECTS) +test_u32_mbtouc_unsafe_LDADD = $(LDADD) +test_u32_mbtouc_unsafe_DEPENDENCIES = libtests.a \ + ../lib/libunistring.la libtests.a $(am__DEPENDENCIES_1) +am_test_u32_mbtoucr_OBJECTS = unistr/test-u32-mbtoucr.$(OBJEXT) +test_u32_mbtoucr_OBJECTS = $(am_test_u32_mbtoucr_OBJECTS) +test_u32_mbtoucr_LDADD = $(LDADD) +test_u32_mbtoucr_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_move_OBJECTS = unistr/test-u32-move.$(OBJEXT) +test_u32_move_OBJECTS = $(am_test_u32_move_OBJECTS) +test_u32_move_LDADD = $(LDADD) +test_u32_move_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_next_OBJECTS = unistr/test-u32-next.$(OBJEXT) +test_u32_next_OBJECTS = $(am_test_u32_next_OBJECTS) +test_u32_next_LDADD = $(LDADD) +test_u32_next_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u32_nfc_big_OBJECTS = uninorm/test-u32-nfc-big.$(OBJEXT) \ uninorm/test-u32-normalize-big.$(OBJEXT) test_u32_nfc_big_OBJECTS = $(am_test_u32_nfc_big_OBJECTS) @@ -1869,6 +2203,39 @@ test_u32_possible_linebreaks_OBJECTS = \ test_u32_possible_linebreaks_LDADD = $(LDADD) test_u32_possible_linebreaks_DEPENDENCIES = libtests.a \ ../lib/libunistring.la libtests.a $(am__DEPENDENCIES_1) +am_test_u32_prev_OBJECTS = unistr/test-u32-prev.$(OBJEXT) +test_u32_prev_OBJECTS = $(am_test_u32_prev_OBJECTS) +test_u32_prev_LDADD = $(LDADD) +test_u32_prev_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_set_OBJECTS = unistr/test-u32-set.$(OBJEXT) +test_u32_set_OBJECTS = $(am_test_u32_set_OBJECTS) +test_u32_set_LDADD = $(LDADD) +test_u32_set_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_stpcpy_OBJECTS = unistr/test-u32-stpcpy.$(OBJEXT) +test_u32_stpcpy_OBJECTS = $(am_test_u32_stpcpy_OBJECTS) +test_u32_stpcpy_LDADD = $(LDADD) +test_u32_stpcpy_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_stpncpy_OBJECTS = unistr/test-u32-stpncpy.$(OBJEXT) +test_u32_stpncpy_OBJECTS = $(am_test_u32_stpncpy_OBJECTS) +test_u32_stpncpy_LDADD = $(LDADD) +test_u32_stpncpy_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_strcat_OBJECTS = unistr/test-u32-strcat.$(OBJEXT) +test_u32_strcat_OBJECTS = $(am_test_u32_strcat_OBJECTS) +test_u32_strcat_LDADD = $(LDADD) +test_u32_strcat_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_strcmp_OBJECTS = unistr/test-u32-strcmp.$(OBJEXT) +test_u32_strcmp_OBJECTS = $(am_test_u32_strcmp_OBJECTS) +test_u32_strcmp_LDADD = $(LDADD) +test_u32_strcmp_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_strcoll_OBJECTS = unistr/test-u32-strcoll.$(OBJEXT) +test_u32_strcoll_OBJECTS = $(am_test_u32_strcoll_OBJECTS) +test_u32_strcoll_DEPENDENCIES = $(am__DEPENDENCIES_2) am_test_u32_strconv_from_enc_OBJECTS = \ uniconv/test-u32-strconv-from-enc.$(OBJEXT) test_u32_strconv_from_enc_OBJECTS = \ @@ -1879,11 +2246,66 @@ am_test_u32_strconv_to_enc_OBJECTS = \ test_u32_strconv_to_enc_OBJECTS = \ $(am_test_u32_strconv_to_enc_OBJECTS) test_u32_strconv_to_enc_DEPENDENCIES = $(am__DEPENDENCIES_2) +am_test_u32_strcpy_OBJECTS = unistr/test-u32-strcpy.$(OBJEXT) +test_u32_strcpy_OBJECTS = $(am_test_u32_strcpy_OBJECTS) +test_u32_strcpy_LDADD = $(LDADD) +test_u32_strcpy_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_strdup_OBJECTS = unistr/test-u32-strdup.$(OBJEXT) +test_u32_strdup_OBJECTS = $(am_test_u32_strdup_OBJECTS) +test_u32_strdup_LDADD = $(LDADD) +test_u32_strdup_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_strlen_OBJECTS = unistr/test-u32-strlen.$(OBJEXT) +test_u32_strlen_OBJECTS = $(am_test_u32_strlen_OBJECTS) +test_u32_strlen_LDADD = $(LDADD) +test_u32_strlen_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_strmblen_OBJECTS = unistr/test-u32-strmblen.$(OBJEXT) +test_u32_strmblen_OBJECTS = $(am_test_u32_strmblen_OBJECTS) +test_u32_strmblen_LDADD = $(LDADD) +test_u32_strmblen_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_strmbtouc_OBJECTS = unistr/test-u32-strmbtouc.$(OBJEXT) +test_u32_strmbtouc_OBJECTS = $(am_test_u32_strmbtouc_OBJECTS) +test_u32_strmbtouc_LDADD = $(LDADD) +test_u32_strmbtouc_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_strncat_OBJECTS = unistr/test-u32-strncat.$(OBJEXT) +test_u32_strncat_OBJECTS = $(am_test_u32_strncat_OBJECTS) +test_u32_strncat_LDADD = $(LDADD) +test_u32_strncat_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_strncmp_OBJECTS = unistr/test-u32-strncmp.$(OBJEXT) +test_u32_strncmp_OBJECTS = $(am_test_u32_strncmp_OBJECTS) +test_u32_strncmp_LDADD = $(LDADD) +test_u32_strncmp_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_strncpy_OBJECTS = unistr/test-u32-strncpy.$(OBJEXT) +test_u32_strncpy_OBJECTS = $(am_test_u32_strncpy_OBJECTS) +test_u32_strncpy_LDADD = $(LDADD) +test_u32_strncpy_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_strnlen_OBJECTS = unistr/test-u32-strnlen.$(OBJEXT) +test_u32_strnlen_OBJECTS = $(am_test_u32_strnlen_OBJECTS) +test_u32_strnlen_LDADD = $(LDADD) +test_u32_strnlen_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u32_strwidth_OBJECTS = uniwidth/test-u32-strwidth.$(OBJEXT) test_u32_strwidth_OBJECTS = $(am_test_u32_strwidth_OBJECTS) test_u32_strwidth_LDADD = $(LDADD) test_u32_strwidth_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) +am_test_u32_to_u16_OBJECTS = unistr/test-u32-to-u16.$(OBJEXT) +test_u32_to_u16_OBJECTS = $(am_test_u32_to_u16_OBJECTS) +test_u32_to_u16_LDADD = $(LDADD) +test_u32_to_u16_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u32_to_u8_OBJECTS = unistr/test-u32-to-u8.$(OBJEXT) +test_u32_to_u8_OBJECTS = $(am_test_u32_to_u8_OBJECTS) +test_u32_to_u8_LDADD = $(LDADD) +test_u32_to_u8_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u32_tolower_OBJECTS = unicase/test-u32-tolower.$(OBJEXT) test_u32_tolower_OBJECTS = $(am_test_u32_tolower_OBJECTS) test_u32_tolower_LDADD = $(LDADD) @@ -1899,6 +2321,11 @@ test_u32_toupper_OBJECTS = $(am_test_u32_toupper_OBJECTS) test_u32_toupper_LDADD = $(LDADD) test_u32_toupper_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) +am_test_u32_uctomb_OBJECTS = unistr/test-u32-uctomb.$(OBJEXT) +test_u32_uctomb_OBJECTS = $(am_test_u32_uctomb_OBJECTS) +test_u32_uctomb_LDADD = $(LDADD) +test_u32_uctomb_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u32_vasnprintf1_OBJECTS = \ unistdio/test-u32-vasnprintf1.$(OBJEXT) test_u32_vasnprintf1_OBJECTS = $(am_test_u32_vasnprintf1_OBJECTS) @@ -1956,6 +2383,26 @@ test_u8_casefold_OBJECTS = $(am_test_u8_casefold_OBJECTS) test_u8_casefold_LDADD = $(LDADD) test_u8_casefold_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) +am_test_u8_check_OBJECTS = unistr/test-u8-check.$(OBJEXT) +test_u8_check_OBJECTS = $(am_test_u8_check_OBJECTS) +test_u8_check_LDADD = $(LDADD) +test_u8_check_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_chr_OBJECTS = unistr/test-u8-chr.$(OBJEXT) +test_u8_chr_OBJECTS = $(am_test_u8_chr_OBJECTS) +test_u8_chr_LDADD = $(LDADD) +test_u8_chr_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_cmp_OBJECTS = unistr/test-u8-cmp.$(OBJEXT) +test_u8_cmp_OBJECTS = $(am_test_u8_cmp_OBJECTS) +test_u8_cmp_LDADD = $(LDADD) +test_u8_cmp_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_cmp2_OBJECTS = unistr/test-u8-cmp2.$(OBJEXT) +test_u8_cmp2_OBJECTS = $(am_test_u8_cmp2_OBJECTS) +test_u8_cmp2_LDADD = $(LDADD) +test_u8_cmp2_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u8_conv_from_enc_OBJECTS = \ uniconv/test-u8-conv-from-enc.$(OBJEXT) test_u8_conv_from_enc_OBJECTS = $(am_test_u8_conv_from_enc_OBJECTS) @@ -1964,6 +2411,16 @@ am_test_u8_conv_to_enc_OBJECTS = \ uniconv/test-u8-conv-to-enc.$(OBJEXT) test_u8_conv_to_enc_OBJECTS = $(am_test_u8_conv_to_enc_OBJECTS) test_u8_conv_to_enc_DEPENDENCIES = $(am__DEPENDENCIES_2) +am_test_u8_cpy_OBJECTS = unistr/test-u8-cpy.$(OBJEXT) +test_u8_cpy_OBJECTS = $(am_test_u8_cpy_OBJECTS) +test_u8_cpy_LDADD = $(LDADD) +test_u8_cpy_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_cpy_alloc_OBJECTS = unistr/test-u8-cpy-alloc.$(OBJEXT) +test_u8_cpy_alloc_OBJECTS = $(am_test_u8_cpy_alloc_OBJECTS) +test_u8_cpy_alloc_LDADD = $(LDADD) +test_u8_cpy_alloc_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u8_is_cased_OBJECTS = unicase/test-u8-is-cased.$(OBJEXT) test_u8_is_cased_OBJECTS = $(am_test_u8_is_cased_OBJECTS) test_u8_is_cased_LDADD = $(LDADD) @@ -1993,6 +2450,42 @@ test_u8_is_uppercase_OBJECTS = $(am_test_u8_is_uppercase_OBJECTS) test_u8_is_uppercase_LDADD = $(LDADD) test_u8_is_uppercase_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) +am_test_u8_mblen_OBJECTS = unistr/test-u8-mblen.$(OBJEXT) +test_u8_mblen_OBJECTS = $(am_test_u8_mblen_OBJECTS) +test_u8_mblen_LDADD = $(LDADD) +test_u8_mblen_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_mbsnlen_OBJECTS = unistr/test-u8-mbsnlen.$(OBJEXT) +test_u8_mbsnlen_OBJECTS = $(am_test_u8_mbsnlen_OBJECTS) +test_u8_mbsnlen_LDADD = $(LDADD) +test_u8_mbsnlen_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_mbtouc_OBJECTS = unistr/test-u8-mbtouc.$(OBJEXT) +test_u8_mbtouc_OBJECTS = $(am_test_u8_mbtouc_OBJECTS) +test_u8_mbtouc_LDADD = $(LDADD) +test_u8_mbtouc_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_mbtouc_unsafe_OBJECTS = \ + unistr/test-u8-mbtouc-unsafe.$(OBJEXT) +test_u8_mbtouc_unsafe_OBJECTS = $(am_test_u8_mbtouc_unsafe_OBJECTS) +test_u8_mbtouc_unsafe_LDADD = $(LDADD) +test_u8_mbtouc_unsafe_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_mbtoucr_OBJECTS = unistr/test-u8-mbtoucr.$(OBJEXT) +test_u8_mbtoucr_OBJECTS = $(am_test_u8_mbtoucr_OBJECTS) +test_u8_mbtoucr_LDADD = $(LDADD) +test_u8_mbtoucr_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_move_OBJECTS = unistr/test-u8-move.$(OBJEXT) +test_u8_move_OBJECTS = $(am_test_u8_move_OBJECTS) +test_u8_move_LDADD = $(LDADD) +test_u8_move_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_next_OBJECTS = unistr/test-u8-next.$(OBJEXT) +test_u8_next_OBJECTS = $(am_test_u8_next_OBJECTS) +test_u8_next_LDADD = $(LDADD) +test_u8_next_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u8_normcmp_OBJECTS = uninorm/test-u8-normcmp.$(OBJEXT) test_u8_normcmp_OBJECTS = $(am_test_u8_normcmp_OBJECTS) test_u8_normcmp_LDADD = $(LDADD) @@ -2008,6 +2501,39 @@ test_u8_possible_linebreaks_OBJECTS = \ test_u8_possible_linebreaks_LDADD = $(LDADD) test_u8_possible_linebreaks_DEPENDENCIES = libtests.a \ ../lib/libunistring.la libtests.a $(am__DEPENDENCIES_1) +am_test_u8_prev_OBJECTS = unistr/test-u8-prev.$(OBJEXT) +test_u8_prev_OBJECTS = $(am_test_u8_prev_OBJECTS) +test_u8_prev_LDADD = $(LDADD) +test_u8_prev_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_set_OBJECTS = unistr/test-u8-set.$(OBJEXT) +test_u8_set_OBJECTS = $(am_test_u8_set_OBJECTS) +test_u8_set_LDADD = $(LDADD) +test_u8_set_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_stpcpy_OBJECTS = unistr/test-u8-stpcpy.$(OBJEXT) +test_u8_stpcpy_OBJECTS = $(am_test_u8_stpcpy_OBJECTS) +test_u8_stpcpy_LDADD = $(LDADD) +test_u8_stpcpy_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_stpncpy_OBJECTS = unistr/test-u8-stpncpy.$(OBJEXT) +test_u8_stpncpy_OBJECTS = $(am_test_u8_stpncpy_OBJECTS) +test_u8_stpncpy_LDADD = $(LDADD) +test_u8_stpncpy_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_strcat_OBJECTS = unistr/test-u8-strcat.$(OBJEXT) +test_u8_strcat_OBJECTS = $(am_test_u8_strcat_OBJECTS) +test_u8_strcat_LDADD = $(LDADD) +test_u8_strcat_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_strcmp_OBJECTS = unistr/test-u8-strcmp.$(OBJEXT) +test_u8_strcmp_OBJECTS = $(am_test_u8_strcmp_OBJECTS) +test_u8_strcmp_LDADD = $(LDADD) +test_u8_strcmp_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_strcoll_OBJECTS = unistr/test-u8-strcoll.$(OBJEXT) +test_u8_strcoll_OBJECTS = $(am_test_u8_strcoll_OBJECTS) +test_u8_strcoll_DEPENDENCIES = $(am__DEPENDENCIES_2) am_test_u8_strconv_from_enc_OBJECTS = \ uniconv/test-u8-strconv-from-enc.$(OBJEXT) test_u8_strconv_from_enc_OBJECTS = \ @@ -2017,11 +2543,66 @@ am_test_u8_strconv_to_enc_OBJECTS = \ uniconv/test-u8-strconv-to-enc.$(OBJEXT) test_u8_strconv_to_enc_OBJECTS = $(am_test_u8_strconv_to_enc_OBJECTS) test_u8_strconv_to_enc_DEPENDENCIES = $(am__DEPENDENCIES_2) +am_test_u8_strcpy_OBJECTS = unistr/test-u8-strcpy.$(OBJEXT) +test_u8_strcpy_OBJECTS = $(am_test_u8_strcpy_OBJECTS) +test_u8_strcpy_LDADD = $(LDADD) +test_u8_strcpy_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_strdup_OBJECTS = unistr/test-u8-strdup.$(OBJEXT) +test_u8_strdup_OBJECTS = $(am_test_u8_strdup_OBJECTS) +test_u8_strdup_LDADD = $(LDADD) +test_u8_strdup_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_strlen_OBJECTS = unistr/test-u8-strlen.$(OBJEXT) +test_u8_strlen_OBJECTS = $(am_test_u8_strlen_OBJECTS) +test_u8_strlen_LDADD = $(LDADD) +test_u8_strlen_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_strmblen_OBJECTS = unistr/test-u8-strmblen.$(OBJEXT) +test_u8_strmblen_OBJECTS = $(am_test_u8_strmblen_OBJECTS) +test_u8_strmblen_LDADD = $(LDADD) +test_u8_strmblen_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_strmbtouc_OBJECTS = unistr/test-u8-strmbtouc.$(OBJEXT) +test_u8_strmbtouc_OBJECTS = $(am_test_u8_strmbtouc_OBJECTS) +test_u8_strmbtouc_LDADD = $(LDADD) +test_u8_strmbtouc_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_strncat_OBJECTS = unistr/test-u8-strncat.$(OBJEXT) +test_u8_strncat_OBJECTS = $(am_test_u8_strncat_OBJECTS) +test_u8_strncat_LDADD = $(LDADD) +test_u8_strncat_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_strncmp_OBJECTS = unistr/test-u8-strncmp.$(OBJEXT) +test_u8_strncmp_OBJECTS = $(am_test_u8_strncmp_OBJECTS) +test_u8_strncmp_LDADD = $(LDADD) +test_u8_strncmp_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_strncpy_OBJECTS = unistr/test-u8-strncpy.$(OBJEXT) +test_u8_strncpy_OBJECTS = $(am_test_u8_strncpy_OBJECTS) +test_u8_strncpy_LDADD = $(LDADD) +test_u8_strncpy_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_strnlen_OBJECTS = unistr/test-u8-strnlen.$(OBJEXT) +test_u8_strnlen_OBJECTS = $(am_test_u8_strnlen_OBJECTS) +test_u8_strnlen_LDADD = $(LDADD) +test_u8_strnlen_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u8_strwidth_OBJECTS = uniwidth/test-u8-strwidth.$(OBJEXT) test_u8_strwidth_OBJECTS = $(am_test_u8_strwidth_OBJECTS) test_u8_strwidth_LDADD = $(LDADD) test_u8_strwidth_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) +am_test_u8_to_u16_OBJECTS = unistr/test-u8-to-u16.$(OBJEXT) +test_u8_to_u16_OBJECTS = $(am_test_u8_to_u16_OBJECTS) +test_u8_to_u16_LDADD = $(LDADD) +test_u8_to_u16_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) +am_test_u8_to_u32_OBJECTS = unistr/test-u8-to-u32.$(OBJEXT) +test_u8_to_u32_OBJECTS = $(am_test_u8_to_u32_OBJECTS) +test_u8_to_u32_LDADD = $(LDADD) +test_u8_to_u32_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u8_tolower_OBJECTS = unicase/test-u8-tolower.$(OBJEXT) test_u8_tolower_OBJECTS = $(am_test_u8_tolower_OBJECTS) test_u8_tolower_LDADD = $(LDADD) @@ -2037,6 +2618,11 @@ test_u8_toupper_OBJECTS = $(am_test_u8_toupper_OBJECTS) test_u8_toupper_LDADD = $(LDADD) test_u8_toupper_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) +am_test_u8_uctomb_OBJECTS = unistr/test-u8-uctomb.$(OBJEXT) +test_u8_uctomb_OBJECTS = $(am_test_u8_uctomb_OBJECTS) +test_u8_uctomb_LDADD = $(LDADD) +test_u8_uctomb_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) am_test_u8_vasnprintf1_OBJECTS = \ unistdio/test-u8-vasnprintf1.$(OBJEXT) test_u8_vasnprintf1_OBJECTS = $(am_test_u8_vasnprintf1_OBJECTS) @@ -2162,6 +2748,11 @@ test_unistd_OBJECTS = test-unistd.$(OBJEXT) test_unistd_LDADD = $(LDADD) test_unistd_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) +test_unsetenv_SOURCES = test-unsetenv.c +test_unsetenv_OBJECTS = test-unsetenv.$(OBJEXT) +test_unsetenv_LDADD = $(LDADD) +test_unsetenv_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a $(am__DEPENDENCIES_1) test_wchar_SOURCES = test-wchar.c test_wchar_OBJECTS = test-wchar.$(OBJEXT) test_wchar_LDADD = $(LDADD) @@ -2177,6 +2768,9 @@ test_wcwidth_OBJECTS = test-wcwidth.$(OBJEXT) test_wcwidth_LDADD = $(LDADD) test_wcwidth_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a $(am__DEPENDENCIES_1) +test_xalloc_die_SOURCES = test-xalloc-die.c +test_xalloc_die_OBJECTS = test-xalloc-die.$(OBJEXT) +test_xalloc_die_DEPENDENCIES = $(am__DEPENDENCIES_2) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f @@ -2238,16 +2832,15 @@ SOURCES = $(libtests_a_SOURCES) $(EXTRA_libtests_a_SOURCES) \ $(test_ctype_space_SOURCES) $(test_ctype_upper_SOURCES) \ $(test_ctype_xdigit_SOURCES) $(test_decdigit_SOURCES) \ $(test_decomposing_form_SOURCES) $(test_decomposition_SOURCES) \ - $(test_digit_SOURCES) test-dup2.c test-environ.c test-errno.c \ - test-fcntl.c $(test_frexpl_nolibm_SOURCES) test-fseterr.c \ - test-iconv.c $(test_ignorable_SOURCES) test-isnand-nolibm.c \ + $(test_digit_SOURCES) test-environ.c test-errno.c \ + $(test_frexpl_nolibm_SOURCES) test-fseterr.c test-iconv.c \ + test-iconv-h.c $(test_ignorable_SOURCES) test-isnand-nolibm.c \ test-isnanf-nolibm.c test-isnanl-nolibm.c test-locale.c \ - $(test_locale_language_SOURCES) test-localename.c \ + $(test_locale_language_SOURCES) test-localename.c test-lock.c \ test-malloca.c test-math.c test-mbrtowc.c test-mbsinit.c \ test-memchr.c $(test_mirror_SOURCES) $(test_nfc_SOURCES) \ $(test_nfd_SOURCES) $(test_nfkc_SOURCES) $(test_nfkd_SOURCES) \ - $(test_numeric_SOURCES) test-open.c \ - $(test_pr_alphabetic_SOURCES) \ + $(test_numeric_SOURCES) $(test_pr_alphabetic_SOURCES) \ $(test_pr_ascii_hex_digit_SOURCES) \ $(test_pr_bidi_arabic_digit_SOURCES) \ $(test_pr_bidi_arabic_right_to_left_SOURCES) \ @@ -2312,66 +2905,111 @@ SOURCES = $(libtests_a_SOURCES) $(EXTRA_libtests_a_SOURCES) \ $(test_pr_white_space_SOURCES) $(test_pr_xid_continue_SOURCES) \ $(test_pr_xid_start_SOURCES) $(test_pr_zero_width_SOURCES) \ test-printf-frexp.c test-printf-frexpl.c \ - $(test_scripts_SOURCES) test-signbit.c test-stdbool.c \ - test-stddef.c test-stdint.c test-stdlib.c test-strerror.c \ - test-striconveh.c test-striconveha.c test-string.c \ - $(test_sy_c_ident_SOURCES) $(test_sy_c_whitespace_SOURCES) \ - $(test_sy_java_ident_SOURCES) \ + $(test_scripts_SOURCES) test-setenv.c test-signbit.c \ + test-stdbool.c test-stddef.c test-stdint.c test-stdlib.c \ + test-strerror.c test-striconveh.c test-striconveha.c \ + test-string.c test-strncat.c $(test_sy_c_ident_SOURCES) \ + $(test_sy_c_whitespace_SOURCES) $(test_sy_java_ident_SOURCES) \ $(test_sy_java_whitespace_SOURCES) \ $(test_u16_asnprintf1_SOURCES) $(test_u16_casecmp_SOURCES) \ $(test_u16_casecoll_SOURCES) $(test_u16_casefold_SOURCES) \ + $(test_u16_check_SOURCES) $(test_u16_chr_SOURCES) \ + $(test_u16_cmp_SOURCES) $(test_u16_cmp2_SOURCES) \ $(test_u16_conv_from_enc_SOURCES) \ - $(test_u16_conv_to_enc_SOURCES) $(test_u16_is_cased_SOURCES) \ + $(test_u16_conv_to_enc_SOURCES) $(test_u16_cpy_SOURCES) \ + $(test_u16_cpy_alloc_SOURCES) $(test_u16_is_cased_SOURCES) \ $(test_u16_is_casefolded_SOURCES) \ $(test_u16_is_lowercase_SOURCES) \ $(test_u16_is_titlecase_SOURCES) \ - $(test_u16_is_uppercase_SOURCES) $(test_u16_normcmp_SOURCES) \ - $(test_u16_normcoll_SOURCES) \ + $(test_u16_is_uppercase_SOURCES) $(test_u16_mblen_SOURCES) \ + $(test_u16_mbsnlen_SOURCES) $(test_u16_mbtouc_SOURCES) \ + $(test_u16_mbtouc_unsafe_SOURCES) $(test_u16_mbtoucr_SOURCES) \ + $(test_u16_move_SOURCES) $(test_u16_next_SOURCES) \ + $(test_u16_normcmp_SOURCES) $(test_u16_normcoll_SOURCES) \ $(test_u16_possible_linebreaks_SOURCES) \ + $(test_u16_prev_SOURCES) $(test_u16_set_SOURCES) \ + $(test_u16_stpcpy_SOURCES) $(test_u16_stpncpy_SOURCES) \ + $(test_u16_strcat_SOURCES) $(test_u16_strcmp_SOURCES) \ + $(test_u16_strcoll_SOURCES) \ $(test_u16_strconv_from_enc_SOURCES) \ - $(test_u16_strconv_to_enc_SOURCES) \ - $(test_u16_strwidth_SOURCES) $(test_u16_tolower_SOURCES) \ + $(test_u16_strconv_to_enc_SOURCES) $(test_u16_strcpy_SOURCES) \ + $(test_u16_strdup_SOURCES) $(test_u16_strlen_SOURCES) \ + $(test_u16_strmblen_SOURCES) $(test_u16_strmbtouc_SOURCES) \ + $(test_u16_strncat_SOURCES) $(test_u16_strncmp_SOURCES) \ + $(test_u16_strncpy_SOURCES) $(test_u16_strnlen_SOURCES) \ + $(test_u16_strwidth_SOURCES) $(test_u16_to_u32_SOURCES) \ + $(test_u16_to_u8_SOURCES) $(test_u16_tolower_SOURCES) \ $(test_u16_totitle_SOURCES) $(test_u16_toupper_SOURCES) \ - $(test_u16_vasnprintf1_SOURCES) \ + $(test_u16_uctomb_SOURCES) $(test_u16_vasnprintf1_SOURCES) \ $(test_u16_vasnprintf2_SOURCES) \ $(test_u16_vasnprintf3_SOURCES) $(test_u16_vasprintf1_SOURCES) \ $(test_u16_vsnprintf1_SOURCES) $(test_u16_vsprintf1_SOURCES) \ $(test_u16_width_SOURCES) $(test_u16_width_linebreaks_SOURCES) \ $(test_u16_wordbreaks_SOURCES) $(test_u32_asnprintf1_SOURCES) \ $(test_u32_casecmp_SOURCES) $(test_u32_casecoll_SOURCES) \ - $(test_u32_casefold_SOURCES) $(test_u32_conv_from_enc_SOURCES) \ - $(test_u32_conv_to_enc_SOURCES) $(test_u32_is_cased_SOURCES) \ + $(test_u32_casefold_SOURCES) $(test_u32_check_SOURCES) \ + $(test_u32_chr_SOURCES) $(test_u32_cmp_SOURCES) \ + $(test_u32_cmp2_SOURCES) $(test_u32_conv_from_enc_SOURCES) \ + $(test_u32_conv_to_enc_SOURCES) $(test_u32_cpy_SOURCES) \ + $(test_u32_cpy_alloc_SOURCES) $(test_u32_is_cased_SOURCES) \ $(test_u32_is_casefolded_SOURCES) \ $(test_u32_is_lowercase_SOURCES) \ $(test_u32_is_titlecase_SOURCES) \ - $(test_u32_is_uppercase_SOURCES) $(test_u32_nfc_big_SOURCES) \ - $(test_u32_nfd_big_SOURCES) $(test_u32_nfkc_big_SOURCES) \ - $(test_u32_nfkd_big_SOURCES) $(test_u32_normcmp_SOURCES) \ - $(test_u32_normcoll_SOURCES) \ + $(test_u32_is_uppercase_SOURCES) $(test_u32_mblen_SOURCES) \ + $(test_u32_mbsnlen_SOURCES) $(test_u32_mbtouc_SOURCES) \ + $(test_u32_mbtouc_unsafe_SOURCES) $(test_u32_mbtoucr_SOURCES) \ + $(test_u32_move_SOURCES) $(test_u32_next_SOURCES) \ + $(test_u32_nfc_big_SOURCES) $(test_u32_nfd_big_SOURCES) \ + $(test_u32_nfkc_big_SOURCES) $(test_u32_nfkd_big_SOURCES) \ + $(test_u32_normcmp_SOURCES) $(test_u32_normcoll_SOURCES) \ $(test_u32_possible_linebreaks_SOURCES) \ + $(test_u32_prev_SOURCES) $(test_u32_set_SOURCES) \ + $(test_u32_stpcpy_SOURCES) $(test_u32_stpncpy_SOURCES) \ + $(test_u32_strcat_SOURCES) $(test_u32_strcmp_SOURCES) \ + $(test_u32_strcoll_SOURCES) \ $(test_u32_strconv_from_enc_SOURCES) \ - $(test_u32_strconv_to_enc_SOURCES) \ - $(test_u32_strwidth_SOURCES) $(test_u32_tolower_SOURCES) \ + $(test_u32_strconv_to_enc_SOURCES) $(test_u32_strcpy_SOURCES) \ + $(test_u32_strdup_SOURCES) $(test_u32_strlen_SOURCES) \ + $(test_u32_strmblen_SOURCES) $(test_u32_strmbtouc_SOURCES) \ + $(test_u32_strncat_SOURCES) $(test_u32_strncmp_SOURCES) \ + $(test_u32_strncpy_SOURCES) $(test_u32_strnlen_SOURCES) \ + $(test_u32_strwidth_SOURCES) $(test_u32_to_u16_SOURCES) \ + $(test_u32_to_u8_SOURCES) $(test_u32_tolower_SOURCES) \ $(test_u32_totitle_SOURCES) $(test_u32_toupper_SOURCES) \ - $(test_u32_vasnprintf1_SOURCES) \ + $(test_u32_uctomb_SOURCES) $(test_u32_vasnprintf1_SOURCES) \ $(test_u32_vasnprintf2_SOURCES) \ $(test_u32_vasnprintf3_SOURCES) $(test_u32_vasprintf1_SOURCES) \ $(test_u32_vsnprintf1_SOURCES) $(test_u32_vsprintf1_SOURCES) \ $(test_u32_width_SOURCES) $(test_u32_width_linebreaks_SOURCES) \ $(test_u32_wordbreaks_SOURCES) $(test_u8_asnprintf1_SOURCES) \ $(test_u8_casecmp_SOURCES) $(test_u8_casecoll_SOURCES) \ - $(test_u8_casefold_SOURCES) $(test_u8_conv_from_enc_SOURCES) \ - $(test_u8_conv_to_enc_SOURCES) $(test_u8_is_cased_SOURCES) \ + $(test_u8_casefold_SOURCES) $(test_u8_check_SOURCES) \ + $(test_u8_chr_SOURCES) $(test_u8_cmp_SOURCES) \ + $(test_u8_cmp2_SOURCES) $(test_u8_conv_from_enc_SOURCES) \ + $(test_u8_conv_to_enc_SOURCES) $(test_u8_cpy_SOURCES) \ + $(test_u8_cpy_alloc_SOURCES) $(test_u8_is_cased_SOURCES) \ $(test_u8_is_casefolded_SOURCES) \ $(test_u8_is_lowercase_SOURCES) \ $(test_u8_is_titlecase_SOURCES) \ - $(test_u8_is_uppercase_SOURCES) $(test_u8_normcmp_SOURCES) \ - $(test_u8_normcoll_SOURCES) \ - $(test_u8_possible_linebreaks_SOURCES) \ + $(test_u8_is_uppercase_SOURCES) $(test_u8_mblen_SOURCES) \ + $(test_u8_mbsnlen_SOURCES) $(test_u8_mbtouc_SOURCES) \ + $(test_u8_mbtouc_unsafe_SOURCES) $(test_u8_mbtoucr_SOURCES) \ + $(test_u8_move_SOURCES) $(test_u8_next_SOURCES) \ + $(test_u8_normcmp_SOURCES) $(test_u8_normcoll_SOURCES) \ + $(test_u8_possible_linebreaks_SOURCES) $(test_u8_prev_SOURCES) \ + $(test_u8_set_SOURCES) $(test_u8_stpcpy_SOURCES) \ + $(test_u8_stpncpy_SOURCES) $(test_u8_strcat_SOURCES) \ + $(test_u8_strcmp_SOURCES) $(test_u8_strcoll_SOURCES) \ $(test_u8_strconv_from_enc_SOURCES) \ - $(test_u8_strconv_to_enc_SOURCES) $(test_u8_strwidth_SOURCES) \ - $(test_u8_tolower_SOURCES) $(test_u8_totitle_SOURCES) \ - $(test_u8_toupper_SOURCES) $(test_u8_vasnprintf1_SOURCES) \ + $(test_u8_strconv_to_enc_SOURCES) $(test_u8_strcpy_SOURCES) \ + $(test_u8_strdup_SOURCES) $(test_u8_strlen_SOURCES) \ + $(test_u8_strmblen_SOURCES) $(test_u8_strmbtouc_SOURCES) \ + $(test_u8_strncat_SOURCES) $(test_u8_strncmp_SOURCES) \ + $(test_u8_strncpy_SOURCES) $(test_u8_strnlen_SOURCES) \ + $(test_u8_strwidth_SOURCES) $(test_u8_to_u16_SOURCES) \ + $(test_u8_to_u32_SOURCES) $(test_u8_tolower_SOURCES) \ + $(test_u8_totitle_SOURCES) $(test_u8_toupper_SOURCES) \ + $(test_u8_uctomb_SOURCES) $(test_u8_vasnprintf1_SOURCES) \ $(test_u8_vasnprintf2_SOURCES) $(test_u8_vasnprintf3_SOURCES) \ $(test_u8_vasprintf1_SOURCES) $(test_u8_vsnprintf1_SOURCES) \ $(test_u8_vsprintf1_SOURCES) $(test_u8_width_SOURCES) \ @@ -2388,8 +3026,9 @@ SOURCES = $(libtests_a_SOURCES) $(EXTRA_libtests_a_SOURCES) \ $(test_ulc_vsnprintf1_SOURCES) $(test_ulc_vsprintf1_SOURCES) \ $(test_ulc_width_linebreaks_SOURCES) \ $(test_ulc_wordbreaks_SOURCES) $(test_uninames_SOURCES) \ - $(test_uninorm_filter_nfc_SOURCES) test-unistd.c test-wchar.c \ - test-wctype.c test-wcwidth.c + $(test_uninorm_filter_nfc_SOURCES) test-unistd.c \ + test-unsetenv.c test-wchar.c test-wctype.c test-wcwidth.c \ + test-xalloc-die.c DIST_SOURCES = $(libtests_a_SOURCES) $(EXTRA_libtests_a_SOURCES) \ test-alloca-opt.c test-array-mergesort.c \ $(test_bidi_byname_SOURCES) $(test_bidi_name_SOURCES) \ @@ -2429,16 +3068,15 @@ DIST_SOURCES = $(libtests_a_SOURCES) $(EXTRA_libtests_a_SOURCES) \ $(test_ctype_space_SOURCES) $(test_ctype_upper_SOURCES) \ $(test_ctype_xdigit_SOURCES) $(test_decdigit_SOURCES) \ $(test_decomposing_form_SOURCES) $(test_decomposition_SOURCES) \ - $(test_digit_SOURCES) test-dup2.c test-environ.c test-errno.c \ - test-fcntl.c $(test_frexpl_nolibm_SOURCES) test-fseterr.c \ - test-iconv.c $(test_ignorable_SOURCES) test-isnand-nolibm.c \ + $(test_digit_SOURCES) test-environ.c test-errno.c \ + $(test_frexpl_nolibm_SOURCES) test-fseterr.c test-iconv.c \ + test-iconv-h.c $(test_ignorable_SOURCES) test-isnand-nolibm.c \ test-isnanf-nolibm.c test-isnanl-nolibm.c test-locale.c \ - $(test_locale_language_SOURCES) test-localename.c \ + $(test_locale_language_SOURCES) test-localename.c test-lock.c \ test-malloca.c test-math.c test-mbrtowc.c test-mbsinit.c \ test-memchr.c $(test_mirror_SOURCES) $(test_nfc_SOURCES) \ $(test_nfd_SOURCES) $(test_nfkc_SOURCES) $(test_nfkd_SOURCES) \ - $(test_numeric_SOURCES) test-open.c \ - $(test_pr_alphabetic_SOURCES) \ + $(test_numeric_SOURCES) $(test_pr_alphabetic_SOURCES) \ $(test_pr_ascii_hex_digit_SOURCES) \ $(test_pr_bidi_arabic_digit_SOURCES) \ $(test_pr_bidi_arabic_right_to_left_SOURCES) \ @@ -2503,66 +3141,111 @@ DIST_SOURCES = $(libtests_a_SOURCES) $(EXTRA_libtests_a_SOURCES) \ $(test_pr_white_space_SOURCES) $(test_pr_xid_continue_SOURCES) \ $(test_pr_xid_start_SOURCES) $(test_pr_zero_width_SOURCES) \ test-printf-frexp.c test-printf-frexpl.c \ - $(test_scripts_SOURCES) test-signbit.c test-stdbool.c \ - test-stddef.c test-stdint.c test-stdlib.c test-strerror.c \ - test-striconveh.c test-striconveha.c test-string.c \ - $(test_sy_c_ident_SOURCES) $(test_sy_c_whitespace_SOURCES) \ - $(test_sy_java_ident_SOURCES) \ + $(test_scripts_SOURCES) test-setenv.c test-signbit.c \ + test-stdbool.c test-stddef.c test-stdint.c test-stdlib.c \ + test-strerror.c test-striconveh.c test-striconveha.c \ + test-string.c test-strncat.c $(test_sy_c_ident_SOURCES) \ + $(test_sy_c_whitespace_SOURCES) $(test_sy_java_ident_SOURCES) \ $(test_sy_java_whitespace_SOURCES) \ $(test_u16_asnprintf1_SOURCES) $(test_u16_casecmp_SOURCES) \ $(test_u16_casecoll_SOURCES) $(test_u16_casefold_SOURCES) \ + $(test_u16_check_SOURCES) $(test_u16_chr_SOURCES) \ + $(test_u16_cmp_SOURCES) $(test_u16_cmp2_SOURCES) \ $(test_u16_conv_from_enc_SOURCES) \ - $(test_u16_conv_to_enc_SOURCES) $(test_u16_is_cased_SOURCES) \ + $(test_u16_conv_to_enc_SOURCES) $(test_u16_cpy_SOURCES) \ + $(test_u16_cpy_alloc_SOURCES) $(test_u16_is_cased_SOURCES) \ $(test_u16_is_casefolded_SOURCES) \ $(test_u16_is_lowercase_SOURCES) \ $(test_u16_is_titlecase_SOURCES) \ - $(test_u16_is_uppercase_SOURCES) $(test_u16_normcmp_SOURCES) \ - $(test_u16_normcoll_SOURCES) \ + $(test_u16_is_uppercase_SOURCES) $(test_u16_mblen_SOURCES) \ + $(test_u16_mbsnlen_SOURCES) $(test_u16_mbtouc_SOURCES) \ + $(test_u16_mbtouc_unsafe_SOURCES) $(test_u16_mbtoucr_SOURCES) \ + $(test_u16_move_SOURCES) $(test_u16_next_SOURCES) \ + $(test_u16_normcmp_SOURCES) $(test_u16_normcoll_SOURCES) \ $(test_u16_possible_linebreaks_SOURCES) \ + $(test_u16_prev_SOURCES) $(test_u16_set_SOURCES) \ + $(test_u16_stpcpy_SOURCES) $(test_u16_stpncpy_SOURCES) \ + $(test_u16_strcat_SOURCES) $(test_u16_strcmp_SOURCES) \ + $(test_u16_strcoll_SOURCES) \ $(test_u16_strconv_from_enc_SOURCES) \ - $(test_u16_strconv_to_enc_SOURCES) \ - $(test_u16_strwidth_SOURCES) $(test_u16_tolower_SOURCES) \ + $(test_u16_strconv_to_enc_SOURCES) $(test_u16_strcpy_SOURCES) \ + $(test_u16_strdup_SOURCES) $(test_u16_strlen_SOURCES) \ + $(test_u16_strmblen_SOURCES) $(test_u16_strmbtouc_SOURCES) \ + $(test_u16_strncat_SOURCES) $(test_u16_strncmp_SOURCES) \ + $(test_u16_strncpy_SOURCES) $(test_u16_strnlen_SOURCES) \ + $(test_u16_strwidth_SOURCES) $(test_u16_to_u32_SOURCES) \ + $(test_u16_to_u8_SOURCES) $(test_u16_tolower_SOURCES) \ $(test_u16_totitle_SOURCES) $(test_u16_toupper_SOURCES) \ - $(test_u16_vasnprintf1_SOURCES) \ + $(test_u16_uctomb_SOURCES) $(test_u16_vasnprintf1_SOURCES) \ $(test_u16_vasnprintf2_SOURCES) \ $(test_u16_vasnprintf3_SOURCES) $(test_u16_vasprintf1_SOURCES) \ $(test_u16_vsnprintf1_SOURCES) $(test_u16_vsprintf1_SOURCES) \ $(test_u16_width_SOURCES) $(test_u16_width_linebreaks_SOURCES) \ $(test_u16_wordbreaks_SOURCES) $(test_u32_asnprintf1_SOURCES) \ $(test_u32_casecmp_SOURCES) $(test_u32_casecoll_SOURCES) \ - $(test_u32_casefold_SOURCES) $(test_u32_conv_from_enc_SOURCES) \ - $(test_u32_conv_to_enc_SOURCES) $(test_u32_is_cased_SOURCES) \ + $(test_u32_casefold_SOURCES) $(test_u32_check_SOURCES) \ + $(test_u32_chr_SOURCES) $(test_u32_cmp_SOURCES) \ + $(test_u32_cmp2_SOURCES) $(test_u32_conv_from_enc_SOURCES) \ + $(test_u32_conv_to_enc_SOURCES) $(test_u32_cpy_SOURCES) \ + $(test_u32_cpy_alloc_SOURCES) $(test_u32_is_cased_SOURCES) \ $(test_u32_is_casefolded_SOURCES) \ $(test_u32_is_lowercase_SOURCES) \ $(test_u32_is_titlecase_SOURCES) \ - $(test_u32_is_uppercase_SOURCES) $(test_u32_nfc_big_SOURCES) \ - $(test_u32_nfd_big_SOURCES) $(test_u32_nfkc_big_SOURCES) \ - $(test_u32_nfkd_big_SOURCES) $(test_u32_normcmp_SOURCES) \ - $(test_u32_normcoll_SOURCES) \ + $(test_u32_is_uppercase_SOURCES) $(test_u32_mblen_SOURCES) \ + $(test_u32_mbsnlen_SOURCES) $(test_u32_mbtouc_SOURCES) \ + $(test_u32_mbtouc_unsafe_SOURCES) $(test_u32_mbtoucr_SOURCES) \ + $(test_u32_move_SOURCES) $(test_u32_next_SOURCES) \ + $(test_u32_nfc_big_SOURCES) $(test_u32_nfd_big_SOURCES) \ + $(test_u32_nfkc_big_SOURCES) $(test_u32_nfkd_big_SOURCES) \ + $(test_u32_normcmp_SOURCES) $(test_u32_normcoll_SOURCES) \ $(test_u32_possible_linebreaks_SOURCES) \ + $(test_u32_prev_SOURCES) $(test_u32_set_SOURCES) \ + $(test_u32_stpcpy_SOURCES) $(test_u32_stpncpy_SOURCES) \ + $(test_u32_strcat_SOURCES) $(test_u32_strcmp_SOURCES) \ + $(test_u32_strcoll_SOURCES) \ $(test_u32_strconv_from_enc_SOURCES) \ - $(test_u32_strconv_to_enc_SOURCES) \ - $(test_u32_strwidth_SOURCES) $(test_u32_tolower_SOURCES) \ + $(test_u32_strconv_to_enc_SOURCES) $(test_u32_strcpy_SOURCES) \ + $(test_u32_strdup_SOURCES) $(test_u32_strlen_SOURCES) \ + $(test_u32_strmblen_SOURCES) $(test_u32_strmbtouc_SOURCES) \ + $(test_u32_strncat_SOURCES) $(test_u32_strncmp_SOURCES) \ + $(test_u32_strncpy_SOURCES) $(test_u32_strnlen_SOURCES) \ + $(test_u32_strwidth_SOURCES) $(test_u32_to_u16_SOURCES) \ + $(test_u32_to_u8_SOURCES) $(test_u32_tolower_SOURCES) \ $(test_u32_totitle_SOURCES) $(test_u32_toupper_SOURCES) \ - $(test_u32_vasnprintf1_SOURCES) \ + $(test_u32_uctomb_SOURCES) $(test_u32_vasnprintf1_SOURCES) \ $(test_u32_vasnprintf2_SOURCES) \ $(test_u32_vasnprintf3_SOURCES) $(test_u32_vasprintf1_SOURCES) \ $(test_u32_vsnprintf1_SOURCES) $(test_u32_vsprintf1_SOURCES) \ $(test_u32_width_SOURCES) $(test_u32_width_linebreaks_SOURCES) \ $(test_u32_wordbreaks_SOURCES) $(test_u8_asnprintf1_SOURCES) \ $(test_u8_casecmp_SOURCES) $(test_u8_casecoll_SOURCES) \ - $(test_u8_casefold_SOURCES) $(test_u8_conv_from_enc_SOURCES) \ - $(test_u8_conv_to_enc_SOURCES) $(test_u8_is_cased_SOURCES) \ + $(test_u8_casefold_SOURCES) $(test_u8_check_SOURCES) \ + $(test_u8_chr_SOURCES) $(test_u8_cmp_SOURCES) \ + $(test_u8_cmp2_SOURCES) $(test_u8_conv_from_enc_SOURCES) \ + $(test_u8_conv_to_enc_SOURCES) $(test_u8_cpy_SOURCES) \ + $(test_u8_cpy_alloc_SOURCES) $(test_u8_is_cased_SOURCES) \ $(test_u8_is_casefolded_SOURCES) \ $(test_u8_is_lowercase_SOURCES) \ $(test_u8_is_titlecase_SOURCES) \ - $(test_u8_is_uppercase_SOURCES) $(test_u8_normcmp_SOURCES) \ - $(test_u8_normcoll_SOURCES) \ - $(test_u8_possible_linebreaks_SOURCES) \ + $(test_u8_is_uppercase_SOURCES) $(test_u8_mblen_SOURCES) \ + $(test_u8_mbsnlen_SOURCES) $(test_u8_mbtouc_SOURCES) \ + $(test_u8_mbtouc_unsafe_SOURCES) $(test_u8_mbtoucr_SOURCES) \ + $(test_u8_move_SOURCES) $(test_u8_next_SOURCES) \ + $(test_u8_normcmp_SOURCES) $(test_u8_normcoll_SOURCES) \ + $(test_u8_possible_linebreaks_SOURCES) $(test_u8_prev_SOURCES) \ + $(test_u8_set_SOURCES) $(test_u8_stpcpy_SOURCES) \ + $(test_u8_stpncpy_SOURCES) $(test_u8_strcat_SOURCES) \ + $(test_u8_strcmp_SOURCES) $(test_u8_strcoll_SOURCES) \ $(test_u8_strconv_from_enc_SOURCES) \ - $(test_u8_strconv_to_enc_SOURCES) $(test_u8_strwidth_SOURCES) \ - $(test_u8_tolower_SOURCES) $(test_u8_totitle_SOURCES) \ - $(test_u8_toupper_SOURCES) $(test_u8_vasnprintf1_SOURCES) \ + $(test_u8_strconv_to_enc_SOURCES) $(test_u8_strcpy_SOURCES) \ + $(test_u8_strdup_SOURCES) $(test_u8_strlen_SOURCES) \ + $(test_u8_strmblen_SOURCES) $(test_u8_strmbtouc_SOURCES) \ + $(test_u8_strncat_SOURCES) $(test_u8_strncmp_SOURCES) \ + $(test_u8_strncpy_SOURCES) $(test_u8_strnlen_SOURCES) \ + $(test_u8_strwidth_SOURCES) $(test_u8_to_u16_SOURCES) \ + $(test_u8_to_u32_SOURCES) $(test_u8_tolower_SOURCES) \ + $(test_u8_totitle_SOURCES) $(test_u8_toupper_SOURCES) \ + $(test_u8_uctomb_SOURCES) $(test_u8_vasnprintf1_SOURCES) \ $(test_u8_vasnprintf2_SOURCES) $(test_u8_vasnprintf3_SOURCES) \ $(test_u8_vasprintf1_SOURCES) $(test_u8_vsnprintf1_SOURCES) \ $(test_u8_vsprintf1_SOURCES) $(test_u8_width_SOURCES) \ @@ -2579,8 +3262,9 @@ DIST_SOURCES = $(libtests_a_SOURCES) $(EXTRA_libtests_a_SOURCES) \ $(test_ulc_vsnprintf1_SOURCES) $(test_ulc_vsprintf1_SOURCES) \ $(test_ulc_width_linebreaks_SOURCES) \ $(test_ulc_wordbreaks_SOURCES) $(test_uninames_SOURCES) \ - $(test_uninorm_filter_nfc_SOURCES) test-unistd.c test-wchar.c \ - test-wctype.c test-wcwidth.c + $(test_uninorm_filter_nfc_SOURCES) test-unistd.c \ + test-unsetenv.c test-wchar.c test-wctype.c test-wcwidth.c \ + test-xalloc-die.c RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ @@ -2680,22 +3364,31 @@ EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@ EOVERFLOW_VALUE = @EOVERFLOW_VALUE@ ERRNO_H = @ERRNO_H@ EXEEXT = @EXEEXT@ -FCNTL_H = @FCNTL_H@ FGREP = @FGREP@ FLOAT_H = @FLOAT_H@ GLIBC21 = @GLIBC21@ GLOBAL_SYMBOL_PIPE = @GLOBAL_SYMBOL_PIPE@ +GNULIB_ACOSL = @GNULIB_ACOSL@ +GNULIB_ASINL = @GNULIB_ASINL@ +GNULIB_ATANL = @GNULIB_ATANL@ GNULIB_ATOLL = @GNULIB_ATOLL@ GNULIB_BTOWC = @GNULIB_BTOWC@ GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@ +GNULIB_CANONICALIZE_FILE_NAME = @GNULIB_CANONICALIZE_FILE_NAME@ GNULIB_CEILF = @GNULIB_CEILF@ GNULIB_CEILL = @GNULIB_CEILL@ GNULIB_CHOWN = @GNULIB_CHOWN@ GNULIB_CLOSE = @GNULIB_CLOSE@ +GNULIB_COSL = @GNULIB_COSL@ GNULIB_DUP2 = @GNULIB_DUP2@ +GNULIB_DUP3 = @GNULIB_DUP3@ +GNULIB_DUPLOCALE = @GNULIB_DUPLOCALE@ GNULIB_ENVIRON = @GNULIB_ENVIRON@ GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@ +GNULIB_EXPL = @GNULIB_EXPL@ +GNULIB_FACCESSAT = @GNULIB_FACCESSAT@ GNULIB_FCHDIR = @GNULIB_FCHDIR@ +GNULIB_FCHOWNAT = @GNULIB_FCHOWNAT@ GNULIB_FLOORF = @GNULIB_FLOORF@ GNULIB_FLOORL = @GNULIB_FLOORL@ GNULIB_FREXP = @GNULIB_FREXP@ @@ -2705,12 +3398,15 @@ GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ GNULIB_GETCWD = @GNULIB_GETCWD@ GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@ GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@ +GNULIB_GETGROUPS = @GNULIB_GETGROUPS@ GNULIB_GETHOSTNAME = @GNULIB_GETHOSTNAME@ GNULIB_GETLOADAVG = @GNULIB_GETLOADAVG@ +GNULIB_GETLOGIN = @GNULIB_GETLOGIN@ GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ +GNULIB_GRANTPT = @GNULIB_GRANTPT@ GNULIB_ISFINITE = @GNULIB_ISFINITE@ GNULIB_ISINF = @GNULIB_ISINF@ GNULIB_ISNAN = @GNULIB_ISNAN@ @@ -2720,9 +3416,11 @@ GNULIB_ISNANL = @GNULIB_ISNANL@ GNULIB_LCHOWN = @GNULIB_LCHOWN@ GNULIB_LDEXPL = @GNULIB_LDEXPL@ GNULIB_LINK = @GNULIB_LINK@ +GNULIB_LINKAT = @GNULIB_LINKAT@ +GNULIB_LOGB = @GNULIB_LOGB@ +GNULIB_LOGL = @GNULIB_LOGL@ GNULIB_LSEEK = @GNULIB_LSEEK@ GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@ -GNULIB_MATHL = @GNULIB_MATHL@ GNULIB_MBRLEN = @GNULIB_MBRLEN@ GNULIB_MBRTOWC = @GNULIB_MBRTOWC@ GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@ @@ -2747,26 +3445,37 @@ GNULIB_MEMMEM = @GNULIB_MEMMEM@ GNULIB_MEMPCPY = @GNULIB_MEMPCPY@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@ GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ +GNULIB_MKOSTEMP = @GNULIB_MKOSTEMP@ +GNULIB_MKOSTEMPS = @GNULIB_MKOSTEMPS@ GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ -GNULIB_OPEN = @GNULIB_OPEN@ +GNULIB_MKSTEMPS = @GNULIB_MKSTEMPS@ +GNULIB_PIPE2 = @GNULIB_PIPE2@ +GNULIB_PREAD = @GNULIB_PREAD@ +GNULIB_PTSNAME = @GNULIB_PTSNAME@ GNULIB_PUTENV = @GNULIB_PUTENV@ GNULIB_RANDOM_R = @GNULIB_RANDOM_R@ GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ GNULIB_READLINK = @GNULIB_READLINK@ +GNULIB_READLINKAT = @GNULIB_READLINKAT@ GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@ +GNULIB_REALPATH = @GNULIB_REALPATH@ +GNULIB_RMDIR = @GNULIB_RMDIR@ GNULIB_ROUND = @GNULIB_ROUND@ GNULIB_ROUNDF = @GNULIB_ROUNDF@ GNULIB_ROUNDL = @GNULIB_ROUNDL@ GNULIB_RPMATCH = @GNULIB_RPMATCH@ GNULIB_SETENV = @GNULIB_SETENV@ GNULIB_SIGNBIT = @GNULIB_SIGNBIT@ +GNULIB_SINL = @GNULIB_SINL@ GNULIB_SLEEP = @GNULIB_SLEEP@ +GNULIB_SQRTL = @GNULIB_SQRTL@ GNULIB_STPCPY = @GNULIB_STPCPY@ GNULIB_STPNCPY = @GNULIB_STPNCPY@ GNULIB_STRCASESTR = @GNULIB_STRCASESTR@ GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@ GNULIB_STRDUP = @GNULIB_STRDUP@ GNULIB_STRERROR = @GNULIB_STRERROR@ +GNULIB_STRNCAT = @GNULIB_STRNCAT@ GNULIB_STRNDUP = @GNULIB_STRNDUP@ GNULIB_STRNLEN = @GNULIB_STRNLEN@ GNULIB_STRPBRK = @GNULIB_STRPBRK@ @@ -2778,12 +3487,20 @@ GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ GNULIB_STRTOLL = @GNULIB_STRTOLL@ GNULIB_STRTOULL = @GNULIB_STRTOULL@ GNULIB_STRVERSCMP = @GNULIB_STRVERSCMP@ +GNULIB_SYMLINK = @GNULIB_SYMLINK@ +GNULIB_SYMLINKAT = @GNULIB_SYMLINKAT@ +GNULIB_TANL = @GNULIB_TANL@ GNULIB_TRUNC = @GNULIB_TRUNC@ GNULIB_TRUNCF = @GNULIB_TRUNCF@ GNULIB_TRUNCL = @GNULIB_TRUNCL@ +GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@ GNULIB_UNISTD_H_GETOPT = @GNULIB_UNISTD_H_GETOPT@ GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@ +GNULIB_UNLINK = @GNULIB_UNLINK@ +GNULIB_UNLINKAT = @GNULIB_UNLINKAT@ +GNULIB_UNLOCKPT = @GNULIB_UNLOCKPT@ GNULIB_UNSETENV = @GNULIB_UNSETENV@ +GNULIB_USLEEP = @GNULIB_USLEEP@ GNULIB_WCRTOMB = @GNULIB_WCRTOMB@ GNULIB_WCSNRTOMBS = @GNULIB_WCSNRTOMBS@ GNULIB_WCSRTOMBS = @GNULIB_WCSRTOMBS@ @@ -2791,26 +3508,41 @@ GNULIB_WCTOB = @GNULIB_WCTOB@ GNULIB_WCWIDTH = @GNULIB_WCWIDTH@ GNULIB_WRITE = @GNULIB_WRITE@ GREP = @GREP@ +HAVE_ACOSL = @HAVE_ACOSL@ +HAVE_ASINL = @HAVE_ASINL@ +HAVE_ATANL = @HAVE_ATANL@ HAVE_ATOLL = @HAVE_ATOLL@ HAVE_BTOWC = @HAVE_BTOWC@ HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@ +HAVE_CANONICALIZE_FILE_NAME = @HAVE_CANONICALIZE_FILE_NAME@ +HAVE_CHOWN = @HAVE_CHOWN@ +HAVE_COSL = @HAVE_COSL@ HAVE_DECL_ACOSL = @HAVE_DECL_ACOSL@ HAVE_DECL_ASINL = @HAVE_DECL_ASINL@ HAVE_DECL_ATANL = @HAVE_DECL_ATANL@ +HAVE_DECL_CEILF = @HAVE_DECL_CEILF@ +HAVE_DECL_CEILL = @HAVE_DECL_CEILL@ HAVE_DECL_COSL = @HAVE_DECL_COSL@ HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ HAVE_DECL_EXPL = @HAVE_DECL_EXPL@ +HAVE_DECL_FLOORF = @HAVE_DECL_FLOORF@ +HAVE_DECL_FLOORL = @HAVE_DECL_FLOORL@ HAVE_DECL_FREXPL = @HAVE_DECL_FREXPL@ HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ +HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ +HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ HAVE_DECL_LDEXPL = @HAVE_DECL_LDEXPL@ +HAVE_DECL_LOGB = @HAVE_DECL_LOGB@ HAVE_DECL_LOGL = @HAVE_DECL_LOGL@ HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ +HAVE_DECL_ROUND = @HAVE_DECL_ROUND@ +HAVE_DECL_ROUNDF = @HAVE_DECL_ROUNDF@ +HAVE_DECL_ROUNDL = @HAVE_DECL_ROUNDL@ HAVE_DECL_SINL = @HAVE_DECL_SINL@ HAVE_DECL_SQRTL = @HAVE_DECL_SQRTL@ HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ -HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@ HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ @@ -2818,52 +3550,77 @@ HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ HAVE_DECL_TANL = @HAVE_DECL_TANL@ HAVE_DECL_TRUNC = @HAVE_DECL_TRUNC@ HAVE_DECL_TRUNCF = @HAVE_DECL_TRUNCF@ +HAVE_DECL_TRUNCL = @HAVE_DECL_TRUNCL@ HAVE_DECL_WCTOB = @HAVE_DECL_WCTOB@ HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ HAVE_DUP2 = @HAVE_DUP2@ +HAVE_DUP3 = @HAVE_DUP3@ +HAVE_DUPLOCALE = @HAVE_DUPLOCALE@ HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ +HAVE_EXPL = @HAVE_EXPL@ +HAVE_FACCESSAT = @HAVE_FACCESSAT@ +HAVE_FCHDIR = @HAVE_FCHDIR@ +HAVE_FCHOWNAT = @HAVE_FCHOWNAT@ HAVE_FSYNC = @HAVE_FSYNC@ HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ HAVE_GETDOMAINNAME = @HAVE_GETDOMAINNAME@ HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ +HAVE_GETGROUPS = @HAVE_GETGROUPS@ HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ +HAVE_GETLOGIN = @HAVE_GETLOGIN@ HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ -HAVE_GETUSERSHELL = @HAVE_GETUSERSHELL@ HAVE_GLOBAL_SYMBOL_PIPE = @HAVE_GLOBAL_SYMBOL_PIPE@ +HAVE_GRANTPT = @HAVE_GRANTPT@ HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ HAVE_ISNAND = @HAVE_ISNAND@ HAVE_ISNANF = @HAVE_ISNANF@ HAVE_ISNANL = @HAVE_ISNANL@ +HAVE_ISWBLANK = @HAVE_ISWBLANK@ HAVE_ISWCNTRL = @HAVE_ISWCNTRL@ +HAVE_LCHOWN = @HAVE_LCHOWN@ HAVE_LINK = @HAVE_LINK@ +HAVE_LINKAT = @HAVE_LINKAT@ +HAVE_LOGL = @HAVE_LOGL@ HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@ HAVE_MBRLEN = @HAVE_MBRLEN@ HAVE_MBRTOWC = @HAVE_MBRTOWC@ HAVE_MBSINIT = @HAVE_MBSINIT@ +HAVE_MBSLEN = @HAVE_MBSLEN@ HAVE_MBSNRTOWCS = @HAVE_MBSNRTOWCS@ HAVE_MBSRTOWCS = @HAVE_MBSRTOWCS@ +HAVE_MEMCHR = @HAVE_MEMCHR@ HAVE_MEMPCPY = @HAVE_MEMPCPY@ HAVE_MKDTEMP = @HAVE_MKDTEMP@ +HAVE_MKOSTEMP = @HAVE_MKOSTEMP@ +HAVE_MKOSTEMPS = @HAVE_MKOSTEMPS@ +HAVE_MKSTEMP = @HAVE_MKSTEMP@ +HAVE_MKSTEMPS = @HAVE_MKSTEMPS@ HAVE_OS_H = @HAVE_OS_H@ +HAVE_PIPE2 = @HAVE_PIPE2@ +HAVE_PREAD = @HAVE_PREAD@ +HAVE_PTSNAME = @HAVE_PTSNAME@ HAVE_RANDOM_H = @HAVE_RANDOM_H@ HAVE_RANDOM_R = @HAVE_RANDOM_R@ HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ HAVE_READLINK = @HAVE_READLINK@ +HAVE_READLINKAT = @HAVE_READLINKAT@ HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@ +HAVE_REALPATH = @HAVE_REALPATH@ HAVE_RPMATCH = @HAVE_RPMATCH@ HAVE_SETENV = @HAVE_SETENV@ HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ +HAVE_SINL = @HAVE_SINL@ HAVE_SLEEP = @HAVE_SLEEP@ +HAVE_SQRTL = @HAVE_SQRTL@ HAVE_STDINT_H = @HAVE_STDINT_H@ HAVE_STPCPY = @HAVE_STPCPY@ HAVE_STPNCPY = @HAVE_STPNCPY@ HAVE_STRCASESTR = @HAVE_STRCASESTR@ HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ -HAVE_STRNDUP = @HAVE_STRNDUP@ HAVE_STRPBRK = @HAVE_STRPBRK@ HAVE_STRSEP = @HAVE_STRSEP@ HAVE_STRTOD = @HAVE_STRTOD@ @@ -2871,14 +3628,21 @@ HAVE_STRTOLL = @HAVE_STRTOLL@ HAVE_STRTOULL = @HAVE_STRTOULL@ HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@ HAVE_STRVERSCMP = @HAVE_STRVERSCMP@ +HAVE_SYMLINK = @HAVE_SYMLINK@ +HAVE_SYMLINKAT = @HAVE_SYMLINKAT@ HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@ HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ +HAVE_TANL = @HAVE_TANL@ +HAVE_TTYNAME_R = @HAVE_TTYNAME_R@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ +HAVE_UNLINKAT = @HAVE_UNLINKAT@ +HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ HAVE_UNSETENV = @HAVE_UNSETENV@ HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ +HAVE_USLEEP = @HAVE_USLEEP@ HAVE_WCHAR_H = @HAVE_WCHAR_H@ HAVE_WCHAR_T = @HAVE_WCHAR_T@ HAVE_WCRTOMB = @HAVE_WCRTOMB@ @@ -2886,6 +3650,7 @@ HAVE_WCSNRTOMBS = @HAVE_WCSNRTOMBS@ HAVE_WCSRTOMBS = @HAVE_WCSRTOMBS@ HAVE_WCTYPE_H = @HAVE_WCTYPE_H@ HAVE_WINT_T = @HAVE_WINT_T@ +HAVE_XLOCALE_H = @HAVE_XLOCALE_H@ HAVE__BOOL = @HAVE__BOOL@ HEXVERSION = @HEXVERSION@ ICONV_H = @ICONV_H@ @@ -2901,27 +3666,32 @@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ +LIBMULTITHREAD = @LIBMULTITHREAD@ LIBOBJS = @LIBOBJS@ +LIBPTH = @LIBPTH@ +LIBPTH_PREFIX = @LIBPTH_PREFIX@ LIBS = @LIBS@ LIBTESTS_LIBDEPS = @LIBTESTS_LIBDEPS@ +LIBTHREAD = @LIBTHREAD@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@ LOCALE_FR = @LOCALE_FR@ LOCALE_FR_UTF8 = @LOCALE_FR_UTF8@ -LOCALE_H = @LOCALE_H@ LOCALE_JA = @LOCALE_JA@ LOCALE_TR_UTF8 = @LOCALE_TR_UTF8@ LOCALE_ZH_CN = @LOCALE_ZH_CN@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ +LTLIBMULTITHREAD = @LTLIBMULTITHREAD@ LTLIBOBJS = @LTLIBOBJS@ +LTLIBPTH = @LTLIBPTH@ +LTLIBTHREAD = @LTLIBTHREAD@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ NAMESPACING = @NAMESPACING@ NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@ -NEXT_AS_FIRST_DIRECTIVE_FCNTL_H = @NEXT_AS_FIRST_DIRECTIVE_FCNTL_H@ NEXT_AS_FIRST_DIRECTIVE_FLOAT_H = @NEXT_AS_FIRST_DIRECTIVE_FLOAT_H@ NEXT_AS_FIRST_DIRECTIVE_ICONV_H = @NEXT_AS_FIRST_DIRECTIVE_ICONV_H@ NEXT_AS_FIRST_DIRECTIVE_LOCALE_H = @NEXT_AS_FIRST_DIRECTIVE_LOCALE_H@ @@ -2934,7 +3704,6 @@ NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ NEXT_AS_FIRST_DIRECTIVE_WCHAR_H = @NEXT_AS_FIRST_DIRECTIVE_WCHAR_H@ NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H = @NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H@ NEXT_ERRNO_H = @NEXT_ERRNO_H@ -NEXT_FCNTL_H = @NEXT_FCNTL_H@ NEXT_FLOAT_H = @NEXT_FLOAT_H@ NEXT_ICONV_H = @NEXT_ICONV_H@ NEXT_LOCALE_H = @NEXT_LOCALE_H@ @@ -2967,17 +3736,21 @@ RANLIB = @RANLIB@ RC = @RC@ RELOCATABLE = @RELOCATABLE@ REPLACE_BTOWC = @REPLACE_BTOWC@ +REPLACE_CANONICALIZE_FILE_NAME = @REPLACE_CANONICALIZE_FILE_NAME@ REPLACE_CEILF = @REPLACE_CEILF@ REPLACE_CEILL = @REPLACE_CEILL@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_CLOSE = @REPLACE_CLOSE@ +REPLACE_DUP = @REPLACE_DUP@ REPLACE_DUP2 = @REPLACE_DUP2@ -REPLACE_FCHDIR = @REPLACE_FCHDIR@ +REPLACE_DUPLOCALE = @REPLACE_DUPLOCALE@ +REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ REPLACE_FLOORF = @REPLACE_FLOORF@ REPLACE_FLOORL = @REPLACE_FLOORL@ REPLACE_FREXP = @REPLACE_FREXP@ REPLACE_FREXPL = @REPLACE_FREXPL@ REPLACE_GETCWD = @REPLACE_GETCWD@ +REPLACE_GETGROUPS = @REPLACE_GETGROUPS@ REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ REPLACE_HUGE_VAL = @REPLACE_HUGE_VAL@ REPLACE_ICONV = @REPLACE_ICONV@ @@ -2989,6 +3762,8 @@ REPLACE_ISNAN = @REPLACE_ISNAN@ REPLACE_ISWCNTRL = @REPLACE_ISWCNTRL@ REPLACE_LCHOWN = @REPLACE_LCHOWN@ REPLACE_LDEXPL = @REPLACE_LDEXPL@ +REPLACE_LINK = @REPLACE_LINK@ +REPLACE_LINKAT = @REPLACE_LINKAT@ REPLACE_LSEEK = @REPLACE_LSEEK@ REPLACE_MBRLEN = @REPLACE_MBRLEN@ REPLACE_MBRTOWC = @REPLACE_MBRTOWC@ @@ -3001,20 +3776,36 @@ REPLACE_MEMMEM = @REPLACE_MEMMEM@ REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ REPLACE_NAN = @REPLACE_NAN@ REPLACE_NULL = @REPLACE_NULL@ -REPLACE_OPEN = @REPLACE_OPEN@ +REPLACE_PREAD = @REPLACE_PREAD@ REPLACE_PUTENV = @REPLACE_PUTENV@ +REPLACE_READLINK = @REPLACE_READLINK@ +REPLACE_REALPATH = @REPLACE_REALPATH@ +REPLACE_RMDIR = @REPLACE_RMDIR@ REPLACE_ROUND = @REPLACE_ROUND@ REPLACE_ROUNDF = @REPLACE_ROUNDF@ REPLACE_ROUNDL = @REPLACE_ROUNDL@ +REPLACE_SETENV = @REPLACE_SETENV@ REPLACE_SIGNBIT = @REPLACE_SIGNBIT@ REPLACE_SIGNBIT_USING_GCC = @REPLACE_SIGNBIT_USING_GCC@ +REPLACE_SLEEP = @REPLACE_SLEEP@ +REPLACE_STPNCPY = @REPLACE_STPNCPY@ REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ REPLACE_STRDUP = @REPLACE_STRDUP@ REPLACE_STRERROR = @REPLACE_STRERROR@ +REPLACE_STRNCAT = @REPLACE_STRNCAT@ +REPLACE_STRNDUP = @REPLACE_STRNDUP@ +REPLACE_STRNLEN = @REPLACE_STRNLEN@ REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ REPLACE_STRSTR = @REPLACE_STRSTR@ REPLACE_STRTOD = @REPLACE_STRTOD@ +REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ +REPLACE_SYMLINK = @REPLACE_SYMLINK@ REPLACE_TRUNCL = @REPLACE_TRUNCL@ +REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ +REPLACE_UNLINK = @REPLACE_UNLINK@ +REPLACE_UNLINKAT = @REPLACE_UNLINKAT@ +REPLACE_UNSETENV = @REPLACE_UNSETENV@ +REPLACE_USLEEP = @REPLACE_USLEEP@ REPLACE_WCRTOMB = @REPLACE_WCRTOMB@ REPLACE_WCSNRTOMBS = @REPLACE_WCSNRTOMBS@ REPLACE_WCSRTOMBS = @REPLACE_WCSRTOMBS@ @@ -3031,14 +3822,13 @@ STDDEF_H = @STDDEF_H@ STDINT_H = @STDINT_H@ STRIP = @STRIP@ TEXI2DVI = @TEXI2DVI@ +UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ VERSION = @VERSION@ -VOID_UNSETENV = @VOID_UNSETENV@ -WCHAR_H = @WCHAR_H@ WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ -WCTYPE_H = @WCTYPE_H@ WINT_T_SUFFIX = @WINT_T_SUFFIX@ +YIELD_LIB = @YIELD_LIB@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -3066,6 +3856,7 @@ gl_LIBOBJS = @gl_LIBOBJS@ gl_LTLIBOBJS = @gl_LTLIBOBJS@ gltests_LIBOBJS = @gltests_LIBOBJS@ gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ +gltests_WITNESS = @gltests_WITNESS@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ @@ -3097,528 +3888,692 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # Rules generated and collected by gnulib-tool. -AUTOMAKE_OPTIONS = 1.5 foreign 1.11 subdir-objects color-tests -SUBDIRS = +AUTOMAKE_OPTIONS = 1.5 foreign subdir-objects 1.11 subdir-objects \ + color-tests +SUBDIRS = . # The test suite uses the 'localcharset' module. # This must be the last thing that gets added to TESTS_ENVIRONMENT. -TESTS_ENVIRONMENT = EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' \ - LOCALE_TR_UTF8='@LOCALE_TR_UTF8@' EXEEXT='@EXEEXT@' \ +TESTS_ENVIRONMENT = EXEEXT='@EXEEXT@' srcdir='$(srcdir)' \ + LOCALE_FR='@LOCALE_FR@' LOCALE_TR_UTF8='@LOCALE_TR_UTF8@' \ LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \ LOCALE_JA='@LOCALE_JA@' LOCALE_ZH_CN='@LOCALE_ZH_CN@' \ - EXEEXT='@EXEEXT@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \ - EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' \ + LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_FR='@LOCALE_FR@' \ LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_JA='@LOCALE_JA@' \ LOCALE_TR_UTF8='@LOCALE_TR_UTF8@' \ - LOCALE_ZH_CN='@LOCALE_ZH_CN@' EXEEXT='@EXEEXT@' \ - LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \ - EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' \ - LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' EXEEXT='@EXEEXT@' \ - srcdir='$(srcdir)' EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' \ - LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' EXEEXT='@EXEEXT@' \ - LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \ - EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' \ - LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' EXEEXT='@EXEEXT@' \ - LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \ - EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' EXEEXT='@EXEEXT@' \ + LOCALE_ZH_CN='@LOCALE_ZH_CN@' LOCALE_FR='@LOCALE_FR@' \ + LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_FR='@LOCALE_FR@' \ + LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_FR='@LOCALE_FR@' \ + LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_FR='@LOCALE_FR@' \ + LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_FR='@LOCALE_FR@' \ + LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_FR='@LOCALE_FR@' \ + LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_FR='@LOCALE_FR@' \ @LOCALCHARSET_TESTS_ENVIRONMENT@ $(SHELL) \ $(top_srcdir)/build-aux/run-test '$(CHECKER)' noinst_HEADERS = noinst_LIBRARIES = check_LIBRARIES = libtests.a -EXTRA_DIST = test-alloca-opt.c test-array-mergesort.c test-c-ctype.c \ +EXTRA_DIST = test-alloca-opt.c $(top_srcdir)/build-aux/arg-nonnull.h \ + test-array-mergesort.c macros.h \ + $(top_srcdir)/build-aux/c++defs.h test-c-ctype.c macros.h \ test-c-strcase.sh test-c-strcasecmp.c test-c-strncasecmp.c \ - test-dup2.c test-environ.c test-errno.c error.c error.h \ - exitfail.c exitfail.h fcntl.in.h test-fcntl.c test-frexpl.c \ - test-fseterr.c test-iconv.c intprops.h test-isnand-nolibm.c \ - test-isnand.h nan.h test-isnanf-nolibm.c test-isnanf.h nan.h \ - test-isnanl-nolibm.c test-isnanl.h nan.h locale.in.h \ - test-locale.c test-localename.c test-malloca.c test-math.c \ - test-mbrtowc1.sh test-mbrtowc2.sh test-mbrtowc3.sh \ - test-mbrtowc4.sh test-mbrtowc.c test-mbsinit.sh test-mbsinit.c \ - test-memchr.c zerosize-ptr.h open.c test-open.c \ - test-printf-frexp.c test-printf-frexpl.c setenv.c \ - test-signbit.c test-stdbool.c test-stddef.c test-stdint.c \ - test-stdlib.c strerror.c test-strerror.c test-striconveh.c \ - test-striconveha.c test-string.c unicase/test-cased.c \ - unicase/test-predicate-part1.h unicase/test-predicate-part2.h \ + macros.h test-environ.c test-errno.c error.c error.h \ + exitfail.h test-frexpl.c signature.h macros.h test-fseterr.c \ + getpagesize.c test-iconv-h.c test-iconv.c signature.h macros.h \ + intprops.h test-isnand-nolibm.c test-isnand.h nan.h macros.h \ + test-isnanf-nolibm.c test-isnanf.h nan.h macros.h \ + test-isnanl-nolibm.c test-isnanl.h nan.h macros.h locale.in.h \ + test-locale.c test-localename.c macros.h test-lock.c \ + test-malloca.c test-math.c test-mbrtowc1.sh test-mbrtowc2.sh \ + test-mbrtowc3.sh test-mbrtowc4.sh test-mbrtowc.c signature.h \ + macros.h test-mbsinit.sh test-mbsinit.c signature.h macros.h \ + test-memchr.c zerosize-ptr.h signature.h macros.h \ + test-printf-frexp.c macros.h test-printf-frexpl.c macros.h \ + putenv.c setenv.c test-setenv.c signature.h macros.h \ + test-signbit.c macros.h test-stdbool.c test-stddef.c \ + test-stdint.c test-stdlib.c strerror.c test-strerror.c \ + signature.h macros.h test-striconveh.c macros.h \ + test-striconveha.c macros.h test-string.c test-strncat.c \ + unistr/test-strncat.h zerosize-ptr.h signature.h macros.h \ + unicase/test-cased.c unicase/test-predicate-part1.h \ + unicase/test-predicate-part2.h macros.h \ unicase/test-ignorable.c unicase/test-predicate-part1.h \ - unicase/test-predicate-part2.h unicase/test-locale-language.sh \ - unicase/test-locale-language.c unicase/test-uc_tolower.c \ + unicase/test-predicate-part2.h macros.h \ + unicase/test-locale-language.sh unicase/test-locale-language.c \ + macros.h unicase/test-uc_tolower.c \ unicase/test-mapping-part1.h unicase/test-mapping-part2.h \ - unicase/test-uc_totitle.c unicase/test-mapping-part1.h \ - unicase/test-mapping-part2.h unicase/test-uc_toupper.c \ + macros.h unicase/test-uc_totitle.c \ unicase/test-mapping-part1.h unicase/test-mapping-part2.h \ - unicase/test-u16-casecmp.c unicase/test-casecmp.h \ - unicase/test-u16-casecoll.c unicase/test-casecmp.h \ - unicase/test-u16-casefold.c unicase/test-u16-is-cased.c \ - unicase/test-is-cased.h unicase/test-u16-is-casefolded.c \ - unicase/test-is-casefolded.h unicase/test-u16-is-lowercase.c \ - unicase/test-is-lowercase.h unicase/test-u16-is-titlecase.c \ - unicase/test-is-titlecase.h unicase/test-u16-is-uppercase.c \ - unicase/test-is-uppercase.h unicase/test-u16-tolower.c \ - unicase/test-u16-totitle.c unicase/test-u16-toupper.c \ - unicase/test-u32-casecmp.c unicase/test-casecmp.h \ - unicase/test-u32-casecoll.c unicase/test-casecmp.h \ - unicase/test-u32-casefold.c unicase/test-u32-is-cased.c \ - unicase/test-is-cased.h unicase/test-u32-is-casefolded.c \ - unicase/test-is-casefolded.h unicase/test-u32-is-lowercase.c \ - unicase/test-is-lowercase.h unicase/test-u32-is-titlecase.c \ - unicase/test-is-titlecase.h unicase/test-u32-is-uppercase.c \ - unicase/test-is-uppercase.h unicase/test-u32-tolower.c \ - unicase/test-u32-totitle.c unicase/test-u32-toupper.c \ - unicase/test-u8-casecmp.c unicase/test-casecmp.h \ - unicase/test-u8-casecoll.c unicase/test-casecmp.h \ - unicase/test-u8-casefold.c unicase/test-u8-is-cased.c \ - unicase/test-is-cased.h unicase/test-u8-is-casefolded.c \ - unicase/test-is-casefolded.h unicase/test-u8-is-lowercase.c \ - unicase/test-is-lowercase.h unicase/test-u8-is-titlecase.c \ - unicase/test-is-titlecase.h unicase/test-u8-is-uppercase.c \ - unicase/test-is-uppercase.h unicase/test-u8-tolower.c \ - unicase/test-u8-totitle.c unicase/test-u8-toupper.c \ + macros.h unicase/test-uc_toupper.c \ + unicase/test-mapping-part1.h unicase/test-mapping-part2.h \ + macros.h unicase/test-u16-casecmp.c unicase/test-casecmp.h \ + macros.h unicase/test-u16-casecoll.c unicase/test-casecmp.h \ + macros.h unicase/test-u16-casefold.c macros.h \ + unicase/test-u16-is-cased.c unicase/test-is-cased.h macros.h \ + unicase/test-u16-is-casefolded.c unicase/test-is-casefolded.h \ + macros.h unicase/test-u16-is-lowercase.c \ + unicase/test-is-lowercase.h macros.h \ + unicase/test-u16-is-titlecase.c unicase/test-is-titlecase.h \ + macros.h unicase/test-u16-is-uppercase.c \ + unicase/test-is-uppercase.h macros.h \ + unicase/test-u16-tolower.c macros.h unicase/test-u16-totitle.c \ + macros.h unicase/test-u16-toupper.c macros.h \ + unicase/test-u32-casecmp.c unicase/test-casecmp.h macros.h \ + unicase/test-u32-casecoll.c unicase/test-casecmp.h macros.h \ + unicase/test-u32-casefold.c macros.h \ + unicase/test-u32-is-cased.c unicase/test-is-cased.h macros.h \ + unicase/test-u32-is-casefolded.c unicase/test-is-casefolded.h \ + macros.h unicase/test-u32-is-lowercase.c \ + unicase/test-is-lowercase.h macros.h \ + unicase/test-u32-is-titlecase.c unicase/test-is-titlecase.h \ + macros.h unicase/test-u32-is-uppercase.c \ + unicase/test-is-uppercase.h macros.h \ + unicase/test-u32-tolower.c macros.h unicase/test-u32-totitle.c \ + macros.h unicase/test-u32-toupper.c macros.h \ + unicase/test-u8-casecmp.c unicase/test-casecmp.h macros.h \ + unicase/test-u8-casecoll.c unicase/test-casecmp.h macros.h \ + unicase/test-u8-casefold.c macros.h unicase/test-u8-is-cased.c \ + unicase/test-is-cased.h macros.h \ + unicase/test-u8-is-casefolded.c unicase/test-is-casefolded.h \ + macros.h unicase/test-u8-is-lowercase.c \ + unicase/test-is-lowercase.h macros.h \ + unicase/test-u8-is-titlecase.c unicase/test-is-titlecase.h \ + macros.h unicase/test-u8-is-uppercase.c \ + unicase/test-is-uppercase.h macros.h unicase/test-u8-tolower.c \ + macros.h unicase/test-u8-totitle.c macros.h \ + unicase/test-u8-toupper.c macros.h \ unicase/test-ulc-casecmp1.sh unicase/test-ulc-casecmp2.sh \ - unicase/test-ulc-casecmp.c unicase/test-casecmp.h \ + unicase/test-ulc-casecmp.c unicase/test-casecmp.h macros.h \ unicase/test-ulc-casecoll1.sh unicase/test-ulc-casecoll2.sh \ - unicase/test-ulc-casecoll.c unicase/test-casecmp.h \ - uniconv/test-u16-conv-from-enc.c \ - uniconv/test-u16-conv-to-enc.c \ - uniconv/test-u16-strconv-from-enc.c \ - uniconv/test-u16-strconv-to-enc.c \ - uniconv/test-u32-conv-from-enc.c \ - uniconv/test-u32-conv-to-enc.c \ - uniconv/test-u32-strconv-from-enc.c \ - uniconv/test-u32-strconv-to-enc.c \ - uniconv/test-u8-conv-from-enc.c uniconv/test-u8-conv-to-enc.c \ - uniconv/test-u8-strconv-from-enc.c \ - uniconv/test-u8-strconv-to-enc.c unictype/test-bidi_byname.c \ - unictype/test-bidi_name.c unictype/test-bidi_of.c \ - unictype/test-bidi_test.c unictype/test-block_list.c \ - unictype/test-block_of.c unictype/test-block_test.c \ - unictype/test-categ_C.c unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Cc.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Cf.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Cn.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Co.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Cs.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_L.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Ll.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Lm.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Lo.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Lt.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Lu.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_M.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Mc.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Me.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Mn.c \ + unicase/test-ulc-casecoll.c unicase/test-casecmp.h macros.h \ + uniconv/test-u16-conv-from-enc.c macros.h \ + uniconv/test-u16-conv-to-enc.c macros.h \ + uniconv/test-u16-strconv-from-enc.c macros.h \ + uniconv/test-u16-strconv-to-enc.c macros.h \ + uniconv/test-u32-conv-from-enc.c macros.h \ + uniconv/test-u32-conv-to-enc.c macros.h \ + uniconv/test-u32-strconv-from-enc.c macros.h \ + uniconv/test-u32-strconv-to-enc.c macros.h \ + uniconv/test-u8-conv-from-enc.c macros.h \ + uniconv/test-u8-conv-to-enc.c macros.h \ + uniconv/test-u8-strconv-from-enc.c macros.h \ + uniconv/test-u8-strconv-to-enc.c macros.h \ + unictype/test-bidi_byname.c macros.h unictype/test-bidi_name.c \ + macros.h unictype/test-bidi_of.c macros.h \ + unictype/test-bidi_test.c macros.h unictype/test-block_list.c \ + macros.h unictype/test-block_of.c macros.h \ + unictype/test-block_test.c macros.h unictype/test-categ_C.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_N.c \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Cc.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Cf.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Cn.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Co.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Cs.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_L.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Ll.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Lm.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Lo.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Lt.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Lu.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_M.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Mc.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Me.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Mn.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_N.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Nd.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Nl.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_No.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_P.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Pc.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Pd.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Pe.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Pf.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Pi.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Po.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Ps.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_S.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Sc.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Sk.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Sm.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_So.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Z.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Zl.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Zp.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_Zs.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-categ_and_not.c macros.h \ + unictype/test-categ_and.c macros.h \ + unictype/test-categ_byname.c macros.h \ + unictype/test-categ_name.c macros.h unictype/test-categ_none.c \ + macros.h unictype/test-categ_of.c macros.h \ + unictype/test-categ_or.c macros.h \ + unictype/test-categ_test_withtable.c macros.h \ + unictype/test-combining.c macros.h unictype/test-ctype_alnum.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Nd.c \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-ctype_alpha.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-ctype_blank.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-ctype_cntrl.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-ctype_digit.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-ctype_graph.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-ctype_lower.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-ctype_print.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-ctype_punct.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-ctype_space.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-ctype_upper.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-ctype_xdigit.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-decdigit.c unictype/test-decdigit.h macros.h \ + unictype/test-digit.c unictype/test-digit.h macros.h \ + unictype/test-mirror.c macros.h unictype/test-numeric.c \ + unictype/test-numeric.h macros.h unictype/test-pr_alphabetic.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Nl.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_No.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_P.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Pc.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Pd.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Pe.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Pf.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Pi.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Po.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Ps.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_S.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Sc.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Sk.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Sm.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_So.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Z.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Zl.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Zp.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_Zs.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-categ_and_not.c \ - unictype/test-categ_and.c unictype/test-categ_byname.c \ - unictype/test-categ_name.c unictype/test-categ_none.c \ - unictype/test-categ_of.c unictype/test-categ_or.c \ - unictype/test-categ_test_withtable.c unictype/test-combining.c \ - unictype/test-ctype_alnum.c unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-ctype_alpha.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-ctype_blank.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-ctype_cntrl.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-ctype_digit.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-ctype_graph.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-ctype_lower.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-ctype_print.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-ctype_punct.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-ctype_space.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-ctype_upper.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-ctype_xdigit.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-decdigit.c \ - unictype/test-decdigit.h unictype/test-digit.c \ - unictype/test-digit.h unictype/test-mirror.c \ - unictype/test-numeric.c unictype/test-numeric.h \ - unictype/test-pr_alphabetic.c unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_ascii_hex_digit.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_bidi_arabic_digit.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_bidi_arabic_right_to_left.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_bidi_block_separator.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_bidi_boundary_neutral.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_bidi_common_separator.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_bidi_control.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_bidi_embedding_or_override.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_bidi_eur_num_separator.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_bidi_eur_num_terminator.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_bidi_european_digit.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_bidi_hebrew_right_to_left.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_bidi_left_to_right.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_bidi_non_spacing_mark.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_bidi_other_neutral.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_bidi_pdf.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_bidi_pdf.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_bidi_segment_separator.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_bidi_whitespace.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_byname.c \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_byname.c macros.h \ unictype/test-pr_combining.c unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_composite.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_composite.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_currency_symbol.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_dash.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_dash.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_decimal_digit.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_default_ignorable_code_point.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_deprecated.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_diacritic.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_extender.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_deprecated.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_diacritic.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_extender.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_format_control.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_grapheme_base.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_grapheme_extend.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_grapheme_link.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_hex_digit.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_hyphen.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_id_continue.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_id_start.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_ideographic.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_hex_digit.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_hyphen.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_id_continue.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_id_start.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_ideographic.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_ids_binary_operator.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_ids_trinary_operator.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_ignorable_control.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_iso_control.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_iso_control.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_join_control.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_left_of_pair.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_line_separator.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_logical_order_exception.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_lowercase.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_math.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_non_break.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_lowercase.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_math.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_non_break.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_not_a_character.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_numeric.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_numeric.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_other_alphabetic.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_other_default_ignorable_code_point.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_other_grapheme_extend.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_other_id_continue.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_other_id_start.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_other_lowercase.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_other_math.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_other_math.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_other_uppercase.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_paired_punctuation.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_paragraph_separator.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_pattern_syntax.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_pattern_white_space.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_private_use.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_punctuation.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_private_use.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_punctuation.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_quotation_mark.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_radical.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_radical.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_sentence_terminal.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_soft_dotted.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_space.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_soft_dotted.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_space.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_terminal_punctuation.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_test.c \ - unictype/test-pr_titlecase.c unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_test.c macros.h unictype/test-pr_titlecase.c \ + unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_unassigned_code_value.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_unified_ideograph.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_uppercase.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_uppercase.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_variation_selector.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_white_space.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_white_space.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ unictype/test-pr_xid_continue.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_xid_start.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-pr_zero_width.c \ - unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-scripts.c \ - unictype/test-sy_c_ident.c unictype/test-sy_c_whitespace.c \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_xid_start.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-pr_zero_width.c unictype/test-predicate-part1.h \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-scripts.c macros.h unictype/test-sy_c_ident.c \ + macros.h unictype/test-sy_c_whitespace.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h unictype/test-sy_java_ident.c \ + unictype/test-predicate-part2.h macros.h \ + unictype/test-sy_java_ident.c macros.h \ unictype/test-sy_java_whitespace.c \ unictype/test-predicate-part1.h \ - unictype/test-predicate-part2.h \ - unilbrk/test-u16-possible-linebreaks.c \ - unilbrk/test-u16-width-linebreaks.c \ - unilbrk/test-u32-possible-linebreaks.c \ - unilbrk/test-u32-width-linebreaks.c \ - unilbrk/test-u8-possible-linebreaks.c \ - unilbrk/test-u8-width-linebreaks.c \ - unilbrk/test-ulc-possible-linebreaks.c \ - unilbrk/test-ulc-width-linebreaks.c uniname/test-uninames.sh \ - uniname/test-uninames.c uniname/UnicodeDataNames.txt \ - uninorm/test-canonical-decomposition.c \ - uninorm/test-compat-decomposition.c uninorm/test-composition.c \ - uninorm/test-decomposing-form.c uninorm/test-decomposition.c \ - uninorm/test-uninorm-filter-nfc.c uninorm/test-nfc.c \ + unictype/test-predicate-part2.h macros.h \ + unilbrk/test-u16-possible-linebreaks.c macros.h \ + unilbrk/test-u16-width-linebreaks.c macros.h \ + unilbrk/test-u32-possible-linebreaks.c macros.h \ + unilbrk/test-u32-width-linebreaks.c macros.h \ + unilbrk/test-u8-possible-linebreaks.c macros.h \ + unilbrk/test-u8-width-linebreaks.c macros.h \ + unilbrk/test-ulc-possible-linebreaks.c macros.h \ + unilbrk/test-ulc-width-linebreaks.c macros.h \ + uniname/test-uninames.sh uniname/test-uninames.c \ + uniname/UnicodeDataNames.txt \ + uninorm/test-canonical-decomposition.c macros.h \ + uninorm/test-compat-decomposition.c macros.h \ + uninorm/test-composition.c macros.h \ + uninorm/test-decomposing-form.c macros.h \ + uninorm/test-decomposition.c macros.h \ + uninorm/test-uninorm-filter-nfc.c macros.h uninorm/test-nfc.c \ uninorm/test-u8-nfc.c uninorm/test-u16-nfc.c \ uninorm/test-u32-nfc.c uninorm/test-u32-nfc-big.sh \ uninorm/test-u32-nfc-big.c uninorm/test-u32-normalize-big.h \ uninorm/test-u32-normalize-big.c uninorm/NormalizationTest.txt \ - uninorm/test-nfd.c uninorm/test-u8-nfd.c \ + macros.h uninorm/test-nfd.c uninorm/test-u8-nfd.c \ uninorm/test-u16-nfd.c uninorm/test-u32-nfd.c \ uninorm/test-u32-nfd-big.sh uninorm/test-u32-nfd-big.c \ uninorm/test-u32-normalize-big.h \ uninorm/test-u32-normalize-big.c uninorm/NormalizationTest.txt \ - uninorm/test-nfkc.c uninorm/test-u8-nfkc.c \ + macros.h uninorm/test-nfkc.c uninorm/test-u8-nfkc.c \ uninorm/test-u16-nfkc.c uninorm/test-u32-nfkc.c \ uninorm/test-u32-nfkc-big.sh uninorm/test-u32-nfkc-big.c \ uninorm/test-u32-normalize-big.h \ uninorm/test-u32-normalize-big.c uninorm/NormalizationTest.txt \ - uninorm/test-nfkd.c uninorm/test-u8-nfkd.c \ + macros.h uninorm/test-nfkd.c uninorm/test-u8-nfkd.c \ uninorm/test-u16-nfkd.c uninorm/test-u32-nfkd.c \ uninorm/test-u32-nfkd-big.sh uninorm/test-u32-nfkd-big.c \ uninorm/test-u32-normalize-big.h \ uninorm/test-u32-normalize-big.c uninorm/NormalizationTest.txt \ - uninorm/test-u16-normcmp.c uninorm/test-u16-normcmp.h \ - uninorm/test-u16-normcoll.c uninorm/test-u16-normcmp.h \ - uninorm/test-u32-normcmp.c uninorm/test-u32-normcmp.h \ + macros.h uninorm/test-u16-normcmp.c uninorm/test-u16-normcmp.h \ + macros.h uninorm/test-u16-normcoll.c \ + uninorm/test-u16-normcmp.h macros.h uninorm/test-u32-normcmp.c \ + uninorm/test-u32-normcmp.h macros.h \ uninorm/test-u32-normcoll.c uninorm/test-u32-normcmp.h \ - uninorm/test-u8-normcmp.c uninorm/test-u8-normcmp.h \ - uninorm/test-u8-normcoll.c uninorm/test-u8-normcmp.h \ - test-unistd.c unistdio/test-u16-asnprintf1.c \ + macros.h uninorm/test-u8-normcmp.c uninorm/test-u8-normcmp.h \ + macros.h uninorm/test-u8-normcoll.c uninorm/test-u8-normcmp.h \ + macros.h test-unistd.c unistdio/test-u16-asnprintf1.c \ unistdio/test-u16-asnprintf1.h unistdio/test-u16-printf1.h \ - unistdio/test-u16-vasnprintf1.c unistdio/test-u16-asnprintf1.h \ - unistdio/test-u16-printf1.h unistdio/test-u16-vasnprintf2.sh \ + macros.h unistdio/test-u16-vasnprintf1.c \ + unistdio/test-u16-asnprintf1.h unistdio/test-u16-printf1.h \ + unistdio/test-u16-vasnprintf2.sh \ unistdio/test-u16-vasnprintf2.c \ unistdio/test-u16-vasnprintf3.sh \ - unistdio/test-u16-vasnprintf3.c unistdio/test-u16-vasprintf1.c \ - unistdio/test-u16-printf1.h unistdio/test-u16-vsnprintf1.c \ - unistdio/test-u16-printf1.h unistdio/test-u16-vsprintf1.c \ - unistdio/test-u16-printf1.h unistdio/test-u32-asnprintf1.c \ + unistdio/test-u16-vasnprintf3.c macros.h \ + unistdio/test-u16-vasprintf1.c unistdio/test-u16-printf1.h \ + macros.h unistdio/test-u16-vsnprintf1.c \ + unistdio/test-u16-printf1.h macros.h \ + unistdio/test-u16-vsprintf1.c unistdio/test-u16-printf1.h \ + macros.h unistdio/test-u32-asnprintf1.c \ unistdio/test-u32-asnprintf1.h unistdio/test-u32-printf1.h \ - unistdio/test-u32-vasnprintf1.c unistdio/test-u32-asnprintf1.h \ - unistdio/test-u32-printf1.h unistdio/test-u32-vasnprintf2.sh \ + macros.h unistdio/test-u32-vasnprintf1.c \ + unistdio/test-u32-asnprintf1.h unistdio/test-u32-printf1.h \ + unistdio/test-u32-vasnprintf2.sh \ unistdio/test-u32-vasnprintf2.c \ unistdio/test-u32-vasnprintf3.sh \ - unistdio/test-u32-vasnprintf3.c unistdio/test-u32-vasprintf1.c \ - unistdio/test-u32-printf1.h unistdio/test-u32-vsnprintf1.c \ - unistdio/test-u32-printf1.h unistdio/test-u32-vsprintf1.c \ - unistdio/test-u32-printf1.h unistdio/test-u8-asnprintf1.c \ + unistdio/test-u32-vasnprintf3.c macros.h \ + unistdio/test-u32-vasprintf1.c unistdio/test-u32-printf1.h \ + macros.h unistdio/test-u32-vsnprintf1.c \ + unistdio/test-u32-printf1.h macros.h \ + unistdio/test-u32-vsprintf1.c unistdio/test-u32-printf1.h \ + macros.h unistdio/test-u8-asnprintf1.c \ unistdio/test-u8-asnprintf1.h unistdio/test-u8-printf1.h \ - unistdio/test-u8-vasnprintf1.c unistdio/test-u8-asnprintf1.h \ - unistdio/test-u8-printf1.h unistdio/test-u8-vasnprintf2.sh \ - unistdio/test-u8-vasnprintf2.c unistdio/test-u8-vasnprintf3.sh \ - unistdio/test-u8-vasnprintf3.c unistdio/test-u8-vasprintf1.c \ - unistdio/test-u8-printf1.h unistdio/test-u8-vsnprintf1.c \ - unistdio/test-u8-printf1.h unistdio/test-u8-vsprintf1.c \ - unistdio/test-u8-printf1.h unistdio/test-ulc-asnprintf1.c \ - unistdio/test-ulc-asnprintf1.h unistdio/test-ulc-printf1.h \ + macros.h unistdio/test-u8-vasnprintf1.c \ + unistdio/test-u8-asnprintf1.h unistdio/test-u8-printf1.h \ + unistdio/test-u8-vasnprintf2.sh unistdio/test-u8-vasnprintf2.c \ + unistdio/test-u8-vasnprintf3.sh unistdio/test-u8-vasnprintf3.c \ + macros.h unistdio/test-u8-vasprintf1.c \ + unistdio/test-u8-printf1.h macros.h \ + unistdio/test-u8-vsnprintf1.c unistdio/test-u8-printf1.h \ + macros.h unistdio/test-u8-vsprintf1.c \ + unistdio/test-u8-printf1.h macros.h \ + unistdio/test-ulc-asnprintf1.c unistdio/test-ulc-asnprintf1.h \ + unistdio/test-ulc-printf1.h macros.h \ unistdio/test-ulc-vasnprintf1.c unistdio/test-ulc-asnprintf1.h \ unistdio/test-ulc-printf1.h unistdio/test-ulc-vasnprintf2.sh \ unistdio/test-ulc-vasnprintf2.c \ unistdio/test-ulc-vasnprintf3.sh \ - unistdio/test-ulc-vasnprintf3.c unistdio/test-ulc-vasprintf1.c \ - unistdio/test-ulc-printf1.h unistdio/test-ulc-vsnprintf1.c \ - unistdio/test-ulc-printf1.h unistdio/test-ulc-vsprintf1.c \ - unistdio/test-ulc-printf1.h uniwbrk/test-u16-wordbreaks.c \ - uniwbrk/test-u32-wordbreaks.c uniwbrk/test-u8-wordbreaks.c \ + unistdio/test-ulc-vasnprintf3.c macros.h \ + unistdio/test-ulc-vasprintf1.c unistdio/test-ulc-printf1.h \ + macros.h unistdio/test-ulc-vsnprintf1.c \ + unistdio/test-ulc-printf1.h macros.h \ + unistdio/test-ulc-vsprintf1.c unistdio/test-ulc-printf1.h \ + macros.h unistr/test-u16-check.c macros.h \ + unistr/test-u16-chr.c unistr/test-chr.h zerosize-ptr.h \ + macros.h unistr/test-u16-cmp.c unistr/test-cmp.h \ + zerosize-ptr.h macros.h unistr/test-u16-cmp2.c \ + unistr/test-cmp2.h macros.h unistr/test-u16-cpy-alloc.c \ + unistr/test-cpy-alloc.h macros.h unistr/test-u16-cpy.c \ + unistr/test-cpy.h macros.h unistr/test-u16-mblen.c macros.h \ + unistr/test-u16-mbsnlen.c macros.h unistr/test-u16-mbtouc.c \ + unistr/test-u16-mbtouc.h macros.h \ + unistr/test-u16-mbtouc-unsafe.c unistr/test-u16-mbtouc.h \ + macros.h unistr/test-u16-mbtoucr.c macros.h \ + unistr/test-u16-move.c unistr/test-move.h macros.h \ + unistr/test-u16-next.c macros.h unistr/test-u16-prev.c \ + macros.h unistr/test-u16-set.c unistr/test-set.h macros.h \ + unistr/test-u16-stpcpy.c unistr/test-stpcpy.h macros.h \ + unistr/test-u16-stpncpy.c unistr/test-stpncpy.h zerosize-ptr.h \ + macros.h unistr/test-u16-strcat.c unistr/test-strcat.h \ + macros.h unistr/test-u16-strcmp.c unistr/test-u16-strcmp.h \ + unistr/test-strcmp.h macros.h unistr/test-u16-strcoll.c \ + unistr/test-u16-strcmp.h unistr/test-strcmp.h macros.h \ + unistr/test-u16-strcpy.c unistr/test-strcpy.h macros.h \ + unistr/test-u16-strdup.c unistr/test-strdup.h macros.h \ + unistr/test-u16-strlen.c macros.h unistr/test-u16-strmblen.c \ + macros.h unistr/test-u16-strmbtouc.c macros.h \ + unistr/test-u16-strncat.c unistr/test-strncat.h zerosize-ptr.h \ + macros.h unistr/test-u16-strncmp.c unistr/test-strncmp.h \ + macros.h unistr/test-u16-strncpy.c unistr/test-strncpy.h \ + zerosize-ptr.h macros.h unistr/test-u16-strnlen.c \ + unistr/test-strnlen.h zerosize-ptr.h macros.h \ + unistr/test-u16-to-u32.c macros.h unistr/test-u16-to-u8.c \ + macros.h unistr/test-u16-uctomb.c macros.h \ + unistr/test-u32-check.c macros.h unistr/test-u32-chr.c \ + unistr/test-chr.h zerosize-ptr.h macros.h \ + unistr/test-u32-cmp.c unistr/test-cmp.h zerosize-ptr.h \ + macros.h unistr/test-u32-cmp2.c unistr/test-cmp2.h macros.h \ + unistr/test-u32-cpy-alloc.c unistr/test-cpy-alloc.h macros.h \ + unistr/test-u32-cpy.c unistr/test-cpy.h macros.h \ + unistr/test-u32-mblen.c macros.h unistr/test-u32-mbsnlen.c \ + macros.h unistr/test-u32-mbtouc.c unistr/test-u32-mbtouc.h \ + macros.h unistr/test-u32-mbtouc-unsafe.c \ + unistr/test-u32-mbtouc.h macros.h unistr/test-u32-mbtoucr.c \ + macros.h unistr/test-u32-move.c unistr/test-move.h macros.h \ + unistr/test-u32-next.c macros.h unistr/test-u32-prev.c \ + macros.h unistr/test-u32-set.c unistr/test-set.h macros.h \ + unistr/test-u32-stpcpy.c unistr/test-stpcpy.h macros.h \ + unistr/test-u32-stpncpy.c unistr/test-stpncpy.h zerosize-ptr.h \ + macros.h unistr/test-u32-strcat.c unistr/test-strcat.h \ + macros.h unistr/test-u32-strcmp.c unistr/test-u32-strcmp.h \ + unistr/test-strcmp.h macros.h unistr/test-u32-strcoll.c \ + unistr/test-u32-strcmp.h unistr/test-strcmp.h macros.h \ + unistr/test-u32-strcpy.c unistr/test-strcpy.h macros.h \ + unistr/test-u32-strdup.c unistr/test-strdup.h macros.h \ + unistr/test-u32-strlen.c macros.h unistr/test-u32-strmblen.c \ + macros.h unistr/test-u32-strmbtouc.c macros.h \ + unistr/test-u32-strncat.c unistr/test-strncat.h zerosize-ptr.h \ + macros.h unistr/test-u32-strncmp.c unistr/test-strncmp.h \ + macros.h unistr/test-u32-strncpy.c unistr/test-strncpy.h \ + zerosize-ptr.h macros.h unistr/test-u32-strnlen.c \ + unistr/test-strnlen.h zerosize-ptr.h macros.h \ + unistr/test-u32-to-u16.c macros.h unistr/test-u32-to-u8.c \ + macros.h unistr/test-u32-uctomb.c macros.h \ + unistr/test-u8-check.c macros.h unistr/test-u8-chr.c \ + unistr/test-chr.h zerosize-ptr.h macros.h unistr/test-u8-cmp.c \ + unistr/test-cmp.h zerosize-ptr.h macros.h \ + unistr/test-u8-cmp2.c unistr/test-cmp2.h macros.h \ + unistr/test-u8-cpy-alloc.c unistr/test-cpy-alloc.h macros.h \ + unistr/test-u8-cpy.c unistr/test-cpy.h macros.h \ + unistr/test-u8-mblen.c macros.h unistr/test-u8-mbsnlen.c \ + macros.h unistr/test-u8-mbtouc.c unistr/test-u8-mbtouc.h \ + macros.h unistr/test-u8-mbtouc-unsafe.c \ + unistr/test-u8-mbtouc.h macros.h unistr/test-u8-mbtoucr.c \ + macros.h unistr/test-u8-move.c unistr/test-move.h macros.h \ + unistr/test-u8-next.c macros.h unistr/test-u8-prev.c macros.h \ + unistr/test-u8-set.c unistr/test-set.h macros.h \ + unistr/test-u8-stpcpy.c unistr/test-stpcpy.h macros.h \ + unistr/test-u8-stpncpy.c unistr/test-stpncpy.h zerosize-ptr.h \ + macros.h unistr/test-u8-strcat.c unistr/test-strcat.h macros.h \ + unistr/test-u8-strcmp.c unistr/test-u8-strcmp.h \ + unistr/test-strcmp.h macros.h unistr/test-u8-strcoll.c \ + unistr/test-u8-strcmp.h unistr/test-strcmp.h macros.h \ + unistr/test-u8-strcpy.c unistr/test-strcpy.h macros.h \ + unistr/test-u8-strdup.c unistr/test-strdup.h macros.h \ + unistr/test-u8-strlen.c macros.h unistr/test-u8-strmblen.c \ + macros.h unistr/test-u8-strmbtouc.c macros.h \ + unistr/test-u8-strncat.c unistr/test-strncat.h zerosize-ptr.h \ + macros.h unistr/test-u8-strncmp.c unistr/test-strncmp.h \ + macros.h unistr/test-u8-strncpy.c unistr/test-strncpy.h \ + zerosize-ptr.h macros.h unistr/test-u8-strnlen.c \ + unistr/test-strnlen.h zerosize-ptr.h macros.h \ + unistr/test-u8-to-u16.c macros.h unistr/test-u8-to-u32.c \ + macros.h unistr/test-u8-uctomb.c macros.h \ + uniwbrk/test-u16-wordbreaks.c macros.h \ + uniwbrk/test-u32-wordbreaks.c macros.h \ + uniwbrk/test-u8-wordbreaks.c macros.h \ uniwbrk/test-ulc-wordbreaks.sh uniwbrk/test-ulc-wordbreaks.c \ - uniwidth/test-u16-strwidth.c uniwidth/test-u16-width.c \ - uniwidth/test-u32-strwidth.c uniwidth/test-u32-width.c \ - uniwidth/test-u8-strwidth.c uniwidth/test-u8-width.c \ + macros.h uniwidth/test-u16-strwidth.c macros.h \ + uniwidth/test-u16-width.c macros.h \ + uniwidth/test-u32-strwidth.c macros.h \ + uniwidth/test-u32-width.c macros.h uniwidth/test-u8-strwidth.c \ + macros.h uniwidth/test-u8-width.c macros.h \ uniwidth/test-uc_width.c uniwidth/test-uc_width2.c \ - uniwidth/test-uc_width2.sh unsetenv.c test-wchar.c wctob.c \ - test-wctype.c test-wcwidth.c xalloc.h xmalloc.c -BUILT_SOURCES = $(FCNTL_H) $(LOCALE_H) + uniwidth/test-uc_width2.sh macros.h unsetenv.c test-unsetenv.c \ + signature.h macros.h \ + $(top_srcdir)/build-aux/unused-parameter.h \ + $(top_srcdir)/build-aux/warn-on-use.h test-wchar.c wctob.c \ + test-wctype.c macros.h test-wcwidth.c signature.h macros.h \ + xalloc.h xmalloc.c test-xalloc-die.c test-xalloc-die.sh \ + init.sh + +# The BUILT_SOURCES created by this Makefile snippet are not used via #include +# statements but through direct file reference. Therefore this snippet must be +# present in all Makefile.am that need it. This is ensured by the applicability +# 'all' defined above. + +# The BUILT_SOURCES created by this Makefile snippet are not used via #include +# statements but through direct file reference. Therefore this snippet must be +# present in all Makefile.am that need it. This is ensured by the applicability +# 'all' defined above. + +# The BUILT_SOURCES created by this Makefile snippet are not used via #include +# statements but through direct file reference. Therefore this snippet must be +# present in all Makefile.am that need it. This is ensured by the applicability +# 'all' defined above. +BUILT_SOURCES = arg-nonnull.h c++defs.h locale.h unused-parameter.h \ + warn-on-use.h SUFFIXES = -MOSTLYCLEANFILES = core *.stackdump fcntl.h fcntl.h-t locale.h \ - locale.h-t +MOSTLYCLEANFILES = core *.stackdump arg-nonnull.h arg-nonnull.h-t \ + c++defs.h c++defs.h-t locale.h locale.h-t unused-parameter.h \ + unused-parameter.h-t warn-on-use.h warn-on-use.h-t MOSTLYCLEANDIRS = CLEANFILES = DISTCLEANFILES = MAINTAINERCLEANFILES = AM_CPPFLAGS = \ + -D@gltests_WITNESS@=1 \ -I. -I$(srcdir) \ -I.. -I$(srcdir)/.. \ -I../lib -I$(srcdir)/../lib LDADD = libtests.a ../lib/libunistring.la libtests.a $(LIBTESTS_LIBDEPS) -libtests_a_SOURCES = gettext.h progname.h progname.c xalloc-die.c +libtests_a_SOURCES = exitfail.c gettext.h progname.h progname.c \ + glthread/thread.h glthread/thread.c xalloc-die.c \ + glthread/yield.h libtests_a_LIBADD = $(gltests_LIBOBJS) libtests_a_DEPENDENCIES = $(gltests_LIBOBJS) -EXTRA_libtests_a_SOURCES = error.c exitfail.c open.c setenv.c \ +EXTRA_libtests_a_SOURCES = error.c getpagesize.c putenv.c setenv.c \ strerror.c unsetenv.c wctob.c xmalloc.c AM_LIBTOOLFLAGS = --preserve-dup-deps +ARG_NONNULL_H = arg-nonnull.h +CXXDEFS_H = c++defs.h test_frexpl_nolibm_SOURCES = test-frexpl.c test_iconv_LDADD = $(LDADD) @LIBICONV@ test_localename_LDADD = $(LDADD) @INTL_MACOSX_LIBS@ +test_lock_LDADD = $(LDADD) @LIBMULTITHREAD@ @YIELD_LIB@ test_striconveh_LDADD = $(LDADD) @LIBICONV@ test_striconveha_LDADD = $(LDADD) @LIBICONV@ test_cased_SOURCES = unicase/test-cased.c @@ -3974,6 +4929,105 @@ test_ulc_vsnprintf1_SOURCES = unistdio/test-ulc-vsnprintf1.c test_ulc_vsnprintf1_LDADD = $(LDADD) @LIBINTL@ @LIBICONV@ test_ulc_vsprintf1_SOURCES = unistdio/test-ulc-vsprintf1.c test_ulc_vsprintf1_LDADD = $(LDADD) @LIBINTL@ @LIBICONV@ +test_u16_check_SOURCES = unistr/test-u16-check.c +test_u16_chr_SOURCES = unistr/test-u16-chr.c +test_u16_cmp_SOURCES = unistr/test-u16-cmp.c +test_u16_cmp2_SOURCES = unistr/test-u16-cmp2.c +test_u16_cpy_alloc_SOURCES = unistr/test-u16-cpy-alloc.c +test_u16_cpy_SOURCES = unistr/test-u16-cpy.c +test_u16_mblen_SOURCES = unistr/test-u16-mblen.c +test_u16_mbsnlen_SOURCES = unistr/test-u16-mbsnlen.c +test_u16_mbtouc_SOURCES = unistr/test-u16-mbtouc.c +test_u16_mbtouc_unsafe_SOURCES = unistr/test-u16-mbtouc-unsafe.c +test_u16_mbtoucr_SOURCES = unistr/test-u16-mbtoucr.c +test_u16_move_SOURCES = unistr/test-u16-move.c +test_u16_next_SOURCES = unistr/test-u16-next.c +test_u16_prev_SOURCES = unistr/test-u16-prev.c +test_u16_set_SOURCES = unistr/test-u16-set.c +test_u16_stpcpy_SOURCES = unistr/test-u16-stpcpy.c +test_u16_stpncpy_SOURCES = unistr/test-u16-stpncpy.c +test_u16_strcat_SOURCES = unistr/test-u16-strcat.c +test_u16_strcmp_SOURCES = unistr/test-u16-strcmp.c +test_u16_strcoll_SOURCES = unistr/test-u16-strcoll.c +test_u16_strcoll_LDADD = $(LDADD) @LIBICONV@ +test_u16_strcpy_SOURCES = unistr/test-u16-strcpy.c +test_u16_strdup_SOURCES = unistr/test-u16-strdup.c +test_u16_strlen_SOURCES = unistr/test-u16-strlen.c +test_u16_strmblen_SOURCES = unistr/test-u16-strmblen.c +test_u16_strmbtouc_SOURCES = unistr/test-u16-strmbtouc.c +test_u16_strncat_SOURCES = unistr/test-u16-strncat.c +test_u16_strncmp_SOURCES = unistr/test-u16-strncmp.c +test_u16_strncpy_SOURCES = unistr/test-u16-strncpy.c +test_u16_strnlen_SOURCES = unistr/test-u16-strnlen.c +test_u16_to_u32_SOURCES = unistr/test-u16-to-u32.c +test_u16_to_u8_SOURCES = unistr/test-u16-to-u8.c +test_u16_uctomb_SOURCES = unistr/test-u16-uctomb.c +test_u32_check_SOURCES = unistr/test-u32-check.c +test_u32_chr_SOURCES = unistr/test-u32-chr.c +test_u32_cmp_SOURCES = unistr/test-u32-cmp.c +test_u32_cmp2_SOURCES = unistr/test-u32-cmp2.c +test_u32_cpy_alloc_SOURCES = unistr/test-u32-cpy-alloc.c +test_u32_cpy_SOURCES = unistr/test-u32-cpy.c +test_u32_mblen_SOURCES = unistr/test-u32-mblen.c +test_u32_mbsnlen_SOURCES = unistr/test-u32-mbsnlen.c +test_u32_mbtouc_SOURCES = unistr/test-u32-mbtouc.c +test_u32_mbtouc_unsafe_SOURCES = unistr/test-u32-mbtouc-unsafe.c +test_u32_mbtoucr_SOURCES = unistr/test-u32-mbtoucr.c +test_u32_move_SOURCES = unistr/test-u32-move.c +test_u32_next_SOURCES = unistr/test-u32-next.c +test_u32_prev_SOURCES = unistr/test-u32-prev.c +test_u32_set_SOURCES = unistr/test-u32-set.c +test_u32_stpcpy_SOURCES = unistr/test-u32-stpcpy.c +test_u32_stpncpy_SOURCES = unistr/test-u32-stpncpy.c +test_u32_strcat_SOURCES = unistr/test-u32-strcat.c +test_u32_strcmp_SOURCES = unistr/test-u32-strcmp.c +test_u32_strcoll_SOURCES = unistr/test-u32-strcoll.c +test_u32_strcoll_LDADD = $(LDADD) @LIBICONV@ +test_u32_strcpy_SOURCES = unistr/test-u32-strcpy.c +test_u32_strdup_SOURCES = unistr/test-u32-strdup.c +test_u32_strlen_SOURCES = unistr/test-u32-strlen.c +test_u32_strmblen_SOURCES = unistr/test-u32-strmblen.c +test_u32_strmbtouc_SOURCES = unistr/test-u32-strmbtouc.c +test_u32_strncat_SOURCES = unistr/test-u32-strncat.c +test_u32_strncmp_SOURCES = unistr/test-u32-strncmp.c +test_u32_strncpy_SOURCES = unistr/test-u32-strncpy.c +test_u32_strnlen_SOURCES = unistr/test-u32-strnlen.c +test_u32_to_u16_SOURCES = unistr/test-u32-to-u16.c +test_u32_to_u8_SOURCES = unistr/test-u32-to-u8.c +test_u32_uctomb_SOURCES = unistr/test-u32-uctomb.c +test_u8_check_SOURCES = unistr/test-u8-check.c +test_u8_chr_SOURCES = unistr/test-u8-chr.c +test_u8_cmp_SOURCES = unistr/test-u8-cmp.c +test_u8_cmp2_SOURCES = unistr/test-u8-cmp2.c +test_u8_cpy_alloc_SOURCES = unistr/test-u8-cpy-alloc.c +test_u8_cpy_SOURCES = unistr/test-u8-cpy.c +test_u8_mblen_SOURCES = unistr/test-u8-mblen.c +test_u8_mbsnlen_SOURCES = unistr/test-u8-mbsnlen.c +test_u8_mbtouc_SOURCES = unistr/test-u8-mbtouc.c +test_u8_mbtouc_unsafe_SOURCES = unistr/test-u8-mbtouc-unsafe.c +test_u8_mbtoucr_SOURCES = unistr/test-u8-mbtoucr.c +test_u8_move_SOURCES = unistr/test-u8-move.c +test_u8_next_SOURCES = unistr/test-u8-next.c +test_u8_prev_SOURCES = unistr/test-u8-prev.c +test_u8_set_SOURCES = unistr/test-u8-set.c +test_u8_stpcpy_SOURCES = unistr/test-u8-stpcpy.c +test_u8_stpncpy_SOURCES = unistr/test-u8-stpncpy.c +test_u8_strcat_SOURCES = unistr/test-u8-strcat.c +test_u8_strcmp_SOURCES = unistr/test-u8-strcmp.c +test_u8_strcoll_SOURCES = unistr/test-u8-strcoll.c +test_u8_strcoll_LDADD = $(LDADD) @LIBICONV@ +test_u8_strcpy_SOURCES = unistr/test-u8-strcpy.c +test_u8_strdup_SOURCES = unistr/test-u8-strdup.c +test_u8_strlen_SOURCES = unistr/test-u8-strlen.c +test_u8_strmblen_SOURCES = unistr/test-u8-strmblen.c +test_u8_strmbtouc_SOURCES = unistr/test-u8-strmbtouc.c +test_u8_strncat_SOURCES = unistr/test-u8-strncat.c +test_u8_strncmp_SOURCES = unistr/test-u8-strncmp.c +test_u8_strncpy_SOURCES = unistr/test-u8-strncpy.c +test_u8_strnlen_SOURCES = unistr/test-u8-strnlen.c +test_u8_to_u16_SOURCES = unistr/test-u8-to-u16.c +test_u8_to_u32_SOURCES = unistr/test-u8-to-u32.c +test_u8_uctomb_SOURCES = unistr/test-u8-uctomb.c test_u16_wordbreaks_SOURCES = uniwbrk/test-u16-wordbreaks.c test_u32_wordbreaks_SOURCES = uniwbrk/test-u32-wordbreaks.c test_u8_wordbreaks_SOURCES = uniwbrk/test-u8-wordbreaks.c @@ -3987,6 +5041,9 @@ test_u8_strwidth_SOURCES = uniwidth/test-u8-strwidth.c test_u8_width_SOURCES = uniwidth/test-u8-width.c test_uc_width_SOURCES = uniwidth/test-uc_width.c test_uc_width2_SOURCES = uniwidth/test-uc_width2.c +UNUSED_PARAMETER_H = unused-parameter.h +WARN_ON_USE_H = warn-on-use.h +test_xalloc_die_LDADD = $(LDADD) @LIBINTL@ # Ensure that ../lib/config.h is seen before ../config.h. DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/lib -I$(top_builddir) @@ -4038,6 +5095,14 @@ clean-checkLIBRARIES: clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +glthread/$(am__dirstamp): + @$(MKDIR_P) glthread + @: > glthread/$(am__dirstamp) +glthread/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) glthread/$(DEPDIR) + @: > glthread/$(DEPDIR)/$(am__dirstamp) +glthread/thread.$(OBJEXT): glthread/$(am__dirstamp) \ + glthread/$(DEPDIR)/$(am__dirstamp) libtests.a: $(libtests_a_OBJECTS) $(libtests_a_DEPENDENCIES) $(AM_V_at)-rm -f libtests.a $(AM_V_AR)$(libtests_a_AR) libtests.a $(libtests_a_OBJECTS) $(libtests_a_LIBADD) @@ -4458,18 +5523,12 @@ unictype/test-digit.$(OBJEXT): unictype/$(am__dirstamp) \ test-digit$(EXEEXT): $(test_digit_OBJECTS) $(test_digit_DEPENDENCIES) @rm -f test-digit$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_digit_OBJECTS) $(test_digit_LDADD) $(LIBS) -test-dup2$(EXEEXT): $(test_dup2_OBJECTS) $(test_dup2_DEPENDENCIES) - @rm -f test-dup2$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_dup2_OBJECTS) $(test_dup2_LDADD) $(LIBS) test-environ$(EXEEXT): $(test_environ_OBJECTS) $(test_environ_DEPENDENCIES) @rm -f test-environ$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_environ_OBJECTS) $(test_environ_LDADD) $(LIBS) test-errno$(EXEEXT): $(test_errno_OBJECTS) $(test_errno_DEPENDENCIES) @rm -f test-errno$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_errno_OBJECTS) $(test_errno_LDADD) $(LIBS) -test-fcntl$(EXEEXT): $(test_fcntl_OBJECTS) $(test_fcntl_DEPENDENCIES) - @rm -f test-fcntl$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_fcntl_OBJECTS) $(test_fcntl_LDADD) $(LIBS) test-frexpl-nolibm$(EXEEXT): $(test_frexpl_nolibm_OBJECTS) $(test_frexpl_nolibm_DEPENDENCIES) @rm -f test-frexpl-nolibm$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_frexpl_nolibm_OBJECTS) $(test_frexpl_nolibm_LDADD) $(LIBS) @@ -4479,6 +5538,9 @@ test-fseterr$(EXEEXT): $(test_fseterr_OBJECTS) $(test_fseterr_DEPENDENCIES) test-iconv$(EXEEXT): $(test_iconv_OBJECTS) $(test_iconv_DEPENDENCIES) @rm -f test-iconv$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_iconv_OBJECTS) $(test_iconv_LDADD) $(LIBS) +test-iconv-h$(EXEEXT): $(test_iconv_h_OBJECTS) $(test_iconv_h_DEPENDENCIES) + @rm -f test-iconv-h$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_iconv_h_OBJECTS) $(test_iconv_h_LDADD) $(LIBS) unicase/test-ignorable.$(OBJEXT): unicase/$(am__dirstamp) \ unicase/$(DEPDIR)/$(am__dirstamp) test-ignorable$(EXEEXT): $(test_ignorable_OBJECTS) $(test_ignorable_DEPENDENCIES) @@ -4504,6 +5566,9 @@ test-locale-language$(EXEEXT): $(test_locale_language_OBJECTS) $(test_locale_lan test-localename$(EXEEXT): $(test_localename_OBJECTS) $(test_localename_DEPENDENCIES) @rm -f test-localename$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_localename_OBJECTS) $(test_localename_LDADD) $(LIBS) +test-lock$(EXEEXT): $(test_lock_OBJECTS) $(test_lock_DEPENDENCIES) + @rm -f test-lock$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_lock_OBJECTS) $(test_lock_LDADD) $(LIBS) test-malloca$(EXEEXT): $(test_malloca_OBJECTS) $(test_malloca_DEPENDENCIES) @rm -f test-malloca$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_malloca_OBJECTS) $(test_malloca_LDADD) $(LIBS) @@ -4573,9 +5638,6 @@ unictype/test-numeric.$(OBJEXT): unictype/$(am__dirstamp) \ test-numeric$(EXEEXT): $(test_numeric_OBJECTS) $(test_numeric_DEPENDENCIES) @rm -f test-numeric$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_numeric_OBJECTS) $(test_numeric_LDADD) $(LIBS) -test-open$(EXEEXT): $(test_open_OBJECTS) $(test_open_DEPENDENCIES) - @rm -f test-open$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_open_OBJECTS) $(test_open_LDADD) $(LIBS) unictype/test-pr_alphabetic.$(OBJEXT): unictype/$(am__dirstamp) \ unictype/$(DEPDIR)/$(am__dirstamp) test-pr_alphabetic$(EXEEXT): $(test_pr_alphabetic_OBJECTS) $(test_pr_alphabetic_DEPENDENCIES) @@ -4992,6 +6054,9 @@ unictype/test-scripts.$(OBJEXT): unictype/$(am__dirstamp) \ test-scripts$(EXEEXT): $(test_scripts_OBJECTS) $(test_scripts_DEPENDENCIES) @rm -f test-scripts$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_scripts_OBJECTS) $(test_scripts_LDADD) $(LIBS) +test-setenv$(EXEEXT): $(test_setenv_OBJECTS) $(test_setenv_DEPENDENCIES) + @rm -f test-setenv$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_setenv_OBJECTS) $(test_setenv_LDADD) $(LIBS) test-signbit$(EXEEXT): $(test_signbit_OBJECTS) $(test_signbit_DEPENDENCIES) @rm -f test-signbit$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_signbit_OBJECTS) $(test_signbit_LDADD) $(LIBS) @@ -5019,6 +6084,9 @@ test-striconveha$(EXEEXT): $(test_striconveha_OBJECTS) $(test_striconveha_DEPEND test-string$(EXEEXT): $(test_string_OBJECTS) $(test_string_DEPENDENCIES) @rm -f test-string$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_string_OBJECTS) $(test_string_LDADD) $(LIBS) +test-strncat$(EXEEXT): $(test_strncat_OBJECTS) $(test_strncat_DEPENDENCIES) + @rm -f test-strncat$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_strncat_OBJECTS) $(test_strncat_LDADD) $(LIBS) unictype/test-sy_c_ident.$(OBJEXT): unictype/$(am__dirstamp) \ unictype/$(DEPDIR)/$(am__dirstamp) test-sy_c_ident$(EXEEXT): $(test_sy_c_ident_OBJECTS) $(test_sy_c_ident_DEPENDENCIES) @@ -5065,6 +6133,32 @@ unicase/test-u16-casefold.$(OBJEXT): unicase/$(am__dirstamp) \ test-u16-casefold$(EXEEXT): $(test_u16_casefold_OBJECTS) $(test_u16_casefold_DEPENDENCIES) @rm -f test-u16-casefold$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u16_casefold_OBJECTS) $(test_u16_casefold_LDADD) $(LIBS) +unistr/$(am__dirstamp): + @$(MKDIR_P) unistr + @: > unistr/$(am__dirstamp) +unistr/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) unistr/$(DEPDIR) + @: > unistr/$(DEPDIR)/$(am__dirstamp) +unistr/test-u16-check.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-check$(EXEEXT): $(test_u16_check_OBJECTS) $(test_u16_check_DEPENDENCIES) + @rm -f test-u16-check$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_check_OBJECTS) $(test_u16_check_LDADD) $(LIBS) +unistr/test-u16-chr.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-chr$(EXEEXT): $(test_u16_chr_OBJECTS) $(test_u16_chr_DEPENDENCIES) + @rm -f test-u16-chr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_chr_OBJECTS) $(test_u16_chr_LDADD) $(LIBS) +unistr/test-u16-cmp.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-cmp$(EXEEXT): $(test_u16_cmp_OBJECTS) $(test_u16_cmp_DEPENDENCIES) + @rm -f test-u16-cmp$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_cmp_OBJECTS) $(test_u16_cmp_LDADD) $(LIBS) +unistr/test-u16-cmp2.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-cmp2$(EXEEXT): $(test_u16_cmp2_OBJECTS) $(test_u16_cmp2_DEPENDENCIES) + @rm -f test-u16-cmp2$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_cmp2_OBJECTS) $(test_u16_cmp2_LDADD) $(LIBS) uniconv/$(am__dirstamp): @$(MKDIR_P) uniconv @: > uniconv/$(am__dirstamp) @@ -5081,6 +6175,16 @@ uniconv/test-u16-conv-to-enc.$(OBJEXT): uniconv/$(am__dirstamp) \ test-u16-conv-to-enc$(EXEEXT): $(test_u16_conv_to_enc_OBJECTS) $(test_u16_conv_to_enc_DEPENDENCIES) @rm -f test-u16-conv-to-enc$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u16_conv_to_enc_OBJECTS) $(test_u16_conv_to_enc_LDADD) $(LIBS) +unistr/test-u16-cpy.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-cpy$(EXEEXT): $(test_u16_cpy_OBJECTS) $(test_u16_cpy_DEPENDENCIES) + @rm -f test-u16-cpy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_cpy_OBJECTS) $(test_u16_cpy_LDADD) $(LIBS) +unistr/test-u16-cpy-alloc.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-cpy-alloc$(EXEEXT): $(test_u16_cpy_alloc_OBJECTS) $(test_u16_cpy_alloc_DEPENDENCIES) + @rm -f test-u16-cpy-alloc$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_cpy_alloc_OBJECTS) $(test_u16_cpy_alloc_LDADD) $(LIBS) unicase/test-u16-is-cased.$(OBJEXT): unicase/$(am__dirstamp) \ unicase/$(DEPDIR)/$(am__dirstamp) test-u16-is-cased$(EXEEXT): $(test_u16_is_cased_OBJECTS) $(test_u16_is_cased_DEPENDENCIES) @@ -5106,6 +6210,41 @@ unicase/test-u16-is-uppercase.$(OBJEXT): unicase/$(am__dirstamp) \ test-u16-is-uppercase$(EXEEXT): $(test_u16_is_uppercase_OBJECTS) $(test_u16_is_uppercase_DEPENDENCIES) @rm -f test-u16-is-uppercase$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u16_is_uppercase_OBJECTS) $(test_u16_is_uppercase_LDADD) $(LIBS) +unistr/test-u16-mblen.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-mblen$(EXEEXT): $(test_u16_mblen_OBJECTS) $(test_u16_mblen_DEPENDENCIES) + @rm -f test-u16-mblen$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_mblen_OBJECTS) $(test_u16_mblen_LDADD) $(LIBS) +unistr/test-u16-mbsnlen.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-mbsnlen$(EXEEXT): $(test_u16_mbsnlen_OBJECTS) $(test_u16_mbsnlen_DEPENDENCIES) + @rm -f test-u16-mbsnlen$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_mbsnlen_OBJECTS) $(test_u16_mbsnlen_LDADD) $(LIBS) +unistr/test-u16-mbtouc.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-mbtouc$(EXEEXT): $(test_u16_mbtouc_OBJECTS) $(test_u16_mbtouc_DEPENDENCIES) + @rm -f test-u16-mbtouc$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_mbtouc_OBJECTS) $(test_u16_mbtouc_LDADD) $(LIBS) +unistr/test-u16-mbtouc-unsafe.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-mbtouc-unsafe$(EXEEXT): $(test_u16_mbtouc_unsafe_OBJECTS) $(test_u16_mbtouc_unsafe_DEPENDENCIES) + @rm -f test-u16-mbtouc-unsafe$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_mbtouc_unsafe_OBJECTS) $(test_u16_mbtouc_unsafe_LDADD) $(LIBS) +unistr/test-u16-mbtoucr.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-mbtoucr$(EXEEXT): $(test_u16_mbtoucr_OBJECTS) $(test_u16_mbtoucr_DEPENDENCIES) + @rm -f test-u16-mbtoucr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_mbtoucr_OBJECTS) $(test_u16_mbtoucr_LDADD) $(LIBS) +unistr/test-u16-move.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-move$(EXEEXT): $(test_u16_move_OBJECTS) $(test_u16_move_DEPENDENCIES) + @rm -f test-u16-move$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_move_OBJECTS) $(test_u16_move_LDADD) $(LIBS) +unistr/test-u16-next.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-next$(EXEEXT): $(test_u16_next_OBJECTS) $(test_u16_next_DEPENDENCIES) + @rm -f test-u16-next$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_next_OBJECTS) $(test_u16_next_LDADD) $(LIBS) uninorm/test-u16-normcmp.$(OBJEXT): uninorm/$(am__dirstamp) \ uninorm/$(DEPDIR)/$(am__dirstamp) test-u16-normcmp$(EXEEXT): $(test_u16_normcmp_OBJECTS) $(test_u16_normcmp_DEPENDENCIES) @@ -5127,6 +6266,41 @@ unilbrk/test-u16-possible-linebreaks.$(OBJEXT): \ test-u16-possible-linebreaks$(EXEEXT): $(test_u16_possible_linebreaks_OBJECTS) $(test_u16_possible_linebreaks_DEPENDENCIES) @rm -f test-u16-possible-linebreaks$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u16_possible_linebreaks_OBJECTS) $(test_u16_possible_linebreaks_LDADD) $(LIBS) +unistr/test-u16-prev.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-prev$(EXEEXT): $(test_u16_prev_OBJECTS) $(test_u16_prev_DEPENDENCIES) + @rm -f test-u16-prev$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_prev_OBJECTS) $(test_u16_prev_LDADD) $(LIBS) +unistr/test-u16-set.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-set$(EXEEXT): $(test_u16_set_OBJECTS) $(test_u16_set_DEPENDENCIES) + @rm -f test-u16-set$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_set_OBJECTS) $(test_u16_set_LDADD) $(LIBS) +unistr/test-u16-stpcpy.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-stpcpy$(EXEEXT): $(test_u16_stpcpy_OBJECTS) $(test_u16_stpcpy_DEPENDENCIES) + @rm -f test-u16-stpcpy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_stpcpy_OBJECTS) $(test_u16_stpcpy_LDADD) $(LIBS) +unistr/test-u16-stpncpy.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-stpncpy$(EXEEXT): $(test_u16_stpncpy_OBJECTS) $(test_u16_stpncpy_DEPENDENCIES) + @rm -f test-u16-stpncpy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_stpncpy_OBJECTS) $(test_u16_stpncpy_LDADD) $(LIBS) +unistr/test-u16-strcat.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-strcat$(EXEEXT): $(test_u16_strcat_OBJECTS) $(test_u16_strcat_DEPENDENCIES) + @rm -f test-u16-strcat$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_strcat_OBJECTS) $(test_u16_strcat_LDADD) $(LIBS) +unistr/test-u16-strcmp.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-strcmp$(EXEEXT): $(test_u16_strcmp_OBJECTS) $(test_u16_strcmp_DEPENDENCIES) + @rm -f test-u16-strcmp$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_strcmp_OBJECTS) $(test_u16_strcmp_LDADD) $(LIBS) +unistr/test-u16-strcoll.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-strcoll$(EXEEXT): $(test_u16_strcoll_OBJECTS) $(test_u16_strcoll_DEPENDENCIES) + @rm -f test-u16-strcoll$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_strcoll_OBJECTS) $(test_u16_strcoll_LDADD) $(LIBS) uniconv/test-u16-strconv-from-enc.$(OBJEXT): uniconv/$(am__dirstamp) \ uniconv/$(DEPDIR)/$(am__dirstamp) test-u16-strconv-from-enc$(EXEEXT): $(test_u16_strconv_from_enc_OBJECTS) $(test_u16_strconv_from_enc_DEPENDENCIES) @@ -5137,6 +6311,51 @@ uniconv/test-u16-strconv-to-enc.$(OBJEXT): uniconv/$(am__dirstamp) \ test-u16-strconv-to-enc$(EXEEXT): $(test_u16_strconv_to_enc_OBJECTS) $(test_u16_strconv_to_enc_DEPENDENCIES) @rm -f test-u16-strconv-to-enc$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u16_strconv_to_enc_OBJECTS) $(test_u16_strconv_to_enc_LDADD) $(LIBS) +unistr/test-u16-strcpy.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-strcpy$(EXEEXT): $(test_u16_strcpy_OBJECTS) $(test_u16_strcpy_DEPENDENCIES) + @rm -f test-u16-strcpy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_strcpy_OBJECTS) $(test_u16_strcpy_LDADD) $(LIBS) +unistr/test-u16-strdup.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-strdup$(EXEEXT): $(test_u16_strdup_OBJECTS) $(test_u16_strdup_DEPENDENCIES) + @rm -f test-u16-strdup$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_strdup_OBJECTS) $(test_u16_strdup_LDADD) $(LIBS) +unistr/test-u16-strlen.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-strlen$(EXEEXT): $(test_u16_strlen_OBJECTS) $(test_u16_strlen_DEPENDENCIES) + @rm -f test-u16-strlen$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_strlen_OBJECTS) $(test_u16_strlen_LDADD) $(LIBS) +unistr/test-u16-strmblen.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-strmblen$(EXEEXT): $(test_u16_strmblen_OBJECTS) $(test_u16_strmblen_DEPENDENCIES) + @rm -f test-u16-strmblen$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_strmblen_OBJECTS) $(test_u16_strmblen_LDADD) $(LIBS) +unistr/test-u16-strmbtouc.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-strmbtouc$(EXEEXT): $(test_u16_strmbtouc_OBJECTS) $(test_u16_strmbtouc_DEPENDENCIES) + @rm -f test-u16-strmbtouc$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_strmbtouc_OBJECTS) $(test_u16_strmbtouc_LDADD) $(LIBS) +unistr/test-u16-strncat.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-strncat$(EXEEXT): $(test_u16_strncat_OBJECTS) $(test_u16_strncat_DEPENDENCIES) + @rm -f test-u16-strncat$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_strncat_OBJECTS) $(test_u16_strncat_LDADD) $(LIBS) +unistr/test-u16-strncmp.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-strncmp$(EXEEXT): $(test_u16_strncmp_OBJECTS) $(test_u16_strncmp_DEPENDENCIES) + @rm -f test-u16-strncmp$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_strncmp_OBJECTS) $(test_u16_strncmp_LDADD) $(LIBS) +unistr/test-u16-strncpy.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-strncpy$(EXEEXT): $(test_u16_strncpy_OBJECTS) $(test_u16_strncpy_DEPENDENCIES) + @rm -f test-u16-strncpy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_strncpy_OBJECTS) $(test_u16_strncpy_LDADD) $(LIBS) +unistr/test-u16-strnlen.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-strnlen$(EXEEXT): $(test_u16_strnlen_OBJECTS) $(test_u16_strnlen_DEPENDENCIES) + @rm -f test-u16-strnlen$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_strnlen_OBJECTS) $(test_u16_strnlen_LDADD) $(LIBS) uniwidth/$(am__dirstamp): @$(MKDIR_P) uniwidth @: > uniwidth/$(am__dirstamp) @@ -5148,6 +6367,16 @@ uniwidth/test-u16-strwidth.$(OBJEXT): uniwidth/$(am__dirstamp) \ test-u16-strwidth$(EXEEXT): $(test_u16_strwidth_OBJECTS) $(test_u16_strwidth_DEPENDENCIES) @rm -f test-u16-strwidth$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u16_strwidth_OBJECTS) $(test_u16_strwidth_LDADD) $(LIBS) +unistr/test-u16-to-u32.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-to-u32$(EXEEXT): $(test_u16_to_u32_OBJECTS) $(test_u16_to_u32_DEPENDENCIES) + @rm -f test-u16-to-u32$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_to_u32_OBJECTS) $(test_u16_to_u32_LDADD) $(LIBS) +unistr/test-u16-to-u8.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-to-u8$(EXEEXT): $(test_u16_to_u8_OBJECTS) $(test_u16_to_u8_DEPENDENCIES) + @rm -f test-u16-to-u8$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_to_u8_OBJECTS) $(test_u16_to_u8_LDADD) $(LIBS) unicase/test-u16-tolower.$(OBJEXT): unicase/$(am__dirstamp) \ unicase/$(DEPDIR)/$(am__dirstamp) test-u16-tolower$(EXEEXT): $(test_u16_tolower_OBJECTS) $(test_u16_tolower_DEPENDENCIES) @@ -5163,6 +6392,11 @@ unicase/test-u16-toupper.$(OBJEXT): unicase/$(am__dirstamp) \ test-u16-toupper$(EXEEXT): $(test_u16_toupper_OBJECTS) $(test_u16_toupper_DEPENDENCIES) @rm -f test-u16-toupper$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u16_toupper_OBJECTS) $(test_u16_toupper_LDADD) $(LIBS) +unistr/test-u16-uctomb.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u16-uctomb$(EXEEXT): $(test_u16_uctomb_OBJECTS) $(test_u16_uctomb_DEPENDENCIES) + @rm -f test-u16-uctomb$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u16_uctomb_OBJECTS) $(test_u16_uctomb_LDADD) $(LIBS) unistdio/test-u16-vasnprintf1.$(OBJEXT): unistdio/$(am__dirstamp) \ unistdio/$(DEPDIR)/$(am__dirstamp) test-u16-vasnprintf1$(EXEEXT): $(test_u16_vasnprintf1_OBJECTS) $(test_u16_vasnprintf1_DEPENDENCIES) @@ -5234,6 +6468,26 @@ unicase/test-u32-casefold.$(OBJEXT): unicase/$(am__dirstamp) \ test-u32-casefold$(EXEEXT): $(test_u32_casefold_OBJECTS) $(test_u32_casefold_DEPENDENCIES) @rm -f test-u32-casefold$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u32_casefold_OBJECTS) $(test_u32_casefold_LDADD) $(LIBS) +unistr/test-u32-check.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-check$(EXEEXT): $(test_u32_check_OBJECTS) $(test_u32_check_DEPENDENCIES) + @rm -f test-u32-check$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_check_OBJECTS) $(test_u32_check_LDADD) $(LIBS) +unistr/test-u32-chr.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-chr$(EXEEXT): $(test_u32_chr_OBJECTS) $(test_u32_chr_DEPENDENCIES) + @rm -f test-u32-chr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_chr_OBJECTS) $(test_u32_chr_LDADD) $(LIBS) +unistr/test-u32-cmp.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-cmp$(EXEEXT): $(test_u32_cmp_OBJECTS) $(test_u32_cmp_DEPENDENCIES) + @rm -f test-u32-cmp$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_cmp_OBJECTS) $(test_u32_cmp_LDADD) $(LIBS) +unistr/test-u32-cmp2.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-cmp2$(EXEEXT): $(test_u32_cmp2_OBJECTS) $(test_u32_cmp2_DEPENDENCIES) + @rm -f test-u32-cmp2$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_cmp2_OBJECTS) $(test_u32_cmp2_LDADD) $(LIBS) uniconv/test-u32-conv-from-enc.$(OBJEXT): uniconv/$(am__dirstamp) \ uniconv/$(DEPDIR)/$(am__dirstamp) test-u32-conv-from-enc$(EXEEXT): $(test_u32_conv_from_enc_OBJECTS) $(test_u32_conv_from_enc_DEPENDENCIES) @@ -5244,6 +6498,16 @@ uniconv/test-u32-conv-to-enc.$(OBJEXT): uniconv/$(am__dirstamp) \ test-u32-conv-to-enc$(EXEEXT): $(test_u32_conv_to_enc_OBJECTS) $(test_u32_conv_to_enc_DEPENDENCIES) @rm -f test-u32-conv-to-enc$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u32_conv_to_enc_OBJECTS) $(test_u32_conv_to_enc_LDADD) $(LIBS) +unistr/test-u32-cpy.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-cpy$(EXEEXT): $(test_u32_cpy_OBJECTS) $(test_u32_cpy_DEPENDENCIES) + @rm -f test-u32-cpy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_cpy_OBJECTS) $(test_u32_cpy_LDADD) $(LIBS) +unistr/test-u32-cpy-alloc.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-cpy-alloc$(EXEEXT): $(test_u32_cpy_alloc_OBJECTS) $(test_u32_cpy_alloc_DEPENDENCIES) + @rm -f test-u32-cpy-alloc$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_cpy_alloc_OBJECTS) $(test_u32_cpy_alloc_LDADD) $(LIBS) unicase/test-u32-is-cased.$(OBJEXT): unicase/$(am__dirstamp) \ unicase/$(DEPDIR)/$(am__dirstamp) test-u32-is-cased$(EXEEXT): $(test_u32_is_cased_OBJECTS) $(test_u32_is_cased_DEPENDENCIES) @@ -5269,6 +6533,41 @@ unicase/test-u32-is-uppercase.$(OBJEXT): unicase/$(am__dirstamp) \ test-u32-is-uppercase$(EXEEXT): $(test_u32_is_uppercase_OBJECTS) $(test_u32_is_uppercase_DEPENDENCIES) @rm -f test-u32-is-uppercase$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u32_is_uppercase_OBJECTS) $(test_u32_is_uppercase_LDADD) $(LIBS) +unistr/test-u32-mblen.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-mblen$(EXEEXT): $(test_u32_mblen_OBJECTS) $(test_u32_mblen_DEPENDENCIES) + @rm -f test-u32-mblen$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_mblen_OBJECTS) $(test_u32_mblen_LDADD) $(LIBS) +unistr/test-u32-mbsnlen.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-mbsnlen$(EXEEXT): $(test_u32_mbsnlen_OBJECTS) $(test_u32_mbsnlen_DEPENDENCIES) + @rm -f test-u32-mbsnlen$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_mbsnlen_OBJECTS) $(test_u32_mbsnlen_LDADD) $(LIBS) +unistr/test-u32-mbtouc.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-mbtouc$(EXEEXT): $(test_u32_mbtouc_OBJECTS) $(test_u32_mbtouc_DEPENDENCIES) + @rm -f test-u32-mbtouc$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_mbtouc_OBJECTS) $(test_u32_mbtouc_LDADD) $(LIBS) +unistr/test-u32-mbtouc-unsafe.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-mbtouc-unsafe$(EXEEXT): $(test_u32_mbtouc_unsafe_OBJECTS) $(test_u32_mbtouc_unsafe_DEPENDENCIES) + @rm -f test-u32-mbtouc-unsafe$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_mbtouc_unsafe_OBJECTS) $(test_u32_mbtouc_unsafe_LDADD) $(LIBS) +unistr/test-u32-mbtoucr.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-mbtoucr$(EXEEXT): $(test_u32_mbtoucr_OBJECTS) $(test_u32_mbtoucr_DEPENDENCIES) + @rm -f test-u32-mbtoucr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_mbtoucr_OBJECTS) $(test_u32_mbtoucr_LDADD) $(LIBS) +unistr/test-u32-move.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-move$(EXEEXT): $(test_u32_move_OBJECTS) $(test_u32_move_DEPENDENCIES) + @rm -f test-u32-move$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_move_OBJECTS) $(test_u32_move_LDADD) $(LIBS) +unistr/test-u32-next.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-next$(EXEEXT): $(test_u32_next_OBJECTS) $(test_u32_next_DEPENDENCIES) + @rm -f test-u32-next$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_next_OBJECTS) $(test_u32_next_LDADD) $(LIBS) uninorm/test-u32-nfc-big.$(OBJEXT): uninorm/$(am__dirstamp) \ uninorm/$(DEPDIR)/$(am__dirstamp) uninorm/test-u32-normalize-big.$(OBJEXT): uninorm/$(am__dirstamp) \ @@ -5306,6 +6605,41 @@ unilbrk/test-u32-possible-linebreaks.$(OBJEXT): \ test-u32-possible-linebreaks$(EXEEXT): $(test_u32_possible_linebreaks_OBJECTS) $(test_u32_possible_linebreaks_DEPENDENCIES) @rm -f test-u32-possible-linebreaks$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u32_possible_linebreaks_OBJECTS) $(test_u32_possible_linebreaks_LDADD) $(LIBS) +unistr/test-u32-prev.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-prev$(EXEEXT): $(test_u32_prev_OBJECTS) $(test_u32_prev_DEPENDENCIES) + @rm -f test-u32-prev$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_prev_OBJECTS) $(test_u32_prev_LDADD) $(LIBS) +unistr/test-u32-set.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-set$(EXEEXT): $(test_u32_set_OBJECTS) $(test_u32_set_DEPENDENCIES) + @rm -f test-u32-set$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_set_OBJECTS) $(test_u32_set_LDADD) $(LIBS) +unistr/test-u32-stpcpy.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-stpcpy$(EXEEXT): $(test_u32_stpcpy_OBJECTS) $(test_u32_stpcpy_DEPENDENCIES) + @rm -f test-u32-stpcpy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_stpcpy_OBJECTS) $(test_u32_stpcpy_LDADD) $(LIBS) +unistr/test-u32-stpncpy.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-stpncpy$(EXEEXT): $(test_u32_stpncpy_OBJECTS) $(test_u32_stpncpy_DEPENDENCIES) + @rm -f test-u32-stpncpy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_stpncpy_OBJECTS) $(test_u32_stpncpy_LDADD) $(LIBS) +unistr/test-u32-strcat.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-strcat$(EXEEXT): $(test_u32_strcat_OBJECTS) $(test_u32_strcat_DEPENDENCIES) + @rm -f test-u32-strcat$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_strcat_OBJECTS) $(test_u32_strcat_LDADD) $(LIBS) +unistr/test-u32-strcmp.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-strcmp$(EXEEXT): $(test_u32_strcmp_OBJECTS) $(test_u32_strcmp_DEPENDENCIES) + @rm -f test-u32-strcmp$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_strcmp_OBJECTS) $(test_u32_strcmp_LDADD) $(LIBS) +unistr/test-u32-strcoll.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-strcoll$(EXEEXT): $(test_u32_strcoll_OBJECTS) $(test_u32_strcoll_DEPENDENCIES) + @rm -f test-u32-strcoll$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_strcoll_OBJECTS) $(test_u32_strcoll_LDADD) $(LIBS) uniconv/test-u32-strconv-from-enc.$(OBJEXT): uniconv/$(am__dirstamp) \ uniconv/$(DEPDIR)/$(am__dirstamp) test-u32-strconv-from-enc$(EXEEXT): $(test_u32_strconv_from_enc_OBJECTS) $(test_u32_strconv_from_enc_DEPENDENCIES) @@ -5316,11 +6650,66 @@ uniconv/test-u32-strconv-to-enc.$(OBJEXT): uniconv/$(am__dirstamp) \ test-u32-strconv-to-enc$(EXEEXT): $(test_u32_strconv_to_enc_OBJECTS) $(test_u32_strconv_to_enc_DEPENDENCIES) @rm -f test-u32-strconv-to-enc$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u32_strconv_to_enc_OBJECTS) $(test_u32_strconv_to_enc_LDADD) $(LIBS) +unistr/test-u32-strcpy.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-strcpy$(EXEEXT): $(test_u32_strcpy_OBJECTS) $(test_u32_strcpy_DEPENDENCIES) + @rm -f test-u32-strcpy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_strcpy_OBJECTS) $(test_u32_strcpy_LDADD) $(LIBS) +unistr/test-u32-strdup.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-strdup$(EXEEXT): $(test_u32_strdup_OBJECTS) $(test_u32_strdup_DEPENDENCIES) + @rm -f test-u32-strdup$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_strdup_OBJECTS) $(test_u32_strdup_LDADD) $(LIBS) +unistr/test-u32-strlen.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-strlen$(EXEEXT): $(test_u32_strlen_OBJECTS) $(test_u32_strlen_DEPENDENCIES) + @rm -f test-u32-strlen$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_strlen_OBJECTS) $(test_u32_strlen_LDADD) $(LIBS) +unistr/test-u32-strmblen.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-strmblen$(EXEEXT): $(test_u32_strmblen_OBJECTS) $(test_u32_strmblen_DEPENDENCIES) + @rm -f test-u32-strmblen$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_strmblen_OBJECTS) $(test_u32_strmblen_LDADD) $(LIBS) +unistr/test-u32-strmbtouc.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-strmbtouc$(EXEEXT): $(test_u32_strmbtouc_OBJECTS) $(test_u32_strmbtouc_DEPENDENCIES) + @rm -f test-u32-strmbtouc$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_strmbtouc_OBJECTS) $(test_u32_strmbtouc_LDADD) $(LIBS) +unistr/test-u32-strncat.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-strncat$(EXEEXT): $(test_u32_strncat_OBJECTS) $(test_u32_strncat_DEPENDENCIES) + @rm -f test-u32-strncat$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_strncat_OBJECTS) $(test_u32_strncat_LDADD) $(LIBS) +unistr/test-u32-strncmp.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-strncmp$(EXEEXT): $(test_u32_strncmp_OBJECTS) $(test_u32_strncmp_DEPENDENCIES) + @rm -f test-u32-strncmp$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_strncmp_OBJECTS) $(test_u32_strncmp_LDADD) $(LIBS) +unistr/test-u32-strncpy.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-strncpy$(EXEEXT): $(test_u32_strncpy_OBJECTS) $(test_u32_strncpy_DEPENDENCIES) + @rm -f test-u32-strncpy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_strncpy_OBJECTS) $(test_u32_strncpy_LDADD) $(LIBS) +unistr/test-u32-strnlen.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-strnlen$(EXEEXT): $(test_u32_strnlen_OBJECTS) $(test_u32_strnlen_DEPENDENCIES) + @rm -f test-u32-strnlen$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_strnlen_OBJECTS) $(test_u32_strnlen_LDADD) $(LIBS) uniwidth/test-u32-strwidth.$(OBJEXT): uniwidth/$(am__dirstamp) \ uniwidth/$(DEPDIR)/$(am__dirstamp) test-u32-strwidth$(EXEEXT): $(test_u32_strwidth_OBJECTS) $(test_u32_strwidth_DEPENDENCIES) @rm -f test-u32-strwidth$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u32_strwidth_OBJECTS) $(test_u32_strwidth_LDADD) $(LIBS) +unistr/test-u32-to-u16.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-to-u16$(EXEEXT): $(test_u32_to_u16_OBJECTS) $(test_u32_to_u16_DEPENDENCIES) + @rm -f test-u32-to-u16$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_to_u16_OBJECTS) $(test_u32_to_u16_LDADD) $(LIBS) +unistr/test-u32-to-u8.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-to-u8$(EXEEXT): $(test_u32_to_u8_OBJECTS) $(test_u32_to_u8_DEPENDENCIES) + @rm -f test-u32-to-u8$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_to_u8_OBJECTS) $(test_u32_to_u8_LDADD) $(LIBS) unicase/test-u32-tolower.$(OBJEXT): unicase/$(am__dirstamp) \ unicase/$(DEPDIR)/$(am__dirstamp) test-u32-tolower$(EXEEXT): $(test_u32_tolower_OBJECTS) $(test_u32_tolower_DEPENDENCIES) @@ -5336,6 +6725,11 @@ unicase/test-u32-toupper.$(OBJEXT): unicase/$(am__dirstamp) \ test-u32-toupper$(EXEEXT): $(test_u32_toupper_OBJECTS) $(test_u32_toupper_DEPENDENCIES) @rm -f test-u32-toupper$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u32_toupper_OBJECTS) $(test_u32_toupper_LDADD) $(LIBS) +unistr/test-u32-uctomb.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u32-uctomb$(EXEEXT): $(test_u32_uctomb_OBJECTS) $(test_u32_uctomb_DEPENDENCIES) + @rm -f test-u32-uctomb$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u32_uctomb_OBJECTS) $(test_u32_uctomb_LDADD) $(LIBS) unistdio/test-u32-vasnprintf1.$(OBJEXT): unistdio/$(am__dirstamp) \ unistdio/$(DEPDIR)/$(am__dirstamp) test-u32-vasnprintf1$(EXEEXT): $(test_u32_vasnprintf1_OBJECTS) $(test_u32_vasnprintf1_DEPENDENCIES) @@ -5401,6 +6795,26 @@ unicase/test-u8-casefold.$(OBJEXT): unicase/$(am__dirstamp) \ test-u8-casefold$(EXEEXT): $(test_u8_casefold_OBJECTS) $(test_u8_casefold_DEPENDENCIES) @rm -f test-u8-casefold$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u8_casefold_OBJECTS) $(test_u8_casefold_LDADD) $(LIBS) +unistr/test-u8-check.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-check$(EXEEXT): $(test_u8_check_OBJECTS) $(test_u8_check_DEPENDENCIES) + @rm -f test-u8-check$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_check_OBJECTS) $(test_u8_check_LDADD) $(LIBS) +unistr/test-u8-chr.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-chr$(EXEEXT): $(test_u8_chr_OBJECTS) $(test_u8_chr_DEPENDENCIES) + @rm -f test-u8-chr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_chr_OBJECTS) $(test_u8_chr_LDADD) $(LIBS) +unistr/test-u8-cmp.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-cmp$(EXEEXT): $(test_u8_cmp_OBJECTS) $(test_u8_cmp_DEPENDENCIES) + @rm -f test-u8-cmp$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_cmp_OBJECTS) $(test_u8_cmp_LDADD) $(LIBS) +unistr/test-u8-cmp2.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-cmp2$(EXEEXT): $(test_u8_cmp2_OBJECTS) $(test_u8_cmp2_DEPENDENCIES) + @rm -f test-u8-cmp2$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_cmp2_OBJECTS) $(test_u8_cmp2_LDADD) $(LIBS) uniconv/test-u8-conv-from-enc.$(OBJEXT): uniconv/$(am__dirstamp) \ uniconv/$(DEPDIR)/$(am__dirstamp) test-u8-conv-from-enc$(EXEEXT): $(test_u8_conv_from_enc_OBJECTS) $(test_u8_conv_from_enc_DEPENDENCIES) @@ -5411,6 +6825,16 @@ uniconv/test-u8-conv-to-enc.$(OBJEXT): uniconv/$(am__dirstamp) \ test-u8-conv-to-enc$(EXEEXT): $(test_u8_conv_to_enc_OBJECTS) $(test_u8_conv_to_enc_DEPENDENCIES) @rm -f test-u8-conv-to-enc$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u8_conv_to_enc_OBJECTS) $(test_u8_conv_to_enc_LDADD) $(LIBS) +unistr/test-u8-cpy.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-cpy$(EXEEXT): $(test_u8_cpy_OBJECTS) $(test_u8_cpy_DEPENDENCIES) + @rm -f test-u8-cpy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_cpy_OBJECTS) $(test_u8_cpy_LDADD) $(LIBS) +unistr/test-u8-cpy-alloc.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-cpy-alloc$(EXEEXT): $(test_u8_cpy_alloc_OBJECTS) $(test_u8_cpy_alloc_DEPENDENCIES) + @rm -f test-u8-cpy-alloc$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_cpy_alloc_OBJECTS) $(test_u8_cpy_alloc_LDADD) $(LIBS) unicase/test-u8-is-cased.$(OBJEXT): unicase/$(am__dirstamp) \ unicase/$(DEPDIR)/$(am__dirstamp) test-u8-is-cased$(EXEEXT): $(test_u8_is_cased_OBJECTS) $(test_u8_is_cased_DEPENDENCIES) @@ -5436,6 +6860,41 @@ unicase/test-u8-is-uppercase.$(OBJEXT): unicase/$(am__dirstamp) \ test-u8-is-uppercase$(EXEEXT): $(test_u8_is_uppercase_OBJECTS) $(test_u8_is_uppercase_DEPENDENCIES) @rm -f test-u8-is-uppercase$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u8_is_uppercase_OBJECTS) $(test_u8_is_uppercase_LDADD) $(LIBS) +unistr/test-u8-mblen.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-mblen$(EXEEXT): $(test_u8_mblen_OBJECTS) $(test_u8_mblen_DEPENDENCIES) + @rm -f test-u8-mblen$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_mblen_OBJECTS) $(test_u8_mblen_LDADD) $(LIBS) +unistr/test-u8-mbsnlen.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-mbsnlen$(EXEEXT): $(test_u8_mbsnlen_OBJECTS) $(test_u8_mbsnlen_DEPENDENCIES) + @rm -f test-u8-mbsnlen$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_mbsnlen_OBJECTS) $(test_u8_mbsnlen_LDADD) $(LIBS) +unistr/test-u8-mbtouc.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-mbtouc$(EXEEXT): $(test_u8_mbtouc_OBJECTS) $(test_u8_mbtouc_DEPENDENCIES) + @rm -f test-u8-mbtouc$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_mbtouc_OBJECTS) $(test_u8_mbtouc_LDADD) $(LIBS) +unistr/test-u8-mbtouc-unsafe.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-mbtouc-unsafe$(EXEEXT): $(test_u8_mbtouc_unsafe_OBJECTS) $(test_u8_mbtouc_unsafe_DEPENDENCIES) + @rm -f test-u8-mbtouc-unsafe$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_mbtouc_unsafe_OBJECTS) $(test_u8_mbtouc_unsafe_LDADD) $(LIBS) +unistr/test-u8-mbtoucr.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-mbtoucr$(EXEEXT): $(test_u8_mbtoucr_OBJECTS) $(test_u8_mbtoucr_DEPENDENCIES) + @rm -f test-u8-mbtoucr$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_mbtoucr_OBJECTS) $(test_u8_mbtoucr_LDADD) $(LIBS) +unistr/test-u8-move.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-move$(EXEEXT): $(test_u8_move_OBJECTS) $(test_u8_move_DEPENDENCIES) + @rm -f test-u8-move$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_move_OBJECTS) $(test_u8_move_LDADD) $(LIBS) +unistr/test-u8-next.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-next$(EXEEXT): $(test_u8_next_OBJECTS) $(test_u8_next_DEPENDENCIES) + @rm -f test-u8-next$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_next_OBJECTS) $(test_u8_next_LDADD) $(LIBS) uninorm/test-u8-normcmp.$(OBJEXT): uninorm/$(am__dirstamp) \ uninorm/$(DEPDIR)/$(am__dirstamp) test-u8-normcmp$(EXEEXT): $(test_u8_normcmp_OBJECTS) $(test_u8_normcmp_DEPENDENCIES) @@ -5451,6 +6910,41 @@ unilbrk/test-u8-possible-linebreaks.$(OBJEXT): \ test-u8-possible-linebreaks$(EXEEXT): $(test_u8_possible_linebreaks_OBJECTS) $(test_u8_possible_linebreaks_DEPENDENCIES) @rm -f test-u8-possible-linebreaks$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u8_possible_linebreaks_OBJECTS) $(test_u8_possible_linebreaks_LDADD) $(LIBS) +unistr/test-u8-prev.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-prev$(EXEEXT): $(test_u8_prev_OBJECTS) $(test_u8_prev_DEPENDENCIES) + @rm -f test-u8-prev$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_prev_OBJECTS) $(test_u8_prev_LDADD) $(LIBS) +unistr/test-u8-set.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-set$(EXEEXT): $(test_u8_set_OBJECTS) $(test_u8_set_DEPENDENCIES) + @rm -f test-u8-set$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_set_OBJECTS) $(test_u8_set_LDADD) $(LIBS) +unistr/test-u8-stpcpy.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-stpcpy$(EXEEXT): $(test_u8_stpcpy_OBJECTS) $(test_u8_stpcpy_DEPENDENCIES) + @rm -f test-u8-stpcpy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_stpcpy_OBJECTS) $(test_u8_stpcpy_LDADD) $(LIBS) +unistr/test-u8-stpncpy.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-stpncpy$(EXEEXT): $(test_u8_stpncpy_OBJECTS) $(test_u8_stpncpy_DEPENDENCIES) + @rm -f test-u8-stpncpy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_stpncpy_OBJECTS) $(test_u8_stpncpy_LDADD) $(LIBS) +unistr/test-u8-strcat.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-strcat$(EXEEXT): $(test_u8_strcat_OBJECTS) $(test_u8_strcat_DEPENDENCIES) + @rm -f test-u8-strcat$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_strcat_OBJECTS) $(test_u8_strcat_LDADD) $(LIBS) +unistr/test-u8-strcmp.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-strcmp$(EXEEXT): $(test_u8_strcmp_OBJECTS) $(test_u8_strcmp_DEPENDENCIES) + @rm -f test-u8-strcmp$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_strcmp_OBJECTS) $(test_u8_strcmp_LDADD) $(LIBS) +unistr/test-u8-strcoll.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-strcoll$(EXEEXT): $(test_u8_strcoll_OBJECTS) $(test_u8_strcoll_DEPENDENCIES) + @rm -f test-u8-strcoll$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_strcoll_OBJECTS) $(test_u8_strcoll_LDADD) $(LIBS) uniconv/test-u8-strconv-from-enc.$(OBJEXT): uniconv/$(am__dirstamp) \ uniconv/$(DEPDIR)/$(am__dirstamp) test-u8-strconv-from-enc$(EXEEXT): $(test_u8_strconv_from_enc_OBJECTS) $(test_u8_strconv_from_enc_DEPENDENCIES) @@ -5461,11 +6955,66 @@ uniconv/test-u8-strconv-to-enc.$(OBJEXT): uniconv/$(am__dirstamp) \ test-u8-strconv-to-enc$(EXEEXT): $(test_u8_strconv_to_enc_OBJECTS) $(test_u8_strconv_to_enc_DEPENDENCIES) @rm -f test-u8-strconv-to-enc$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u8_strconv_to_enc_OBJECTS) $(test_u8_strconv_to_enc_LDADD) $(LIBS) +unistr/test-u8-strcpy.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-strcpy$(EXEEXT): $(test_u8_strcpy_OBJECTS) $(test_u8_strcpy_DEPENDENCIES) + @rm -f test-u8-strcpy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_strcpy_OBJECTS) $(test_u8_strcpy_LDADD) $(LIBS) +unistr/test-u8-strdup.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-strdup$(EXEEXT): $(test_u8_strdup_OBJECTS) $(test_u8_strdup_DEPENDENCIES) + @rm -f test-u8-strdup$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_strdup_OBJECTS) $(test_u8_strdup_LDADD) $(LIBS) +unistr/test-u8-strlen.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-strlen$(EXEEXT): $(test_u8_strlen_OBJECTS) $(test_u8_strlen_DEPENDENCIES) + @rm -f test-u8-strlen$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_strlen_OBJECTS) $(test_u8_strlen_LDADD) $(LIBS) +unistr/test-u8-strmblen.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-strmblen$(EXEEXT): $(test_u8_strmblen_OBJECTS) $(test_u8_strmblen_DEPENDENCIES) + @rm -f test-u8-strmblen$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_strmblen_OBJECTS) $(test_u8_strmblen_LDADD) $(LIBS) +unistr/test-u8-strmbtouc.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-strmbtouc$(EXEEXT): $(test_u8_strmbtouc_OBJECTS) $(test_u8_strmbtouc_DEPENDENCIES) + @rm -f test-u8-strmbtouc$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_strmbtouc_OBJECTS) $(test_u8_strmbtouc_LDADD) $(LIBS) +unistr/test-u8-strncat.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-strncat$(EXEEXT): $(test_u8_strncat_OBJECTS) $(test_u8_strncat_DEPENDENCIES) + @rm -f test-u8-strncat$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_strncat_OBJECTS) $(test_u8_strncat_LDADD) $(LIBS) +unistr/test-u8-strncmp.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-strncmp$(EXEEXT): $(test_u8_strncmp_OBJECTS) $(test_u8_strncmp_DEPENDENCIES) + @rm -f test-u8-strncmp$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_strncmp_OBJECTS) $(test_u8_strncmp_LDADD) $(LIBS) +unistr/test-u8-strncpy.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-strncpy$(EXEEXT): $(test_u8_strncpy_OBJECTS) $(test_u8_strncpy_DEPENDENCIES) + @rm -f test-u8-strncpy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_strncpy_OBJECTS) $(test_u8_strncpy_LDADD) $(LIBS) +unistr/test-u8-strnlen.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-strnlen$(EXEEXT): $(test_u8_strnlen_OBJECTS) $(test_u8_strnlen_DEPENDENCIES) + @rm -f test-u8-strnlen$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_strnlen_OBJECTS) $(test_u8_strnlen_LDADD) $(LIBS) uniwidth/test-u8-strwidth.$(OBJEXT): uniwidth/$(am__dirstamp) \ uniwidth/$(DEPDIR)/$(am__dirstamp) test-u8-strwidth$(EXEEXT): $(test_u8_strwidth_OBJECTS) $(test_u8_strwidth_DEPENDENCIES) @rm -f test-u8-strwidth$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u8_strwidth_OBJECTS) $(test_u8_strwidth_LDADD) $(LIBS) +unistr/test-u8-to-u16.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-to-u16$(EXEEXT): $(test_u8_to_u16_OBJECTS) $(test_u8_to_u16_DEPENDENCIES) + @rm -f test-u8-to-u16$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_to_u16_OBJECTS) $(test_u8_to_u16_LDADD) $(LIBS) +unistr/test-u8-to-u32.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-to-u32$(EXEEXT): $(test_u8_to_u32_OBJECTS) $(test_u8_to_u32_DEPENDENCIES) + @rm -f test-u8-to-u32$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_to_u32_OBJECTS) $(test_u8_to_u32_LDADD) $(LIBS) unicase/test-u8-tolower.$(OBJEXT): unicase/$(am__dirstamp) \ unicase/$(DEPDIR)/$(am__dirstamp) test-u8-tolower$(EXEEXT): $(test_u8_tolower_OBJECTS) $(test_u8_tolower_DEPENDENCIES) @@ -5481,6 +7030,11 @@ unicase/test-u8-toupper.$(OBJEXT): unicase/$(am__dirstamp) \ test-u8-toupper$(EXEEXT): $(test_u8_toupper_OBJECTS) $(test_u8_toupper_DEPENDENCIES) @rm -f test-u8-toupper$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_u8_toupper_OBJECTS) $(test_u8_toupper_LDADD) $(LIBS) +unistr/test-u8-uctomb.$(OBJEXT): unistr/$(am__dirstamp) \ + unistr/$(DEPDIR)/$(am__dirstamp) +test-u8-uctomb$(EXEEXT): $(test_u8_uctomb_OBJECTS) $(test_u8_uctomb_DEPENDENCIES) + @rm -f test-u8-uctomb$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_u8_uctomb_OBJECTS) $(test_u8_uctomb_LDADD) $(LIBS) unistdio/test-u8-vasnprintf1.$(OBJEXT): unistdio/$(am__dirstamp) \ unistdio/$(DEPDIR)/$(am__dirstamp) test-u8-vasnprintf1$(EXEEXT): $(test_u8_vasnprintf1_OBJECTS) $(test_u8_vasnprintf1_DEPENDENCIES) @@ -5630,6 +7184,9 @@ test-uninorm-filter-nfc$(EXEEXT): $(test_uninorm_filter_nfc_OBJECTS) $(test_unin test-unistd$(EXEEXT): $(test_unistd_OBJECTS) $(test_unistd_DEPENDENCIES) @rm -f test-unistd$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_unistd_OBJECTS) $(test_unistd_LDADD) $(LIBS) +test-unsetenv$(EXEEXT): $(test_unsetenv_OBJECTS) $(test_unsetenv_DEPENDENCIES) + @rm -f test-unsetenv$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_unsetenv_OBJECTS) $(test_unsetenv_LDADD) $(LIBS) test-wchar$(EXEEXT): $(test_wchar_OBJECTS) $(test_wchar_DEPENDENCIES) @rm -f test-wchar$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_wchar_OBJECTS) $(test_wchar_LDADD) $(LIBS) @@ -5639,9 +7196,13 @@ test-wctype$(EXEEXT): $(test_wctype_OBJECTS) $(test_wctype_DEPENDENCIES) test-wcwidth$(EXEEXT): $(test_wcwidth_OBJECTS) $(test_wcwidth_DEPENDENCIES) @rm -f test-wcwidth$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_wcwidth_OBJECTS) $(test_wcwidth_LDADD) $(LIBS) +test-xalloc-die$(EXEEXT): $(test_xalloc_die_OBJECTS) $(test_xalloc_die_DEPENDENCIES) + @rm -f test-xalloc-die$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_xalloc_die_OBJECTS) $(test_xalloc_die_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) + -rm -f glthread/thread.$(OBJEXT) -rm -f unicase/test-cased.$(OBJEXT) -rm -f unicase/test-ignorable.$(OBJEXT) -rm -f unicase/test-locale-language.$(OBJEXT) @@ -5920,6 +7481,102 @@ mostlyclean-compile: -rm -f unistdio/test-ulc-vasprintf1.$(OBJEXT) -rm -f unistdio/test-ulc-vsnprintf1.$(OBJEXT) -rm -f unistdio/test-ulc-vsprintf1.$(OBJEXT) + -rm -f unistr/test-u16-check.$(OBJEXT) + -rm -f unistr/test-u16-chr.$(OBJEXT) + -rm -f unistr/test-u16-cmp.$(OBJEXT) + -rm -f unistr/test-u16-cmp2.$(OBJEXT) + -rm -f unistr/test-u16-cpy-alloc.$(OBJEXT) + -rm -f unistr/test-u16-cpy.$(OBJEXT) + -rm -f unistr/test-u16-mblen.$(OBJEXT) + -rm -f unistr/test-u16-mbsnlen.$(OBJEXT) + -rm -f unistr/test-u16-mbtouc-unsafe.$(OBJEXT) + -rm -f unistr/test-u16-mbtouc.$(OBJEXT) + -rm -f unistr/test-u16-mbtoucr.$(OBJEXT) + -rm -f unistr/test-u16-move.$(OBJEXT) + -rm -f unistr/test-u16-next.$(OBJEXT) + -rm -f unistr/test-u16-prev.$(OBJEXT) + -rm -f unistr/test-u16-set.$(OBJEXT) + -rm -f unistr/test-u16-stpcpy.$(OBJEXT) + -rm -f unistr/test-u16-stpncpy.$(OBJEXT) + -rm -f unistr/test-u16-strcat.$(OBJEXT) + -rm -f unistr/test-u16-strcmp.$(OBJEXT) + -rm -f unistr/test-u16-strcoll.$(OBJEXT) + -rm -f unistr/test-u16-strcpy.$(OBJEXT) + -rm -f unistr/test-u16-strdup.$(OBJEXT) + -rm -f unistr/test-u16-strlen.$(OBJEXT) + -rm -f unistr/test-u16-strmblen.$(OBJEXT) + -rm -f unistr/test-u16-strmbtouc.$(OBJEXT) + -rm -f unistr/test-u16-strncat.$(OBJEXT) + -rm -f unistr/test-u16-strncmp.$(OBJEXT) + -rm -f unistr/test-u16-strncpy.$(OBJEXT) + -rm -f unistr/test-u16-strnlen.$(OBJEXT) + -rm -f unistr/test-u16-to-u32.$(OBJEXT) + -rm -f unistr/test-u16-to-u8.$(OBJEXT) + -rm -f unistr/test-u16-uctomb.$(OBJEXT) + -rm -f unistr/test-u32-check.$(OBJEXT) + -rm -f unistr/test-u32-chr.$(OBJEXT) + -rm -f unistr/test-u32-cmp.$(OBJEXT) + -rm -f unistr/test-u32-cmp2.$(OBJEXT) + -rm -f unistr/test-u32-cpy-alloc.$(OBJEXT) + -rm -f unistr/test-u32-cpy.$(OBJEXT) + -rm -f unistr/test-u32-mblen.$(OBJEXT) + -rm -f unistr/test-u32-mbsnlen.$(OBJEXT) + -rm -f unistr/test-u32-mbtouc-unsafe.$(OBJEXT) + -rm -f unistr/test-u32-mbtouc.$(OBJEXT) + -rm -f unistr/test-u32-mbtoucr.$(OBJEXT) + -rm -f unistr/test-u32-move.$(OBJEXT) + -rm -f unistr/test-u32-next.$(OBJEXT) + -rm -f unistr/test-u32-prev.$(OBJEXT) + -rm -f unistr/test-u32-set.$(OBJEXT) + -rm -f unistr/test-u32-stpcpy.$(OBJEXT) + -rm -f unistr/test-u32-stpncpy.$(OBJEXT) + -rm -f unistr/test-u32-strcat.$(OBJEXT) + -rm -f unistr/test-u32-strcmp.$(OBJEXT) + -rm -f unistr/test-u32-strcoll.$(OBJEXT) + -rm -f unistr/test-u32-strcpy.$(OBJEXT) + -rm -f unistr/test-u32-strdup.$(OBJEXT) + -rm -f unistr/test-u32-strlen.$(OBJEXT) + -rm -f unistr/test-u32-strmblen.$(OBJEXT) + -rm -f unistr/test-u32-strmbtouc.$(OBJEXT) + -rm -f unistr/test-u32-strncat.$(OBJEXT) + -rm -f unistr/test-u32-strncmp.$(OBJEXT) + -rm -f unistr/test-u32-strncpy.$(OBJEXT) + -rm -f unistr/test-u32-strnlen.$(OBJEXT) + -rm -f unistr/test-u32-to-u16.$(OBJEXT) + -rm -f unistr/test-u32-to-u8.$(OBJEXT) + -rm -f unistr/test-u32-uctomb.$(OBJEXT) + -rm -f unistr/test-u8-check.$(OBJEXT) + -rm -f unistr/test-u8-chr.$(OBJEXT) + -rm -f unistr/test-u8-cmp.$(OBJEXT) + -rm -f unistr/test-u8-cmp2.$(OBJEXT) + -rm -f unistr/test-u8-cpy-alloc.$(OBJEXT) + -rm -f unistr/test-u8-cpy.$(OBJEXT) + -rm -f unistr/test-u8-mblen.$(OBJEXT) + -rm -f unistr/test-u8-mbsnlen.$(OBJEXT) + -rm -f unistr/test-u8-mbtouc-unsafe.$(OBJEXT) + -rm -f unistr/test-u8-mbtouc.$(OBJEXT) + -rm -f unistr/test-u8-mbtoucr.$(OBJEXT) + -rm -f unistr/test-u8-move.$(OBJEXT) + -rm -f unistr/test-u8-next.$(OBJEXT) + -rm -f unistr/test-u8-prev.$(OBJEXT) + -rm -f unistr/test-u8-set.$(OBJEXT) + -rm -f unistr/test-u8-stpcpy.$(OBJEXT) + -rm -f unistr/test-u8-stpncpy.$(OBJEXT) + -rm -f unistr/test-u8-strcat.$(OBJEXT) + -rm -f unistr/test-u8-strcmp.$(OBJEXT) + -rm -f unistr/test-u8-strcoll.$(OBJEXT) + -rm -f unistr/test-u8-strcpy.$(OBJEXT) + -rm -f unistr/test-u8-strdup.$(OBJEXT) + -rm -f unistr/test-u8-strlen.$(OBJEXT) + -rm -f unistr/test-u8-strmblen.$(OBJEXT) + -rm -f unistr/test-u8-strmbtouc.$(OBJEXT) + -rm -f unistr/test-u8-strncat.$(OBJEXT) + -rm -f unistr/test-u8-strncmp.$(OBJEXT) + -rm -f unistr/test-u8-strncpy.$(OBJEXT) + -rm -f unistr/test-u8-strnlen.$(OBJEXT) + -rm -f unistr/test-u8-to-u16.$(OBJEXT) + -rm -f unistr/test-u8-to-u32.$(OBJEXT) + -rm -f unistr/test-u8-uctomb.$(OBJEXT) -rm -f uniwbrk/test-u16-wordbreaks.$(OBJEXT) -rm -f uniwbrk/test-u32-wordbreaks.$(OBJEXT) -rm -f uniwbrk/test-u8-wordbreaks.$(OBJEXT) @@ -5938,8 +7595,9 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exitfail.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/open.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getpagesize.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/progname.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/putenv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setenv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strerror.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-alloca-opt.Po@am__quote@ @@ -5947,26 +7605,26 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-c-ctype.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-c-strcasecmp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-c-strncasecmp.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-dup2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-environ.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-errno.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-fcntl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-frexpl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-fseterr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-iconv-h.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-iconv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-isnand-nolibm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-isnanf-nolibm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-isnanl-nolibm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-locale.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-localename.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-lock.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-malloca.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-math.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-mbrtowc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-mbsinit.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-memchr.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-open.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-printf-frexp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-printf-frexpl.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-setenv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-signbit.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-stdbool.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-stddef.Po@am__quote@ @@ -5976,14 +7634,18 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-striconveh.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-striconveha.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-string.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-strncat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-unistd.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-unsetenv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-wchar.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-wctype.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-wcwidth.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-xalloc-die.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unsetenv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wctob.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xalloc-die.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmalloc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@glthread/$(DEPDIR)/thread.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@unicase/$(DEPDIR)/test-cased.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@unicase/$(DEPDIR)/test-ignorable.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@unicase/$(DEPDIR)/test-locale-language.Po@am__quote@ @@ -6262,6 +7924,102 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@unistdio/$(DEPDIR)/test-ulc-vasprintf1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@unistdio/$(DEPDIR)/test-ulc-vsnprintf1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@unistdio/$(DEPDIR)/test-ulc-vsprintf1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-check.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-chr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-cmp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-cmp2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-cpy-alloc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-cpy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-mblen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-mbsnlen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-mbtouc-unsafe.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-mbtouc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-mbtoucr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-move.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-next.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-prev.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-set.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-stpcpy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-stpncpy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-strcat.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-strcmp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-strcoll.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-strcpy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-strdup.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-strlen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-strmblen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-strmbtouc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-strncat.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-strncmp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-strncpy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-strnlen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-to-u32.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-to-u8.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u16-uctomb.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-check.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-chr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-cmp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-cmp2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-cpy-alloc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-cpy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-mblen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-mbsnlen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-mbtouc-unsafe.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-mbtouc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-mbtoucr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-move.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-next.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-prev.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-set.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-stpcpy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-stpncpy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-strcat.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-strcmp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-strcoll.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-strcpy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-strdup.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-strlen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-strmblen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-strmbtouc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-strncat.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-strncmp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-strncpy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-strnlen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-to-u16.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-to-u8.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u32-uctomb.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-check.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-chr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-cmp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-cmp2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-cpy-alloc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-cpy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-mblen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-mbsnlen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-mbtouc-unsafe.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-mbtouc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-mbtoucr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-move.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-next.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-prev.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-set.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-stpcpy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-stpncpy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-strcat.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-strcmp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-strcoll.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-strcpy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-strdup.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-strlen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-strmblen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-strmbtouc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-strncat.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-strncmp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-strncpy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-strnlen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-to-u16.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-to-u32.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@unistr/$(DEPDIR)/test-u8-uctomb.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@uniwbrk/$(DEPDIR)/test-u16-wordbreaks.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@uniwbrk/$(DEPDIR)/test-u32-wordbreaks.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@uniwbrk/$(DEPDIR)/test-u8-wordbreaks.Po@am__quote@ @@ -6315,7 +8073,7 @@ clean-libtool: # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): - @failcom='exit 1'; \ + @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ @@ -6340,7 +8098,7 @@ $(RECURSIVE_TARGETS): fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): - @failcom='exit 1'; \ + @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ @@ -6625,6 +8383,8 @@ clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -rm -f glthread/$(DEPDIR)/$(am__dirstamp) + -rm -f glthread/$(am__dirstamp) -rm -f unicase/$(DEPDIR)/$(am__dirstamp) -rm -f unicase/$(am__dirstamp) -rm -f uniconv/$(DEPDIR)/$(am__dirstamp) @@ -6639,6 +8399,8 @@ distclean-generic: -rm -f uninorm/$(am__dirstamp) -rm -f unistdio/$(DEPDIR)/$(am__dirstamp) -rm -f unistdio/$(am__dirstamp) + -rm -f unistr/$(DEPDIR)/$(am__dirstamp) + -rm -f unistr/$(am__dirstamp) -rm -f uniwbrk/$(DEPDIR)/$(am__dirstamp) -rm -f uniwbrk/$(am__dirstamp) -rm -f uniwidth/$(DEPDIR)/$(am__dirstamp) @@ -6657,7 +8419,7 @@ clean-am: clean-checkLIBRARIES clean-checkPROGRAMS clean-generic \ clean-noinstPROGRAMS mostlyclean-am distclean: distclean-recursive - -rm -rf ./$(DEPDIR) unicase/$(DEPDIR) uniconv/$(DEPDIR) unictype/$(DEPDIR) unilbrk/$(DEPDIR) uniname/$(DEPDIR) uninorm/$(DEPDIR) unistdio/$(DEPDIR) uniwbrk/$(DEPDIR) uniwidth/$(DEPDIR) + -rm -rf ./$(DEPDIR) glthread/$(DEPDIR) unicase/$(DEPDIR) uniconv/$(DEPDIR) unictype/$(DEPDIR) unilbrk/$(DEPDIR) uniname/$(DEPDIR) uninorm/$(DEPDIR) unistdio/$(DEPDIR) unistr/$(DEPDIR) uniwbrk/$(DEPDIR) uniwidth/$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags @@ -6703,7 +8465,7 @@ install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive - -rm -rf ./$(DEPDIR) unicase/$(DEPDIR) uniconv/$(DEPDIR) unictype/$(DEPDIR) unilbrk/$(DEPDIR) uniname/$(DEPDIR) uninorm/$(DEPDIR) unistdio/$(DEPDIR) uniwbrk/$(DEPDIR) uniwidth/$(DEPDIR) + -rm -rf ./$(DEPDIR) glthread/$(DEPDIR) unicase/$(DEPDIR) uniconv/$(DEPDIR) unictype/$(DEPDIR) unilbrk/$(DEPDIR) uniname/$(DEPDIR) uninorm/$(DEPDIR) unistdio/$(DEPDIR) unistr/$(DEPDIR) uniwbrk/$(DEPDIR) uniwidth/$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -6743,31 +8505,57 @@ uninstall-am: mostlyclean-libtool mostlyclean-local pdf pdf-am ps ps-am tags \ tags-recursive uninstall uninstall-am - -# We need the following in order to create <fcntl.h> when the system -# doesn't have one that works with the given compiler. -fcntl.h: fcntl.in.h - rm -f $@-t $@ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''NEXT_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \ - -e 's|@''GNULIB_OPEN''@|$(GNULIB_OPEN)|g' \ - -e 's|@''REPLACE_OPEN''@|$(REPLACE_OPEN)|g' \ - < $(srcdir)/fcntl.in.h; \ - } > $@-t +# The arg-nonnull.h that gets inserted into generated .h files is the same as +# build-aux/arg-nonnull.h, except that it has the copyright header cut off. +arg-nonnull.h: $(top_srcdir)/build-aux/arg-nonnull.h + $(AM_V_GEN)rm -f $@-t $@ && \ + sed -n -e '/GL_ARG_NONNULL/,$$p' \ + < $(top_srcdir)/build-aux/arg-nonnull.h \ + > $@-t && \ + mv $@-t $@ +# The c++defs.h that gets inserted into generated .h files is the same as +# build-aux/c++defs.h, except that it has the copyright header cut off. +c++defs.h: $(top_srcdir)/build-aux/c++defs.h + $(AM_V_GEN)rm -f $@-t $@ && \ + sed -n -e '/_GL_CXXDEFS/,$$p' \ + < $(top_srcdir)/build-aux/c++defs.h \ + > $@-t && \ mv $@-t $@ # We need the following in order to create <locale.h> when the system # doesn't have one that provides all definitions. -locale.h: locale.in.h - rm -f $@-t $@ +locale.h: locale.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) + $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''NEXT_LOCALE_H''@|$(NEXT_LOCALE_H)|g' \ + -e 's|@''GNULIB_DUPLOCALE''@|$(GNULIB_DUPLOCALE)|g' \ + -e 's|@''HAVE_DUPLOCALE''@|$(HAVE_DUPLOCALE)|g' \ + -e 's|@''HAVE_XLOCALE_H''@|$(HAVE_XLOCALE_H)|g' \ + -e 's|@''REPLACE_DUPLOCALE''@|$(REPLACE_DUPLOCALE)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/locale.in.h; \ - } > $@-t + } > $@-t && \ + mv $@-t $@ +# The unused-parameter.h that gets inserted into generated .h files is the same +# as build-aux/unused-parameter.h, except that it has the copyright header cut +# off. +unused-parameter.h: $(top_srcdir)/build-aux/unused-parameter.h + $(AM_V_GEN)rm -f $@-t $@ && \ + sed -n -e '/GL_UNUSED_PARAMETER/,$$p' \ + < $(top_srcdir)/build-aux/unused-parameter.h \ + > $@-t && \ + mv $@-t $@ +# The warn-on-use.h that gets inserted into generated .h files is the same as +# build-aux/warn-on-use.h, except that it has the copyright header cut off. +warn-on-use.h: $(top_srcdir)/build-aux/warn-on-use.h + $(AM_V_GEN)rm -f $@-t $@ && \ + sed -n -e '/^.ifndef/,$$p' \ + < $(top_srcdir)/build-aux/warn-on-use.h \ + > $@-t && \ mv $@-t $@ # Clean up after Solaris cc. diff --git a/tests/error.c b/tests/error.c index af2287b..c79e8d4 100644 --- a/tests/error.c +++ b/tests/error.c @@ -1,5 +1,5 @@ /* Error handler for noninteractive utilities - Copyright (C) 1990-1998, 2000-2007, 2009 Free Software Foundation, Inc. + Copyright (C) 1990-1998, 2000-2007, 2009-2010 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -70,8 +70,8 @@ unsigned int error_message_count; extern void __error (int status, int errnum, const char *message, ...) __attribute__ ((__format__ (__printf__, 3, 4))); extern void __error_at_line (int status, int errnum, const char *file_name, - unsigned int line_number, const char *message, - ...) + unsigned int line_number, const char *message, + ...) __attribute__ ((__format__ (__printf__, 5, 6)));; # define error __error # define error_at_line __error_at_line @@ -86,6 +86,7 @@ extern void __error_at_line (int status, int errnum, const char *file_name, #else /* not _LIBC */ # include <fcntl.h> +# include <unistd.h> # if !HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P # ifndef HAVE_DECL_STRERROR_R @@ -100,8 +101,33 @@ extern char *program_name; # if HAVE_STRERROR_R || defined strerror_r # define __strerror_r strerror_r -# endif /* HAVE_STRERROR_R || defined strerror_r */ -#endif /* not _LIBC */ +# endif /* HAVE_STRERROR_R || defined strerror_r */ +#endif /* not _LIBC */ + +static inline void +flush_stdout (void) +{ +#if !_LIBC && defined F_GETFL + int stdout_fd; + +# if GNULIB_FREOPEN_SAFER + /* Use of gnulib's freopen-safer module normally ensures that + fileno (stdout) == 1 + whenever stdout is open. */ + stdout_fd = STDOUT_FILENO; +# else + /* POSIX states that fileno (stdout) after fclose is unspecified. But in + practice it is not a problem, because stdout is statically allocated and + the fd of a FILE stream is stored as a field in its allocated memory. */ + stdout_fd = fileno (stdout); +# endif + /* POSIX states that fflush (stdout) after fclose is unspecified; it + is safe in glibc, but not on all other platforms. fflush (NULL) + is always defined, but too draconian. */ + if (0 <= stdout_fd && 0 <= fcntl (stdout_fd, F_GETFL)) +#endif + fflush (stdout); +} static void print_errno_message (int errnum) @@ -149,58 +175,58 @@ error_tail (int status, int errnum, const char *message, va_list args) bool use_malloc = false; while (1) - { - if (__libc_use_alloca (len * sizeof (wchar_t))) - wmessage = (wchar_t *) alloca (len * sizeof (wchar_t)); - else - { - if (!use_malloc) - wmessage = NULL; - - wchar_t *p = (wchar_t *) realloc (wmessage, - len * sizeof (wchar_t)); - if (p == NULL) - { - free (wmessage); - fputws_unlocked (L"out of memory\n", stderr); - return; - } - wmessage = p; - use_malloc = true; - } - - memset (&st, '\0', sizeof (st)); - tmp = message; - - res = mbsrtowcs (wmessage, &tmp, len, &st); - if (res != len) - break; - - if (__builtin_expect (len >= SIZE_MAX / 2, 0)) - { - /* This really should not happen if everything is fine. */ - res = (size_t) -1; - break; - } - - len *= 2; - } + { + if (__libc_use_alloca (len * sizeof (wchar_t))) + wmessage = (wchar_t *) alloca (len * sizeof (wchar_t)); + else + { + if (!use_malloc) + wmessage = NULL; + + wchar_t *p = (wchar_t *) realloc (wmessage, + len * sizeof (wchar_t)); + if (p == NULL) + { + free (wmessage); + fputws_unlocked (L"out of memory\n", stderr); + return; + } + wmessage = p; + use_malloc = true; + } + + memset (&st, '\0', sizeof (st)); + tmp = message; + + res = mbsrtowcs (wmessage, &tmp, len, &st); + if (res != len) + break; + + if (__builtin_expect (len >= SIZE_MAX / 2, 0)) + { + /* This really should not happen if everything is fine. */ + res = (size_t) -1; + break; + } + + len *= 2; + } if (res == (size_t) -1) - { - /* The string cannot be converted. */ - if (use_malloc) - { - free (wmessage); - use_malloc = false; - } - wmessage = (wchar_t *) L"???"; - } + { + /* The string cannot be converted. */ + if (use_malloc) + { + free (wmessage); + use_malloc = false; + } + wmessage = (wchar_t *) L"???"; + } __vfwprintf (stderr, wmessage, args); if (use_malloc) - free (wmessage); + free (wmessage); } else #endif @@ -235,16 +261,10 @@ error (int status, int errnum, const char *message, ...) cancellation. Therefore disable cancellation for now. */ int state = PTHREAD_CANCEL_ENABLE; __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state), - 0); + 0); #endif -#if !_LIBC && defined F_GETFL - /* POSIX states that fflush (stdout) after fclose is unspecified; it - is safe in glibc, but not on all other platforms. fflush (NULL) - is always defined, but too draconian. */ - if (0 <= fcntl (1, F_GETFL)) -#endif - fflush (stdout); + flush_stdout (); #ifdef _LIBC _IO_flockfile (stderr); #endif @@ -276,7 +296,7 @@ int error_one_per_line; void error_at_line (int status, int errnum, const char *file_name, - unsigned int line_number, const char *message, ...) + unsigned int line_number, const char *message, ...) { va_list args; @@ -286,10 +306,10 @@ error_at_line (int status, int errnum, const char *file_name, static unsigned int old_line_number; if (old_line_number == line_number - && (file_name == old_file_name - || strcmp (old_file_name, file_name) == 0)) - /* Simply return and print nothing. */ - return; + && (file_name == old_file_name + || strcmp (old_file_name, file_name) == 0)) + /* Simply return and print nothing. */ + return; old_file_name = file_name; old_line_number = line_number; @@ -300,16 +320,10 @@ error_at_line (int status, int errnum, const char *file_name, cancellation. Therefore disable cancellation for now. */ int state = PTHREAD_CANCEL_ENABLE; __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state), - 0); + 0); #endif -#if !_LIBC && defined F_GETFL - /* POSIX states that fflush (stdout) after fclose is unspecified; it - is safe in glibc, but not on all other platforms. fflush (NULL) - is always defined, but too draconian. */ - if (0 <= fcntl (1, F_GETFL)) -#endif - fflush (stdout); + flush_stdout (); #ifdef _LIBC _IO_flockfile (stderr); #endif @@ -326,10 +340,10 @@ error_at_line (int status, int errnum, const char *file_name, #if _LIBC __fxprintf (NULL, file_name != NULL ? "%s:%d: " : " ", - file_name, line_number); + file_name, line_number); #else fprintf (stderr, file_name != NULL ? "%s:%d: " : " ", - file_name, line_number); + file_name, line_number); #endif va_start (args, message); diff --git a/tests/error.h b/tests/error.h index 6d49681..9deef02 100644 --- a/tests/error.h +++ b/tests/error.h @@ -1,5 +1,6 @@ /* Declaration for error-reporting function - Copyright (C) 1995, 1996, 1997, 2003, 2006, 2008 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997, 2003, 2006, 2008, 2009, 2010 Free Software + Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -19,19 +20,18 @@ #define _ERROR_H 1 #ifndef __attribute__ -/* This feature is available in gcc versions 2.5 and later. */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) -# define __attribute__(Spec) /* empty */ -# endif -/* The __-protected variants of `format' and `printf' attributes - are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ +/* The __attribute__ feature is available in gcc versions 2.5 and later. + The __-protected variants of the attributes 'format' and 'printf' are + accepted by gcc versions 2.6.4 (effectively 2.7) and later. + We enable __attribute__ only if these are supported too, because + gnulib and libintl do '#define printf __printf__' when they override + the 'printf' function. */ # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) -# define __format__ format -# define __printf__ printf +# define __attribute__(Spec) /* empty */ # endif #endif -#ifdef __cplusplus +#ifdef __cplusplus extern "C" { #endif @@ -43,7 +43,7 @@ extern void error (int __status, int __errnum, const char *__format, ...) __attribute__ ((__format__ (__printf__, 3, 4))); extern void error_at_line (int __status, int __errnum, const char *__fname, - unsigned int __lineno, const char *__format, ...) + unsigned int __lineno, const char *__format, ...) __attribute__ ((__format__ (__printf__, 5, 6))); /* If NULL, error will flush stdout, then print on stderr the program @@ -58,7 +58,7 @@ extern unsigned int error_message_count; variable controls whether this mode is selected or not. */ extern int error_one_per_line; -#ifdef __cplusplus +#ifdef __cplusplus } #endif diff --git a/tests/exitfail.c b/tests/exitfail.c index 6d1fe4a..3b63f8a 100644 --- a/tests/exitfail.c +++ b/tests/exitfail.c @@ -1,6 +1,7 @@ /* Failure exit status - Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2005, 2006, 2007, 2009, 2010 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/exitfail.h b/tests/exitfail.h index 713f259..7ffffe5 100644 --- a/tests/exitfail.h +++ b/tests/exitfail.h @@ -1,6 +1,6 @@ /* Failure exit status - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/fcntl.in.h b/tests/fcntl.in.h deleted file mode 100644 index fd7520e..0000000 --- a/tests/fcntl.in.h +++ /dev/null @@ -1,144 +0,0 @@ -/* Like <fcntl.h>, but with non-working flags defined to 0. - - Copyright (C) 2006-2008 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* written by Paul Eggert */ - -#if __GNUC__ >= 3 -@PRAGMA_SYSTEM_HEADER@ -#endif - -#if defined __need_system_fcntl_h -/* Special invocation convention. */ - -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#@INCLUDE_NEXT@ @NEXT_FCNTL_H@ - -#else -/* Normal invocation convention. */ - -#ifndef _GL_FCNTL_H - -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -/* The include_next requires a split double-inclusion guard. */ -#@INCLUDE_NEXT@ @NEXT_FCNTL_H@ - -#ifndef _GL_FCNTL_H -#define _GL_FCNTL_H - - -/* Declare overridden functions. */ - -#ifdef __cplusplus -extern "C" { -#endif - -#if @GNULIB_OPEN@ -# if @REPLACE_OPEN@ -# undef open -# define open rpl_open -extern int open (const char *filename, int flags, ...); -# endif -#endif - -#ifdef FCHDIR_REPLACEMENT -/* gnulib internal function. */ -extern void _gl_register_fd (int fd, const char *filename); -#endif - -#ifdef __cplusplus -} -#endif - - -/* Fix up the O_* macros. */ - -#if !defined O_DIRECT && defined O_DIRECTIO -/* Tru64 spells it `O_DIRECTIO'. */ -# define O_DIRECT O_DIRECTIO -#endif - -#ifndef O_DIRECT -# define O_DIRECT 0 -#endif - -#ifndef O_DIRECTORY -# define O_DIRECTORY 0 -#endif - -#ifndef O_DSYNC -# define O_DSYNC 0 -#endif - -#ifndef O_NDELAY -# define O_NDELAY 0 -#endif - -#ifndef O_NOATIME -# define O_NOATIME 0 -#endif - -#ifndef O_NONBLOCK -# define O_NONBLOCK O_NDELAY -#endif - -#ifndef O_NOCTTY -# define O_NOCTTY 0 -#endif - -#ifndef O_NOFOLLOW -# define O_NOFOLLOW 0 -#endif - -#ifndef O_NOLINKS -# define O_NOLINKS 0 -#endif - -#ifndef O_RSYNC -# define O_RSYNC 0 -#endif - -#ifndef O_SYNC -# define O_SYNC 0 -#endif - -/* For systems that distinguish between text and binary I/O. - O_BINARY is usually declared in fcntl.h */ -#if !defined O_BINARY && defined _O_BINARY - /* For MSC-compatible compilers. */ -# define O_BINARY _O_BINARY -# define O_TEXT _O_TEXT -#endif - -#if defined __BEOS__ || defined __HAIKU__ - /* BeOS 5 and Haiku have O_BINARY and O_TEXT, but they have no effect. */ -# undef O_BINARY -# undef O_TEXT -#endif - -#ifndef O_BINARY -# define O_BINARY 0 -# define O_TEXT 0 -#endif - - -#endif /* _GL_FCNTL_H */ -#endif /* _GL_FCNTL_H */ -#endif diff --git a/tests/getpagesize.c b/tests/getpagesize.c new file mode 100644 index 0000000..cc25268 --- /dev/null +++ b/tests/getpagesize.c @@ -0,0 +1,39 @@ +/* getpagesize emulation for systems where it cannot be done in a C macro. + + Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible and Martin Lambers. */ + +#include <config.h> + +/* Specification. */ +#include <unistd.h> + +/* This implementation is only for native Win32 systems. */ +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ + +# define WIN32_LEAN_AND_MEAN +# include <windows.h> + +int +getpagesize (void) +{ + SYSTEM_INFO system_info; + GetSystemInfo (&system_info); + return system_info.dwPageSize; +} + +#endif diff --git a/tests/gettext.h b/tests/gettext.h index 8cf2dca..881ae33 100644 --- a/tests/gettext.h +++ b/tests/gettext.h @@ -1,5 +1,6 @@ /* Convenience header for conditional use of GNU <libintl.h>. - Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009 Free Software Foundation, Inc. + Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2010 Free Software + Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -80,7 +81,7 @@ ((void) (Domainname), ngettext (Msgid1, Msgid2, N)) # undef dcngettext # define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ - ((void) (Category), dngettext(Domainname, Msgid1, Msgid2, N)) + ((void) (Category), dngettext (Domainname, Msgid1, Msgid2, N)) # undef textdomain # define textdomain(Domainname) ((const char *) (Domainname)) # undef bindtextdomain @@ -140,8 +141,8 @@ inline #endif static const char * pgettext_aux (const char *domain, - const char *msg_ctxt_id, const char *msgid, - int category) + const char *msg_ctxt_id, const char *msgid, + int category) { const char *translation = dcgettext (domain, msg_ctxt_id, category); if (translation == msg_ctxt_id) @@ -159,9 +160,9 @@ inline #endif static const char * npgettext_aux (const char *domain, - const char *msg_ctxt_id, const char *msgid, - const char *msgid_plural, unsigned long int n, - int category) + const char *msg_ctxt_id, const char *msgid, + const char *msgid_plural, unsigned long int n, + int category) { const char *translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); @@ -199,8 +200,8 @@ inline #endif static const char * dcpgettext_expr (const char *domain, - const char *msgctxt, const char *msgid, - int category) + const char *msgctxt, const char *msgid, + int category) { size_t msgctxt_len = strlen (msgctxt) + 1; size_t msgid_len = strlen (msgid) + 1; @@ -222,10 +223,10 @@ dcpgettext_expr (const char *domain, translation = dcgettext (domain, msg_ctxt_id, category); #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS if (msg_ctxt_id != buf) - free (msg_ctxt_id); + free (msg_ctxt_id); #endif if (translation != msg_ctxt_id) - return translation; + return translation; } return msgid; } @@ -244,9 +245,9 @@ inline #endif static const char * dcnpgettext_expr (const char *domain, - const char *msgctxt, const char *msgid, - const char *msgid_plural, unsigned long int n, - int category) + const char *msgctxt, const char *msgid, + const char *msgid_plural, unsigned long int n, + int category) { size_t msgctxt_len = strlen (msgctxt) + 1; size_t msgid_len = strlen (msgid) + 1; @@ -268,10 +269,10 @@ dcnpgettext_expr (const char *domain, translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS if (msg_ctxt_id != buf) - free (msg_ctxt_id); + free (msg_ctxt_id); #endif if (!(translation == msg_ctxt_id || translation == msgid_plural)) - return translation; + return translation; } return (n == 1 ? msgid : msgid_plural); } diff --git a/tests/glthread/thread.c b/tests/glthread/thread.c new file mode 100644 index 0000000..5237994 --- /dev/null +++ b/tests/glthread/thread.c @@ -0,0 +1,218 @@ +/* Creating and controlling threads. + Copyright (C) 2005-2010 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2005. + Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-solaris.h, + gthr-win32.h. */ + +#include <config.h> + +/* Specification. */ +#include "glthread/thread.h" + +#include <stdlib.h> +#include "glthread/lock.h" + +/* ========================================================================= */ + +#if USE_WIN32_THREADS + +#include <process.h> + +/* -------------------------- gl_thread_t datatype -------------------------- */ + +/* The Thread-Local Storage (TLS) key that allows to access each thread's + 'struct gl_thread_struct *' pointer. */ +static DWORD self_key = (DWORD)-1; + +/* Initializes self_key. This function must only be called once. */ +static void +do_init_self_key (void) +{ + self_key = TlsAlloc (); + /* If this fails, we're hosed. */ + if (self_key == (DWORD)-1) + abort (); +} + +/* Initializes self_key. */ +static void +init_self_key (void) +{ + gl_once_define(static, once) + gl_once (once, do_init_self_key); +} + +/* This structure contains information about a thread. + It is stored in TLS under key self_key. */ +struct gl_thread_struct +{ + /* Fields for managing the handle. */ + HANDLE volatile handle; + CRITICAL_SECTION handle_lock; + /* Fields for managing the exit value. */ + void * volatile result; + /* Fields for managing the thread start. */ + void * (*func) (void *); + void *arg; +}; + +/* Return a real HANDLE object for the current thread. */ +static inline HANDLE +get_current_thread_handle (void) +{ + HANDLE this_handle; + + /* GetCurrentThread() returns a pseudo-handle, i.e. only a symbolic + identifier, not a real handle. */ + if (!DuplicateHandle (GetCurrentProcess (), GetCurrentThread (), + GetCurrentProcess (), &this_handle, + 0, FALSE, DUPLICATE_SAME_ACCESS)) + abort (); + return this_handle; +} + +gl_thread_t +gl_thread_self_func (void) +{ + gl_thread_t thread; + + if (self_key == (DWORD)-1) + init_self_key (); + thread = TlsGetValue (self_key); + if (thread == NULL) + { + /* This happens only in threads that have not been created through + glthread_create(), such as the main thread. */ + for (;;) + { + thread = + (struct gl_thread_struct *) + malloc (sizeof (struct gl_thread_struct)); + if (thread != NULL) + break; + /* Memory allocation failed. There is not much we can do. Have to + busy-loop, waiting for the availability of memory. */ + Sleep (1); + } + + thread->handle = get_current_thread_handle (); + InitializeCriticalSection (&thread->handle_lock); + thread->result = NULL; /* just to be deterministic */ + TlsSetValue (self_key, thread); + } + return thread; +} + +/* The main function of a freshly creating thread. It's a wrapper around + the FUNC and ARG arguments passed to glthread_create_func. */ +static unsigned int WINAPI +wrapper_func (void *varg) +{ + struct gl_thread_struct *thread = (struct gl_thread_struct *)varg; + + EnterCriticalSection (&thread->handle_lock); + /* Create a new handle for the thread only if the parent thread did not yet + fill in the handle. */ + if (thread->handle == NULL) + thread->handle = get_current_thread_handle (); + LeaveCriticalSection (&thread->handle_lock); + + if (self_key == (DWORD)-1) + init_self_key (); + TlsSetValue (self_key, thread); + + /* Run the thread. Store the exit value if the thread was not terminated + otherwise. */ + thread->result = thread->func (thread->arg); + return 0; +} + +int +glthread_create_func (gl_thread_t *threadp, void * (*func) (void *), void *arg) +{ + struct gl_thread_struct *thread = + (struct gl_thread_struct *) malloc (sizeof (struct gl_thread_struct)); + if (thread == NULL) + return ENOMEM; + thread->handle = NULL; + InitializeCriticalSection (&thread->handle_lock); + thread->result = NULL; /* just to be deterministic */ + thread->func = func; + thread->arg = arg; + + { + unsigned int thread_id; + HANDLE thread_handle; + + thread_handle = (HANDLE) + _beginthreadex (NULL, 100000, wrapper_func, thread, 0, &thread_id); + /* calls CreateThread with the same arguments */ + if (thread_handle == NULL) + { + DeleteCriticalSection (&thread->handle_lock); + free (thread); + return EAGAIN; + } + + EnterCriticalSection (&thread->handle_lock); + if (thread->handle == NULL) + thread->handle = thread_handle; + else + /* thread->handle was already set by the thread itself. */ + CloseHandle (thread_handle); + LeaveCriticalSection (&thread->handle_lock); + + *threadp = thread; + return 0; + } +} + +int +glthread_join_func (gl_thread_t thread, void **retvalp) +{ + if (thread == NULL) + return EINVAL; + + if (thread == gl_thread_self ()) + return EDEADLK; + + if (WaitForSingleObject (thread->handle, INFINITE) == WAIT_FAILED) + return EINVAL; + + if (retvalp != NULL) + *retvalp = thread->result; + + DeleteCriticalSection (&thread->handle_lock); + CloseHandle (thread->handle); + free (thread); + + return 0; +} + +int +gl_thread_exit_func (void *retval) +{ + gl_thread_t thread = gl_thread_self (); + thread->result = retval; + _endthreadex (0); /* calls ExitThread (0) */ + abort (); +} + +#endif + +/* ========================================================================= */ diff --git a/tests/glthread/thread.h b/tests/glthread/thread.h new file mode 100644 index 0000000..d35be0d --- /dev/null +++ b/tests/glthread/thread.h @@ -0,0 +1,376 @@ +/* Creating and controlling threads. + Copyright (C) 2005-2010 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2005. + Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-solaris.h, + gthr-win32.h. */ + +/* This file contains primitives for creating and controlling threads. + + Thread data type: gl_thread_t. + + Creating a thread: + thread = gl_thread_create (func, arg); + Or with control of error handling: + err = glthread_create (&thread, func, arg); + extern int glthread_create (gl_thread_t *result, + void *(*func) (void *), void *arg); + + Querying and changing the signal mask of a thread (not supported on all + platforms): + gl_thread_sigmask (how, newmask, oldmask); + Or with control of error handling: + err = glthread_sigmask (how, newmask, oldmask); + extern int glthread_sigmask (int how, const sigset_t *newmask, sigset_t *oldmask); + + Waiting for termination of another thread: + gl_thread_join (thread, &return_value); + Or with control of error handling: + err = glthread_join (thread, &return_value); + extern int glthread_join (gl_thread_t thread, void **return_value_ptr); + + Getting a reference to the current thread: + current = gl_thread_self (); + extern gl_thread_t gl_thread_self (void); + + Terminating the current thread: + gl_thread_exit (return_value); + extern void gl_thread_exit (void *return_value) __attribute__ ((noreturn)); + + Requesting custom code to be executed at fork() time(not supported on all + platforms): + gl_thread_atfork (prepare_func, parent_func, child_func); + Or with control of error handling: + err = glthread_atfork (prepare_func, parent_func, child_func); + extern int glthread_atfork (void (*prepare_func) (void), + void (*parent_func) (void), + void (*child_func) (void)); + Note that even on platforms where this is supported, use of fork() and + threads together is problematic, see + <http://lists.gnu.org/archive/html/bug-gnulib/2008-08/msg00062.html> + */ + + +#ifndef _GLTHREAD_THREAD_H +#define _GLTHREAD_THREAD_H + +#include <errno.h> +#include <stdlib.h> + +/* ========================================================================= */ + +#if USE_POSIX_THREADS + +/* Use the POSIX threads library. */ + +# include <pthread.h> + +# ifdef __cplusplus +extern "C" { +# endif + +# if PTHREAD_IN_USE_DETECTION_HARD + +/* The pthread_in_use() detection needs to be done at runtime. */ +# define pthread_in_use() \ + glthread_in_use () +extern int glthread_in_use (void); + +# endif + +# if USE_POSIX_THREADS_WEAK + +/* Use weak references to the POSIX threads library. */ + +/* Weak references avoid dragging in external libraries if the other parts + of the program don't use them. Here we use them, because we don't want + every program that uses libintl to depend on libpthread. This assumes + that libpthread would not be loaded after libintl; i.e. if libintl is + loaded first, by an executable that does not depend on libpthread, and + then a module is dynamically loaded that depends on libpthread, libintl + will not be multithread-safe. */ + +/* The way to test at runtime whether libpthread is present is to test + whether a function pointer's value, such as &pthread_mutex_init, is + non-NULL. However, some versions of GCC have a bug through which, in + PIC mode, &foo != NULL always evaluates to true if there is a direct + call to foo(...) in the same function. To avoid this, we test the + address of a function in libpthread that we don't use. */ + +# pragma weak pthread_create +# pragma weak pthread_sigmask +# pragma weak pthread_join +# ifndef pthread_self +# pragma weak pthread_self +# endif +# pragma weak pthread_exit +# if HAVE_PTHREAD_ATFORK +# pragma weak pthread_atfork +# endif + +# if !PTHREAD_IN_USE_DETECTION_HARD +# pragma weak pthread_cancel +# define pthread_in_use() (pthread_cancel != NULL) +# endif + +# else + +# if !PTHREAD_IN_USE_DETECTION_HARD +# define pthread_in_use() 1 +# endif + +# endif + +/* -------------------------- gl_thread_t datatype -------------------------- */ + +/* This choice of gl_thread_t assumes that + pthread_equal (a, b) is equivalent to ((a) == (b)). + This is the case on all platforms in use in 2008. */ +typedef pthread_t gl_thread_t; +# define glthread_create(THREADP, FUNC, ARG) \ + (pthread_in_use () ? pthread_create (THREADP, NULL, FUNC, ARG) : ENOSYS) +# define glthread_sigmask(HOW, SET, OSET) \ + (pthread_in_use () ? pthread_sigmask (HOW, SET, OSET) : 0) +# define glthread_join(THREAD, RETVALP) \ + (pthread_in_use () ? pthread_join (THREAD, RETVALP) : 0) +# define gl_thread_self() \ + (pthread_in_use () ? (void *) pthread_self () : NULL) +# define gl_thread_exit(RETVAL) \ + (pthread_in_use () ? pthread_exit (RETVAL) : 0) + +# if HAVE_PTHREAD_ATFORK +# define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) \ + (pthread_in_use () ? pthread_atfork (PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) : 0) +# else +# define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) 0 +# endif + +# ifdef __cplusplus +} +# endif + +#endif + +/* ========================================================================= */ + +#if USE_PTH_THREADS + +/* Use the GNU Pth threads library. */ + +# include <pth.h> + +# ifdef __cplusplus +extern "C" { +# endif + +# if USE_PTH_THREADS_WEAK + +/* Use weak references to the GNU Pth threads library. */ + +# pragma weak pth_spawn +# pragma weak pth_sigmask +# pragma weak pth_join +# pragma weak pth_self +# pragma weak pth_exit + +# pragma weak pth_cancel +# define pth_in_use() (pth_cancel != NULL) + +# else + +# define pth_in_use() 1 + +# endif +/* -------------------------- gl_thread_t datatype -------------------------- */ + +typedef pth_t gl_thread_t; +# define glthread_create(THREADP, FUNC, ARG) \ + (pth_in_use () ? ((*(THREADP) = pth_spawn (NULL, FUNC, ARG)) ? 0 : errno) : 0) +# define glthread_sigmask(HOW, SET, OSET) \ + (pth_in_use () && !pth_sigmask (HOW, SET, OSET) ? errno : 0) +# define glthread_join(THREAD, RETVALP) \ + (pth_in_use () && !pth_join (THREAD, RETVALP) ? errno : 0) +# define gl_thread_self() \ + (pth_in_use () ? (void *) pth_self () : 0) +# define gl_thread_exit(RETVAL) \ + (pth_in_use () ? pth_exit (RETVAL) : 0) +# define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) 0 + +# ifdef __cplusplus +} +# endif + +#endif + +/* ========================================================================= */ + +#if USE_SOLARIS_THREADS + +/* Use the old Solaris threads library. */ + +# include <thread.h> +# include <synch.h> + +# ifdef __cplusplus +extern "C" { +# endif + +# if USE_SOLARIS_THREADS_WEAK + +/* Use weak references to the old Solaris threads library. */ + +# pragma weak thr_create +# pragma weak thr_join +# pragma weak thr_self +# pragma weak thr_exit + +# pragma weak thr_suspend +# define thread_in_use() (thr_suspend != NULL) + +# else + +# define thread_in_use() 1 + +# endif + +/* -------------------------- gl_thread_t datatype -------------------------- */ + +typedef thread_t gl_thread_t; +# define glthread_create(THREADP, FUNC, ARG) \ + (thread_in_use () ? thr_create (NULL, 0, FUNC, ARG, 0, THREADP) : 0) +# define glthread_sigmask(HOW, SET, OSET) \ + (thread_in_use () ? sigprocmask (HOW, SET, OSET) : 0) +# define glthread_join(THREAD, RETVALP) \ + (thread_in_use () ? thr_join (THREAD, NULL, RETVALP) : 0) +# define gl_thread_self() \ + (thread_in_use () ? (void *) thr_self () : 0) +# define gl_thread_exit(RETVAL) \ + (thread_in_use () ? thr_exit (RETVAL) : 0) +# define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) 0 + +# ifdef __cplusplus +} +# endif + +#endif + +/* ========================================================================= */ + +#if USE_WIN32_THREADS + +# include <windows.h> + +# ifdef __cplusplus +extern "C" { +# endif + +/* -------------------------- gl_thread_t datatype -------------------------- */ + +/* The gl_thread_t is a pointer to a structure in memory. + Why not the thread handle? If it were the thread handle, it would be hard + to implement gl_thread_self() (since GetCurrentThread () returns a pseudo- + handle, DuplicateHandle (GetCurrentThread ()) returns a handle that must be + closed afterwards, and there is no function for quickly retrieving a thread + handle from its id). + Why not the thread id? I tried it. It did not work: Sometimes ids appeared + that did not belong to running threads, and glthread_join failed with ESRCH. + */ +typedef struct gl_thread_struct *gl_thread_t; +# define glthread_create(THREADP, FUNC, ARG) \ + glthread_create_func (THREADP, FUNC, ARG) +# define glthread_sigmask(HOW, SET, OSET) \ + /* unsupported */ 0 +# define glthread_join(THREAD, RETVALP) \ + glthread_join_func (THREAD, RETVALP) +# define gl_thread_self() \ + gl_thread_self_func () +# define gl_thread_exit(RETVAL) \ + gl_thread_exit_func (RETVAL) +# define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) 0 +extern int glthread_create_func (gl_thread_t *threadp, void * (*func) (void *), void *arg); +extern int glthread_join_func (gl_thread_t thread, void **retvalp); +extern gl_thread_t gl_thread_self_func (void); +extern int gl_thread_exit_func (void *retval); + +# ifdef __cplusplus +} +# endif + +#endif + +/* ========================================================================= */ + +#if !(USE_POSIX_THREADS || USE_PTH_THREADS || USE_SOLARIS_THREADS || USE_WIN32_THREADS) + +/* Provide dummy implementation if threads are not supported. */ + +typedef int gl_thread_t; +# define glthread_create(THREADP, FUNC, ARG) ENOSYS +# define glthread_sigmask(HOW, SET, OSET) 0 +# define glthread_join(THREAD, RETVALP) 0 +# define gl_thread_self() NULL +# define gl_thread_exit(RETVAL) 0 +# define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) 0 + +#endif + +/* ========================================================================= */ + +/* Macros with built-in error handling. */ + +#ifdef __cplusplus +extern "C" { +#endif + +static inline gl_thread_t +gl_thread_create (void *(*func) (void *arg), void *arg) +{ + gl_thread_t thread; + int ret; + + ret = glthread_create (&thread, func, arg); + if (ret != 0) + abort (); + return thread; +} +#define gl_thread_sigmask(HOW, SET, OSET) \ + do \ + { \ + if (glthread_sigmask (HOW, SET, OSET)) \ + abort (); \ + } \ + while (0) +#define gl_thread_join(THREAD, RETVAL) \ + do \ + { \ + if (glthread_join (THREAD, RETVAL)) \ + abort (); \ + } \ + while (0) +#define gl_thread_atfork(PREPARE, PARENT, CHILD) \ + do \ + { \ + if (glthread_atfork (PREPARE, PARENT, CHILD)) \ + abort (); \ + } \ + while (0) + +#ifdef __cplusplus +} +#endif + +#endif /* _GLTHREAD_THREAD_H */ diff --git a/tests/glthread/yield.h b/tests/glthread/yield.h new file mode 100644 index 0000000..df61ac4 --- /dev/null +++ b/tests/glthread/yield.h @@ -0,0 +1,121 @@ +/* Yielding the processor to other threads and processes. + Copyright (C) 2005-2010 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* This file contains a primitive for yielding the processor to other threads. + extern void gl_thread_yield (void); + */ + +#ifndef _GLTHREAD_YIELD_H +#define _GLTHREAD_YIELD_H + +#include <errno.h> + +/* ========================================================================= */ + +#if USE_POSIX_THREADS + +/* Use the POSIX threads library. */ + +# include <sched.h> + +# ifdef __cplusplus +extern "C" { +# endif + +# define gl_thread_yield() \ + sched_yield () + +# ifdef __cplusplus +} +# endif + +#endif + +/* ========================================================================= */ + +#if USE_PTH_THREADS + +/* Use the GNU Pth threads library. */ + +# include <pth.h> + +# ifdef __cplusplus +extern "C" { +# endif + +# define gl_thread_yield() \ + pth_yield (NULL) + +# ifdef __cplusplus +} +# endif + +#endif + +/* ========================================================================= */ + +#if USE_SOLARIS_THREADS + +/* Use the old Solaris threads library. */ + +# include <thread.h> + +# ifdef __cplusplus +extern "C" { +# endif + +# define gl_thread_yield() \ + thr_yield () + +# ifdef __cplusplus +} +# endif + +#endif + +/* ========================================================================= */ + +#if USE_WIN32_THREADS + +# include <windows.h> + +# ifdef __cplusplus +extern "C" { +# endif + +# define gl_thread_yield() \ + Sleep (0) + +# ifdef __cplusplus +} +# endif + +#endif + +/* ========================================================================= */ + +#if !(USE_POSIX_THREADS || USE_PTH_THREADS || USE_SOLARIS_THREADS || USE_WIN32_THREADS) + +/* Provide dummy implementation if threads are not supported. */ + +# define gl_thread_yield() 0 + +#endif + +/* ========================================================================= */ + +#endif /* _GLTHREAD_YIELD_H */ diff --git a/tests/init.sh b/tests/init.sh new file mode 100644 index 0000000..512e876 --- /dev/null +++ b/tests/init.sh @@ -0,0 +1,357 @@ +# source this file; set up for tests + +# Copyright (C) 2009, 2010 Free Software Foundation, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# Using this file in a test +# ========================= +# +# The typical skeleton of a test looks like this: +# +# #!/bin/sh +# : ${srcdir=.} +# . "$srcdir/init.sh"; path_prepend_ . +# Execute some commands. +# Note that these commands are executed in a subdirectory, therefore you +# need to prepend "../" to relative filenames in the build directory. +# Set the exit code 0 for success, 77 for skipped, or 1 or other for failure. +# Use the skip_ and fail_ functions to print a diagnostic and then exit +# with the corresponding exit code. +# Exit $? + +# Executing a test that uses this file +# ==================================== +# +# Running a single test: +# $ make check TESTS=test-foo.sh +# +# Running a single test, with verbose output: +# $ make check TESTS=test-foo.sh VERBOSE=yes +# +# Running a single test, with single-stepping: +# 1. Go into a sub-shell: +# $ bash +# 2. Set relevant environment variables from TESTS_ENVIRONMENT in the +# Makefile: +# $ export srcdir=../../tests # this is an example +# 3. Execute the commands from the test, copy&pasting them one by one: +# $ . "$srcdir/init.sh"; path_prepend_ . +# ... +# 4. Finally +# $ exit + +# We require $(...) support unconditionally. +# We require a few additional shell features only when $EXEEXT is nonempty, +# in order to support automatic $EXEEXT emulation: +# - hyphen-containing alias names +# - we prefer to use ${var#...} substitution, rather than having +# to work around lack of support for that feature. +# The following code attempts to find a shell with support for these features +# and re-exec's it. If not, it skips the current test. + +gl_shell_test_script_=' +test $(echo y) = y || exit 1 +test -z "$EXEEXT" && exit 0 +shopt -s expand_aliases +alias a-b="echo zoo" +v=abx + test ${v%x} = ab \ + && test ${v#a} = bx \ + && test $(a-b) = zoo +' + +if test "x$1" = "x--no-reexec"; then + shift +else + for re_shell_ in "${CONFIG_SHELL:-no_shell}" /bin/sh bash dash zsh pdksh fail + do + test "$re_shell_" = no_shell && continue + test "$re_shell_" = fail && skip_ failed to find an adequate shell + if "$re_shell_" -c "$gl_shell_test_script_" 2>/dev/null; then + exec "$re_shell_" "$0" --no-reexec "$@" + echo "$ME_: exec failed" 1>&2 + exit 127 + fi + done +fi + +test -n "$EXEEXT" && shopt -s expand_aliases + +# We use a trap below for cleanup. This requires us to go through +# hoops to get the right exit status transported through the handler. +# So use `Exit STATUS' instead of `exit STATUS' inside of the tests. +# Turn off errexit here so that we don't trip the bug with OSF1/Tru64 +# sh inside this function. +Exit () { set +e; (exit $1); exit $1; } + +# Print warnings (e.g., about skipped and failed tests) to this file number. +# Override by defining to say, 9, in init.cfg, and putting say, +# "export ...ENVVAR_SETTINGS...; exec 9>&2; $(SHELL)" in the definition +# of TESTS_ENVIRONMENT in your tests/Makefile.am file. +# This is useful when using automake's parallel tests mode, to print +# the reason for skip/failure to console, rather than to the .log files. +: ${stderr_fileno_=2} + +warn_() { echo "$@" 1>&$stderr_fileno_; } +fail_() { warn_ "$ME_: failed test: $@"; Exit 1; } +skip_() { warn_ "$ME_: skipped test: $@"; Exit 77; } +framework_failure_() { warn_ "$ME_: set-up failure: $@"; Exit 1; } + +# This is a stub function that is run upon trap (upon regular exit and +# interrupt). Override it with a per-test function, e.g., to unmount +# a partition, or to undo any other global state changes. +cleanup_() { :; } + +if ( diff --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then + compare() { diff -u "$@"; } +elif ( cmp --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then + compare() { cmp -s "$@"; } +else + compare() { cmp "$@"; } +fi + +# An arbitrary prefix to help distinguish test directories. +testdir_prefix_() { printf gt; } + +# Run the user-overridable cleanup_ function, remove the temporary +# directory and exit with the incoming value of $?. +remove_tmp_() +{ + __st=$? + cleanup_ + # cd out of the directory we're about to remove + cd "$initial_cwd_" || cd / || cd /tmp + chmod -R u+rwx "$test_dir_" + # If removal fails and exit status was to be 0, then change it to 1. + rm -rf "$test_dir_" || { test $__st = 0 && __st=1; } + exit $__st +} + +# Given a directory name, DIR, if every entry in it that matches *.exe +# contains only the specified bytes (see the case stmt below), then print +# a space-separated list of those names and return 0. Otherwise, don't +# print anything and return 1. Naming constraints apply also to DIR. +find_exe_basenames_() +{ + feb_dir_=$1 + feb_fail_=0 + feb_result_= + feb_sp_= + for feb_file_ in $feb_dir_/*.exe; do + case $feb_file_ in + *[!-a-zA-Z/0-9_.+]*) feb_fail_=1; break;; + *) # Remove leading file name components as well as the .exe suffix. + feb_file_=${feb_file_##*/} + feb_file_=${feb_file_%.exe} + feb_result_="$feb_result_$feb_sp_$feb_file_";; + esac + feb_sp_=' ' + done + test $feb_fail_ = 0 && printf %s "$feb_result_" + return $feb_fail_ +} + +# Consider the files in directory, $1. +# For each file name of the form PROG.exe, create an alias named +# PROG that simply invokes PROG.exe, then return 0. If any selected +# file name or the directory name, $1, contains an unexpected character, +# define no function and return 1. +create_exe_shims_() +{ + case $EXEEXT in + '') return 0 ;; + .exe) ;; + *) echo "$0: unexpected \$EXEEXT value: $EXEEXT" 1>&2; return 1 ;; + esac + + base_names_=`find_exe_basenames_ $1` \ + || { echo "$0 (exe_shim): skipping directory: $1" 1>&2; return 1; } + + if test -n "$base_names_"; then + for base_ in $base_names_; do + alias "$base_"="$base_$EXEEXT" + done + fi + + return 0 +} + +# Use this function to prepend to PATH an absolute name for each +# specified, possibly-$initial_cwd_-relative, directory. +path_prepend_() +{ + while test $# != 0; do + path_dir_=$1 + case $path_dir_ in + '') fail_ "invalid path dir: '$1'";; + /*) abs_path_dir_=$path_dir_;; + *) abs_path_dir_=`cd "$initial_cwd_/$path_dir_" && echo "$PWD"` \ + || fail_ "invalid path dir: $path_dir_";; + esac + case $abs_path_dir_ in + *:*) fail_ "invalid path dir: '$abs_path_dir_'";; + esac + PATH="$abs_path_dir_:$PATH" + + # Create an alias, FOO, for each FOO.exe in this directory. + create_exe_shims_ "$abs_path_dir_" \ + || fail_ "something failed (above): $abs_path_dir_" + shift + done + export PATH +} + +setup_() +{ + test "$VERBOSE" = yes && set -x + + initial_cwd_=$PWD + ME_=`expr "./$0" : '.*/\(.*\)$'` + + pfx_=`testdir_prefix_` + test_dir_=`mktempd_ "$initial_cwd_" "$pfx_-$ME_.XXXX"` \ + || fail_ "failed to create temporary directory in $initial_cwd_" + cd "$test_dir_" + + # These trap statements ensure that the temporary directory, $test_dir_, + # is removed upon exit as well as upon receipt of any of the listed signals. + trap remove_tmp_ 0 + for sig_ in 1 2 3 13 15; do + eval "trap 'Exit $(expr $sig_ + 128)' $sig_" + done +} + +# Create a temporary directory, much like mktemp -d does. +# Written by Jim Meyering. +# +# Usage: mktempd_ /tmp phoey.XXXXXXXXXX +# +# First, try to use the mktemp program. +# Failing that, we'll roll our own mktemp-like function: +# - try to get random bytes from /dev/urandom +# - failing that, generate output from a combination of quickly-varying +# sources and gzip. Ignore non-varying gzip header, and extract +# "random" bits from there. +# - given those bits, map to file-name bytes using tr, and try to create +# the desired directory. +# - make only $MAX_TRIES_ attempts + +# Helper function. Print $N pseudo-random bytes from a-zA-Z0-9. +rand_bytes_() +{ + n_=$1 + + # Maybe try openssl rand -base64 $n_prime_|tr '+/=\012' abcd first? + # But if they have openssl, they probably have mktemp, too. + + chars_=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 + dev_rand_=/dev/urandom + if test -r "$dev_rand_"; then + # Note: 256-length($chars_) == 194; 3 copies of $chars_ is 186 + 8 = 194. + dd ibs=$n_ count=1 if=$dev_rand_ 2>/dev/null \ + | LC_ALL=C tr -c $chars_ 01234567$chars_$chars_$chars_ + return + fi + + n_plus_50_=`expr $n_ + 50` + cmds_='date; date +%N; free; who -a; w; ps auxww; ps ef; netstat -n' + data_=` (eval "$cmds_") 2>&1 | gzip ` + + # Ensure that $data_ has length at least 50+$n_ + while :; do + len_=`echo "$data_"|wc -c` + test $n_plus_50_ -le $len_ && break; + data_=` (echo "$data_"; eval "$cmds_") 2>&1 | gzip ` + done + + echo "$data_" \ + | dd bs=1 skip=50 count=$n_ 2>/dev/null \ + | LC_ALL=C tr -c $chars_ 01234567$chars_$chars_$chars_ +} + +mktempd_() +{ + case $# in + 2);; + *) fail_ "Usage: $ME DIR TEMPLATE";; + esac + + destdir_=$1 + template_=$2 + + MAX_TRIES_=4 + + # Disallow any trailing slash on specified destdir: + # it would subvert the post-mktemp "case"-based destdir test. + case $destdir_ in + /) ;; + */) fail_ "invalid destination dir: remove trailing slash(es)";; + esac + + case $template_ in + *XXXX) ;; + *) fail_ "invalid template: $template_ (must have a suffix of at least 4 X's)";; + esac + + fail=0 + + # First, try to use mktemp. + d=`unset TMPDIR; mktemp -d -t -p "$destdir_" "$template_" 2>/dev/null` \ + || fail=1 + + # The resulting name must be in the specified directory. + case $d in "$destdir_"*);; *) fail=1;; esac + + # It must have created the directory. + test -d "$d" || fail=1 + + # It must have 0700 permissions. Handle sticky "S" bits. + perms=`ls -dgo "$d" 2>/dev/null|tr S -` || fail=1 + case $perms in drwx------*) ;; *) fail=1;; esac + + test $fail = 0 && { + echo "$d" + return + } + + # If we reach this point, we'll have to create a directory manually. + + # Get a copy of the template without its suffix of X's. + base_template_=`echo "$template_"|sed 's/XX*$//'` + + # Calculate how many X's we've just removed. + template_length_=`echo "$template_" | wc -c` + nx_=`echo "$base_template_" | wc -c` + nx_=`expr $template_length_ - $nx_` + + err_= + i_=1 + while :; do + X_=`rand_bytes_ $nx_` + candidate_dir_="$destdir_/$base_template_$X_" + err_=`mkdir -m 0700 "$candidate_dir_" 2>&1` \ + && { echo "$candidate_dir_"; return; } + test $MAX_TRIES_ -le $i_ && break; + i_=`expr $i_ + 1` + done + fail_ "$err_" +} + +# If you want to override the testdir_prefix_ function, +# or to add more utility functions, use this file. +test -f "$srcdir/init.cfg" \ + && . "$srcdir/init.cfg" + +setup_ "$@" diff --git a/tests/intprops.h b/tests/intprops.h index 002161e..46f4d47 100644 --- a/tests/intprops.h +++ b/tests/intprops.h @@ -1,6 +1,7 @@ /* intprops.h -- properties of integer types - Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009, 2010 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,40 +18,43 @@ /* Written by Paul Eggert. */ -#include <limits.h> +#ifndef GL_INTPROPS_H +# define GL_INTPROPS_H + +# include <limits.h> /* The extra casts in the following macros work around compiler bugs, e.g., in Cray C 5.0.3.0. */ /* True if the arithmetic type T is an integer type. bool counts as an integer. */ -#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1) +# define TYPE_IS_INTEGER(t) ((t) 1.5 == 1) /* True if negative values of the signed integer type T use two's complement, ones' complement, or signed magnitude representation, respectively. Much GNU code assumes two's complement, but some people like to be portable to all possible C hosts. */ -#define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1) -#define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0) -#define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1) +# define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1) +# define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0) +# define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1) /* True if the arithmetic type T is signed. */ -#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) +# define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) /* The maximum and minimum values for the integer type T. These macros have undefined behavior if T is signed and has padding bits. If this is a problem for you, please let us know how to fix it for your host. */ -#define TYPE_MINIMUM(t) \ +# define TYPE_MINIMUM(t) \ ((t) (! TYPE_SIGNED (t) \ - ? (t) 0 \ - : TYPE_SIGNED_MAGNITUDE (t) \ - ? ~ (t) 0 \ - : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))) -#define TYPE_MAXIMUM(t) \ + ? (t) 0 \ + : TYPE_SIGNED_MAGNITUDE (t) \ + ? ~ (t) 0 \ + : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))) +# define TYPE_MAXIMUM(t) \ ((t) (! TYPE_SIGNED (t) \ - ? (t) -1 \ - : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))) + ? (t) -1 \ + : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))) /* Return zero if T can be determined to be an unsigned type. Otherwise, return 1. @@ -58,20 +62,22 @@ tighter bound. Otherwise, it overestimates the true bound by one byte when applied to unsigned types of size 2, 4, 16, ... bytes. The symbol signed_type_or_expr__ is private to this header file. */ -#if __GNUC__ >= 2 -# define signed_type_or_expr__(t) TYPE_SIGNED (__typeof__ (t)) -#else -# define signed_type_or_expr__(t) 1 -#endif +# if __GNUC__ >= 2 +# define signed_type_or_expr__(t) TYPE_SIGNED (__typeof__ (t)) +# else +# define signed_type_or_expr__(t) 1 +# endif /* Bound on length of the string representing an integer type or expression T. Subtract 1 for the sign bit if T is signed; log10 (2.0) < 146/485; add 1 for integer division truncation; add 1 more for a minus sign if needed. */ -#define INT_STRLEN_BOUND(t) \ +# define INT_STRLEN_BOUND(t) \ ((sizeof (t) * CHAR_BIT - signed_type_or_expr__ (t)) * 146 / 485 \ + signed_type_or_expr__ (t) + 1) /* Bound on buffer size needed to represent an integer type or expression T, including the terminating null. */ -#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1) +# define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1) + +#endif /* GL_INTPROPS_H */ diff --git a/tests/locale.in.h b/tests/locale.in.h index 0557c9f..75b5299 100644 --- a/tests/locale.in.h +++ b/tests/locale.in.h @@ -1,5 +1,5 @@ /* A POSIX <locale.h>. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,11 +29,46 @@ /* NetBSD 5.0 mis-defines NULL. */ #include <stddef.h> +/* MacOS X 10.5 defines the locale_t type in <xlocale.h>. */ +#if @HAVE_XLOCALE_H@ +# include <xlocale.h> +#endif + +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_ARG_NONNULL is copied here. */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ + /* The LC_MESSAGES locale category is specified in POSIX, but not in ISO C. On systems that don't define it, use the same value as GNU libintl. */ #if !defined LC_MESSAGES # define LC_MESSAGES 1729 #endif +#if @GNULIB_DUPLOCALE@ +# if @REPLACE_DUPLOCALE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef duplocale +# define duplocale rpl_duplocale +# endif +_GL_FUNCDECL_RPL (duplocale, locale_t, (locale_t locale) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (duplocale, locale_t, (locale_t locale)); +# else +# if @HAVE_DUPLOCALE@ +_GL_CXXALIAS_SYS (duplocale, locale_t, (locale_t locale)); +# endif +# endif +# if @HAVE_DUPLOCALE@ +_GL_CXXALIASWARN (duplocale); +# endif +#elif defined GNULIB_POSIXCHECK +# undef duplocale +# if HAVE_RAW_DECL_DUPLOCALE +_GL_WARN_ON_USE (duplocale, "duplocale is buggy on some glibc systems - " + "use gnulib module duplocale for portability"); +# endif +#endif + #endif /* _GL_LOCALE_H */ #endif /* _GL_LOCALE_H */ diff --git a/tests/macros.h b/tests/macros.h new file mode 100644 index 0000000..11db5a8 --- /dev/null +++ b/tests/macros.h @@ -0,0 +1,64 @@ +/* Common macros used by gnulib tests. + Copyright (C) 2006-2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + + +/* This file contains macros that are used by many gnulib tests. + Put here only frequently used macros, say, used by 10 tests or more. */ + +#include <stdio.h> +#include <stdlib.h> + +/* Define ASSERT_STREAM before including this file if ASSERT must + target a stream other than stderr. */ +#ifndef ASSERT_STREAM +# define ASSERT_STREAM stderr +#endif + +/* ASSERT (condition); + verifies that the specified condition is fulfilled. If not, a message + is printed to ASSERT_STREAM if defined (defaulting to stderr if + undefined) and the program is terminated with an error code. + + This macro has the following properties: + - The programmer specifies the expected condition, not the failure + condition. This simplifies thinking. + - The condition is tested always, regardless of compilation flags. + (Unlike the macro from <assert.h>.) + - On Unix platforms, the tester can debug the test program with a + debugger (provided core dumps are enabled: "ulimit -c unlimited"). + - For the sake of platforms where no debugger is available (such as + some mingw systems), an error message is printed on the error + stream that includes the source location of the ASSERT invocation. + */ +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (ASSERT_STREAM, "%s:%d: assertion failed\n", \ + __FILE__, __LINE__); \ + fflush (ASSERT_STREAM); \ + abort (); \ + } \ + } \ + while (0) + +/* SIZEOF (array) + returns the number of elements of an array. It works for arrays that are + declared outside functions and for local variables of array type. It does + *not* work for function parameters of array type, because they are actually + parameters of pointer type. */ +#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) diff --git a/tests/nan.h b/tests/nan.h index 8aa8bf0..611eed3 100644 --- a/tests/nan.h +++ b/tests/nan.h @@ -1,5 +1,5 @@ /* Macros for not-a-number. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/open.c b/tests/open.c deleted file mode 100644 index 326e6d1..0000000 --- a/tests/open.c +++ /dev/null @@ -1,137 +0,0 @@ -/* Open a descriptor to a file. - Copyright (C) 2007-2009 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ - -#include <config.h> - -/* Get the original definition of open. It might be defined as a macro. */ -#define __need_system_fcntl_h -#include <fcntl.h> -#undef __need_system_fcntl_h -#include <sys/types.h> - -static inline int -orig_open (const char *filename, int flags, mode_t mode) -{ - return open (filename, flags, mode); -} - -/* Specification. */ -#include <fcntl.h> - -#include <errno.h> -#include <stdarg.h> -#include <string.h> -#include <sys/types.h> -#include <sys/stat.h> - -int -open (const char *filename, int flags, ...) -{ - mode_t mode; - int fd; - - mode = 0; - if (flags & O_CREAT) - { - va_list arg; - va_start (arg, flags); - - /* We have to use PROMOTED_MODE_T instead of mode_t, otherwise GCC 4 - creates crashing code when 'mode_t' is smaller than 'int'. */ - mode = va_arg (arg, PROMOTED_MODE_T); - - va_end (arg); - } - -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - if (strcmp (filename, "/dev/null") == 0) - filename = "NUL"; -#endif - -#if OPEN_TRAILING_SLASH_BUG - /* If the filename ends in a slash and one of O_CREAT, O_WRONLY, O_RDWR - is specified, then fail. - Rationale: POSIX <http://www.opengroup.org/susv3/basedefs/xbd_chap04.html> - says that - "A pathname that contains at least one non-slash character and that - ends with one or more trailing slashes shall be resolved as if a - single dot character ( '.' ) were appended to the pathname." - and - "The special filename dot shall refer to the directory specified by - its predecessor." - If the named file already exists as a directory, then - - if O_CREAT is specified, open() must fail because of the semantics - of O_CREAT, - - if O_WRONLY or O_RDWR is specified, open() must fail because POSIX - <http://www.opengroup.org/susv3/functions/open.html> says that it - fails with errno = EISDIR in this case. - If the named file does not exist or does not name a directory, then - - if O_CREAT is specified, open() must fail since open() cannot create - directories, - - if O_WRONLY or O_RDWR is specified, open() must fail because the - file does not contain a '.' directory. */ - if (flags & (O_CREAT | O_WRONLY | O_RDWR)) - { - size_t len = strlen (filename); - if (len > 0 && filename[len - 1] == '/') - { - errno = EISDIR; - return -1; - } - } -#endif - - fd = orig_open (filename, flags, mode); - -#if OPEN_TRAILING_SLASH_BUG - /* If the filename ends in a slash and fd does not refer to a directory, - then fail. - Rationale: POSIX <http://www.opengroup.org/susv3/basedefs/xbd_chap04.html> - says that - "A pathname that contains at least one non-slash character and that - ends with one or more trailing slashes shall be resolved as if a - single dot character ( '.' ) were appended to the pathname." - and - "The special filename dot shall refer to the directory specified by - its predecessor." - If the named file without the slash is not a directory, open() must fail - with ENOTDIR. */ - if (fd >= 0) - { - size_t len = strlen (filename); - if (len > 0 && filename[len - 1] == '/') - { - struct stat statbuf; - - if (fstat (fd, &statbuf) >= 0 && !S_ISDIR (statbuf.st_mode)) - { - close (fd); - errno = ENOTDIR; - return -1; - } - } - } -#endif - -#ifdef FCHDIR_REPLACEMENT - if (fd >= 0) - _gl_register_fd (fd, filename); -#endif - - return fd; -} diff --git a/tests/progname.c b/tests/progname.c index 9854b5e..1415e6a 100644 --- a/tests/progname.c +++ b/tests/progname.c @@ -1,6 +1,6 @@ /* Program name management. - Copyright (C) 2001-2003, 2005-2009 Free Software Foundation, Inc. - Written by Bruno Haible <haible@clisp.cons.org>, 2001. + Copyright (C) 2001-2003, 2005-2010 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,6 +22,9 @@ #undef ENABLE_RELOCATABLE /* avoid defining set_program_name as a macro */ #include "progname.h" +#include <errno.h> /* get program_invocation_name declaration */ +#include <stdio.h> +#include <stdlib.h> #include <string.h> @@ -29,7 +32,9 @@ To be initialized by main(). */ const char *program_name = NULL; -/* Set program_name, based on argv[0]. */ +/* Set program_name, based on argv[0]. + argv0 must be a string allocated with indefinite extent, and must not be + modified after this call. */ void set_program_name (const char *argv0) { @@ -41,13 +46,30 @@ set_program_name (const char *argv0) const char *slash; const char *base; + /* Sanity check. POSIX requires the invoking process to pass a non-NULL + argv[0]. */ + if (argv0 == NULL) + { + /* It's a bug in the invoking program. Help diagnosing it. */ + fputs ("A NULL argv[0] was passed through an exec system call.\n", + stderr); + abort (); + } + slash = strrchr (argv0, '/'); base = (slash != NULL ? slash + 1 : argv0); if (base - argv0 >= 7 && strncmp (base - 7, "/.libs/", 7) == 0) { argv0 = base; if (strncmp (base, "lt-", 3) == 0) - argv0 = base + 3; + { + argv0 = base + 3; + /* On glibc systems, remove the "lt-" prefix from the variable + program_invocation_short_name. */ +#if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME + program_invocation_short_name = (char *) argv0; +#endif + } } /* But don't strip off a leading <dirname>/ in general, because when the user @@ -60,4 +82,11 @@ set_program_name (const char *argv0) */ program_name = argv0; + + /* On glibc systems, the error() function comes from libc and uses the + variable program_invocation_name, not program_name. So set this variable + as well. */ +#if HAVE_DECL_PROGRAM_INVOCATION_NAME + program_invocation_name = (char *) argv0; +#endif } diff --git a/tests/progname.h b/tests/progname.h index 82615c6..5ba303b 100644 --- a/tests/progname.h +++ b/tests/progname.h @@ -1,6 +1,6 @@ /* Program name management. - Copyright (C) 2001-2004, 2006 Free Software Foundation, Inc. - Written by Bruno Haible <haible@clisp.cons.org>, 2001. + Copyright (C) 2001-2004, 2006, 2009-2010 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -31,7 +31,9 @@ extern "C" { /* String containing name the program is called with. */ extern const char *program_name; -/* Set program_name, based on argv[0]. */ +/* Set program_name, based on argv[0]. + argv0 must be a string allocated with indefinite extent, and must not be + modified after this call. */ extern void set_program_name (const char *argv0); #if ENABLE_RELOCATABLE @@ -39,8 +41,8 @@ extern void set_program_name (const char *argv0); /* Set program_name, based on argv[0], and original installation prefix and directory, for relocatability. */ extern void set_program_name_and_installdir (const char *argv0, - const char *orig_installprefix, - const char *orig_installdir); + const char *orig_installprefix, + const char *orig_installdir); #undef set_program_name #define set_program_name(ARG0) \ set_program_name_and_installdir (ARG0, INSTALLPREFIX, INSTALLDIR) diff --git a/tests/putenv.c b/tests/putenv.c new file mode 100644 index 0000000..030f567 --- /dev/null +++ b/tests/putenv.c @@ -0,0 +1,132 @@ +/* Copyright (C) 1991, 1994, 1997-1998, 2000, 2003-2010 Free Software + Foundation, Inc. + + NOTE: The canonical source of this file is maintained with the GNU C + Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3 of the License, or any + later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include <stdlib.h> + +#include <stddef.h> + +/* Include errno.h *after* sys/types.h to work around header problems + on AIX 3.2.5. */ +#include <errno.h> +#ifndef __set_errno +# define __set_errno(ev) ((errno) = (ev)) +#endif + +#include <string.h> +#include <unistd.h> + +#if HAVE_GNU_LD +# define environ __environ +#else +extern char **environ; +#endif + +#if _LIBC +/* This lock protects against simultaneous modifications of `environ'. */ +# include <bits/libc-lock.h> +__libc_lock_define_initialized (static, envlock) +# define LOCK __libc_lock_lock (envlock) +# define UNLOCK __libc_lock_unlock (envlock) +#else +# define LOCK +# define UNLOCK +#endif + +static int +_unsetenv (const char *name) +{ + size_t len; + char **ep; + + if (name == NULL || *name == '\0' || strchr (name, '=') != NULL) + { + __set_errno (EINVAL); + return -1; + } + + len = strlen (name); + + LOCK; + + ep = environ; + while (*ep != NULL) + if (!strncmp (*ep, name, len) && (*ep)[len] == '=') + { + /* Found it. Remove this pointer by moving later ones back. */ + char **dp = ep; + + do + dp[0] = dp[1]; + while (*dp++); + /* Continue the loop in case NAME appears again. */ + } + else + ++ep; + + UNLOCK; + + return 0; +} + + +/* Put STRING, which is of the form "NAME=VALUE", in the environment. + If STRING contains no `=', then remove STRING from the environment. */ +int +putenv (char *string) +{ + const char *const name_end = strchr (string, '='); + register size_t size; + register char **ep; + + if (name_end == NULL) + { + /* Remove the variable from the environment. */ + return _unsetenv (string); + } + + size = 0; + for (ep = environ; *ep != NULL; ++ep) + if (!strncmp (*ep, string, name_end - string) && + (*ep)[name_end - string] == '=') + break; + else + ++size; + + if (*ep == NULL) + { + static char **last_environ = NULL; + char **new_environ = (char **) malloc ((size + 2) * sizeof (char *)); + if (new_environ == NULL) + return -1; + (void) memcpy ((void *) new_environ, (void *) environ, + size * sizeof (char *)); + new_environ[size] = (char *) string; + new_environ[size + 1] = NULL; + free (last_environ); + last_environ = new_environ; + environ = new_environ; + } + else + *ep = string; + + return 0; +} diff --git a/tests/setenv.c b/tests/setenv.c index 83b52b8..ee9da0d 100644 --- a/tests/setenv.c +++ b/tests/setenv.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992,1995-1999,2000-2003,2005-2008 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1995-2003, 2005-2010 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -17,6 +17,11 @@ #if !_LIBC # include <config.h> #endif + +/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc + optimizes away the name == NULL test below. */ +#define _GL_ARG_NONNULL(params) + #include <alloca.h> /* Specification. */ @@ -32,22 +37,22 @@ # include <unistd.h> #endif -#if _LIBC || !HAVE_SETENV - #if !_LIBC # include "malloca.h" #endif +#if _LIBC || !HAVE_SETENV + #if !_LIBC -# define __environ environ +# define __environ environ #endif #if _LIBC /* This lock protects against simultaneous modifications of `environ'. */ # include <bits/libc-lock.h> __libc_lock_define_initialized (static, envlock) -# define LOCK __libc_lock_lock (envlock) -# define UNLOCK __libc_lock_unlock (envlock) +# define LOCK __libc_lock_lock (envlock) +# define UNLOCK __libc_lock_unlock (envlock) #else # define LOCK # define UNLOCK @@ -66,8 +71,8 @@ __libc_lock_define_initialized (static, envlock) values are from a small set. Outside glibc this will eat up all memory after a while. */ #if defined _LIBC || (defined HAVE_SEARCH_H && defined HAVE_TSEARCH \ - && defined __GNUC__) -# define USE_TSEARCH 1 + && defined __GNUC__) +# define USE_TSEARCH 1 # include <search.h> typedef int (*compar_fn_t) (const void *, const void *); @@ -76,9 +81,9 @@ typedef int (*compar_fn_t) (const void *, const void *); static void *known_values; # define KNOWN_VALUE(Str) \ - ({ \ - void *value = tfind (Str, &known_values, (compar_fn_t) strcmp); \ - value != NULL ? *(char **) value : NULL; \ + ({ \ + void *value = tfind (Str, &known_values, (compar_fn_t) strcmp); \ + value != NULL ? *(char **) value : NULL; \ }) # define STORE_VALUE(Str) \ tsearch (Str, &known_values, (compar_fn_t) strcmp) @@ -105,10 +110,10 @@ static char **last_environ; free the strings. */ int __add_to_environ (const char *name, const char *value, const char *combined, - int replace) + int replace) { - register char **ep; - register size_t size; + char **ep; + size_t size; const size_t namelen = strlen (name); const size_t vallen = value != NULL ? strlen (value) + 1 : 0; @@ -122,10 +127,10 @@ __add_to_environ (const char *name, const char *value, const char *combined, if (ep != NULL) { for (; *ep != NULL; ++ep) - if (!strncmp (*ep, name, namelen) && (*ep)[namelen] == '=') - break; - else - ++size; + if (!strncmp (*ep, name, namelen) && (*ep)[namelen] == '=') + break; + else + ++size; } if (ep == NULL || *ep == NULL) @@ -137,76 +142,76 @@ __add_to_environ (const char *name, const char *value, const char *combined, /* We allocated this space; we can extend it. */ new_environ = - (char **) (last_environ == NULL - ? malloc ((size + 2) * sizeof (char *)) - : realloc (last_environ, (size + 2) * sizeof (char *))); + (char **) (last_environ == NULL + ? malloc ((size + 2) * sizeof (char *)) + : realloc (last_environ, (size + 2) * sizeof (char *))); if (new_environ == NULL) - { - UNLOCK; - return -1; - } + { + UNLOCK; + return -1; + } /* If the whole entry is given add it. */ if (combined != NULL) - /* We must not add the string to the search tree since it belongs - to the user. */ - new_environ[size] = (char *) combined; + /* We must not add the string to the search tree since it belongs + to the user. */ + new_environ[size] = (char *) combined; else - { - /* See whether the value is already known. */ + { + /* See whether the value is already known. */ #ifdef USE_TSEARCH # ifdef _LIBC - new_value = (char *) alloca (namelen + 1 + vallen); - __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1), - value, vallen); + new_value = (char *) alloca (namelen + 1 + vallen); + __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1), + value, vallen); # else - new_value = (char *) malloca (namelen + 1 + vallen); - if (new_value == NULL) - { - __set_errno (ENOMEM); - UNLOCK; - return -1; - } - memcpy (new_value, name, namelen); - new_value[namelen] = '='; - memcpy (&new_value[namelen + 1], value, vallen); + new_value = (char *) malloca (namelen + 1 + vallen); + if (new_value == NULL) + { + __set_errno (ENOMEM); + UNLOCK; + return -1; + } + memcpy (new_value, name, namelen); + new_value[namelen] = '='; + memcpy (&new_value[namelen + 1], value, vallen); # endif - new_environ[size] = KNOWN_VALUE (new_value); - if (new_environ[size] == NULL) + new_environ[size] = KNOWN_VALUE (new_value); + if (new_environ[size] == NULL) #endif - { - new_environ[size] = (char *) malloc (namelen + 1 + vallen); - if (new_environ[size] == NULL) - { + { + new_environ[size] = (char *) malloc (namelen + 1 + vallen); + if (new_environ[size] == NULL) + { #if defined USE_TSEARCH && !defined _LIBC - freea (new_value); + freea (new_value); #endif - __set_errno (ENOMEM); - UNLOCK; - return -1; - } + __set_errno (ENOMEM); + UNLOCK; + return -1; + } #ifdef USE_TSEARCH - memcpy (new_environ[size], new_value, namelen + 1 + vallen); + memcpy (new_environ[size], new_value, namelen + 1 + vallen); #else - memcpy (new_environ[size], name, namelen); - new_environ[size][namelen] = '='; - memcpy (&new_environ[size][namelen + 1], value, vallen); + memcpy (new_environ[size], name, namelen); + new_environ[size][namelen] = '='; + memcpy (&new_environ[size][namelen + 1], value, vallen); #endif - /* And save the value now. We cannot do this when we remove - the string since then we cannot decide whether it is a - user string or not. */ - STORE_VALUE (new_environ[size]); - } + /* And save the value now. We cannot do this when we remove + the string since then we cannot decide whether it is a + user string or not. */ + STORE_VALUE (new_environ[size]); + } #if defined USE_TSEARCH && !defined _LIBC - freea (new_value); + freea (new_value); #endif - } + } if (__environ != last_environ) - memcpy ((char *) new_environ, (char *) __environ, - size * sizeof (char *)); + memcpy ((char *) new_environ, (char *) __environ, + size * sizeof (char *)); new_environ[size + 1] = NULL; @@ -218,57 +223,57 @@ __add_to_environ (const char *name, const char *value, const char *combined, /* Use the user string if given. */ if (combined != NULL) - np = (char *) combined; + np = (char *) combined; else - { + { #ifdef USE_TSEARCH - char *new_value; + char *new_value; # ifdef _LIBC - new_value = alloca (namelen + 1 + vallen); - __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1), - value, vallen); + new_value = alloca (namelen + 1 + vallen); + __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1), + value, vallen); # else - new_value = malloca (namelen + 1 + vallen); - if (new_value == NULL) - { - __set_errno (ENOMEM); - UNLOCK; - return -1; - } - memcpy (new_value, name, namelen); - new_value[namelen] = '='; - memcpy (&new_value[namelen + 1], value, vallen); + new_value = malloca (namelen + 1 + vallen); + if (new_value == NULL) + { + __set_errno (ENOMEM); + UNLOCK; + return -1; + } + memcpy (new_value, name, namelen); + new_value[namelen] = '='; + memcpy (&new_value[namelen + 1], value, vallen); # endif - np = KNOWN_VALUE (new_value); - if (np == NULL) + np = KNOWN_VALUE (new_value); + if (np == NULL) #endif - { - np = malloc (namelen + 1 + vallen); - if (np == NULL) - { + { + np = (char *) malloc (namelen + 1 + vallen); + if (np == NULL) + { #if defined USE_TSEARCH && !defined _LIBC - freea (new_value); + freea (new_value); #endif - __set_errno (ENOMEM); - UNLOCK; - return -1; - } + __set_errno (ENOMEM); + UNLOCK; + return -1; + } #ifdef USE_TSEARCH - memcpy (np, new_value, namelen + 1 + vallen); + memcpy (np, new_value, namelen + 1 + vallen); #else - memcpy (np, name, namelen); - np[namelen] = '='; - memcpy (&np[namelen + 1], value, vallen); + memcpy (np, name, namelen); + np[namelen] = '='; + memcpy (&np[namelen + 1], value, vallen); #endif - /* And remember the value. */ - STORE_VALUE (np); - } + /* And remember the value. */ + STORE_VALUE (np); + } #if defined USE_TSEARCH && !defined _LIBC - freea (new_value); + freea (new_value); #endif - } + } *ep = np; } @@ -281,6 +286,12 @@ __add_to_environ (const char *name, const char *value, const char *combined, int setenv (const char *name, const char *value, int replace) { + if (name == NULL || *name == '\0' || strchr (name, '=') != NULL) + { + __set_errno (EINVAL); + return -1; + } + return __add_to_environ (name, value, NULL, replace); } @@ -328,3 +339,45 @@ weak_alias (__clearenv, clearenv) #endif #endif /* _LIBC || !HAVE_SETENV */ + +/* The rest of this file is called into use when replacing an existing + but buggy setenv. Known bugs include failure to diagnose invalid + name, and consuming a leading '=' from value. */ +#if HAVE_SETENV + +# undef setenv +# define STREQ(a, b) (strcmp (a, b) == 0) + +int +rpl_setenv (const char *name, const char *value, int replace) +{ + int result; + if (!name || !*name || strchr (name, '=')) + { + errno = EINVAL; + return -1; + } + /* Call the real setenv even if replace is 0, in case implementation + has underlying data to update, such as when environ changes. */ + result = setenv (name, value, replace); + if (result == 0 && replace && *value == '=') + { + char *tmp = getenv (name); + if (!STREQ (tmp, value)) + { + int saved_errno; + size_t len = strlen (value); + tmp = malloca (len + 2); + /* Since leading '=' is eaten, double it up. */ + *tmp = '='; + memcpy (tmp + 1, value, len + 1); + result = setenv (name, tmp, replace); + saved_errno = errno; + freea (tmp); + errno = saved_errno; + } + } + return result; +} + +#endif /* HAVE_SETENV */ diff --git a/tests/signature.h b/tests/signature.h new file mode 100644 index 0000000..6e15c43 --- /dev/null +++ b/tests/signature.h @@ -0,0 +1,48 @@ +/* Macro for checking that a function declaration is compliant. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#ifndef SIGNATURE_CHECK + +/* Check that the function FN takes the specified arguments ARGS with + a return type of RET. This header is designed to be included after + <config.h> and the one system header that is supposed to contain + the function being checked, but prior to any other system headers + that are necessary for the unit test. Therefore, this file does + not include any system headers, nor reference anything outside of + the macro arguments. For an example, if foo.h should provide: + + extern int foo (char, float); + + then the unit test named test-foo.c would start out with: + + #include <config.h> + #include <foo.h> + #include "signature.h" + SIGNATURE_CHECK (foo, int, (char, float)); + #include <other.h> + ... +*/ +# define SIGNATURE_CHECK(fn, ret, args) \ + SIGNATURE_CHECK1 (fn, ret, args, __LINE__) + +/* Necessary to allow multiple SIGNATURE_CHECK lines in a unit test. + Note that the checks must not occupy the same line. */ +# define SIGNATURE_CHECK1(fn, ret, args, id) \ + SIGNATURE_CHECK2 (fn, ret, args, id) /* macroexpand line */ +# define SIGNATURE_CHECK2(fn, ret, args, id) \ + static ret (* _GL_UNUSED signature_check ## id) args = fn + +#endif /* SIGNATURE_CHECK */ diff --git a/tests/strerror.c b/tests/strerror.c index dfe6c25..b0df778 100644 --- a/tests/strerror.c +++ b/tests/strerror.c @@ -1,6 +1,6 @@ /* strerror.c --- POSIX compatible system error routine - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -334,10 +334,10 @@ rpl_strerror (int n) if (result == NULL || result[0] == '\0') { - static char const fmt[] = "Unknown error (%d)"; - static char msg_buf[sizeof fmt + INT_STRLEN_BOUND (n)]; - sprintf (msg_buf, fmt, n); - return msg_buf; + static char const fmt[] = "Unknown error (%d)"; + static char msg_buf[sizeof fmt + INT_STRLEN_BOUND (n)]; + sprintf (msg_buf, fmt, n); + return msg_buf; } return result; diff --git a/tests/test-alloca-opt.c b/tests/test-alloca-opt.c index 68d906d..cfbecaf 100644 --- a/tests/test-alloca-opt.c +++ b/tests/test-alloca-opt.c @@ -1,5 +1,5 @@ /* Test of optional automatic memory allocation. - Copyright (C) 2005, 2007 Free Software Foundation, Inc. + Copyright (C) 2005, 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-array-mergesort.c b/tests/test-array-mergesort.c index 8a47b67..3f5d082 100644 --- a/tests/test-array-mergesort.c +++ b/tests/test-array-mergesort.c @@ -1,5 +1,5 @@ /* Test of stable-sorting of an array using mergesort. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -24,20 +24,9 @@ struct foo { double x; double index; }; #define STATIC static #include "array-mergesort.h" -#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define NMAX 257 static const struct foo data[NMAX] = @@ -305,8 +294,8 @@ static int cmp_double (const void *a, const void *b) { return (*(const double *)a < *(const double *)b ? -1 : - *(const double *)a > *(const double *)b ? 1 : - 0); + *(const double *)a > *(const double *)b ? 1 : + 0); } int @@ -336,15 +325,15 @@ main () /* Verify the result. */ qsort_result = (double *) malloc (n * sizeof (double)); for (i = 0; i < n; i++) - qsort_result[i] = data[i].x; + qsort_result[i] = data[i].x; qsort (qsort_result, n, sizeof (double), cmp_double); for (i = 0; i < n; i++) - ASSERT (dst[i].x == qsort_result[i]); + ASSERT (dst[i].x == qsort_result[i]); /* Verify the stability. */ for (i = 0; i < n; i++) - if (i > 0 && dst[i - 1].x == dst[i].x) - ASSERT (dst[i - 1].index < dst[i].index); + if (i > 0 && dst[i - 1].x == dst[i].x) + ASSERT (dst[i - 1].index < dst[i].index); free (qsort_result); free (tmp); @@ -365,7 +354,7 @@ main () tmp[n].x = 0x587EF149; /* canary */ for (i = 0; i < n; i++) - src[i] = data[i]; + src[i] = data[i]; merge_sort_inplace (src, n, tmp); @@ -376,15 +365,15 @@ main () /* Verify the result. */ qsort_result = (double *) malloc (n * sizeof (double)); for (i = 0; i < n; i++) - qsort_result[i] = data[i].x; + qsort_result[i] = data[i].x; qsort (qsort_result, n, sizeof (double), cmp_double); for (i = 0; i < n; i++) - ASSERT (src[i].x == qsort_result[i]); + ASSERT (src[i].x == qsort_result[i]); /* Verify the stability. */ for (i = 0; i < n; i++) - if (i > 0 && src[i - 1].x == src[i].x) - ASSERT (src[i - 1].index < src[i].index); + if (i > 0 && src[i - 1].x == src[i].x) + ASSERT (src[i - 1].index < src[i].index); free (qsort_result); free (tmp); diff --git a/tests/test-c-ctype.c b/tests/test-c-ctype.c index 6d7fe1b..ebe594d 100644 --- a/tests/test-c-ctype.c +++ b/tests/test-c-ctype.c @@ -1,5 +1,5 @@ /* Test of character handling in C locale. - Copyright (C) 2005, 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2005, 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,20 +21,8 @@ #include "c-ctype.h" #include <locale.h> -#include <stdio.h> -#include <stdlib.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static void test_all (void) @@ -46,81 +34,81 @@ test_all (void) ASSERT (c_isascii (c) == (c >= 0 && c < 0x80)); switch (c) - { - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': - case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': - case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': - case 'Y': case 'Z': - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': - case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': - case 's': case 't': case 'u': case 'v': case 'w': case 'x': - case 'y': case 'z': - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - ASSERT (c_isalnum (c) == 1); - break; - default: - ASSERT (c_isalnum (c) == 0); - break; - } + { + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': + case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': + case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': + case 'Y': case 'Z': + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': + case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': + case 's': case 't': case 'u': case 'v': case 'w': case 'x': + case 'y': case 'z': + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': + ASSERT (c_isalnum (c) == 1); + break; + default: + ASSERT (c_isalnum (c) == 0); + break; + } switch (c) - { - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': - case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': - case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': - case 'Y': case 'Z': - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': - case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': - case 's': case 't': case 'u': case 'v': case 'w': case 'x': - case 'y': case 'z': - ASSERT (c_isalpha (c) == 1); - break; - default: - ASSERT (c_isalpha (c) == 0); - break; - } + { + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': + case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': + case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': + case 'Y': case 'Z': + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': + case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': + case 's': case 't': case 'u': case 'v': case 'w': case 'x': + case 'y': case 'z': + ASSERT (c_isalpha (c) == 1); + break; + default: + ASSERT (c_isalpha (c) == 0); + break; + } switch (c) - { - case '\t': case ' ': - ASSERT (c_isblank (c) == 1); - break; - default: - ASSERT (c_isblank (c) == 0); - break; - } + { + case '\t': case ' ': + ASSERT (c_isblank (c) == 1); + break; + default: + ASSERT (c_isblank (c) == 0); + break; + } ASSERT (c_iscntrl (c) == ((c >= 0 && c < 0x20) || c == 0x7f)); switch (c) - { - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - ASSERT (c_isdigit (c) == 1); - break; - default: - ASSERT (c_isdigit (c) == 0); - break; - } + { + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': + ASSERT (c_isdigit (c) == 1); + break; + default: + ASSERT (c_isdigit (c) == 0); + break; + } switch (c) - { - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': - case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': - case 's': case 't': case 'u': case 'v': case 'w': case 'x': - case 'y': case 'z': - ASSERT (c_islower (c) == 1); - break; - default: - ASSERT (c_islower (c) == 0); - break; - } + { + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': + case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': + case 's': case 't': case 'u': case 'v': case 'w': case 'x': + case 'y': case 'z': + ASSERT (c_islower (c) == 1); + break; + default: + ASSERT (c_islower (c) == 0); + break; + } ASSERT (c_isgraph (c) == ((c >= 0x20 && c < 0x7f) && c != ' ')); @@ -129,257 +117,257 @@ test_all (void) ASSERT (c_ispunct (c) == (c_isgraph (c) && !c_isalnum (c))); switch (c) - { - case ' ': case '\t': case '\n': case '\v': case '\f': case '\r': - ASSERT (c_isspace (c) == 1); - break; - default: - ASSERT (c_isspace (c) == 0); - break; - } + { + case ' ': case '\t': case '\n': case '\v': case '\f': case '\r': + ASSERT (c_isspace (c) == 1); + break; + default: + ASSERT (c_isspace (c) == 0); + break; + } switch (c) - { - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': - case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': - case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': - case 'Y': case 'Z': - ASSERT (c_isupper (c) == 1); - break; - default: - ASSERT (c_isupper (c) == 0); - break; - } + { + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': + case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': + case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': + case 'Y': case 'Z': + ASSERT (c_isupper (c) == 1); + break; + default: + ASSERT (c_isupper (c) == 0); + break; + } switch (c) - { - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - ASSERT (c_isxdigit (c) == 1); - break; - default: - ASSERT (c_isxdigit (c) == 0); - break; - } + { + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + ASSERT (c_isxdigit (c) == 1); + break; + default: + ASSERT (c_isxdigit (c) == 0); + break; + } switch (c) - { - case 'A': - ASSERT (c_tolower (c) == 'a'); - ASSERT (c_toupper (c) == c); - break; - case 'B': - ASSERT (c_tolower (c) == 'b'); - ASSERT (c_toupper (c) == c); - break; - case 'C': - ASSERT (c_tolower (c) == 'c'); - ASSERT (c_toupper (c) == c); - break; - case 'D': - ASSERT (c_tolower (c) == 'd'); - ASSERT (c_toupper (c) == c); - break; - case 'E': - ASSERT (c_tolower (c) == 'e'); - ASSERT (c_toupper (c) == c); - break; - case 'F': - ASSERT (c_tolower (c) == 'f'); - ASSERT (c_toupper (c) == c); - break; - case 'G': - ASSERT (c_tolower (c) == 'g'); - ASSERT (c_toupper (c) == c); - break; - case 'H': - ASSERT (c_tolower (c) == 'h'); - ASSERT (c_toupper (c) == c); - break; - case 'I': - ASSERT (c_tolower (c) == 'i'); - ASSERT (c_toupper (c) == c); - break; - case 'J': - ASSERT (c_tolower (c) == 'j'); - ASSERT (c_toupper (c) == c); - break; - case 'K': - ASSERT (c_tolower (c) == 'k'); - ASSERT (c_toupper (c) == c); - break; - case 'L': - ASSERT (c_tolower (c) == 'l'); - ASSERT (c_toupper (c) == c); - break; - case 'M': - ASSERT (c_tolower (c) == 'm'); - ASSERT (c_toupper (c) == c); - break; - case 'N': - ASSERT (c_tolower (c) == 'n'); - ASSERT (c_toupper (c) == c); - break; - case 'O': - ASSERT (c_tolower (c) == 'o'); - ASSERT (c_toupper (c) == c); - break; - case 'P': - ASSERT (c_tolower (c) == 'p'); - ASSERT (c_toupper (c) == c); - break; - case 'Q': - ASSERT (c_tolower (c) == 'q'); - ASSERT (c_toupper (c) == c); - break; - case 'R': - ASSERT (c_tolower (c) == 'r'); - ASSERT (c_toupper (c) == c); - break; - case 'S': - ASSERT (c_tolower (c) == 's'); - ASSERT (c_toupper (c) == c); - break; - case 'T': - ASSERT (c_tolower (c) == 't'); - ASSERT (c_toupper (c) == c); - break; - case 'U': - ASSERT (c_tolower (c) == 'u'); - ASSERT (c_toupper (c) == c); - break; - case 'V': - ASSERT (c_tolower (c) == 'v'); - ASSERT (c_toupper (c) == c); - break; - case 'W': - ASSERT (c_tolower (c) == 'w'); - ASSERT (c_toupper (c) == c); - break; - case 'X': - ASSERT (c_tolower (c) == 'x'); - ASSERT (c_toupper (c) == c); - break; - case 'Y': - ASSERT (c_tolower (c) == 'y'); - ASSERT (c_toupper (c) == c); - break; - case 'Z': - ASSERT (c_tolower (c) == 'z'); - ASSERT (c_toupper (c) == c); - break; - case 'a': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'A'); - break; - case 'b': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'B'); - break; - case 'c': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'C'); - break; - case 'd': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'D'); - break; - case 'e': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'E'); - break; - case 'f': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'F'); - break; - case 'g': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'G'); - break; - case 'h': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'H'); - break; - case 'i': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'I'); - break; - case 'j': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'J'); - break; - case 'k': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'K'); - break; - case 'l': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'L'); - break; - case 'm': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'M'); - break; - case 'n': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'N'); - break; - case 'o': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'O'); - break; - case 'p': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'P'); - break; - case 'q': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'Q'); - break; - case 'r': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'R'); - break; - case 's': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'S'); - break; - case 't': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'T'); - break; - case 'u': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'U'); - break; - case 'v': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'V'); - break; - case 'w': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'W'); - break; - case 'x': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'X'); - break; - case 'y': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'Y'); - break; - case 'z': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'Z'); - break; - default: - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == c); - break; - } + { + case 'A': + ASSERT (c_tolower (c) == 'a'); + ASSERT (c_toupper (c) == c); + break; + case 'B': + ASSERT (c_tolower (c) == 'b'); + ASSERT (c_toupper (c) == c); + break; + case 'C': + ASSERT (c_tolower (c) == 'c'); + ASSERT (c_toupper (c) == c); + break; + case 'D': + ASSERT (c_tolower (c) == 'd'); + ASSERT (c_toupper (c) == c); + break; + case 'E': + ASSERT (c_tolower (c) == 'e'); + ASSERT (c_toupper (c) == c); + break; + case 'F': + ASSERT (c_tolower (c) == 'f'); + ASSERT (c_toupper (c) == c); + break; + case 'G': + ASSERT (c_tolower (c) == 'g'); + ASSERT (c_toupper (c) == c); + break; + case 'H': + ASSERT (c_tolower (c) == 'h'); + ASSERT (c_toupper (c) == c); + break; + case 'I': + ASSERT (c_tolower (c) == 'i'); + ASSERT (c_toupper (c) == c); + break; + case 'J': + ASSERT (c_tolower (c) == 'j'); + ASSERT (c_toupper (c) == c); + break; + case 'K': + ASSERT (c_tolower (c) == 'k'); + ASSERT (c_toupper (c) == c); + break; + case 'L': + ASSERT (c_tolower (c) == 'l'); + ASSERT (c_toupper (c) == c); + break; + case 'M': + ASSERT (c_tolower (c) == 'm'); + ASSERT (c_toupper (c) == c); + break; + case 'N': + ASSERT (c_tolower (c) == 'n'); + ASSERT (c_toupper (c) == c); + break; + case 'O': + ASSERT (c_tolower (c) == 'o'); + ASSERT (c_toupper (c) == c); + break; + case 'P': + ASSERT (c_tolower (c) == 'p'); + ASSERT (c_toupper (c) == c); + break; + case 'Q': + ASSERT (c_tolower (c) == 'q'); + ASSERT (c_toupper (c) == c); + break; + case 'R': + ASSERT (c_tolower (c) == 'r'); + ASSERT (c_toupper (c) == c); + break; + case 'S': + ASSERT (c_tolower (c) == 's'); + ASSERT (c_toupper (c) == c); + break; + case 'T': + ASSERT (c_tolower (c) == 't'); + ASSERT (c_toupper (c) == c); + break; + case 'U': + ASSERT (c_tolower (c) == 'u'); + ASSERT (c_toupper (c) == c); + break; + case 'V': + ASSERT (c_tolower (c) == 'v'); + ASSERT (c_toupper (c) == c); + break; + case 'W': + ASSERT (c_tolower (c) == 'w'); + ASSERT (c_toupper (c) == c); + break; + case 'X': + ASSERT (c_tolower (c) == 'x'); + ASSERT (c_toupper (c) == c); + break; + case 'Y': + ASSERT (c_tolower (c) == 'y'); + ASSERT (c_toupper (c) == c); + break; + case 'Z': + ASSERT (c_tolower (c) == 'z'); + ASSERT (c_toupper (c) == c); + break; + case 'a': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'A'); + break; + case 'b': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'B'); + break; + case 'c': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'C'); + break; + case 'd': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'D'); + break; + case 'e': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'E'); + break; + case 'f': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'F'); + break; + case 'g': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'G'); + break; + case 'h': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'H'); + break; + case 'i': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'I'); + break; + case 'j': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'J'); + break; + case 'k': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'K'); + break; + case 'l': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'L'); + break; + case 'm': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'M'); + break; + case 'n': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'N'); + break; + case 'o': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'O'); + break; + case 'p': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'P'); + break; + case 'q': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'Q'); + break; + case 'r': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'R'); + break; + case 's': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'S'); + break; + case 't': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'T'); + break; + case 'u': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'U'); + break; + case 'v': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'V'); + break; + case 'w': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'W'); + break; + case 'x': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'X'); + break; + case 'y': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'Y'); + break; + case 'z': + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == 'Z'); + break; + default: + ASSERT (c_tolower (c) == c); + ASSERT (c_toupper (c) == c); + break; + } } } diff --git a/tests/test-c-strcasecmp.c b/tests/test-c-strcasecmp.c index 16244b9..84ea9b5 100644 --- a/tests/test-c-strcasecmp.c +++ b/tests/test-c-strcasecmp.c @@ -1,5 +1,5 @@ /* Test of case-insensitive string comparison function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,21 +21,9 @@ #include "c-strcase.h" #include <locale.h> -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char *argv[]) @@ -44,7 +32,7 @@ main (int argc, char *argv[]) { /* configure should already have checked that the locale is supported. */ if (setlocale (LC_ALL, "") == NULL) - return 1; + return 1; } ASSERT (c_strcasecmp ("paragraph", "Paragraph") == 0); diff --git a/tests/test-c-strncasecmp.c b/tests/test-c-strncasecmp.c index 7d6dbf5..f02cb2d 100644 --- a/tests/test-c-strncasecmp.c +++ b/tests/test-c-strncasecmp.c @@ -1,5 +1,5 @@ /* Test of case-insensitive string comparison function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,21 +21,9 @@ #include "c-strcase.h" #include <locale.h> -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char *argv[]) @@ -44,7 +32,7 @@ main (int argc, char *argv[]) { /* configure should already have checked that the locale is supported. */ if (setlocale (LC_ALL, "") == NULL) - return 1; + return 1; } ASSERT (c_strncasecmp ("paragraph", "Paragraph", 1000000) == 0); diff --git a/tests/test-dup2.c b/tests/test-dup2.c deleted file mode 100644 index 2009aaa..0000000 --- a/tests/test-dup2.c +++ /dev/null @@ -1,121 +0,0 @@ -/* Test duplicating file descriptors. - Copyright (C) 2009 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Eric Blake <ebb9@byu.net>, 2009. */ - -#include <config.h> - -#include <unistd.h> - -#include <errno.h> -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> - -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -/* Get declarations of the Win32 API functions. */ -# define WIN32_LEAN_AND_MEAN -# include <windows.h> -#endif - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) - -/* Return non-zero if FD is open. */ -static int -is_open (int fd) -{ -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - /* On Win32, the initial state of unassigned standard file - descriptors is that they are open but point to an - INVALID_HANDLE_VALUE, and there is no fcntl. */ - return (HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE; -#else -# ifndef F_GETFL -# error Please port fcntl to your platform -# endif - return 0 <= fcntl (fd, F_GETFL); -#endif -} - -int -main () -{ - const char *file = "test-dup2.tmp"; - char buffer[1]; - int fd = open (file, O_CREAT | O_RDWR, 0600); - - /* Assume std descriptors were provided by invoker. */ - ASSERT (STDERR_FILENO < fd); - ASSERT (is_open (fd)); - /* Ignore any other fd's leaked into this process. */ - close (fd + 1); - close (fd + 2); - ASSERT (!is_open (fd + 1)); - ASSERT (!is_open (fd + 2)); - - /* Assigning to self must be a no-op. */ - ASSERT (dup2 (fd, fd) == fd); - ASSERT (is_open (fd)); - - /* If the source is not open, then the destination is unaffected. */ - errno = 0; - ASSERT (dup2 (fd + 1, fd + 1) == -1); - ASSERT (errno == EBADF); - ASSERT (!is_open (fd + 1)); - errno = 0; - ASSERT (dup2 (fd + 1, fd) == -1); - ASSERT (errno == EBADF); - ASSERT (is_open (fd)); - - /* The destination must be valid. */ - errno = 0; - ASSERT (dup2 (fd, -2) == -1); - ASSERT (errno == EBADF); - - /* Using dup2 can skip fds. */ - ASSERT (dup2 (fd, fd + 2) == fd + 2); - ASSERT (is_open (fd)); - ASSERT (!is_open (fd + 1)); - ASSERT (is_open (fd + 2)); - - /* Prove that dup2 closes the previous occupant of a fd. */ - ASSERT (open ("/dev/null", O_WRONLY, 0600) == fd + 1); - ASSERT (dup2 (fd + 1, fd) == fd); - ASSERT (close (fd + 1) == 0); - ASSERT (write (fd, "1", 1) == 1); - ASSERT (dup2 (fd + 2, fd) == fd); - ASSERT (write (fd + 2, "2", 1) == 1); - ASSERT (lseek (fd, SEEK_SET, 0) == 0); - ASSERT (read (fd, buffer, 1) == 1); - ASSERT (*buffer == '2'); - - /* Clean up. */ - ASSERT (close (fd + 2) == 0); - ASSERT (close (fd) == 0); - ASSERT (unlink (file) == 0); - - return 0; -} diff --git a/tests/test-environ.c b/tests/test-environ.c index d9501bb..534c4e6 100644 --- a/tests/test-environ.c +++ b/tests/test-environ.c @@ -1,5 +1,5 @@ /* Test of environ variable. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -36,8 +36,8 @@ main () for (; (string = *remaining_variables) != NULL; remaining_variables++) { if (strncmp (string, "PATH=", 5) == 0) - /* Found the PATH environment variable. */ - return 0; + /* Found the PATH environment variable. */ + return 0; } /* Failed to find the PATH environment variable. */ return 1; diff --git a/tests/test-errno.c b/tests/test-errno.c index 4642027..129b236 100644 --- a/tests/test-errno.c +++ b/tests/test-errno.c @@ -1,5 +1,5 @@ /* Test of <errno.h> substitute. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-frexpl.c b/tests/test-frexpl.c index d4babb8..8d9d41d 100644 --- a/tests/test-frexpl.c +++ b/tests/test-frexpl.c @@ -1,5 +1,5 @@ /* Test of splitting a 'long double' into fraction and mantissa. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,31 +20,21 @@ #include <math.h> +#include "signature.h" +SIGNATURE_CHECK (frexpl, long double, (long double, int *)); + #include <float.h> -#include <stdio.h> -#include <stdlib.h> #include "fpucw.h" #include "isnanl-nolibm.h" #include "nan.h" +#include "macros.h" /* Avoid some warnings from "gcc -Wshadow". This file doesn't use the exp() function. */ #undef exp #define exp exponent -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) - /* On MIPS IRIX machines, LDBL_MIN_EXP is -1021, but the smallest reliable exponent for 'long double' is -964. Similarly, on PowerPC machines, LDBL_MIN_EXP is -1021, but the smallest reliable exponent for 'long double' diff --git a/tests/test-fseterr.c b/tests/test-fseterr.c index 475979b..c114f1a 100644 --- a/tests/test-fseterr.c +++ b/tests/test-fseterr.c @@ -1,5 +1,5 @@ /* Test setting the error indicator of a stream. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-iconv-h.c b/tests/test-iconv-h.c new file mode 100644 index 0000000..10a8e3d --- /dev/null +++ b/tests/test-iconv-h.c @@ -0,0 +1,31 @@ +/* Test of <iconv.h> substitute. + Copyright (C) 2007-2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +#if HAVE_ICONV +# include <iconv.h> + +# ifndef ICONV_CONST +# define ICONV_CONST /* empty */ +# endif +#endif + +int +main () +{ + return 0; +} diff --git a/tests/test-iconv.c b/tests/test-iconv.c index 8bac176..cf00ac8 100644 --- a/tests/test-iconv.c +++ b/tests/test-iconv.c @@ -1,5 +1,5 @@ /* Test of character set conversion. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,24 +20,23 @@ #if HAVE_ICONV # include <iconv.h> + +# ifndef ICONV_CONST +# define ICONV_CONST /* empty */ +# endif + +#include "signature.h" +SIGNATURE_CHECK (iconv, size_t, (iconv_t, ICONV_CONST char **, size_t *, + char **, size_t *)); +SIGNATURE_CHECK (iconv_close, int, (iconv_t x)); +SIGNATURE_CHECK (iconv_open, iconv_t, (char const *, char const *)); + #endif #include <errno.h> -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -61,8 +60,8 @@ main () char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_88591_to_utf8, - (ICONV_CONST char **) &inptr, &inbytesleft, - &outptr, &outbytesleft); + (ICONV_CONST char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); ASSERT (res == 0 && inbytesleft == 0); ASSERT (outptr == buf + strlen (expected)); ASSERT (memcmp (buf, expected, strlen (expected)) == 0); @@ -77,8 +76,8 @@ main () char *outptr = buf; size_t outbytesleft = 1; size_t res = iconv (cd_88591_to_utf8, - (ICONV_CONST char **) &inptr, &inbytesleft, - &outptr, &outbytesleft); + (ICONV_CONST char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); ASSERT (res == (size_t)(-1) && errno == E2BIG); ASSERT (inbytesleft == 1); ASSERT (outbytesleft == 1); @@ -96,8 +95,8 @@ main () char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_utf8_to_88591, - (ICONV_CONST char **) &inptr, &inbytesleft, - &outptr, &outbytesleft); + (ICONV_CONST char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); ASSERT (res == 0 && inbytesleft == 0); ASSERT (outptr == buf + strlen (expected)); ASSERT (memcmp (buf, expected, strlen (expected)) == 0); @@ -112,17 +111,17 @@ main () char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_utf8_to_88591, - (ICONV_CONST char **) &inptr, &inbytesleft, - &outptr, &outbytesleft); + (ICONV_CONST char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); if (res == (size_t)(-1)) { ASSERT (errno == EILSEQ); - ASSERT (inbytesleft == strlen (input) && outptr == buf); + ASSERT (inbytesleft == strlen (input) && outptr == buf); } else { - ASSERT (res == 1); - ASSERT (inbytesleft == 0); + ASSERT (res == 1); + ASSERT (inbytesleft == 0); } } @@ -135,8 +134,8 @@ main () char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_utf8_to_88591, - (ICONV_CONST char **) &inptr, &inbytesleft, - &outptr, &outbytesleft); + (ICONV_CONST char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); ASSERT (res == (size_t)(-1) && errno == EINVAL); ASSERT (inbytesleft == 1 && outptr == buf); } diff --git a/tests/test-isnand-nolibm.c b/tests/test-isnand-nolibm.c index fd739ca..b0ac0ba 100644 --- a/tests/test-isnand-nolibm.c +++ b/tests/test-isnand-nolibm.c @@ -1,5 +1,5 @@ /* Test of isnand() substitute. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-isnand.h b/tests/test-isnand.h index 09c5e97..f986621 100644 --- a/tests/test-isnand.h +++ b/tests/test-isnand.h @@ -1,5 +1,5 @@ /* Test of isnand() substitute. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,22 +17,9 @@ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <limits.h> -#include <stdio.h> -#include <stdlib.h> #include "nan.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0. So we use -zero instead. */ diff --git a/tests/test-isnanf-nolibm.c b/tests/test-isnanf-nolibm.c index 0105ce9..6ac69e0 100644 --- a/tests/test-isnanf-nolibm.c +++ b/tests/test-isnanf-nolibm.c @@ -1,5 +1,5 @@ /* Test of isnanf() substitute. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-isnanf.h b/tests/test-isnanf.h index f3f387c..d071b2c 100644 --- a/tests/test-isnanf.h +++ b/tests/test-isnanf.h @@ -1,5 +1,5 @@ /* Test of isnanf() substitute. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,22 +17,9 @@ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <limits.h> -#include <stdio.h> -#include <stdlib.h> #include "nan.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0f. So we use -zero instead. */ diff --git a/tests/test-isnanl-nolibm.c b/tests/test-isnanl-nolibm.c index 70c984d..eeca6d8 100644 --- a/tests/test-isnanl-nolibm.c +++ b/tests/test-isnanl-nolibm.c @@ -1,5 +1,5 @@ /* Test of isnanl() substitute. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-isnanl.h b/tests/test-isnanl.h index baf04db..1665cf4 100644 --- a/tests/test-isnanl.h +++ b/tests/test-isnanl.h @@ -1,5 +1,5 @@ /* Test of isnanl() substitute. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,22 +18,9 @@ #include <float.h> #include <limits.h> -#include <stdio.h> -#include <stdlib.h> #include "nan.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. So we use minus_zero instead. diff --git a/tests/test-locale.c b/tests/test-locale.c index 625cc43..2e5c4fc 100644 --- a/tests/test-locale.c +++ b/tests/test-locale.c @@ -1,5 +1,5 @@ /* Test of <locale.h> substitute. - Copyright (C) 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -33,6 +33,11 @@ int a[] = LC_TIME }; +#if HAVE_NEWLOCALE +/* Check that the locale_t type and the LC_GLOBAL_LOCALE macro are defined. */ +locale_t b = LC_GLOBAL_LOCALE; +#endif + /* Check that NULL can be passed through varargs as a pointer type, per POSIX 2008. */ verify (sizeof NULL == sizeof (void *)); diff --git a/tests/test-localename.c b/tests/test-localename.c index 82f786b..8f081b3 100644 --- a/tests/test-localename.c +++ b/tests/test-localename.c @@ -1,5 +1,5 @@ -/* Test of gl_locale_name function. - Copyright (C) 2007, 2008 Free Software Foundation, Inc. +/* Test of gl_locale_name function and its variants. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,30 +21,61 @@ #include "localename.h" #include <locale.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" -int -main () + +#if HAVE_NEWLOCALE + +static struct { int cat; int mask; const char *string; } const categories[] = + { + { LC_CTYPE, LC_CTYPE_MASK, "LC_CTYPE" }, + { LC_NUMERIC, LC_NUMERIC_MASK, "LC_NUMERIC" }, + { LC_TIME, LC_TIME_MASK, "LC_TIME" }, + { LC_COLLATE, LC_COLLATE_MASK, "LC_COLLATE" }, + { LC_MONETARY, LC_MONETARY_MASK, "LC_MONETARY" }, + { LC_MESSAGES, LC_MESSAGES_MASK, "LC_MESSAGES" } +# ifdef LC_PAPER + , { LC_PAPER, LC_PAPER_MASK, "LC_PAPER" } +# endif +# ifdef LC_NAME + , { LC_NAME, LC_NAME_MASK, "LC_NAME" } +# endif +# ifdef LC_ADDRESS + , { LC_ADDRESS, LC_ADDRESS_MASK, "LC_ADDRESS" } +# endif +# ifdef LC_TELEPHONE + , { LC_TELEPHONE, LC_TELEPHONE_MASK, "LC_TELEPHONE" } +# endif +# ifdef LC_MEASUREMENT + , { LC_MEASUREMENT, LC_MEASUREMENT_MASK, "LC_MEASUREMENT" } +# endif +# ifdef LC_IDENTIFICATION + , { LC_IDENTIFICATION, LC_IDENTIFICATION_MASK, "LC_IDENTIFICATION" } +# endif + }; + +#endif + +/* Test the gl_locale_name() function. */ +static void +test_locale_name (void) { + const char *name; + /* Check that gl_locale_name returns non-NULL. */ ASSERT (gl_locale_name (LC_MESSAGES, "LC_MESSAGES") != NULL); + /* Get into a defined state, */ + setlocale (LC_ALL, "en_US.UTF-8"); +#if HAVE_NEWLOCALE + uselocale (LC_GLOBAL_LOCALE); +#endif + /* Check that when all environment variables are unset, - gl_locale_name_posix returns NULL. */ + gl_locale_name returns the default locale. */ unsetenv ("LC_ALL"); unsetenv ("LC_CTYPE"); unsetenv ("LC_MESSAGES"); @@ -52,9 +83,9 @@ main () unsetenv ("LANG"); setlocale (LC_ALL, ""); ASSERT (strcmp (gl_locale_name (LC_MESSAGES, "LC_MESSAGES"), - gl_locale_name_default ()) == 0); + gl_locale_name_default ()) == 0); ASSERT (strcmp (gl_locale_name (LC_NUMERIC, "LC_NUMERIC"), - gl_locale_name_default ()) == 0); + gl_locale_name_default ()) == 0); /* Check that an empty environment variable is treated like an unset environment variable. */ @@ -65,7 +96,7 @@ main () unsetenv ("LANG"); setlocale (LC_ALL, ""); ASSERT (strcmp (gl_locale_name (LC_MESSAGES, "LC_MESSAGES"), - gl_locale_name_default ()) == 0); + gl_locale_name_default ()) == 0); unsetenv ("LC_ALL"); setenv ("LC_CTYPE", "", 1); @@ -73,7 +104,7 @@ main () unsetenv ("LANG"); setlocale (LC_ALL, ""); ASSERT (strcmp (gl_locale_name (LC_MESSAGES, "LC_MESSAGES"), - gl_locale_name_default ()) == 0); + gl_locale_name_default ()) == 0); unsetenv ("LC_ALL"); unsetenv ("LC_CTYPE"); @@ -81,7 +112,7 @@ main () unsetenv ("LANG"); setlocale (LC_ALL, ""); ASSERT (strcmp (gl_locale_name (LC_MESSAGES, "LC_MESSAGES"), - gl_locale_name_default ()) == 0); + gl_locale_name_default ()) == 0); unsetenv ("LC_ALL"); unsetenv ("LC_CTYPE"); @@ -89,7 +120,7 @@ main () setenv ("LANG", "", 1); setlocale (LC_ALL, ""); ASSERT (strcmp (gl_locale_name (LC_MESSAGES, "LC_MESSAGES"), - gl_locale_name_default ()) == 0); + gl_locale_name_default ()) == 0); /* Check that LC_ALL overrides the others, and LANG is overridden by the others. */ @@ -99,7 +130,6 @@ main () unsetenv ("LC_MESSAGES"); unsetenv ("LANG"); setlocale (LC_ALL, ""); - ASSERT (strcmp (gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"), "C") == 0); ASSERT (strcmp (gl_locale_name (LC_MESSAGES, "LC_MESSAGES"), "C") == 0); unsetenv ("LC_ALL"); @@ -107,7 +137,6 @@ main () setenv ("LC_MESSAGES", "C", 1); unsetenv ("LANG"); setlocale (LC_ALL, ""); - ASSERT (strcmp (gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"), "C") == 0); ASSERT (strcmp (gl_locale_name (LC_MESSAGES, "LC_MESSAGES"), "C") == 0); unsetenv ("LC_ALL"); @@ -115,8 +144,604 @@ main () unsetenv ("LC_MESSAGES"); setenv ("LANG", "C", 1); setlocale (LC_ALL, ""); - ASSERT (strcmp (gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"), "C") == 0); ASSERT (strcmp (gl_locale_name (LC_MESSAGES, "LC_MESSAGES"), "C") == 0); + /* Check mixed situations. */ + + unsetenv ("LC_ALL"); + unsetenv ("LC_CTYPE"); + setenv ("LC_MESSAGES", "fr_FR.UTF-8", 1); + setenv ("LANG", "de_DE.UTF-8", 1); + if (setlocale (LC_ALL, "") != NULL) + { + name = gl_locale_name (LC_CTYPE, "LC_CTYPE"); + ASSERT (strcmp (name, "de_DE.UTF-8") == 0); + name = gl_locale_name (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (strcmp (name, "fr_FR.UTF-8") == 0); + } + + unsetenv ("LC_ALL"); + unsetenv ("LC_CTYPE"); + setenv ("LC_MESSAGES", "fr_FR.UTF-8", 1); + unsetenv ("LANG"); + if (setlocale (LC_ALL, "") != NULL) + { + name = gl_locale_name (LC_CTYPE, "LC_CTYPE"); + ASSERT (strcmp (name, gl_locale_name_default ()) == 0); + name = gl_locale_name (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (strcmp (name, "fr_FR.UTF-8") == 0); + } + +#if HAVE_NEWLOCALE + /* Check that gl_locale_name considers the thread locale. */ + { + locale_t locale = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL); + if (locale != NULL) + { + uselocale (locale); + name = gl_locale_name (LC_CTYPE, "LC_CTYPE"); + ASSERT (strcmp (name, "fr_FR.UTF-8") == 0); + name = gl_locale_name (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (strcmp (name, "fr_FR.UTF-8") == 0); + } + } + + /* Check that gl_locale_name distinguishes different categories of the + thread locale, and that the name is the right one for each. */ + { + unsigned int i; + + for (i = 0; i < SIZEOF (categories); i++) + { + int category_mask = categories[i].mask; + locale_t locale = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL); + if (locale != NULL) + { + locale = newlocale (category_mask, "de_DE.UTF-8", locale); + if (locale != NULL) + { + unsigned int j; + + uselocale (locale); + for (j = 0; j < SIZEOF (categories); j++) + { + const char *name_j = + gl_locale_name (categories[j].cat, categories[j].string); + if (j == i) + ASSERT (strcmp (name_j, "de_DE.UTF-8") == 0); + else + ASSERT (strcmp (name_j, "fr_FR.UTF-8") == 0); + } + } + } + } + } +#endif +} + +/* Test the gl_locale_name_thread() function. */ +static void +test_locale_name_thread (void) +{ + /* Get into a defined state, */ + setlocale (LC_ALL, "en_US.UTF-8"); + +#if HAVE_NEWLOCALE + /* Check that gl_locale_name_thread returns NULL when no thread locale is + set. */ + uselocale (LC_GLOBAL_LOCALE); + ASSERT (gl_locale_name_thread (LC_CTYPE, "LC_CTYPE") == NULL); + ASSERT (gl_locale_name_thread (LC_MESSAGES, "LC_MESSAGES") == NULL); + + /* Check that gl_locale_name_thread considers the thread locale. */ + { + locale_t locale = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL); + if (locale != NULL) + { + const char *name; + + uselocale (locale); + name = gl_locale_name_thread (LC_CTYPE, "LC_CTYPE"); + ASSERT (strcmp (name, "fr_FR.UTF-8") == 0); + name = gl_locale_name_thread (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (strcmp (name, "fr_FR.UTF-8") == 0); + } + } + + /* Check that gl_locale_name_thread distinguishes different categories of the + thread locale, and that the name is the right one for each. */ + { + unsigned int i; + + for (i = 0; i < SIZEOF (categories); i++) + { + int category_mask = categories[i].mask; + locale_t locale = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL); + if (locale != NULL) + { + locale = newlocale (category_mask, "de_DE.UTF-8", locale); + if (locale != NULL) + { + unsigned int j; + + uselocale (locale); + for (j = 0; j < SIZEOF (categories); j++) + { + const char *name_j = + gl_locale_name_thread (categories[j].cat, + categories[j].string); + if (j == i) + ASSERT (strcmp (name_j, "de_DE.UTF-8") == 0); + else + ASSERT (strcmp (name_j, "fr_FR.UTF-8") == 0); + } + } + } + } + } + + /* Check that gl_locale_name_thread returns a string that is allocated with + indefinite extent. */ + { + /* Try many locale names in turn, in order to defeat possible caches. */ + static const char * const choices[] = + { + "C", + "POSIX", + "af_ZA", + "af_ZA.UTF-8", + "am_ET", + "am_ET.UTF-8", + "be_BY", + "be_BY.UTF-8", + "bg_BG", + "bg_BG.UTF-8", + "ca_ES", + "ca_ES.UTF-8", + "cs_CZ", + "cs_CZ.UTF-8", + "da_DK", + "da_DK.UTF-8", + "de_AT", + "de_AT.UTF-8", + "de_CH", + "de_CH.UTF-8", + "de_DE", + "de_DE.UTF-8", + "el_GR", + "el_GR.UTF-8", + "en_AU", + "en_AU.UTF-8", + "en_CA", + "en_CA.UTF-8", + "en_GB", + "en_GB.UTF-8", + "en_IE", + "en_IE.UTF-8", + "en_NZ", + "en_NZ.UTF-8", + "en_US", + "en_US.UTF-8", + "es_ES", + "es_ES.UTF-8", + "et_EE", + "et_EE.UTF-8", + "eu_ES", + "eu_ES.UTF-8", + "fi_FI", + "fi_FI.UTF-8", + "fr_BE", + "fr_BE.UTF-8", + "fr_CA", + "fr_CA.UTF-8", + "fr_CH", + "fr_CH.UTF-8", + "fr_FR", + "fr_FR.UTF-8", + "he_IL", + "he_IL.UTF-8", + "hr_HR", + "hr_HR.UTF-8", + "hu_HU", + "hu_HU.UTF-8", + "hy_AM", + "is_IS", + "is_IS.UTF-8", + "it_CH", + "it_CH.UTF-8", + "it_IT", + "it_IT.UTF-8", + "ja_JP.UTF-8", + "kk_KZ", + "kk_KZ.UTF-8", + "ko_KR.UTF-8", + "lt_LT", + "lt_LT.UTF-8", + "nl_BE", + "nl_BE.UTF-8", + "nl_NL", + "nl_NL.UTF-8", + "no_NO", + "no_NO.UTF-8", + "pl_PL", + "pl_PL.UTF-8", + "pt_BR", + "pt_BR.UTF-8", + "pt_PT", + "pt_PT.UTF-8", + "ro_RO", + "ro_RO.UTF-8", + "ru_RU", + "ru_RU.UTF-8", + "sk_SK", + "sk_SK.UTF-8", + "sl_SI", + "sl_SI.UTF-8", + "sv_SE", + "sv_SE.UTF-8", + "tr_TR", + "tr_TR.UTF-8", + "uk_UA", + "uk_UA.UTF-8", + "zh_CN", + "zh_CN.UTF-8", + "zh_HK", + "zh_HK.UTF-8", + "zh_TW", + "zh_TW.UTF-8" + }; + /* Remember which locales are available. */ + unsigned char /* bool */ available[SIZEOF (choices)]; + /* Array of remembered results of gl_locale_name_thread. */ + const char *unsaved_names[SIZEOF (choices)][SIZEOF (categories)]; + /* Array of remembered results of gl_locale_name_thread, stored in safe + memory. */ + char *saved_names[SIZEOF (choices)][SIZEOF (categories)]; + unsigned int j; + + for (j = 0; j < SIZEOF (choices); j++) + { + locale_t locale = newlocale (LC_ALL_MASK, choices[j], NULL); + available[j] = (locale != NULL); + if (locale != NULL) + { + unsigned int i; + + uselocale (locale); + for (i = 0; i < SIZEOF (categories); i++) + { + unsaved_names[j][i] = gl_locale_name_thread (categories[i].cat, categories[i].string); + saved_names[j][i] = strdup (unsaved_names[j][i]); + } + uselocale (LC_GLOBAL_LOCALE); + freelocale (locale); + } + } + /* Verify the unsaved_names are still valid. */ + for (j = 0; j < SIZEOF (choices); j++) + if (available[j]) + { + unsigned int i; + + for (i = 0; i < SIZEOF (categories); i++) + ASSERT (strcmp (unsaved_names[j][i], saved_names[j][i]) == 0); + } + /* Allocate many locales, without freeing them. This is an attempt at + overwriting as much of the previously allocated memory as possible. */ + for (j = SIZEOF (choices); j > 0; ) + { + j--; + if (available[j]) + { + locale_t locale = newlocale (LC_ALL_MASK, choices[j], NULL); + unsigned int i; + + ASSERT (locale != NULL); + uselocale (locale); + for (i = 0; i < SIZEOF (categories); i++) + { + const char *name = gl_locale_name_thread (categories[i].cat, categories[i].string); + ASSERT (strcmp (unsaved_names[j][i], name) == 0); + } + uselocale (LC_GLOBAL_LOCALE); + } + } + /* Verify the unsaved_names are still valid. */ + for (j = 0; j < SIZEOF (choices); j++) + if (available[j]) + { + unsigned int i; + + for (i = 0; i < SIZEOF (categories); i++) + ASSERT (strcmp (unsaved_names[j][i], saved_names[j][i]) == 0); + } + } +#else + /* Check that gl_locale_name_thread always returns NULL. */ + ASSERT (gl_locale_name_thread (LC_CTYPE, "LC_CTYPE") == NULL); + ASSERT (gl_locale_name_thread (LC_MESSAGES, "LC_MESSAGES") == NULL); +#endif +} + +/* Test the gl_locale_name_posix() function. */ +static void +test_locale_name_posix (void) +{ + const char *name; + + /* Get into a defined state, */ + setlocale (LC_ALL, "en_US.UTF-8"); +#if HAVE_NEWLOCALE + uselocale (LC_GLOBAL_LOCALE); +#endif + + /* Check that when all environment variables are unset, + gl_locale_name_posix returns either NULL or the default locale. */ + unsetenv ("LC_ALL"); + unsetenv ("LC_CTYPE"); + unsetenv ("LC_MESSAGES"); + unsetenv ("LC_NUMERIC"); + unsetenv ("LANG"); + setlocale (LC_ALL, ""); + name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (name == NULL || strcmp (name, gl_locale_name_default ()) == 0); + name = gl_locale_name_posix (LC_NUMERIC, "LC_NUMERIC"); + ASSERT (name == NULL || strcmp (name, gl_locale_name_default ()) == 0); + + /* Check that an empty environment variable is treated like an unset + environment variable. */ + + setenv ("LC_ALL", "", 1); + unsetenv ("LC_CTYPE"); + unsetenv ("LC_MESSAGES"); + unsetenv ("LANG"); + setlocale (LC_ALL, ""); + name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (name == NULL || strcmp (name, gl_locale_name_default ()) == 0); + + unsetenv ("LC_ALL"); + setenv ("LC_CTYPE", "", 1); + unsetenv ("LC_MESSAGES"); + unsetenv ("LANG"); + setlocale (LC_ALL, ""); + name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (name == NULL || strcmp (name, gl_locale_name_default ()) == 0); + + unsetenv ("LC_ALL"); + unsetenv ("LC_CTYPE"); + setenv ("LC_MESSAGES", "", 1); + unsetenv ("LANG"); + setlocale (LC_ALL, ""); + name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (name == NULL || strcmp (name, gl_locale_name_default ()) == 0); + + unsetenv ("LC_ALL"); + unsetenv ("LC_CTYPE"); + unsetenv ("LC_MESSAGES"); + setenv ("LANG", "", 1); + setlocale (LC_ALL, ""); + name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (name == NULL || strcmp (name, gl_locale_name_default ()) == 0); + + /* Check that LC_ALL overrides the others, and LANG is overridden by the + others. */ + + setenv ("LC_ALL", "C", 1); + unsetenv ("LC_CTYPE"); + unsetenv ("LC_MESSAGES"); + unsetenv ("LANG"); + setlocale (LC_ALL, ""); + name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (strcmp (name, "C") == 0); + + unsetenv ("LC_ALL"); + setenv ("LC_CTYPE", "C", 1); + setenv ("LC_MESSAGES", "C", 1); + unsetenv ("LANG"); + setlocale (LC_ALL, ""); + name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (strcmp (name, "C") == 0); + + unsetenv ("LC_ALL"); + unsetenv ("LC_CTYPE"); + unsetenv ("LC_MESSAGES"); + setenv ("LANG", "C", 1); + setlocale (LC_ALL, ""); + name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (strcmp (name, "C") == 0); + + /* Check mixed situations. */ + + unsetenv ("LC_ALL"); + unsetenv ("LC_CTYPE"); + setenv ("LC_MESSAGES", "fr_FR.UTF-8", 1); + setenv ("LANG", "de_DE.UTF-8", 1); + if (setlocale (LC_ALL, "") != NULL) + { + name = gl_locale_name_posix (LC_CTYPE, "LC_CTYPE"); + ASSERT (strcmp (name, "de_DE.UTF-8") == 0); + name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (strcmp (name, "fr_FR.UTF-8") == 0); + } + + unsetenv ("LC_ALL"); + unsetenv ("LC_CTYPE"); + setenv ("LC_MESSAGES", "fr_FR.UTF-8", 1); + unsetenv ("LANG"); + if (setlocale (LC_ALL, "") != NULL) + { + name = gl_locale_name_posix (LC_CTYPE, "LC_CTYPE"); + ASSERT (name == NULL || strcmp (name, gl_locale_name_default ()) == 0); + name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (strcmp (name, "fr_FR.UTF-8") == 0); + } + +#if HAVE_NEWLOCALE + /* Check that gl_locale_name_posix ignores the thread locale. */ + { + locale_t locale = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL); + if (locale != NULL) + { + unsetenv ("LC_ALL"); + unsetenv ("LC_CTYPE"); + unsetenv ("LC_MESSAGES"); + setenv ("LANG", "C", 1); + setlocale (LC_ALL, ""); + uselocale (locale); + name = gl_locale_name_posix (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (strcmp (name, "C") == 0); + } + } +#endif +} + +/* Test the gl_locale_name_environ() function. */ +static void +test_locale_name_environ (void) +{ + const char *name; + + /* Get into a defined state, */ + setlocale (LC_ALL, "en_US.UTF-8"); +#if HAVE_NEWLOCALE + uselocale (LC_GLOBAL_LOCALE); +#endif + + /* Check that when all environment variables are unset, + gl_locale_name_environ returns NULL. */ + unsetenv ("LC_ALL"); + unsetenv ("LC_CTYPE"); + unsetenv ("LC_MESSAGES"); + unsetenv ("LC_NUMERIC"); + unsetenv ("LANG"); + ASSERT (gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES") == NULL); + ASSERT (gl_locale_name_environ (LC_NUMERIC, "LC_NUMERIC") == NULL); + + /* Check that an empty environment variable is treated like an unset + environment variable. */ + + setenv ("LC_ALL", "", 1); + unsetenv ("LC_CTYPE"); + unsetenv ("LC_MESSAGES"); + unsetenv ("LANG"); + ASSERT (gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES") == NULL); + + unsetenv ("LC_ALL"); + setenv ("LC_CTYPE", "", 1); + unsetenv ("LC_MESSAGES"); + unsetenv ("LANG"); + ASSERT (gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES") == NULL); + + unsetenv ("LC_ALL"); + unsetenv ("LC_CTYPE"); + setenv ("LC_MESSAGES", "", 1); + unsetenv ("LANG"); + ASSERT (gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES") == NULL); + + unsetenv ("LC_ALL"); + unsetenv ("LC_CTYPE"); + unsetenv ("LC_MESSAGES"); + setenv ("LANG", "", 1); + ASSERT (gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES") == NULL); + + /* Check that LC_ALL overrides the others, and LANG is overridden by the + others. */ + + setenv ("LC_ALL", "C", 1); + unsetenv ("LC_CTYPE"); + unsetenv ("LC_MESSAGES"); + unsetenv ("LANG"); + name = gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (strcmp (name, "C") == 0); + + unsetenv ("LC_ALL"); + setenv ("LC_CTYPE", "C", 1); + setenv ("LC_MESSAGES", "C", 1); + unsetenv ("LANG"); + name = gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (strcmp (name, "C") == 0); + + unsetenv ("LC_ALL"); + unsetenv ("LC_CTYPE"); + unsetenv ("LC_MESSAGES"); + setenv ("LANG", "C", 1); + name = gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (strcmp (name, "C") == 0); + + /* Check mixed situations. */ + + unsetenv ("LC_ALL"); + unsetenv ("LC_CTYPE"); + setenv ("LC_MESSAGES", "fr_FR.UTF-8", 1); + setenv ("LANG", "de_DE.UTF-8", 1); + name = gl_locale_name_environ (LC_CTYPE, "LC_CTYPE"); + ASSERT (strcmp (name, "de_DE.UTF-8") == 0); + name = gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (strcmp (name, "fr_FR.UTF-8") == 0); + + unsetenv ("LC_ALL"); + unsetenv ("LC_CTYPE"); + setenv ("LC_MESSAGES", "fr_FR.UTF-8", 1); + unsetenv ("LANG"); + name = gl_locale_name_environ (LC_CTYPE, "LC_CTYPE"); + ASSERT (name == NULL); + name = gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (strcmp (name, "fr_FR.UTF-8") == 0); + +#if HAVE_NEWLOCALE + /* Check that gl_locale_name_environ ignores the thread locale. */ + { + locale_t locale = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL); + if (locale != NULL) + { + unsetenv ("LC_ALL"); + unsetenv ("LC_CTYPE"); + unsetenv ("LC_MESSAGES"); + setenv ("LANG", "C", 1); + setlocale (LC_ALL, ""); + uselocale (locale); + name = gl_locale_name_environ (LC_MESSAGES, "LC_MESSAGES"); + ASSERT (strcmp (name, "C") == 0); + } + } +#endif +} + +/* Test the gl_locale_name_default() function. */ +static void +test_locale_name_default (void) +{ + const char *name = gl_locale_name_default (); + + ASSERT (name != NULL); + + /* Only MacOS X and Windows have a facility for the user to set the default + locale. */ +#if !((defined __APPLE__ && defined __MACH__) || (defined _WIN32 || defined __WIN32__ || defined __CYGWIN__)) + ASSERT (strcmp (name, "C") == 0); +#endif + +#if HAVE_NEWLOCALE + /* Check that gl_locale_name_default ignores the thread locale. */ + { + locale_t locale = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL); + if (locale != NULL) + { + uselocale (locale); + ASSERT (strcmp (gl_locale_name_default (), name) == 0); + } + } +#endif +} + +int +main () +{ + test_locale_name (); + test_locale_name_thread (); + test_locale_name_posix (); + test_locale_name_environ (); + test_locale_name_default (); + return 0; } diff --git a/tests/test-lock.c b/tests/test-lock.c new file mode 100644 index 0000000..7792dca --- /dev/null +++ b/tests/test-lock.c @@ -0,0 +1,601 @@ +/* Test of locking in multithreaded situations. + Copyright (C) 2005, 2008-2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2005. */ + +#include <config.h> + +#if USE_POSIX_THREADS || USE_SOLARIS_THREADS || USE_PTH_THREADS || USE_WIN32_THREADS + +#if USE_POSIX_THREADS +# define TEST_POSIX_THREADS 1 +#endif +#if USE_SOLARIS_THREADS +# define TEST_SOLARIS_THREADS 1 +#endif +#if USE_PTH_THREADS +# define TEST_PTH_THREADS 1 +#endif +#if USE_WIN32_THREADS +# define TEST_WIN32_THREADS 1 +#endif + +/* Whether to enable locking. + Uncomment this to get a test program without locking, to verify that + it crashes. */ +#define ENABLE_LOCKING 1 + +/* Which tests to perform. + Uncomment some of these, to verify that all tests crash if no locking + is enabled. */ +#define DO_TEST_LOCK 1 +#define DO_TEST_RWLOCK 1 +#define DO_TEST_RECURSIVE_LOCK 1 +#define DO_TEST_ONCE 1 + +/* Whether to help the scheduler through explicit yield(). + Uncomment this to see if the operating system has a fair scheduler. */ +#define EXPLICIT_YIELD 1 + +/* Whether to print debugging messages. */ +#define ENABLE_DEBUGGING 0 + +/* Number of simultaneous threads. */ +#define THREAD_COUNT 10 + +/* Number of operations performed in each thread. + This is quite high, because with a smaller count, say 5000, we often get + an "OK" result even without ENABLE_LOCKING (on Linux/x86). */ +#define REPEAT_COUNT 50000 + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#if !ENABLE_LOCKING +# undef USE_POSIX_THREADS +# undef USE_SOLARIS_THREADS +# undef USE_PTH_THREADS +# undef USE_WIN32_THREADS +#endif +#include "glthread/lock.h" + +#if !ENABLE_LOCKING +# if TEST_POSIX_THREADS +# define USE_POSIX_THREADS 1 +# endif +# if TEST_SOLARIS_THREADS +# define USE_SOLARIS_THREADS 1 +# endif +# if TEST_PTH_THREADS +# define USE_PTH_THREADS 1 +# endif +# if TEST_WIN32_THREADS +# define USE_WIN32_THREADS 1 +# endif +#endif + +#include "glthread/thread.h" +#include "glthread/yield.h" + +#if ENABLE_DEBUGGING +# define dbgprintf printf +#else +# define dbgprintf if (0) printf +#endif + +#if EXPLICIT_YIELD +# define yield() gl_thread_yield () +#else +# define yield() +#endif + +#define ACCOUNT_COUNT 4 + +static int account[ACCOUNT_COUNT]; + +static int +random_account (void) +{ + return ((unsigned int) rand () >> 3) % ACCOUNT_COUNT; +} + +static void +check_accounts (void) +{ + int i, sum; + + sum = 0; + for (i = 0; i < ACCOUNT_COUNT; i++) + sum += account[i]; + if (sum != ACCOUNT_COUNT * 1000) + abort (); +} + + +/* ------------------- Test normal (non-recursive) locks ------------------- */ + +/* Test normal locks by having several bank accounts and several threads + which shuffle around money between the accounts and another thread + checking that all the money is still there. */ + +gl_lock_define_initialized(static, my_lock) + +static void * +lock_mutator_thread (void *arg) +{ + int repeat; + + for (repeat = REPEAT_COUNT; repeat > 0; repeat--) + { + int i1, i2, value; + + dbgprintf ("Mutator %p before lock\n", gl_thread_self ()); + gl_lock_lock (my_lock); + dbgprintf ("Mutator %p after lock\n", gl_thread_self ()); + + i1 = random_account (); + i2 = random_account (); + value = ((unsigned int) rand () >> 3) % 10; + account[i1] += value; + account[i2] -= value; + + dbgprintf ("Mutator %p before unlock\n", gl_thread_self ()); + gl_lock_unlock (my_lock); + dbgprintf ("Mutator %p after unlock\n", gl_thread_self ()); + + dbgprintf ("Mutator %p before check lock\n", gl_thread_self ()); + gl_lock_lock (my_lock); + check_accounts (); + gl_lock_unlock (my_lock); + dbgprintf ("Mutator %p after check unlock\n", gl_thread_self ()); + + yield (); + } + + dbgprintf ("Mutator %p dying.\n", gl_thread_self ()); + return NULL; +} + +static volatile int lock_checker_done; + +static void * +lock_checker_thread (void *arg) +{ + while (!lock_checker_done) + { + dbgprintf ("Checker %p before check lock\n", gl_thread_self ()); + gl_lock_lock (my_lock); + check_accounts (); + gl_lock_unlock (my_lock); + dbgprintf ("Checker %p after check unlock\n", gl_thread_self ()); + + yield (); + } + + dbgprintf ("Checker %p dying.\n", gl_thread_self ()); + return NULL; +} + +static void +test_lock (void) +{ + int i; + gl_thread_t checkerthread; + gl_thread_t threads[THREAD_COUNT]; + + /* Initialization. */ + for (i = 0; i < ACCOUNT_COUNT; i++) + account[i] = 1000; + lock_checker_done = 0; + + /* Spawn the threads. */ + checkerthread = gl_thread_create (lock_checker_thread, NULL); + for (i = 0; i < THREAD_COUNT; i++) + threads[i] = gl_thread_create (lock_mutator_thread, NULL); + + /* Wait for the threads to terminate. */ + for (i = 0; i < THREAD_COUNT; i++) + gl_thread_join (threads[i], NULL); + lock_checker_done = 1; + gl_thread_join (checkerthread, NULL); + check_accounts (); +} + + +/* ----------------- Test read-write (non-recursive) locks ----------------- */ + +/* Test read-write locks by having several bank accounts and several threads + which shuffle around money between the accounts and several other threads + that check that all the money is still there. */ + +gl_rwlock_define_initialized(static, my_rwlock) + +static void * +rwlock_mutator_thread (void *arg) +{ + int repeat; + + for (repeat = REPEAT_COUNT; repeat > 0; repeat--) + { + int i1, i2, value; + + dbgprintf ("Mutator %p before wrlock\n", gl_thread_self ()); + gl_rwlock_wrlock (my_rwlock); + dbgprintf ("Mutator %p after wrlock\n", gl_thread_self ()); + + i1 = random_account (); + i2 = random_account (); + value = ((unsigned int) rand () >> 3) % 10; + account[i1] += value; + account[i2] -= value; + + dbgprintf ("Mutator %p before unlock\n", gl_thread_self ()); + gl_rwlock_unlock (my_rwlock); + dbgprintf ("Mutator %p after unlock\n", gl_thread_self ()); + + yield (); + } + + dbgprintf ("Mutator %p dying.\n", gl_thread_self ()); + return NULL; +} + +static volatile int rwlock_checker_done; + +static void * +rwlock_checker_thread (void *arg) +{ + while (!rwlock_checker_done) + { + dbgprintf ("Checker %p before check rdlock\n", gl_thread_self ()); + gl_rwlock_rdlock (my_rwlock); + check_accounts (); + gl_rwlock_unlock (my_rwlock); + dbgprintf ("Checker %p after check unlock\n", gl_thread_self ()); + + yield (); + } + + dbgprintf ("Checker %p dying.\n", gl_thread_self ()); + return NULL; +} + +static void +test_rwlock (void) +{ + int i; + gl_thread_t checkerthreads[THREAD_COUNT]; + gl_thread_t threads[THREAD_COUNT]; + + /* Initialization. */ + for (i = 0; i < ACCOUNT_COUNT; i++) + account[i] = 1000; + rwlock_checker_done = 0; + + /* Spawn the threads. */ + for (i = 0; i < THREAD_COUNT; i++) + checkerthreads[i] = gl_thread_create (rwlock_checker_thread, NULL); + for (i = 0; i < THREAD_COUNT; i++) + threads[i] = gl_thread_create (rwlock_mutator_thread, NULL); + + /* Wait for the threads to terminate. */ + for (i = 0; i < THREAD_COUNT; i++) + gl_thread_join (threads[i], NULL); + rwlock_checker_done = 1; + for (i = 0; i < THREAD_COUNT; i++) + gl_thread_join (checkerthreads[i], NULL); + check_accounts (); +} + + +/* -------------------------- Test recursive locks -------------------------- */ + +/* Test recursive locks by having several bank accounts and several threads + which shuffle around money between the accounts (recursively) and another + thread checking that all the money is still there. */ + +gl_recursive_lock_define_initialized(static, my_reclock) + +static void +recshuffle (void) +{ + int i1, i2, value; + + dbgprintf ("Mutator %p before lock\n", gl_thread_self ()); + gl_recursive_lock_lock (my_reclock); + dbgprintf ("Mutator %p after lock\n", gl_thread_self ()); + + i1 = random_account (); + i2 = random_account (); + value = ((unsigned int) rand () >> 3) % 10; + account[i1] += value; + account[i2] -= value; + + /* Recursive with probability 0.5. */ + if (((unsigned int) rand () >> 3) % 2) + recshuffle (); + + dbgprintf ("Mutator %p before unlock\n", gl_thread_self ()); + gl_recursive_lock_unlock (my_reclock); + dbgprintf ("Mutator %p after unlock\n", gl_thread_self ()); +} + +static void * +reclock_mutator_thread (void *arg) +{ + int repeat; + + for (repeat = REPEAT_COUNT; repeat > 0; repeat--) + { + recshuffle (); + + dbgprintf ("Mutator %p before check lock\n", gl_thread_self ()); + gl_recursive_lock_lock (my_reclock); + check_accounts (); + gl_recursive_lock_unlock (my_reclock); + dbgprintf ("Mutator %p after check unlock\n", gl_thread_self ()); + + yield (); + } + + dbgprintf ("Mutator %p dying.\n", gl_thread_self ()); + return NULL; +} + +static volatile int reclock_checker_done; + +static void * +reclock_checker_thread (void *arg) +{ + while (!reclock_checker_done) + { + dbgprintf ("Checker %p before check lock\n", gl_thread_self ()); + gl_recursive_lock_lock (my_reclock); + check_accounts (); + gl_recursive_lock_unlock (my_reclock); + dbgprintf ("Checker %p after check unlock\n", gl_thread_self ()); + + yield (); + } + + dbgprintf ("Checker %p dying.\n", gl_thread_self ()); + return NULL; +} + +static void +test_recursive_lock (void) +{ + int i; + gl_thread_t checkerthread; + gl_thread_t threads[THREAD_COUNT]; + + /* Initialization. */ + for (i = 0; i < ACCOUNT_COUNT; i++) + account[i] = 1000; + reclock_checker_done = 0; + + /* Spawn the threads. */ + checkerthread = gl_thread_create (reclock_checker_thread, NULL); + for (i = 0; i < THREAD_COUNT; i++) + threads[i] = gl_thread_create (reclock_mutator_thread, NULL); + + /* Wait for the threads to terminate. */ + for (i = 0; i < THREAD_COUNT; i++) + gl_thread_join (threads[i], NULL); + reclock_checker_done = 1; + gl_thread_join (checkerthread, NULL); + check_accounts (); +} + + +/* ------------------------ Test once-only execution ------------------------ */ + +/* Test once-only execution by having several threads attempt to grab a + once-only task simultaneously (triggered by releasing a read-write lock). */ + +gl_once_define(static, fresh_once) +static int ready[THREAD_COUNT]; +static gl_lock_t ready_lock[THREAD_COUNT]; +#if ENABLE_LOCKING +static gl_rwlock_t fire_signal[REPEAT_COUNT]; +#else +static volatile int fire_signal_state; +#endif +static gl_once_t once_control; +static int performed; +gl_lock_define_initialized(static, performed_lock) + +static void +once_execute (void) +{ + gl_lock_lock (performed_lock); + performed++; + gl_lock_unlock (performed_lock); +} + +static void * +once_contender_thread (void *arg) +{ + int id = (int) (long) arg; + int repeat; + + for (repeat = 0; repeat <= REPEAT_COUNT; repeat++) + { + /* Tell the main thread that we're ready. */ + gl_lock_lock (ready_lock[id]); + ready[id] = 1; + gl_lock_unlock (ready_lock[id]); + + if (repeat == REPEAT_COUNT) + break; + + dbgprintf ("Contender %p waiting for signal for round %d\n", + gl_thread_self (), repeat); +#if ENABLE_LOCKING + /* Wait for the signal to go. */ + gl_rwlock_rdlock (fire_signal[repeat]); + /* And don't hinder the others (if the scheduler is unfair). */ + gl_rwlock_unlock (fire_signal[repeat]); +#else + /* Wait for the signal to go. */ + while (fire_signal_state <= repeat) + yield (); +#endif + dbgprintf ("Contender %p got the signal for round %d\n", + gl_thread_self (), repeat); + + /* Contend for execution. */ + gl_once (once_control, once_execute); + } + + return NULL; +} + +static void +test_once (void) +{ + int i, repeat; + gl_thread_t threads[THREAD_COUNT]; + + /* Initialize all variables. */ + for (i = 0; i < THREAD_COUNT; i++) + { + ready[i] = 0; + gl_lock_init (ready_lock[i]); + } +#if ENABLE_LOCKING + for (i = 0; i < REPEAT_COUNT; i++) + gl_rwlock_init (fire_signal[i]); +#else + fire_signal_state = 0; +#endif + + /* Block all fire_signals. */ + for (i = REPEAT_COUNT-1; i >= 0; i--) + gl_rwlock_wrlock (fire_signal[i]); + + /* Spawn the threads. */ + for (i = 0; i < THREAD_COUNT; i++) + threads[i] = gl_thread_create (once_contender_thread, (void *) (long) i); + + for (repeat = 0; repeat <= REPEAT_COUNT; repeat++) + { + /* Wait until every thread is ready. */ + dbgprintf ("Main thread before synchonizing for round %d\n", repeat); + for (;;) + { + int ready_count = 0; + for (i = 0; i < THREAD_COUNT; i++) + { + gl_lock_lock (ready_lock[i]); + ready_count += ready[i]; + gl_lock_unlock (ready_lock[i]); + } + if (ready_count == THREAD_COUNT) + break; + yield (); + } + dbgprintf ("Main thread after synchonizing for round %d\n", repeat); + + if (repeat > 0) + { + /* Check that exactly one thread executed the once_execute() + function. */ + if (performed != 1) + abort (); + } + + if (repeat == REPEAT_COUNT) + break; + + /* Preparation for the next round: Initialize once_control. */ + memcpy (&once_control, &fresh_once, sizeof (gl_once_t)); + + /* Preparation for the next round: Reset the performed counter. */ + performed = 0; + + /* Preparation for the next round: Reset the ready flags. */ + for (i = 0; i < THREAD_COUNT; i++) + { + gl_lock_lock (ready_lock[i]); + ready[i] = 0; + gl_lock_unlock (ready_lock[i]); + } + + /* Signal all threads simultaneously. */ + dbgprintf ("Main thread giving signal for round %d\n", repeat); +#if ENABLE_LOCKING + gl_rwlock_unlock (fire_signal[repeat]); +#else + fire_signal_state = repeat + 1; +#endif + } + + /* Wait for the threads to terminate. */ + for (i = 0; i < THREAD_COUNT; i++) + gl_thread_join (threads[i], NULL); +} + + +/* -------------------------------------------------------------------------- */ + +int +main () +{ +#if TEST_PTH_THREADS + if (!pth_init ()) + abort (); +#endif + +#if DO_TEST_LOCK + printf ("Starting test_lock ..."); fflush (stdout); + test_lock (); + printf (" OK\n"); fflush (stdout); +#endif +#if DO_TEST_RWLOCK + printf ("Starting test_rwlock ..."); fflush (stdout); + test_rwlock (); + printf (" OK\n"); fflush (stdout); +#endif +#if DO_TEST_RECURSIVE_LOCK + printf ("Starting test_recursive_lock ..."); fflush (stdout); + test_recursive_lock (); + printf (" OK\n"); fflush (stdout); +#endif +#if DO_TEST_ONCE + printf ("Starting test_once ..."); fflush (stdout); + test_once (); + printf (" OK\n"); fflush (stdout); +#endif + + return 0; +} + +#else + +/* No multithreading available. */ + +#include <stdio.h> + +int +main () +{ + fputs ("Skipping test: multithreading not enabled\n", stderr); + return 77; +} + +#endif diff --git a/tests/test-malloca.c b/tests/test-malloca.c index 7de6c68..14ef3a9 100644 --- a/tests/test-malloca.c +++ b/tests/test-malloca.c @@ -1,5 +1,5 @@ /* Test of safe automatic memory allocation. - Copyright (C) 2005, 2007 Free Software Foundation, Inc. + Copyright (C) 2005, 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-math.c b/tests/test-math.c index aa51f85..f940a24 100644 --- a/tests/test-math.c +++ b/tests/test-math.c @@ -1,5 +1,5 @@ /* Test of <math.h> substitute. - Copyright (C) 2007, 2008 Free Software Foundation, Inc. + Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -40,7 +40,7 @@ numeric_equal (double x, double y) } int -main () +main (void) { double d = NAN; double zero = 0.0; diff --git a/tests/test-mbrtowc.c b/tests/test-mbrtowc.c index 8f1f1be..5477677 100644 --- a/tests/test-mbrtowc.c +++ b/tests/test-mbrtowc.c @@ -1,5 +1,5 @@ /* Test of conversion of multibyte character to wide character. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,22 +20,15 @@ #include <wchar.h> +#include "signature.h" +SIGNATURE_CHECK (mbrtowc, size_t, (wchar_t *, char const *, size_t, + mbstate_t *)); + #include <locale.h> #include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char *argv[]) @@ -81,40 +74,40 @@ main (int argc, char *argv[]) memset (&state, '\0', sizeof (mbstate_t)); for (c = 0; c < 0x100; c++) switch (c) - { - case '\t': case '\v': case '\f': - case ' ': case '!': case '"': case '#': case '%': - case '&': case '\'': case '(': case ')': case '*': - case '+': case ',': case '-': case '.': case '/': - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - case ':': case ';': case '<': case '=': case '>': - case '?': - case 'A': case 'B': case 'C': case 'D': case 'E': - case 'F': case 'G': case 'H': case 'I': case 'J': - case 'K': case 'L': case 'M': case 'N': case 'O': - case 'P': case 'Q': case 'R': case 'S': case 'T': - case 'U': case 'V': case 'W': case 'X': case 'Y': - case 'Z': - case '[': case '\\': case ']': case '^': case '_': - case 'a': case 'b': case 'c': case 'd': case 'e': - case 'f': case 'g': case 'h': case 'i': case 'j': - case 'k': case 'l': case 'm': case 'n': case 'o': - case 'p': case 'q': case 'r': case 's': case 't': - case 'u': case 'v': case 'w': case 'x': case 'y': - case 'z': case '{': case '|': case '}': case '~': - /* c is in the ISO C "basic character set". */ - buf[0] = c; - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, buf, 1, &state); - ASSERT (ret == 1); - ASSERT (wc == c); - ASSERT (mbsinit (&state)); - ret = mbrtowc (NULL, buf, 1, &state); - ASSERT (ret == 1); - ASSERT (mbsinit (&state)); - break; - } + { + case '\t': case '\v': case '\f': + case ' ': case '!': case '"': case '#': case '%': + case '&': case '\'': case '(': case ')': case '*': + case '+': case ',': case '-': case '.': case '/': + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + case ':': case ';': case '<': case '=': case '>': + case '?': + case 'A': case 'B': case 'C': case 'D': case 'E': + case 'F': case 'G': case 'H': case 'I': case 'J': + case 'K': case 'L': case 'M': case 'N': case 'O': + case 'P': case 'Q': case 'R': case 'S': case 'T': + case 'U': case 'V': case 'W': case 'X': case 'Y': + case 'Z': + case '[': case '\\': case ']': case '^': case '_': + case 'a': case 'b': case 'c': case 'd': case 'e': + case 'f': case 'g': case 'h': case 'i': case 'j': + case 'k': case 'l': case 'm': case 'n': case 'o': + case 'p': case 'q': case 'r': case 's': case 't': + case 'u': case 'v': case 'w': case 'x': case 'y': + case 'z': case '{': case '|': case '}': case '~': + /* c is in the ISO C "basic character set". */ + buf[0] = c; + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, buf, 1, &state); + ASSERT (ret == 1); + ASSERT (wc == c); + ASSERT (mbsinit (&state)); + ret = mbrtowc (NULL, buf, 1, &state); + ASSERT (ret == 1); + ASSERT (mbsinit (&state)); + break; + } } /* Test special calling convention, passing a NULL pointer. */ @@ -131,199 +124,199 @@ main (int argc, char *argv[]) switch (argv[1][0]) { case '1': - /* Locale encoding is ISO-8859-1 or ISO-8859-15. */ - { - char input[] = "B\374\337er"; /* "Büßer" */ - memset (&state, '\0', sizeof (mbstate_t)); - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input, 1, &state); - ASSERT (ret == 1); - ASSERT (wc == 'B'); - ASSERT (mbsinit (&state)); - input[0] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 1, 1, &state); - ASSERT (ret == 1); - ASSERT (wctob (wc) == (unsigned char) '\374'); - ASSERT (mbsinit (&state)); - input[1] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 2, 3, &state); - ASSERT (ret == 1); - ASSERT (wctob (wc) == (unsigned char) '\337'); - ASSERT (mbsinit (&state)); - input[2] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 3, 2, &state); - ASSERT (ret == 1); - ASSERT (wc == 'e'); - ASSERT (mbsinit (&state)); - input[3] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 4, 1, &state); - ASSERT (ret == 1); - ASSERT (wc == 'r'); - ASSERT (mbsinit (&state)); - } - return 0; + /* Locale encoding is ISO-8859-1 or ISO-8859-15. */ + { + char input[] = "B\374\337er"; /* "Büßer" */ + memset (&state, '\0', sizeof (mbstate_t)); + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input, 1, &state); + ASSERT (ret == 1); + ASSERT (wc == 'B'); + ASSERT (mbsinit (&state)); + input[0] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 1, 1, &state); + ASSERT (ret == 1); + ASSERT (wctob (wc) == (unsigned char) '\374'); + ASSERT (mbsinit (&state)); + input[1] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 2, 3, &state); + ASSERT (ret == 1); + ASSERT (wctob (wc) == (unsigned char) '\337'); + ASSERT (mbsinit (&state)); + input[2] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 3, 2, &state); + ASSERT (ret == 1); + ASSERT (wc == 'e'); + ASSERT (mbsinit (&state)); + input[3] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 4, 1, &state); + ASSERT (ret == 1); + ASSERT (wc == 'r'); + ASSERT (mbsinit (&state)); + } + return 0; case '2': - /* Locale encoding is UTF-8. */ - { - char input[] = "B\303\274\303\237er"; /* "Büßer" */ - memset (&state, '\0', sizeof (mbstate_t)); - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input, 1, &state); - ASSERT (ret == 1); - ASSERT (wc == 'B'); - ASSERT (mbsinit (&state)); - input[0] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 1, 1, &state); - ASSERT (ret == (size_t)(-2)); - ASSERT (wc == (wchar_t) 0xBADFACE); - ASSERT (!mbsinit (&state)); - input[1] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 2, 5, &state); - ASSERT (ret == 1); - ASSERT (wctob (wc) == EOF); - ASSERT (mbsinit (&state)); - input[2] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 3, 4, &state); - ASSERT (ret == 2); - ASSERT (wctob (wc) == EOF); - ASSERT (mbsinit (&state)); - input[3] = '\0'; - input[4] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 5, 2, &state); - ASSERT (ret == 1); - ASSERT (wc == 'e'); - ASSERT (mbsinit (&state)); - input[5] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 6, 1, &state); - ASSERT (ret == 1); - ASSERT (wc == 'r'); - ASSERT (mbsinit (&state)); - } - return 0; + /* Locale encoding is UTF-8. */ + { + char input[] = "B\303\274\303\237er"; /* "Büßer" */ + memset (&state, '\0', sizeof (mbstate_t)); + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input, 1, &state); + ASSERT (ret == 1); + ASSERT (wc == 'B'); + ASSERT (mbsinit (&state)); + input[0] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 1, 1, &state); + ASSERT (ret == (size_t)(-2)); + ASSERT (wc == (wchar_t) 0xBADFACE); + ASSERT (!mbsinit (&state)); + input[1] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 2, 5, &state); + ASSERT (ret == 1); + ASSERT (wctob (wc) == EOF); + ASSERT (mbsinit (&state)); + input[2] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 3, 4, &state); + ASSERT (ret == 2); + ASSERT (wctob (wc) == EOF); + ASSERT (mbsinit (&state)); + input[3] = '\0'; + input[4] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 5, 2, &state); + ASSERT (ret == 1); + ASSERT (wc == 'e'); + ASSERT (mbsinit (&state)); + input[5] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 6, 1, &state); + ASSERT (ret == 1); + ASSERT (wc == 'r'); + ASSERT (mbsinit (&state)); + } + return 0; case '3': - /* Locale encoding is EUC-JP. */ - { - char input[] = "<\306\374\313\334\270\354>"; /* "<日本語>" */ - memset (&state, '\0', sizeof (mbstate_t)); - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input, 1, &state); - ASSERT (ret == 1); - ASSERT (wc == '<'); - ASSERT (mbsinit (&state)); - input[0] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 1, 2, &state); - ASSERT (ret == 2); - ASSERT (wctob (wc) == EOF); - ASSERT (mbsinit (&state)); - input[1] = '\0'; - input[2] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 3, 1, &state); - ASSERT (ret == (size_t)(-2)); - ASSERT (wc == (wchar_t) 0xBADFACE); - ASSERT (!mbsinit (&state)); - input[3] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 4, 4, &state); - ASSERT (ret == 1); - ASSERT (wctob (wc) == EOF); - ASSERT (mbsinit (&state)); - input[4] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 5, 3, &state); - ASSERT (ret == 2); - ASSERT (wctob (wc) == EOF); - ASSERT (mbsinit (&state)); - input[5] = '\0'; - input[6] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 7, 1, &state); - ASSERT (ret == 1); - ASSERT (wc == '>'); - ASSERT (mbsinit (&state)); - } - return 0; + /* Locale encoding is EUC-JP. */ + { + char input[] = "<\306\374\313\334\270\354>"; /* "<日本語>" */ + memset (&state, '\0', sizeof (mbstate_t)); + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input, 1, &state); + ASSERT (ret == 1); + ASSERT (wc == '<'); + ASSERT (mbsinit (&state)); + input[0] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 1, 2, &state); + ASSERT (ret == 2); + ASSERT (wctob (wc) == EOF); + ASSERT (mbsinit (&state)); + input[1] = '\0'; + input[2] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 3, 1, &state); + ASSERT (ret == (size_t)(-2)); + ASSERT (wc == (wchar_t) 0xBADFACE); + ASSERT (!mbsinit (&state)); + input[3] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 4, 4, &state); + ASSERT (ret == 1); + ASSERT (wctob (wc) == EOF); + ASSERT (mbsinit (&state)); + input[4] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 5, 3, &state); + ASSERT (ret == 2); + ASSERT (wctob (wc) == EOF); + ASSERT (mbsinit (&state)); + input[5] = '\0'; + input[6] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 7, 1, &state); + ASSERT (ret == 1); + ASSERT (wc == '>'); + ASSERT (mbsinit (&state)); + } + return 0; case '4': - /* Locale encoding is GB18030. */ - { - char input[] = "B\250\271\201\060\211\070er"; /* "Büßer" */ - memset (&state, '\0', sizeof (mbstate_t)); - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input, 1, &state); - ASSERT (ret == 1); - ASSERT (wc == 'B'); - ASSERT (mbsinit (&state)); - input[0] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 1, 1, &state); - ASSERT (ret == (size_t)(-2)); - ASSERT (wc == (wchar_t) 0xBADFACE); - ASSERT (!mbsinit (&state)); - input[1] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 2, 7, &state); - ASSERT (ret == 1); - ASSERT (wctob (wc) == EOF); - ASSERT (mbsinit (&state)); - input[2] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 3, 6, &state); - ASSERT (ret == 4); - ASSERT (wctob (wc) == EOF); - ASSERT (mbsinit (&state)); - input[3] = '\0'; - input[4] = '\0'; - input[5] = '\0'; - input[6] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 7, 2, &state); - ASSERT (ret == 1); - ASSERT (wc == 'e'); - ASSERT (mbsinit (&state)); - input[5] = '\0'; - - wc = (wchar_t) 0xBADFACE; - ret = mbrtowc (&wc, input + 8, 1, &state); - ASSERT (ret == 1); - ASSERT (wc == 'r'); - ASSERT (mbsinit (&state)); - } - return 0; + /* Locale encoding is GB18030. */ + { + char input[] = "B\250\271\201\060\211\070er"; /* "Büßer" */ + memset (&state, '\0', sizeof (mbstate_t)); + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input, 1, &state); + ASSERT (ret == 1); + ASSERT (wc == 'B'); + ASSERT (mbsinit (&state)); + input[0] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 1, 1, &state); + ASSERT (ret == (size_t)(-2)); + ASSERT (wc == (wchar_t) 0xBADFACE); + ASSERT (!mbsinit (&state)); + input[1] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 2, 7, &state); + ASSERT (ret == 1); + ASSERT (wctob (wc) == EOF); + ASSERT (mbsinit (&state)); + input[2] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 3, 6, &state); + ASSERT (ret == 4); + ASSERT (wctob (wc) == EOF); + ASSERT (mbsinit (&state)); + input[3] = '\0'; + input[4] = '\0'; + input[5] = '\0'; + input[6] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 7, 2, &state); + ASSERT (ret == 1); + ASSERT (wc == 'e'); + ASSERT (mbsinit (&state)); + input[5] = '\0'; + + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, input + 8, 1, &state); + ASSERT (ret == 1); + ASSERT (wc == 'r'); + ASSERT (mbsinit (&state)); + } + return 0; } return 1; diff --git a/tests/test-mbsinit.c b/tests/test-mbsinit.c index 5d4c9c3..4ca0fc3 100644 --- a/tests/test-mbsinit.c +++ b/tests/test-mbsinit.c @@ -1,5 +1,5 @@ /* Test of test for initial conversion state. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,21 +20,12 @@ #include <wchar.h> +#include "signature.h" +SIGNATURE_CHECK (mbsinit, int, (const mbstate_t *)); + #include <locale.h> -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) + +#include "macros.h" int main (int argc, char *argv[]) @@ -51,7 +42,7 @@ main (int argc, char *argv[]) /* configure should already have checked that the locale is supported. */ if (setlocale (LC_ALL, "") == NULL) - return 1; + return 1; ret = mbrtowc (&wc, input, 1, &state); ASSERT (ret == (size_t)(-2)); diff --git a/tests/test-memchr.c b/tests/test-memchr.c index 1124f8b..a801614 100644 --- a/tests/test-memchr.c +++ b/tests/test-memchr.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2009 Free Software Foundation + * Copyright (C) 2008-2010 Free Software Foundation, Inc. * Written by Eric Blake and Bruno Haible * * This program is free software: you can redistribute it and/or modify @@ -19,29 +19,20 @@ #include <string.h> -#include <stdio.h> +#include "signature.h" +SIGNATURE_CHECK (memchr, void *, (void const *, int, size_t)); + #include <stdlib.h> #include "zerosize-ptr.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Calculating void * + int is not portable, so this wrapper converts to char * to make the tests easier to write. */ #define MEMCHR (char *) memchr int -main () +main (void) { size_t n = 0x100000; char *input = malloc (n); @@ -76,7 +67,7 @@ main () size_t repeat = 10000; for (; repeat > 0; repeat--) { - ASSERT (MEMCHR (input, 'c', n) == input + 2); + ASSERT (MEMCHR (input, 'c', n) == input + 2); } } @@ -85,12 +76,12 @@ main () int i, j; for (i = 0; i < 32; i++) { - for (j = 0; j < 256; j++) - input[i + j] = j; - for (j = 0; j < 256; j++) - { - ASSERT (MEMCHR (input + i, j, 256) == input + i + j); - } + for (j = 0; j < 256; j++) + input[i + j] = j; + for (j = 0; j < 256; j++) + { + ASSERT (MEMCHR (input + i, j, 256) == input + i + j); + } } } @@ -102,25 +93,23 @@ main () if (page_boundary != NULL) { - int n; - - for (n = 1; n <= 500; n++) - { - char *mem = page_boundary - n; - memset (mem, 'X', n); - ASSERT (MEMCHR (mem, 'U', n) == NULL); - - { - int i; - - for (i = 0; i < n; i++) - { - mem[i] = 'U'; - ASSERT (MEMCHR (mem, 'U', 4000) == mem + i); - mem[i] = 'X'; - } - } - } + for (n = 1; n <= 500; n++) + { + char *mem = page_boundary - n; + memset (mem, 'X', n); + ASSERT (MEMCHR (mem, 'U', n) == NULL); + + { + size_t i; + + for (i = 0; i < n; i++) + { + mem[i] = 'U'; + ASSERT (MEMCHR (mem, 'U', 4000) == mem + i); + mem[i] = 'X'; + } + } + } } } diff --git a/tests/test-printf-frexp.c b/tests/test-printf-frexp.c index 8ba9348..13e1c30 100644 --- a/tests/test-printf-frexp.c +++ b/tests/test-printf-frexp.c @@ -1,5 +1,5 @@ /* Test of splitting a double into fraction and mantissa. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,20 +21,8 @@ #include "printf-frexp.h" #include <float.h> -#include <stdio.h> -#include <stdlib.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static double my_ldexp (double x, int d) diff --git a/tests/test-printf-frexpl.c b/tests/test-printf-frexpl.c index c4c156a..6f7e4f7 100644 --- a/tests/test-printf-frexpl.c +++ b/tests/test-printf-frexpl.c @@ -1,5 +1,5 @@ /* Test of splitting a 'long double' into fraction and mantissa. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,22 +21,9 @@ #include "printf-frexpl.h" #include <float.h> -#include <stdio.h> -#include <stdlib.h> #include "fpucw.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* On MIPS IRIX machines, LDBL_MIN_EXP is -1021, but the smallest reliable exponent for 'long double' is -964. Similarly, on PowerPC machines, diff --git a/tests/test-setenv.c b/tests/test-setenv.c new file mode 100644 index 0000000..de589c1 --- /dev/null +++ b/tests/test-setenv.c @@ -0,0 +1,56 @@ +/* Tests of setenv. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Eric Blake <ebb9@byu.net>, 2009. */ + +#include <config.h> + +#include <stdlib.h> + +#include "signature.h" +SIGNATURE_CHECK (setenv, int, (char const *, char const *, int)); + +#include <errno.h> +#include <string.h> +#include <unistd.h> + +#include "macros.h" + +int +main (void) +{ + /* Test overwriting. */ + ASSERT (setenv ("a", "==", -1) == 0); + ASSERT (setenv ("a", "2", 0) == 0); + ASSERT (strcmp (getenv ("a"), "==") == 0); + + /* Required to fail with EINVAL. */ + errno = 0; + ASSERT (setenv ("", "", 1) == -1); + ASSERT (errno == EINVAL); + errno = 0; + ASSERT (setenv ("a=b", "", 0) == -1); + ASSERT (errno == EINVAL); +#if 0 + /* glibc and gnulib's implementation guarantee this, but POSIX no + longer requires it: http://austingroupbugs.net/view.php?id=185 */ + errno = 0; + ASSERT (setenv (NULL, "", 0) == -1); + ASSERT (errno == EINVAL); +#endif + + return 0; +} diff --git a/tests/test-signbit.c b/tests/test-signbit.c index 97f68e6..9581190 100644 --- a/tests/test-signbit.c +++ b/tests/test-signbit.c @@ -1,5 +1,5 @@ /* Test of signbit() substitute. - Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. + Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,22 +20,15 @@ #include <math.h> +/* signbit must be a macro. */ +#ifndef signbit +# error missing declaration +#endif + #include <float.h> #include <limits.h> -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) + +#include "macros.h" float zerof = 0.0f; double zerod = 0.0; diff --git a/tests/test-stdbool.c b/tests/test-stdbool.c index 30d5321..fcb534d 100644 --- a/tests/test-stdbool.c +++ b/tests/test-stdbool.c @@ -1,5 +1,5 @@ /* Test of <stdbool.h> substitute. - Copyright (C) 2002-2007 Free Software Foundation, Inc. + Copyright (C) 2002-2007, 2009-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -46,11 +46,12 @@ struct s { _Bool s: 1; _Bool t; } s; char a[true == 1 ? 1 : -1]; char b[false == 0 ? 1 : -1]; char c[__bool_true_false_are_defined == 1 ? 1 : -1]; -#if 0 /* Cannot be guaranteed with gnulib's <stdbool.h>. */ +#if 0 /* Cannot be guaranteed with gnulib's <stdbool.h>, at least, +not for all compilers. */ char d[(bool) 0.5 == true ? 1 : -1]; bool e = &s; -#endif char f[(_Bool) 0.0 == false ? 1 : -1]; +#endif char g[true]; char h[sizeof (_Bool)]; #if 0 /* See above. */ diff --git a/tests/test-stddef.c b/tests/test-stddef.c index f848498..d047e57 100644 --- a/tests/test-stddef.c +++ b/tests/test-stddef.c @@ -1,5 +1,5 @@ /* Test of <stddef.h> substitute. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -32,7 +32,7 @@ size_t c = 2; verify (sizeof NULL == sizeof (void *)); int -main () +main (void) { return 0; } diff --git a/tests/test-stdint.c b/tests/test-stdint.c index a2bf42a..d64057a 100644 --- a/tests/test-stdint.c +++ b/tests/test-stdint.c @@ -1,5 +1,5 @@ /* Test of <stdint.h> substitute. - Copyright (C) 2006-2008 Free Software Foundation, Inc. + Copyright (C) 2006-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,6 +22,7 @@ #define DO_PEDANTIC 0 #define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ +#define __STDC_CONSTANT_MACROS 1 /* likewise */ #include <stdint.h> #include "verify.h" @@ -354,7 +355,7 @@ verify_same_types (UINTMAX_C (17), (uintmax_t)0 + 0); int -main () +main (void) { return 0; } diff --git a/tests/test-stdlib.c b/tests/test-stdlib.c index ae46ba1..4bd8715 100644 --- a/tests/test-stdlib.c +++ b/tests/test-stdlib.c @@ -1,5 +1,5 @@ /* Test of <stdlib.h> substitute. - Copyright (C) 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,7 +29,7 @@ int exitcode; verify (sizeof NULL == sizeof (void *)); int -main () +main (void) { /* Check that some macros are defined and different integer constants. */ switch (exitcode) diff --git a/tests/test-strerror.c b/tests/test-strerror.c index 3d9814d..11ab7e3 100644 --- a/tests/test-strerror.c +++ b/tests/test-strerror.c @@ -1,5 +1,5 @@ /* Test of strerror() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,25 +19,17 @@ #include <config.h> -#include <errno.h> -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "signature.h" +SIGNATURE_CHECK (strerror, char *, (int)); + +#include <errno.h> + +#include "macros.h" int -main (int argc, char **argv) +main (void) { char *str; diff --git a/tests/test-striconveh.c b/tests/test-striconveh.c index 16a16f4..679bb0e 100644 --- a/tests/test-striconveh.c +++ b/tests/test-striconveh.c @@ -1,5 +1,5 @@ /* Test of character set conversion with error handling. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,22 +25,10 @@ #endif #include <errno.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Magic number for detecting bounds violations. */ #define MAGIC 0x1983EFF1 @@ -58,6 +46,7 @@ main () { static enum iconv_ilseq_handler handlers[] = { iconveh_error, iconveh_question_mark, iconveh_escape_sequence }; + size_t indirect; size_t h; size_t o; size_t i; @@ -65,111 +54,211 @@ main () #if HAVE_ICONV /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1, ISO-8859-2, and UTF-8. */ + iconv_t cd_ascii_to_88591 = iconv_open ("ISO-8859-1", "ASCII"); iconv_t cd_88591_to_88592 = iconv_open ("ISO-8859-2", "ISO-8859-1"); iconv_t cd_88592_to_88591 = iconv_open ("ISO-8859-1", "ISO-8859-2"); + iconv_t cd_ascii_to_utf8 = iconv_open ("UTF-8", "ASCII"); iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1"); iconv_t cd_utf8_to_88591 = iconv_open ("ISO-8859-1", "UTF-8"); iconv_t cd_88592_to_utf8 = iconv_open ("UTF-8", "ISO-8859-2"); iconv_t cd_utf8_to_88592 = iconv_open ("ISO-8859-2", "UTF-8"); iconv_t cd_utf7_to_utf8 = iconv_open ("UTF-8", "UTF-7"); + iconveh_t cdeh_ascii_to_88591; + iconveh_t cdeh_ascii_to_88591_indirectly; + iconveh_t cdeh_88592_to_88591; + iconveh_t cdeh_88592_to_88591_indirectly; + iconveh_t cdeh_ascii_to_utf8; + iconveh_t cdeh_88591_to_utf8; + iconveh_t cdeh_utf8_to_88591; + iconveh_t cdeh_utf7_to_utf8; + ASSERT (cd_ascii_to_utf8 != (iconv_t)(-1)); ASSERT (cd_88591_to_utf8 != (iconv_t)(-1)); ASSERT (cd_utf8_to_88591 != (iconv_t)(-1)); ASSERT (cd_88592_to_utf8 != (iconv_t)(-1)); ASSERT (cd_utf8_to_88592 != (iconv_t)(-1)); + cdeh_ascii_to_88591.cd = cd_ascii_to_88591; + cdeh_ascii_to_88591.cd1 = cd_ascii_to_utf8; + cdeh_ascii_to_88591.cd2 = cd_utf8_to_88591; + + cdeh_ascii_to_88591_indirectly.cd = (iconv_t)(-1); + cdeh_ascii_to_88591_indirectly.cd1 = cd_ascii_to_utf8; + cdeh_ascii_to_88591_indirectly.cd2 = cd_utf8_to_88591; + + cdeh_88592_to_88591.cd = cd_88592_to_88591; + cdeh_88592_to_88591.cd1 = cd_88592_to_utf8; + cdeh_88592_to_88591.cd2 = cd_utf8_to_88591; + + cdeh_88592_to_88591_indirectly.cd = (iconv_t)(-1); + cdeh_88592_to_88591_indirectly.cd1 = cd_88592_to_utf8; + cdeh_88592_to_88591_indirectly.cd2 = cd_utf8_to_88591; + + cdeh_ascii_to_utf8.cd = cd_ascii_to_utf8; + cdeh_ascii_to_utf8.cd1 = cd_ascii_to_utf8; + cdeh_ascii_to_utf8.cd2 = (iconv_t)(-1); + + cdeh_88591_to_utf8.cd = cd_88591_to_utf8; + cdeh_88591_to_utf8.cd1 = cd_88591_to_utf8; + cdeh_88591_to_utf8.cd2 = (iconv_t)(-1); + + cdeh_utf8_to_88591.cd = cd_utf8_to_88591; + cdeh_utf8_to_88591.cd1 = (iconv_t)(-1); + cdeh_utf8_to_88591.cd2 = cd_utf8_to_88591; + + cdeh_utf7_to_utf8.cd = cd_utf7_to_utf8; + cdeh_utf7_to_utf8.cd1 = cd_utf7_to_utf8; + cdeh_utf7_to_utf8.cd2 = (iconv_t)(-1); + /* ------------------------ Test mem_cd_iconveh() ------------------------ */ /* Test conversion from ISO-8859-2 to ISO-8859-1 with no errors. */ - for (h = 0; h < SIZEOF (handlers); h++) + for (indirect = 0; indirect <= 1; indirect++) { - enum iconv_ilseq_handler handler = handlers[h]; - static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; - static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; - for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_cd_iconveh (input, strlen (input), - cd_88592_to_88591, - cd_88592_to_utf8, cd_utf8_to_88591, - handler, - offsets, - &result, &length); - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 37; i++) - ASSERT (offsets[i] == i); - ASSERT (offsets[37] == MAGIC); - free (offsets); - } - free (result); - } + for (h = 0; h < SIZEOF (handlers); h++) + { + enum iconv_ilseq_handler handler = handlers[h]; + static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; + static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; + for (o = 0; o < 2; o++) + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_cd_iconveh (input, strlen (input), + (indirect + ? &cdeh_88592_to_88591_indirectly + : &cdeh_88592_to_88591), + handler, + offsets, + &result, &length); + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 37; i++) + ASSERT (offsets[i] == i); + ASSERT (offsets[37] == MAGIC); + free (offsets); + } + free (result); + } + } + } + + /* Test conversion from ASCII to ISO-8859-1 with invalid input (EILSEQ). */ + for (indirect = 0; indirect <= 1; indirect++) + { + for (h = 0; h < SIZEOF (handlers); h++) + { + enum iconv_ilseq_handler handler = handlers[h]; + static const char input[] = "Rafa\263 Maszkowski"; /* Rafa? Maszkowski */ + for (o = 0; o < 2; o++) + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_cd_iconveh (input, strlen (input), + (indirect + ? &cdeh_ascii_to_88591_indirectly + : &cdeh_ascii_to_88591), + handler, + offsets, + &result, &length); + switch (handler) + { + case iconveh_error: + ASSERT (retval == -1 && errno == EILSEQ); + ASSERT (result == NULL); + if (o) + free (offsets); + break; + case iconveh_question_mark: + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa? Maszkowski"; + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == i); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } + break; + } + } + } } /* Test conversion from ISO-8859-2 to ISO-8859-1 with EILSEQ. */ - for (h = 0; h < SIZEOF (handlers); h++) + for (indirect = 0; indirect <= 1; indirect++) { - enum iconv_ilseq_handler handler = handlers[h]; - static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */ - for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_cd_iconveh (input, strlen (input), - cd_88592_to_88591, - cd_88592_to_utf8, cd_utf8_to_88591, - handler, - offsets, - &result, &length); - switch (handler) - { - case iconveh_error: - ASSERT (retval == -1 && errno == EILSEQ); - ASSERT (result == NULL); - if (o) - free (offsets); - break; - case iconveh_question_mark: - { - static const char expected[] = "Rafa? Maszkowski"; - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 16; i++) - ASSERT (offsets[i] == i); - ASSERT (offsets[16] == MAGIC); - free (offsets); - } - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Rafa\\u0142 Maszkowski"; - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 16; i++) - ASSERT (offsets[i] == (i < 5 ? i : - i + 5)); - ASSERT (offsets[16] == MAGIC); - free (offsets); - } - free (result); - } - break; - } - } + for (h = 0; h < SIZEOF (handlers); h++) + { + enum iconv_ilseq_handler handler = handlers[h]; + static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */ + for (o = 0; o < 2; o++) + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_cd_iconveh (input, strlen (input), + (indirect + ? &cdeh_88592_to_88591_indirectly + : &cdeh_88592_to_88591), + handler, + offsets, + &result, &length); + switch (handler) + { + case iconveh_error: + ASSERT (retval == -1 && errno == EILSEQ); + ASSERT (result == NULL); + if (o) + free (offsets); + break; + case iconveh_question_mark: + { + static const char expected[] = "Rafa? Maszkowski"; + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == i); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa\\u0142 Maszkowski"; + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == (i < 5 ? i : + i + 5)); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } + break; + } + } + } } /* Test conversion from ISO-8859-1 to UTF-8 with no errors. */ @@ -179,31 +268,30 @@ main () static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; static const char expected[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_cd_iconveh (input, strlen (input), - cd_88591_to_utf8, - cd_88591_to_utf8, (iconv_t)(-1), - handler, - offsets, - &result, &length); - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 37; i++) - ASSERT (offsets[i] == (i < 1 ? i : - i < 12 ? i + 1 : - i < 18 ? i + 2 : - i + 3)); - ASSERT (offsets[37] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_cd_iconveh (input, strlen (input), + &cdeh_88591_to_utf8, + handler, + offsets, + &result, &length); + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 37; i++) + ASSERT (offsets[i] == (i < 1 ? i : + i < 12 ? i + 1 : + i < 18 ? i + 2 : + i + 3)); + ASSERT (offsets[37] == MAGIC); + free (offsets); + } + free (result); + } } /* Test conversion from UTF-8 to ISO-8859-1 with no errors. */ @@ -213,35 +301,78 @@ main () static const char input[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237"; static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_cd_iconveh (input, strlen (input), - cd_utf8_to_88591, - (iconv_t)(-1), cd_utf8_to_88591, - handler, - offsets, - &result, &length); - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 41; i++) - ASSERT (offsets[i] == (i < 1 ? i : - i == 1 ? (size_t)(-1) : - i < 13 ? i - 1 : - i == 13 ? (size_t)(-1) : - i < 20 ? i - 2 : - i == 20 ? (size_t)(-1) : - i < 40 ? i - 3 : - (size_t)(-1))); - ASSERT (offsets[41] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_cd_iconveh (input, strlen (input), + &cdeh_utf8_to_88591, + handler, + offsets, + &result, &length); + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 41; i++) + ASSERT (offsets[i] == (i < 1 ? i : + i == 1 ? (size_t)(-1) : + i < 13 ? i - 1 : + i == 13 ? (size_t)(-1) : + i < 20 ? i - 2 : + i == 20 ? (size_t)(-1) : + i < 40 ? i - 3 : + (size_t)(-1))); + ASSERT (offsets[41] == MAGIC); + free (offsets); + } + free (result); + } + } + + /* Test conversion from ASCII to UTF-8 with invalid input (EILSEQ). */ + for (h = 0; h < SIZEOF (handlers); h++) + { + enum iconv_ilseq_handler handler = handlers[h]; + static const char input[] = "Rafa\263 Maszkowski"; /* Rafa? Maszkowski */ + for (o = 0; o < 2; o++) + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_cd_iconveh (input, strlen (input), + &cdeh_ascii_to_utf8, + handler, + offsets, + &result, &length); + switch (handler) + { + case iconveh_error: + ASSERT (retval == -1 && errno == EILSEQ); + ASSERT (result == NULL); + if (o) + free (offsets); + break; + case iconveh_question_mark: + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa? Maszkowski"; + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == i); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } + break; + } + } } /* Test conversion from UTF-8 to ISO-8859-1 with EILSEQ. */ @@ -250,62 +381,61 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "Rafa\305\202 Maszkowski"; /* Rafał Maszkowski */ for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_cd_iconveh (input, strlen (input), - cd_utf8_to_88591, - (iconv_t)(-1), cd_utf8_to_88591, - handler, - offsets, - &result, &length); - switch (handler) - { - case iconveh_error: - ASSERT (retval == -1 && errno == EILSEQ); - ASSERT (result == NULL); - if (o) - free (offsets); - break; - case iconveh_question_mark: - { - static const char expected[] = "Rafa? Maszkowski"; - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 17; i++) - ASSERT (offsets[i] == (i < 5 ? i : - i == 5 ? (size_t)(-1) : - i - 1)); - ASSERT (offsets[17] == MAGIC); - free (offsets); - } - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Rafa\\u0142 Maszkowski"; - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 17; i++) - ASSERT (offsets[i] == (i < 5 ? i : - i == 5 ? (size_t)(-1) : - i + 4)); - ASSERT (offsets[17] == MAGIC); - free (offsets); - } - free (result); - } - break; - } - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_cd_iconveh (input, strlen (input), + &cdeh_utf8_to_88591, + handler, + offsets, + &result, &length); + switch (handler) + { + case iconveh_error: + ASSERT (retval == -1 && errno == EILSEQ); + ASSERT (result == NULL); + if (o) + free (offsets); + break; + case iconveh_question_mark: + { + static const char expected[] = "Rafa? Maszkowski"; + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 17; i++) + ASSERT (offsets[i] == (i < 5 ? i : + i == 5 ? (size_t)(-1) : + i - 1)); + ASSERT (offsets[17] == MAGIC); + free (offsets); + } + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa\\u0142 Maszkowski"; + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 17; i++) + ASSERT (offsets[i] == (i < 5 ? i : + i == 5 ? (size_t)(-1) : + i + 4)); + ASSERT (offsets[17] == MAGIC); + free (offsets); + } + free (result); + } + break; + } + } } /* Test conversion from UTF-8 to ISO-8859-1 with EINVAL. */ @@ -314,159 +444,194 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\342"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_cd_iconveh (input, strlen (input), - cd_utf8_to_88591, - (iconv_t)(-1), cd_utf8_to_88591, - handler, - offsets, - &result, &length); - ASSERT (retval == 0); - ASSERT (length == 0); - if (o) - { - ASSERT (offsets[0] == 0); - ASSERT (offsets[1] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_cd_iconveh (input, strlen (input), + &cdeh_utf8_to_88591, + handler, + offsets, + &result, &length); + ASSERT (retval == 0); + ASSERT (length == 0); + if (o) + { + ASSERT (offsets[0] == 0); + ASSERT (offsets[1] == MAGIC); + free (offsets); + } + free (result); + } } if (cd_utf7_to_utf8 != (iconv_t)(-1)) { /* Disabled on Solaris, because Solaris 9 iconv() is buggy: it returns - -1 / EILSEQ when converting the 7th byte of the input "+VDLYP9hA". */ + -1 / EILSEQ when converting the 7th byte of the input "+VDLYP9hA". */ # if !(defined __sun && !defined _LIBICONV_VERSION) /* Test conversion from UTF-7 to UTF-8 with EINVAL. */ for (h = 0; h < SIZEOF (handlers); h++) - { - enum iconv_ilseq_handler handler = handlers[h]; - /* This is base64 encoded 0x54 0x32 0xD8 0x3F 0xD8 0x40. It would - convert to U+5432 U+D83F U+D840 but these are Unicode surrogates. */ - static const char input[] = "+VDLYP9hA"; - static const char expected1[] = "\345\220\262"; /* 吲 glibc */ - static const char expected2[] = ""; /* libiconv */ - char *result = NULL; - size_t length = 0; - int retval = mem_cd_iconveh (input, 7, - cd_utf7_to_utf8, - cd_utf7_to_utf8, (iconv_t)(-1), - handler, - NULL, - &result, &length); - ASSERT (retval == 0); - ASSERT (length == strlen (expected1) || length == strlen (expected2)); - ASSERT (result != NULL); - if (length == strlen (expected1)) - ASSERT (memcmp (result, expected1, strlen (expected1)) == 0); - else - ASSERT (memcmp (result, expected2, strlen (expected2)) == 0); - free (result); - } + { + enum iconv_ilseq_handler handler = handlers[h]; + /* This is base64 encoded 0x54 0x32 0xD8 0x3F 0xD8 0x40. It would + convert to U+5432 U+D83F U+D840 but these are Unicode surrogates. */ + static const char input[] = "+VDLYP9hA"; + static const char expected1[] = "\345\220\262"; /* 吲 glibc */ + static const char expected2[] = ""; /* libiconv */ + char *result = NULL; + size_t length = 0; + int retval = mem_cd_iconveh (input, 7, + &cdeh_utf7_to_utf8, + handler, + NULL, + &result, &length); + ASSERT (retval == 0); + ASSERT (length == strlen (expected1) || length == strlen (expected2)); + ASSERT (result != NULL); + if (length == strlen (expected1)) + ASSERT (memcmp (result, expected1, strlen (expected1)) == 0); + else + ASSERT (memcmp (result, expected2, strlen (expected2)) == 0); + free (result); + } /* Test conversion from UTF-7 to UTF-8 with EILSEQ. */ for (h = 0; h < SIZEOF (handlers); h++) - { - enum iconv_ilseq_handler handler = handlers[h]; - /* This is base64 encoded 0xD8 0x3F 0xD8 0x40 0xD8 0x41. It would - convert to U+D83F U+D840 U+D841 but these are Unicode surrogates. */ - static const char input[] = "+2D/YQNhB"; - char *result = NULL; - size_t length = 0; - int retval = mem_cd_iconveh (input, strlen (input), - cd_utf7_to_utf8, - cd_utf7_to_utf8, (iconv_t)(-1), - handler, - NULL, - &result, &length); - switch (handler) - { - case iconveh_error: - ASSERT (retval == -1 && errno == EILSEQ); - ASSERT (result == NULL); - break; - case iconveh_question_mark: - case iconveh_escape_sequence: - { - /* glibc result */ - static const char expected1[] = "?????"; - /* libiconv <= 1.12 result */ - static const char expected2[] = "?2D/YQNhB"; - /* libiconv behaviour changed in version 1.13: the result is - '?' U+0FF6 U+1036; this is U+D83F U+D840 U+D841 shifted left - by 6 bits. */ - static const char expected3[] = "?\340\277\266\341\200\266"; - ASSERT (retval == 0); - ASSERT (length == strlen (expected1) - || length == strlen (expected2) - || length == strlen (expected3)); - ASSERT (result != NULL); - if (length == strlen (expected1)) - ASSERT (memcmp (result, expected1, strlen (expected1)) == 0); - else if (length == strlen (expected2)) - ASSERT (memcmp (result, expected2, strlen (expected2)) == 0); - else - ASSERT (memcmp (result, expected3, strlen (expected3)) == 0); - free (result); - } - break; - } - } + { + enum iconv_ilseq_handler handler = handlers[h]; + /* This is base64 encoded 0xD8 0x3F 0xD8 0x40 0xD8 0x41. It would + convert to U+D83F U+D840 U+D841 but these are Unicode surrogates. */ + static const char input[] = "+2D/YQNhB"; + char *result = NULL; + size_t length = 0; + int retval = mem_cd_iconveh (input, strlen (input), + &cdeh_utf7_to_utf8, + handler, + NULL, + &result, &length); + switch (handler) + { + case iconveh_error: + ASSERT (retval == -1 && errno == EILSEQ); + ASSERT (result == NULL); + break; + case iconveh_question_mark: + case iconveh_escape_sequence: + { + /* glibc result */ + static const char expected1[] = "?????"; + /* libiconv <= 1.12 result */ + static const char expected2[] = "?2D/YQNhB"; + /* libiconv behaviour changed in version 1.13: the result is + '?' U+0FF6 U+1036; this is U+D83F U+D840 U+D841 shifted left + by 6 bits. */ + static const char expected3[] = "?\340\277\266\341\200\266"; + ASSERT (retval == 0); + ASSERT (length == strlen (expected1) + || length == strlen (expected2) + || length == strlen (expected3)); + ASSERT (result != NULL); + if (length == strlen (expected1)) + ASSERT (memcmp (result, expected1, strlen (expected1)) == 0); + else if (length == strlen (expected2)) + ASSERT (memcmp (result, expected2, strlen (expected2)) == 0); + else + ASSERT (memcmp (result, expected3, strlen (expected3)) == 0); + free (result); + } + break; + } + } # endif } /* ------------------------ Test str_cd_iconveh() ------------------------ */ /* Test conversion from ISO-8859-2 to ISO-8859-1 with no errors. */ - for (h = 0; h < SIZEOF (handlers); h++) + for (indirect = 0; indirect <= 1; indirect++) { - enum iconv_ilseq_handler handler = handlers[h]; - static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; - static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; - char *result = str_cd_iconveh (input, - cd_88592_to_88591, - cd_88592_to_utf8, cd_utf8_to_88591, - handler); - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0); - free (result); + for (h = 0; h < SIZEOF (handlers); h++) + { + enum iconv_ilseq_handler handler = handlers[h]; + static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; + static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; + char *result = str_cd_iconveh (input, + (indirect + ? &cdeh_88592_to_88591_indirectly + : &cdeh_88592_to_88591), + handler); + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + } + + /* Test conversion from ASCII to ISO-8859-1 with invalid input (EILSEQ). */ + for (indirect = 0; indirect <= 1; indirect++) + { + for (h = 0; h < SIZEOF (handlers); h++) + { + enum iconv_ilseq_handler handler = handlers[h]; + static const char input[] = "Rafa\263 Maszkowski"; /* Rafa? Maszkowski */ + char *result = str_cd_iconveh (input, + (indirect + ? &cdeh_ascii_to_88591_indirectly + : &cdeh_ascii_to_88591), + handler); + switch (handler) + { + case iconveh_error: + ASSERT (result == NULL && errno == EILSEQ); + break; + case iconveh_question_mark: + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa? Maszkowski"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + break; + } + } } /* Test conversion from ISO-8859-2 to ISO-8859-1 with EILSEQ. */ - for (h = 0; h < SIZEOF (handlers); h++) + for (indirect = 0; indirect <= 1; indirect++) { - enum iconv_ilseq_handler handler = handlers[h]; - static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */ - char *result = str_cd_iconveh (input, - cd_88592_to_88591, - cd_88592_to_utf8, cd_utf8_to_88591, - handler); - switch (handler) - { - case iconveh_error: - ASSERT (result == NULL && errno == EILSEQ); - break; - case iconveh_question_mark: - { - static const char expected[] = "Rafa? Maszkowski"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0); - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Rafa\\u0142 Maszkowski"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0); - free (result); - } - break; - } + for (h = 0; h < SIZEOF (handlers); h++) + { + enum iconv_ilseq_handler handler = handlers[h]; + static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */ + char *result = str_cd_iconveh (input, + (indirect + ? &cdeh_88592_to_88591_indirectly + : &cdeh_88592_to_88591), + handler); + switch (handler) + { + case iconveh_error: + ASSERT (result == NULL && errno == EILSEQ); + break; + case iconveh_question_mark: + { + static const char expected[] = "Rafa? Maszkowski"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa\\u0142 Maszkowski"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + break; + } + } } /* Test conversion from ISO-8859-1 to UTF-8 with no errors. */ @@ -476,9 +641,8 @@ main () static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; static const char expected[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237"; char *result = str_cd_iconveh (input, - cd_88591_to_utf8, - cd_88591_to_utf8, (iconv_t)(-1), - handler); + &cdeh_88591_to_utf8, + handler); ASSERT (result != NULL); ASSERT (strcmp (result, expected) == 0); free (result); @@ -491,45 +655,68 @@ main () static const char input[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237"; static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; char *result = str_cd_iconveh (input, - cd_utf8_to_88591, - (iconv_t)(-1), cd_utf8_to_88591, - handler); + &cdeh_utf8_to_88591, + handler); ASSERT (result != NULL); ASSERT (strcmp (result, expected) == 0); free (result); } + /* Test conversion from ASCII to UTF-8 with invalid input (EILSEQ). */ + for (h = 0; h < SIZEOF (handlers); h++) + { + enum iconv_ilseq_handler handler = handlers[h]; + static const char input[] = "Rafa\263 Maszkowski"; /* Rafa? Maszkowski */ + char *result = str_cd_iconveh (input, + &cdeh_ascii_to_utf8, + handler); + switch (handler) + { + case iconveh_error: + ASSERT (result == NULL && errno == EILSEQ); + break; + case iconveh_question_mark: + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa? Maszkowski"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + break; + } + } + /* Test conversion from UTF-8 to ISO-8859-1 with EILSEQ. */ for (h = 0; h < SIZEOF (handlers); h++) { enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "Costs: 27 \342\202\254"; /* EURO SIGN */ char *result = str_cd_iconveh (input, - cd_utf8_to_88591, - (iconv_t)(-1), cd_utf8_to_88591, - handler); + &cdeh_utf8_to_88591, + handler); switch (handler) - { - case iconveh_error: - ASSERT (result == NULL && errno == EILSEQ); - break; - case iconveh_question_mark: - { - static const char expected[] = "Costs: 27 ?"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0); - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Costs: 27 \\u20AC"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0); - free (result); - } - break; - } + { + case iconveh_error: + ASSERT (result == NULL && errno == EILSEQ); + break; + case iconveh_question_mark: + { + static const char expected[] = "Costs: 27 ?"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Costs: 27 \\u20AC"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + break; + } } /* Test conversion from UTF-8 to ISO-8859-1 with EINVAL. */ @@ -538,9 +725,8 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\342"; char *result = str_cd_iconveh (input, - cd_utf8_to_88591, - (iconv_t)(-1), cd_utf8_to_88591, - handler); + &cdeh_utf8_to_88591, + handler); ASSERT (result != NULL); ASSERT (strcmp (result, "") == 0); free (result); @@ -564,27 +750,27 @@ main () static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_iconveh (input, strlen (input), - "ISO-8859-2", "ISO-8859-1", - handler, - offsets, - &result, &length); - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 37; i++) - ASSERT (offsets[i] == i); - ASSERT (offsets[37] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_iconveh (input, strlen (input), + "ISO-8859-2", "ISO-8859-1", + handler, + offsets, + &result, &length); + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 37; i++) + ASSERT (offsets[i] == i); + ASSERT (offsets[37] == MAGIC); + free (offsets); + } + free (result); + } } /* Test conversion from ISO-8859-2 to ISO-8859-1 with EILSEQ. */ @@ -593,58 +779,58 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */ for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_iconveh (input, strlen (input), - "ISO-8859-2", "ISO-8859-1", - handler, - offsets, - &result, &length); - switch (handler) - { - case iconveh_error: - ASSERT (retval == -1 && errno == EILSEQ); - ASSERT (result == NULL); - if (o) - free (offsets); - break; - case iconveh_question_mark: - { - static const char expected[] = "Rafa? Maszkowski"; - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 16; i++) - ASSERT (offsets[i] == i); - ASSERT (offsets[16] == MAGIC); - free (offsets); - } - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Rafa\\u0142 Maszkowski"; - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 16; i++) - ASSERT (offsets[i] == (i < 5 ? i : - i + 5)); - ASSERT (offsets[16] == MAGIC); - free (offsets); - } - free (result); - } - break; - } - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_iconveh (input, strlen (input), + "ISO-8859-2", "ISO-8859-1", + handler, + offsets, + &result, &length); + switch (handler) + { + case iconveh_error: + ASSERT (retval == -1 && errno == EILSEQ); + ASSERT (result == NULL); + if (o) + free (offsets); + break; + case iconveh_question_mark: + { + static const char expected[] = "Rafa? Maszkowski"; + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == i); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa\\u0142 Maszkowski"; + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == (i < 5 ? i : + i + 5)); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } + break; + } + } } /* Test conversion from ISO-8859-1 to UTF-8 with no errors. */ @@ -654,30 +840,30 @@ main () static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; static const char expected[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_iconveh (input, strlen (input), - "ISO-8859-1", "UTF-8", - handler, - offsets, - &result, &length); - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 37; i++) - ASSERT (offsets[i] == (i < 1 ? i : - i < 12 ? i + 1 : - i < 18 ? i + 2 : - i + 3)); - ASSERT (offsets[37] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_iconveh (input, strlen (input), + "ISO-8859-1", "UTF-8", + handler, + offsets, + &result, &length); + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 37; i++) + ASSERT (offsets[i] == (i < 1 ? i : + i < 12 ? i + 1 : + i < 18 ? i + 2 : + i + 3)); + ASSERT (offsets[37] == MAGIC); + free (offsets); + } + free (result); + } } /* Test conversion from UTF-8 to ISO-8859-1 with no errors. */ @@ -687,34 +873,34 @@ main () static const char input[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237"; static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_iconveh (input, strlen (input), - "UTF-8", "ISO-8859-1", - handler, - offsets, - &result, &length); - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 41; i++) - ASSERT (offsets[i] == (i < 1 ? i : - i == 1 ? (size_t)(-1) : - i < 13 ? i - 1 : - i == 13 ? (size_t)(-1) : - i < 20 ? i - 2 : - i == 20 ? (size_t)(-1) : - i < 40 ? i - 3 : - (size_t)(-1))); - ASSERT (offsets[41] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_iconveh (input, strlen (input), + "UTF-8", "ISO-8859-1", + handler, + offsets, + &result, &length); + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 41; i++) + ASSERT (offsets[i] == (i < 1 ? i : + i == 1 ? (size_t)(-1) : + i < 13 ? i - 1 : + i == 13 ? (size_t)(-1) : + i < 20 ? i - 2 : + i == 20 ? (size_t)(-1) : + i < 40 ? i - 3 : + (size_t)(-1))); + ASSERT (offsets[41] == MAGIC); + free (offsets); + } + free (result); + } } /* Test conversion from UTF-8 to ISO-8859-1 with EILSEQ. */ @@ -723,61 +909,61 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "Rafa\305\202 Maszkowski"; /* Rafał Maszkowski */ for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_iconveh (input, strlen (input), - "UTF-8", "ISO-8859-1", - handler, - offsets, - &result, &length); - switch (handler) - { - case iconveh_error: - ASSERT (retval == -1 && errno == EILSEQ); - ASSERT (result == NULL); - if (o) - free (offsets); - break; - case iconveh_question_mark: - { - static const char expected[] = "Rafa? Maszkowski"; - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 17; i++) - ASSERT (offsets[i] == (i < 5 ? i : - i == 5 ? (size_t)(-1) : - i - 1)); - ASSERT (offsets[17] == MAGIC); - free (offsets); - } - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Rafa\\u0142 Maszkowski"; - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 17; i++) - ASSERT (offsets[i] == (i < 5 ? i : - i == 5 ? (size_t)(-1) : - i + 4)); - ASSERT (offsets[17] == MAGIC); - free (offsets); - } - free (result); - } - break; - } - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_iconveh (input, strlen (input), + "UTF-8", "ISO-8859-1", + handler, + offsets, + &result, &length); + switch (handler) + { + case iconveh_error: + ASSERT (retval == -1 && errno == EILSEQ); + ASSERT (result == NULL); + if (o) + free (offsets); + break; + case iconveh_question_mark: + { + static const char expected[] = "Rafa? Maszkowski"; + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 17; i++) + ASSERT (offsets[i] == (i < 5 ? i : + i == 5 ? (size_t)(-1) : + i - 1)); + ASSERT (offsets[17] == MAGIC); + free (offsets); + } + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa\\u0142 Maszkowski"; + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 17; i++) + ASSERT (offsets[i] == (i < 5 ? i : + i == 5 ? (size_t)(-1) : + i + 4)); + ASSERT (offsets[17] == MAGIC); + free (offsets); + } + free (result); + } + break; + } + } } /* Test conversion from UTF-8 to ISO-8859-1 with EINVAL. */ @@ -786,25 +972,25 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\342"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_iconveh (input, strlen (input), - "UTF-8", "ISO-8859-1", - handler, - offsets, - &result, &length); - ASSERT (retval == 0); - ASSERT (length == 0); - if (o) - { - ASSERT (offsets[0] == 0); - ASSERT (offsets[1] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_iconveh (input, strlen (input), + "UTF-8", "ISO-8859-1", + handler, + offsets, + &result, &length); + ASSERT (retval == 0); + ASSERT (length == 0); + if (o) + { + ASSERT (offsets[0] == 0); + ASSERT (offsets[1] == MAGIC); + free (offsets); + } + free (result); + } } /* ------------------------- Test str_iconveh() ------------------------- */ @@ -828,27 +1014,27 @@ main () static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */ char *result = str_iconveh (input, "ISO-8859-2", "ISO-8859-1", handler); switch (handler) - { - case iconveh_error: - ASSERT (result == NULL && errno == EILSEQ); - break; - case iconveh_question_mark: - { - static const char expected[] = "Rafa? Maszkowski"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0); - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Rafa\\u0142 Maszkowski"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0); - free (result); - } - break; - } + { + case iconveh_error: + ASSERT (result == NULL && errno == EILSEQ); + break; + case iconveh_question_mark: + { + static const char expected[] = "Rafa? Maszkowski"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa\\u0142 Maszkowski"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + break; + } } /* Test conversion from ISO-8859-1 to UTF-8 with no errors. */ @@ -882,27 +1068,27 @@ main () static const char input[] = "Costs: 27 \342\202\254"; /* EURO SIGN */ char *result = str_iconveh (input, "UTF-8", "ISO-8859-1", handler); switch (handler) - { - case iconveh_error: - ASSERT (result == NULL && errno == EILSEQ); - break; - case iconveh_question_mark: - { - static const char expected[] = "Costs: 27 ?"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0); - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Costs: 27 \\u20AC"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0); - free (result); - } - break; - } + { + case iconveh_error: + ASSERT (result == NULL && errno == EILSEQ); + break; + case iconveh_question_mark: + { + static const char expected[] = "Costs: 27 ?"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Costs: 27 \\u20AC"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + break; + } } /* Test conversion from UTF-8 to ISO-8859-1 with EINVAL. */ diff --git a/tests/test-striconveha.c b/tests/test-striconveha.c index 47e9a46..1da674e 100644 --- a/tests/test-striconveha.c +++ b/tests/test-striconveha.c @@ -1,5 +1,5 @@ /* Test of character set conversion with error handling and autodetection. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,22 +25,10 @@ #endif #include <errno.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Magic number for detecting bounds violations. */ #define MAGIC 0x1983EFF1 @@ -75,27 +63,27 @@ main () static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_iconveha (input, strlen (input), - "ISO-8859-2", "ISO-8859-1", - false, handler, - offsets, - &result, &length); - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 37; i++) - ASSERT (offsets[i] == i); - ASSERT (offsets[37] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_iconveha (input, strlen (input), + "ISO-8859-2", "ISO-8859-1", + false, handler, + offsets, + &result, &length); + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 37; i++) + ASSERT (offsets[i] == i); + ASSERT (offsets[37] == MAGIC); + free (offsets); + } + free (result); + } } /* Test conversion from ISO-8859-2 to ISO-8859-1 with EILSEQ. */ @@ -104,58 +92,58 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */ for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_iconveha (input, strlen (input), - "ISO-8859-2", "ISO-8859-1", - false, handler, - offsets, - &result, &length); - switch (handler) - { - case iconveh_error: - ASSERT (retval == -1 && errno == EILSEQ); - ASSERT (result == NULL); - if (o) - free (offsets); - break; - case iconveh_question_mark: - { - static const char expected[] = "Rafa? Maszkowski"; - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 16; i++) - ASSERT (offsets[i] == i); - ASSERT (offsets[16] == MAGIC); - free (offsets); - } - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Rafa\\u0142 Maszkowski"; - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 16; i++) - ASSERT (offsets[i] == (i < 5 ? i : - i + 5)); - ASSERT (offsets[16] == MAGIC); - free (offsets); - } - free (result); - } - break; - } - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_iconveha (input, strlen (input), + "ISO-8859-2", "ISO-8859-1", + false, handler, + offsets, + &result, &length); + switch (handler) + { + case iconveh_error: + ASSERT (retval == -1 && errno == EILSEQ); + ASSERT (result == NULL); + if (o) + free (offsets); + break; + case iconveh_question_mark: + { + static const char expected[] = "Rafa? Maszkowski"; + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == i); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa\\u0142 Maszkowski"; + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == (i < 5 ? i : + i + 5)); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } + break; + } + } } /* Test conversion from ISO-8859-1 to UTF-8 with no errors. */ @@ -165,30 +153,30 @@ main () static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; static const char expected[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_iconveha (input, strlen (input), - "ISO-8859-1", "UTF-8", - false, handler, - offsets, - &result, &length); - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 37; i++) - ASSERT (offsets[i] == (i < 1 ? i : - i < 12 ? i + 1 : - i < 18 ? i + 2 : - i + 3)); - ASSERT (offsets[37] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_iconveha (input, strlen (input), + "ISO-8859-1", "UTF-8", + false, handler, + offsets, + &result, &length); + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 37; i++) + ASSERT (offsets[i] == (i < 1 ? i : + i < 12 ? i + 1 : + i < 18 ? i + 2 : + i + 3)); + ASSERT (offsets[37] == MAGIC); + free (offsets); + } + free (result); + } } /* Test conversion from UTF-8 to ISO-8859-1 with no errors. */ @@ -198,34 +186,34 @@ main () static const char input[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237"; static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_iconveha (input, strlen (input), - "UTF-8", "ISO-8859-1", - false, handler, - offsets, - &result, &length); - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 41; i++) - ASSERT (offsets[i] == (i < 1 ? i : - i == 1 ? (size_t)(-1) : - i < 13 ? i - 1 : - i == 13 ? (size_t)(-1) : - i < 20 ? i - 2 : - i == 20 ? (size_t)(-1) : - i < 40 ? i - 3 : - (size_t)(-1))); - ASSERT (offsets[41] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_iconveha (input, strlen (input), + "UTF-8", "ISO-8859-1", + false, handler, + offsets, + &result, &length); + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 41; i++) + ASSERT (offsets[i] == (i < 1 ? i : + i == 1 ? (size_t)(-1) : + i < 13 ? i - 1 : + i == 13 ? (size_t)(-1) : + i < 20 ? i - 2 : + i == 20 ? (size_t)(-1) : + i < 40 ? i - 3 : + (size_t)(-1))); + ASSERT (offsets[41] == MAGIC); + free (offsets); + } + free (result); + } } /* Test conversion from UTF-8 to ISO-8859-1 with EILSEQ. */ @@ -234,61 +222,61 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "Rafa\305\202 Maszkowski"; /* Rafał Maszkowski */ for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_iconveha (input, strlen (input), - "UTF-8", "ISO-8859-1", - false, handler, - offsets, - &result, &length); - switch (handler) - { - case iconveh_error: - ASSERT (retval == -1 && errno == EILSEQ); - ASSERT (result == NULL); - if (o) - free (offsets); - break; - case iconveh_question_mark: - { - static const char expected[] = "Rafa? Maszkowski"; - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 17; i++) - ASSERT (offsets[i] == (i < 5 ? i : - i == 5 ? (size_t)(-1) : - i - 1)); - ASSERT (offsets[17] == MAGIC); - free (offsets); - } - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Rafa\\u0142 Maszkowski"; - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 17; i++) - ASSERT (offsets[i] == (i < 5 ? i : - i == 5 ? (size_t)(-1) : - i + 4)); - ASSERT (offsets[17] == MAGIC); - free (offsets); - } - free (result); - } - break; - } - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_iconveha (input, strlen (input), + "UTF-8", "ISO-8859-1", + false, handler, + offsets, + &result, &length); + switch (handler) + { + case iconveh_error: + ASSERT (retval == -1 && errno == EILSEQ); + ASSERT (result == NULL); + if (o) + free (offsets); + break; + case iconveh_question_mark: + { + static const char expected[] = "Rafa? Maszkowski"; + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 17; i++) + ASSERT (offsets[i] == (i < 5 ? i : + i == 5 ? (size_t)(-1) : + i - 1)); + ASSERT (offsets[17] == MAGIC); + free (offsets); + } + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa\\u0142 Maszkowski"; + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 17; i++) + ASSERT (offsets[i] == (i < 5 ? i : + i == 5 ? (size_t)(-1) : + i + 4)); + ASSERT (offsets[17] == MAGIC); + free (offsets); + } + free (result); + } + break; + } + } } /* Test conversion from UTF-8 to ISO-8859-1 with EINVAL. */ @@ -297,25 +285,25 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\342"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_iconveha (input, strlen (input), - "UTF-8", "ISO-8859-1", - false, handler, - offsets, - &result, &length); - ASSERT (retval == 0); - ASSERT (length == 0); - if (o) - { - ASSERT (offsets[0] == 0); - ASSERT (offsets[1] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_iconveha (input, strlen (input), + "UTF-8", "ISO-8859-1", + false, handler, + offsets, + &result, &length); + ASSERT (retval == 0); + ASSERT (length == 0); + if (o) + { + ASSERT (offsets[0] == 0); + ASSERT (offsets[1] == MAGIC); + free (offsets); + } + free (result); + } } /* autodetect_jp is only supported when iconv() support ISO-2022-JP-2. */ @@ -327,27 +315,27 @@ main () static const char input[] = "\244\263\244\363\244\313\244\301\244\317"; /* こんにちは in EUC-JP */ static const char expected[] = "\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257"; /* こんにちは */ for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_iconveha (input, strlen (input), - "autodetect_jp", "UTF-8", - false, handler, - offsets, - &result, &length); - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 10; i++) - ASSERT (offsets[i] == ((i % 2) == 0 ? (i / 2) * 3 : (size_t)(-1))); - ASSERT (offsets[10] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_iconveha (input, strlen (input), + "autodetect_jp", "UTF-8", + false, handler, + offsets, + &result, &length); + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 10; i++) + ASSERT (offsets[i] == ((i % 2) == 0 ? (i / 2) * 3 : (size_t)(-1))); + ASSERT (offsets[10] == MAGIC); + free (offsets); + } + free (result); + } } for (h = 0; h < SIZEOF (handlers); h++) { @@ -355,27 +343,27 @@ main () static const char input[] = "\202\261\202\361\202\311\202\277\202\315"; /* こんにちは in Shift_JIS */ static const char expected[] = "\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257"; /* こんにちは */ for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_iconveha (input, strlen (input), - "autodetect_jp", "UTF-8", - false, handler, - offsets, - &result, &length); - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 10; i++) - ASSERT (offsets[i] == ((i % 2) == 0 ? (i / 2) * 3 : (size_t)(-1))); - ASSERT (offsets[10] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_iconveha (input, strlen (input), + "autodetect_jp", "UTF-8", + false, handler, + offsets, + &result, &length); + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 10; i++) + ASSERT (offsets[i] == ((i % 2) == 0 ? (i / 2) * 3 : (size_t)(-1))); + ASSERT (offsets[10] == MAGIC); + free (offsets); + } + free (result); + } } for (h = 0; h < SIZEOF (handlers); h++) { @@ -383,33 +371,33 @@ main () static const char input[] = "\033$B$3$s$K$A$O\033(B"; /* こんにちは in ISO-2022-JP-2 */ static const char expected[] = "\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257"; /* こんにちは */ for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_iconveha (input, strlen (input), - "autodetect_jp", "UTF-8", - false, handler, - offsets, - &result, &length); - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 16; i++) - ASSERT (offsets[i] == (i == 0 ? 0 : - i == 5 ? 3 : - i == 7 ? 6 : - i == 9 ? 9 : - i == 11 ? 12 : - i == 13 ? 15 : - (size_t)(-1))); - ASSERT (offsets[16] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_iconveha (input, strlen (input), + "autodetect_jp", "UTF-8", + false, handler, + offsets, + &result, &length); + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == (i == 0 ? 0 : + i == 5 ? 3 : + i == 7 ? 6 : + i == 9 ? 9 : + i == 11 ? 12 : + i == 13 ? 15 : + (size_t)(-1))); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } } # endif @@ -421,27 +409,27 @@ main () static const char input[] = "Costs: 27 \342\202\254"; /* EURO SIGN */ static const char expected[] = "Costs: 27 EUR"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - char *result = NULL; - size_t length = 0; - int retval = mem_iconveha (input, strlen (input), - "UTF-8", "ISO-8859-1", - true, handler, - offsets, - &result, &length); - ASSERT (retval == 0); - ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 13; i++) - ASSERT (offsets[i] == (i < 11 ? i : (size_t)(-1))); - ASSERT (offsets[13] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + char *result = NULL; + size_t length = 0; + int retval = mem_iconveha (input, strlen (input), + "UTF-8", "ISO-8859-1", + true, handler, + offsets, + &result, &length); + ASSERT (retval == 0); + ASSERT (length == strlen (expected)); + ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 13; i++) + ASSERT (offsets[i] == (i < 11 ? i : (size_t)(-1))); + ASSERT (offsets[13] == MAGIC); + free (offsets); + } + free (result); + } } # endif @@ -466,27 +454,27 @@ main () static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */ char *result = str_iconveha (input, "ISO-8859-2", "ISO-8859-1", false, handler); switch (handler) - { - case iconveh_error: - ASSERT (result == NULL && errno == EILSEQ); - break; - case iconveh_question_mark: - { - static const char expected[] = "Rafa? Maszkowski"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0); - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Rafa\\u0142 Maszkowski"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0); - free (result); - } - break; - } + { + case iconveh_error: + ASSERT (result == NULL && errno == EILSEQ); + break; + case iconveh_question_mark: + { + static const char expected[] = "Rafa? Maszkowski"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa\\u0142 Maszkowski"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + break; + } } /* Test conversion from ISO-8859-1 to UTF-8 with no errors. */ @@ -520,27 +508,27 @@ main () static const char input[] = "Costs: 27 \342\202\254"; /* EURO SIGN */ char *result = str_iconveha (input, "UTF-8", "ISO-8859-1", false, handler); switch (handler) - { - case iconveh_error: - ASSERT (result == NULL && errno == EILSEQ); - break; - case iconveh_question_mark: - { - static const char expected[] = "Costs: 27 ?"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0); - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Costs: 27 \\u20AC"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0); - free (result); - } - break; - } + { + case iconveh_error: + ASSERT (result == NULL && errno == EILSEQ); + break; + case iconveh_question_mark: + { + static const char expected[] = "Costs: 27 ?"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Costs: 27 \\u20AC"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + break; + } } /* Test conversion from UTF-8 to ISO-8859-1 with EINVAL. */ diff --git a/tests/test-string.c b/tests/test-string.c index fe53cd9..019a817 100644 --- a/tests/test-string.c +++ b/tests/test-string.c @@ -1,5 +1,5 @@ /* Test of <string.h> substitute. - Copyright (C) 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,7 +27,7 @@ verify (sizeof NULL == sizeof (void *)); int -main () +main (void) { return 0; } diff --git a/tests/test-strncat.c b/tests/test-strncat.c new file mode 100644 index 0000000..49cf396 --- /dev/null +++ b/tests/test-strncat.c @@ -0,0 +1,62 @@ +/* Test of strncat() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include <string.h> + +#include "signature.h" +SIGNATURE_CHECK (strncat, char *, (char *, const char *, size_t)); + +#include <stdlib.h> + +#include "zerosize-ptr.h" +#include "macros.h" + +#define UNIT char +#define U_STRNCAT strncat +#define MAGIC ((char) 0xBA) +#include "unistr/test-strncat.h" + +int +main () +{ + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" + in UTF-8 encoding. */ + static const char input[] = + { 'G', 'r', (char) 0xC3, (char) 0xBC, (char) 0xC3, (char) 0x9F, ' ', + 'G', 'o', 't', 't', '.', ' ', (char) 0xD0, (char) 0x97, (char) 0xD0, + (char) 0xB4, (char) 0xD1, (char) 0x80, (char) 0xD0, (char) 0xB0, + (char) 0xD0, (char) 0xB2, (char) 0xD1, (char) 0x81, (char) 0xD1, + (char) 0x82, (char) 0xD0, (char) 0xB2, (char) 0xD1, (char) 0x83, + (char) 0xD0, (char) 0xB9, (char) 0xD1, (char) 0x82, (char) 0xD0, + (char) 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', (char) 0xC2, + (char) 0xB1, 's', 'q', 'r', 't', '(', 'b', (char) 0xC2, (char) 0xB2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + (char) 0xE6, (char) 0x97, (char) 0xA5, (char) 0xE6, (char) 0x9C, + (char) 0xAC, (char) 0xE8, (char) 0xAA, (char) 0x9E, ',', (char) 0xE4, + (char) 0xB8, (char) 0xAD, (char) 0xE6, (char) 0x96, (char) 0x87, ',', + (char) 0xED, (char) 0x95, (char) 0x9C, (char) 0xEA, (char) 0xB8, + (char) 0x80, '\0' + }; + check (input, SIZEOF (input)); + } + + return 0; +} diff --git a/tests/test-unistd.c b/tests/test-unistd.c index 129367b..ec02eee 100644 --- a/tests/test-unistd.c +++ b/tests/test-unistd.c @@ -1,5 +1,5 @@ /* Test of <unistd.h> substitute. - Copyright (C) 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -50,7 +50,7 @@ intptr_t t8; #endif int -main () +main (void) { return 0; } diff --git a/tests/test-unsetenv.c b/tests/test-unsetenv.c new file mode 100644 index 0000000..7b92ff3 --- /dev/null +++ b/tests/test-unsetenv.c @@ -0,0 +1,61 @@ +/* Tests of unsetenv. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Eric Blake <ebb9@byu.net>, 2009. */ + +#include <config.h> + +#include <stdlib.h> + +#include "signature.h" +SIGNATURE_CHECK (unsetenv, int, (char const *)); + +#include <errno.h> +#include <string.h> +#include <unistd.h> + +#include "macros.h" + +int +main (void) +{ + char entry[] = "b=2"; + + /* Test removal when multiple entries present. */ + ASSERT (putenv ((char *) "a=1") == 0); + ASSERT (putenv (entry) == 0); + entry[0] = 'a'; /* Unspecified what getenv("a") would be at this point. */ + ASSERT (unsetenv ("a") == 0); /* Both entries will be removed. */ + ASSERT (getenv ("a") == NULL); + ASSERT (unsetenv ("a") == 0); + + /* Required to fail with EINVAL. */ + errno = 0; + ASSERT (unsetenv ("") == -1); + ASSERT (errno == EINVAL); + errno = 0; + ASSERT (unsetenv ("a=b") == -1); + ASSERT (errno == EINVAL); +#if 0 + /* glibc and gnulib's implementation guarantee this, but POSIX no + longer requires it: http://austingroupbugs.net/view.php?id=185 */ + errno = 0; + ASSERT (unsetenv (NULL) == -1); + ASSERT (errno == EINVAL); +#endif + + return 0; +} diff --git a/tests/test-wchar.c b/tests/test-wchar.c index 2866068..2a03d6b 100644 --- a/tests/test-wchar.c +++ b/tests/test-wchar.c @@ -1,5 +1,5 @@ /* Test of <wchar.h> substitute. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -31,7 +31,7 @@ wint_t b = 'x'; verify (sizeof NULL == sizeof (void *)); int -main () +main (void) { return 0; } diff --git a/tests/test-wctype.c b/tests/test-wctype.c index c2d8601..5db215e 100644 --- a/tests/test-wctype.c +++ b/tests/test-wctype.c @@ -1,5 +1,5 @@ /* Test of <wctype.h> substitute. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,18 +20,20 @@ #include <wctype.h> +#include "macros.h" + /* Check that the type wint_t is defined. */ wint_t a = 'x'; +/* Check that WEOF is defined. */ +wint_t e = WEOF; int -main () +main (void) { /* Check that the isw* functions exist as functions or as macros. */ (void) iswalnum (0); (void) iswalpha (0); -#if 0 /* not portable: missing on mingw */ (void) iswblank (0); -#endif (void) iswcntrl (0); (void) iswdigit (0); (void) iswgraph (0); @@ -42,5 +44,27 @@ main () (void) iswupper (0); (void) iswxdigit (0); + /* Check that the isw* functions map WEOF to 0. */ + ASSERT (!iswalnum (e)); + ASSERT (!iswalpha (e)); + ASSERT (!iswblank (e)); + ASSERT (!iswcntrl (e)); + ASSERT (!iswdigit (e)); + ASSERT (!iswgraph (e)); + ASSERT (!iswlower (e)); + ASSERT (!iswprint (e)); + ASSERT (!iswpunct (e)); + ASSERT (!iswspace (e)); + ASSERT (!iswupper (e)); + ASSERT (!iswxdigit (e)); + + /* Check that the tow* functions exist as functions or as macros. */ + (void) towlower (0); + (void) towupper (0); + + /* Check that the tow* functions map WEOF to WEOF. */ + ASSERT (towlower (e) == e); + ASSERT (towupper (e) == e); + return 0; } diff --git a/tests/test-wcwidth.c b/tests/test-wcwidth.c index 582a8aa..f6f9792 100644 --- a/tests/test-wcwidth.c +++ b/tests/test-wcwidth.c @@ -1,5 +1,5 @@ /* Test of wcwidth() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,24 +20,14 @@ #include <wchar.h> +#include "signature.h" +SIGNATURE_CHECK (wcwidth, int, (wchar_t)); + #include <locale.h> -#include <stdio.h> -#include <stdlib.h> #include <string.h> #include "localcharset.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -51,15 +41,15 @@ main () /* Switch to an UTF-8 locale. */ if (setlocale (LC_ALL, "fr_FR.UTF-8") != NULL /* Check whether it's really an UTF-8 locale. - On OpenBSD 4.0, the setlocale call succeeds only for the LC_CTYPE - category and therefore returns "C/fr_FR.UTF-8/C/C/C/C", but the - LC_CTYPE category is effectively set to an ASCII LC_CTYPE category; - in particular, locale_charset() returns "ASCII". */ + On OpenBSD 4.0, the setlocale call succeeds only for the LC_CTYPE + category and therefore returns "C/fr_FR.UTF-8/C/C/C/C", but the + LC_CTYPE category is effectively set to an ASCII LC_CTYPE category; + in particular, locale_charset() returns "ASCII". */ && strcmp (locale_charset (), "UTF-8") == 0) { /* Test width of ASCII characters. */ for (wc = 0x20; wc < 0x7F; wc++) - ASSERT (wcwidth (wc) == 1); + ASSERT (wcwidth (wc) == 1); /* Test width of some non-spacing characters. */ ASSERT (wcwidth (0x0301) == 0); diff --git a/tests/test-xalloc-die.c b/tests/test-xalloc-die.c new file mode 100644 index 0000000..67edd92 --- /dev/null +++ b/tests/test-xalloc-die.c @@ -0,0 +1,30 @@ +/* Test of xalloc_die() function. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Simon Josefsson <simon@josefsson.org>, 2009. */ + +#include <config.h> + +#include "xalloc.h" +#include "progname.h" + +int +main (int argc _GL_UNUSED, char **argv) +{ + set_program_name (argv[0]); + xalloc_die (); + return 0; +} diff --git a/tests/test-xalloc-die.sh b/tests/test-xalloc-die.sh new file mode 100755 index 0000000..80d6208 --- /dev/null +++ b/tests/test-xalloc-die.sh @@ -0,0 +1,36 @@ +#!/bin/sh +# Test suite for xalloc_die. +# Copyright (C) 2009, 2010 Free Software Foundation, Inc. +# This file is part of the GNUlib Library. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +. "${srcdir=.}/init.sh"; path_prepend_ . + +test-xalloc-die${EXEEXT} 2> err > out +case $? in + 1) ;; + *) Exit 1;; +esac + +tr -d '\015' < err \ + | sed 's,.*test-xalloc-die[.ex]*:,test-xalloc-die:,' > err2 || Exit 1 + +compare - err2 <<\EOF || Exit 1 +test-xalloc-die: memory exhausted +EOF + +test -s out && Exit 1 + +Exit $fail diff --git a/tests/unicase/test-casecmp.h b/tests/unicase/test-casecmp.h index d057f89..eb06113 100644 --- a/tests/unicase/test-casecmp.h +++ b/tests/unicase/test-casecmp.h @@ -1,5 +1,5 @@ /* Test of case and normalization insensitive comparison of Unicode strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,7 +18,7 @@ static void test_ascii (int (*my_casecmp) (const UNIT *, size_t, const UNIT *, size_t, const char *, uninorm_t, int *), - uninorm_t nf) + uninorm_t nf) { /* Empty string. */ { diff --git a/tests/unicase/test-cased.c b/tests/unicase/test-cased.c index 37af3d2..d9cc432 100644 --- a/tests/unicase/test-cased.c +++ b/tests/unicase/test-cased.c @@ -1,6 +1,6 @@ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Test the Unicode character type functions. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-ignorable.c b/tests/unicase/test-ignorable.c index 94f809e..90f7b8e 100644 --- a/tests/unicase/test-ignorable.c +++ b/tests/unicase/test-ignorable.c @@ -1,6 +1,6 @@ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Test the Unicode character type functions. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-is-cased.h b/tests/unicase/test-is-cased.h index 474b8a4..a00b8b8 100644 --- a/tests/unicase/test-is-cased.h +++ b/tests/unicase/test-is-cased.h @@ -1,5 +1,5 @@ /* Test of test whether case matters for a Unicode string. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-is-casefolded.h b/tests/unicase/test-is-casefolded.h index 99638c6..9a1f3d8 100644 --- a/tests/unicase/test-is-casefolded.h +++ b/tests/unicase/test-is-casefolded.h @@ -1,5 +1,5 @@ /* Test of test whether a Unicode string is already case-folded. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-is-lowercase.h b/tests/unicase/test-is-lowercase.h index cc37471..b780fcd 100644 --- a/tests/unicase/test-is-lowercase.h +++ b/tests/unicase/test-is-lowercase.h @@ -1,5 +1,5 @@ /* Test of test whether a Unicode string is entirely lower case. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-is-titlecase.h b/tests/unicase/test-is-titlecase.h index b36abab..edfc60b 100644 --- a/tests/unicase/test-is-titlecase.h +++ b/tests/unicase/test-is-titlecase.h @@ -1,5 +1,5 @@ /* Test of test whether a Unicode string is entirely title case. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-is-uppercase.h b/tests/unicase/test-is-uppercase.h index d1b7ca1..6134d9d 100644 --- a/tests/unicase/test-is-uppercase.h +++ b/tests/unicase/test-is-uppercase.h @@ -1,5 +1,5 @@ /* Test of test whether a Unicode string is entirely upper case. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-locale-language.c b/tests/unicase/test-locale-language.c index e8fe181..4a62261 100644 --- a/tests/unicase/test-locale-language.c +++ b/tests/unicase/test-locale-language.c @@ -1,5 +1,5 @@ /* Test of language code determination. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,21 +21,9 @@ #include "unicase.h" #include <locale.h> -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char *argv[]) diff --git a/tests/unicase/test-mapping-part1.h b/tests/unicase/test-mapping-part1.h index 4b7ac8e..dbb93db 100644 --- a/tests/unicase/test-mapping-part1.h +++ b/tests/unicase/test-mapping-part1.h @@ -1,5 +1,5 @@ /* Test of single character case mapping functions. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,23 +18,9 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed for c = 0x%04X\n", \ - __FILE__, __LINE__, c); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) -#define SIZEOF(a) (sizeof(a) / sizeof(a[0])) +#include "macros.h" /* Pair of Unicode characters. */ typedef struct { ucs4_t ch; ucs4_t value; } pair_t; diff --git a/tests/unicase/test-mapping-part2.h b/tests/unicase/test-mapping-part2.h index ef43cdd..15c24c4 100644 --- a/tests/unicase/test-mapping-part2.h +++ b/tests/unicase/test-mapping-part2.h @@ -1,5 +1,5 @@ /* Test of single character case mapping functions. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,7 +26,7 @@ main () for (i = 0; i < SIZEOF (mapping); i++) { for (; c < mapping[i].ch; c++) - ASSERT (MAP (c) == c); + ASSERT (MAP (c) == c); ASSERT (MAP (c) == mapping[i].value); c++; } diff --git a/tests/unicase/test-predicate-part1.h b/tests/unicase/test-predicate-part1.h index 76d804e..8aca7a8 100644 --- a/tests/unicase/test-predicate-part1.h +++ b/tests/unicase/test-predicate-part1.h @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,23 +18,9 @@ #include "unicase/caseprop.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed for c = 0x%04X\n", \ - __FILE__, __LINE__, c); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) -#define SIZEOF(a) (sizeof(a) / sizeof(a[0])) +#include "macros.h" /* Interval of Unicode characters. */ typedef struct { ucs4_t start; ucs4_t end; } interval_t; diff --git a/tests/unicase/test-predicate-part2.h b/tests/unicase/test-predicate-part2.h index 60b7c24..ac95ba2 100644 --- a/tests/unicase/test-predicate-part2.h +++ b/tests/unicase/test-predicate-part2.h @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,9 +26,9 @@ main () for (i = 0; i < SIZEOF (set); i++) { for (; c < set[i].start; c++) - ASSERT (!PREDICATE (c)); + ASSERT (!PREDICATE (c)); for (; c <= set[i].end; c++) - ASSERT (PREDICATE (c)); + ASSERT (PREDICATE (c)); } for (; c < 0x110000; c++) ASSERT (!PREDICATE (c)); diff --git a/tests/unicase/test-u16-casecmp.c b/tests/unicase/test-u16-casecmp.c index f079bbf..d70b356 100644 --- a/tests/unicase/test-u16-casecmp.c +++ b/tests/unicase/test-u16-casecmp.c @@ -1,5 +1,5 @@ /* Test of case and normalization insensitive comparison of UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint16_t #include "test-casecmp.h" @@ -127,27 +112,27 @@ test_nonascii (int (*my_casecmp) (const uint16_t *, size_t, const uint16_t *, si { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint16_t input1[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint16_t input2[] = { 'g', 'r', 0x00FC, 0x0073, 0x0073, ' ', 'g', 'o', 't', 't', '.', ' ', - 0x0437, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0437, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint16_t input3[] = { 'G', 'R', 0x00DC, 0x0053, 0x0053, ' ', 'G', 'O', 'T', 'T', '.', ' ', - 0x0417, 0x0414, 0x0420, 0x0410, 0x0412, 0x0421, 0x0422, 0x0412, 0x0423, - 0x0419, 0x0422, 0x0415, '!', ' ', - 'X', '=', '(', '-', 'B', 0x00B1, 'S', 'Q', 'R', 'T', '(', 'B', 0x00B2, - '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0414, 0x0420, 0x0410, 0x0412, 0x0421, 0x0422, 0x0412, 0x0423, + 0x0419, 0x0422, 0x0415, '!', ' ', + 'X', '=', '(', '-', 'B', 0x00B1, 'S', 'Q', 'R', 'T', '(', 'B', 0x00B2, + '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; int cmp; @@ -277,21 +262,21 @@ test_nonascii (int (*my_casecmp) (const uint16_t *, size_t, const uint16_t *, si { /* "περισσότερες πληροφορίες" */ static const uint16_t input1[] = { - 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, - 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, - 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 + 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, + 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, + 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 }; static const uint16_t input2[] = { - 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, - 0x03B5, 0x03C1, 0x03B5, 0x03C3, 0x0020, 0x03C0, 0x03BB, 0x03B7, - 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C3 + 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, + 0x03B5, 0x03C1, 0x03B5, 0x03C3, 0x0020, 0x03C0, 0x03BB, 0x03B7, + 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C3 }; static const uint16_t input3[] = { - 0x03A0, 0x0395, 0x03A1, 0x0399, 0x03A3, 0x03A3, 0x038C, 0x03A4, - 0x0395, 0x03A1, 0x0395, 0x03A3, 0x0020, 0x03A0, 0x039B, 0x0397, - 0x03A1, 0x039F, 0x03A6, 0x039F, 0x03A1, 0x038A, 0x0395, 0x03A3 + 0x03A0, 0x0395, 0x03A1, 0x0399, 0x03A3, 0x03A3, 0x038C, 0x03A4, + 0x0395, 0x03A1, 0x0395, 0x03A3, 0x0020, 0x03A0, 0x039B, 0x0397, + 0x03A1, 0x039F, 0x03A6, 0x039F, 0x03A1, 0x038A, 0x0395, 0x03A3 }; int cmp; diff --git a/tests/unicase/test-u16-casecoll.c b/tests/unicase/test-u16-casecoll.c index 5428cf0..253aadc 100644 --- a/tests/unicase/test-u16-casecoll.c +++ b/tests/unicase/test-u16-casecoll.c @@ -1,6 +1,6 @@ /* Test of locale dependent, case and normalization insensitive comparison of UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,23 +21,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint16_t #include "test-casecmp.h" diff --git a/tests/unicase/test-u16-casefold.c b/tests/unicase/test-u16-casefold.c index 3f4f633..1c188e4 100644 --- a/tests/unicase/test-u16-casefold.c +++ b/tests/unicase/test-u16-casefold.c @@ -1,5 +1,5 @@ /* Test of casefolding mapping for UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint16_t *input, size_t input_length, @@ -66,13 +53,13 @@ check (const uint16_t *input, size_t input_length, preallocated = (uint16_t *) malloc (length * sizeof (uint16_t)); result = u16_casefold (input, input_length, iso639_language, nf, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u16_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -110,19 +97,19 @@ main () { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint16_t input[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint16_t casefolded[] = { 'g', 'r', 0x00FC, 0x0073, 0x0073, ' ', 'g', 'o', 't', 't', '.', ' ', - 0x0437, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0437, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casefolded, SIZEOF (casefolded)) == 0); } @@ -186,15 +173,15 @@ main () { /* "περισσότερες πληροφορίες" */ static const uint16_t input[] = { - 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, - 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, - 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 + 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, + 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, + 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 }; static const uint16_t casefolded[] = { - 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, - 0x03B5, 0x03C1, 0x03B5, 0x03C3, 0x0020, 0x03C0, 0x03BB, 0x03B7, - 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C3 + 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, + 0x03B5, 0x03C1, 0x03B5, 0x03C3, 0x0020, 0x03C0, 0x03BB, 0x03B7, + 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C3 }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casefolded, SIZEOF (casefolded)) == 0); } diff --git a/tests/unicase/test-u16-is-cased.c b/tests/unicase/test-u16-is-cased.c index a4b9dc3..801d4ee 100644 --- a/tests/unicase/test-u16-is-cased.c +++ b/tests/unicase/test-u16-is-cased.c @@ -1,5 +1,5 @@ /* Test of test whether case matters for an UTF-16 string. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint16_t #include "test-is-cased.h" diff --git a/tests/unicase/test-u16-is-casefolded.c b/tests/unicase/test-u16-is-casefolded.c index 8c0122d..cd242f6 100644 --- a/tests/unicase/test-u16-is-casefolded.c +++ b/tests/unicase/test-u16-is-casefolded.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-16 string is already case-folded. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint16_t #include "test-is-casefolded.h" diff --git a/tests/unicase/test-u16-is-lowercase.c b/tests/unicase/test-u16-is-lowercase.c index f7bea49..9f17439 100644 --- a/tests/unicase/test-u16-is-lowercase.c +++ b/tests/unicase/test-u16-is-lowercase.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-16 string is entirely lower case. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint16_t #include "test-is-lowercase.h" diff --git a/tests/unicase/test-u16-is-titlecase.c b/tests/unicase/test-u16-is-titlecase.c index 6b1c6d1..e7000db 100644 --- a/tests/unicase/test-u16-is-titlecase.c +++ b/tests/unicase/test-u16-is-titlecase.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-16 string is entirely title case. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint16_t #include "test-is-titlecase.h" diff --git a/tests/unicase/test-u16-is-uppercase.c b/tests/unicase/test-u16-is-uppercase.c index 1acf705..9844846 100644 --- a/tests/unicase/test-u16-is-uppercase.c +++ b/tests/unicase/test-u16-is-uppercase.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-16 string is entirely upper case. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint16_t #include "test-is-uppercase.h" diff --git a/tests/unicase/test-u16-tolower.c b/tests/unicase/test-u16-tolower.c index 5ec764c..af5f9d2 100644 --- a/tests/unicase/test-u16-tolower.c +++ b/tests/unicase/test-u16-tolower.c @@ -1,5 +1,5 @@ /* Test of lowercase mapping for UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint16_t *input, size_t input_length, @@ -66,13 +53,13 @@ check (const uint16_t *input, size_t input_length, preallocated = (uint16_t *) malloc (length * sizeof (uint16_t)); result = u16_tolower (input, input_length, iso639_language, nf, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u16_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -110,19 +97,19 @@ main () { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint16_t input[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint16_t casemapped[] = { 'g', 'r', 0x00FC, 0x00DF, ' ', 'g', 'o', 't', 't', '.', ' ', - 0x0437, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0437, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } @@ -173,15 +160,15 @@ main () { /* "ΠΕΡΙΣΣΌΤΕΡΕΣ ΠΛΗΡΟΦΟΡΊΕΣ" */ static const uint16_t input[] = { - 0x03A0, 0x0395, 0x03A1, 0x0399, 0x03A3, 0x03A3, 0x038C, 0x03A4, - 0x0395, 0x03A1, 0x0395, 0x03A3, 0x0020, 0x03A0, 0x039B, 0x0397, - 0x03A1, 0x039F, 0x03A6, 0x039F, 0x03A1, 0x038A, 0x0395, 0x03A3 + 0x03A0, 0x0395, 0x03A1, 0x0399, 0x03A3, 0x03A3, 0x038C, 0x03A4, + 0x0395, 0x03A1, 0x0395, 0x03A3, 0x0020, 0x03A0, 0x039B, 0x0397, + 0x03A1, 0x039F, 0x03A6, 0x039F, 0x03A1, 0x038A, 0x0395, 0x03A3 }; static const uint16_t casemapped[] = { - 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, - 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, - 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 + 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, + 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, + 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } diff --git a/tests/unicase/test-u16-totitle.c b/tests/unicase/test-u16-totitle.c index 3839c90..e08b82e 100644 --- a/tests/unicase/test-u16-totitle.c +++ b/tests/unicase/test-u16-totitle.c @@ -1,5 +1,5 @@ /* Test of titlecase mapping for UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint16_t *input, size_t input_length, @@ -66,13 +53,13 @@ check (const uint16_t *input, size_t input_length, preallocated = (uint16_t *) malloc (length * sizeof (uint16_t)); result = u16_totitle (input, input_length, iso639_language, nf, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u16_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -110,19 +97,19 @@ main () { /* "GRÜß GOTT. ЗДРАВСТВУЙТЕ! X=(-B±SQRT(B²-4AC))/(2A) 日本語,中文,한글" */ static const uint16_t input[] = { 'G', 'R', 0x00DC, 0x00DF, ' ', 'G', 'O', 'T', 'T', '.', ' ', - 0x0417, 0x0414, 0x0420, 0x0410, 0x0412, 0x0421, 0x0422, 0x0412, 0x0423, - 0x0419, 0x0422, 0x0415, '!', ' ', - 'X', '=', '(', '-', 'B', 0x00B1, 'S', 'Q', 'R', 'T', '(', 'B', 0x00B2, - '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0414, 0x0420, 0x0410, 0x0412, 0x0421, 0x0422, 0x0412, 0x0423, + 0x0419, 0x0422, 0x0415, '!', ' ', + 'X', '=', '(', '-', 'B', 0x00B1, 'S', 'Q', 'R', 'T', '(', 'B', 0x00B2, + '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint16_t casemapped[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'X', '=', '(', '-', 'B', 0x00B1, 'S', 'q', 'r', 't', '(', 'B', 0x00B2, - '-', '4', 'A', 'c', ')', ')', '/', '(', '2', 'A', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'X', '=', '(', '-', 'B', 0x00B1, 'S', 'q', 'r', 't', '(', 'B', 0x00B2, + '-', '4', 'A', 'c', ')', ')', '/', '(', '2', 'A', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } @@ -185,15 +172,15 @@ main () { /* "περισσότερες πληροφορίες" */ static const uint16_t input[] = { - 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, - 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, - 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 + 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, + 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, + 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 }; static const uint16_t casemapped[] = { - 0x03A0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, - 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03A0, 0x03BB, 0x03B7, - 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 + 0x03A0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, + 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03A0, 0x03BB, 0x03B7, + 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } diff --git a/tests/unicase/test-u16-toupper.c b/tests/unicase/test-u16-toupper.c index ed9fd6b..ec87fc7 100644 --- a/tests/unicase/test-u16-toupper.c +++ b/tests/unicase/test-u16-toupper.c @@ -1,5 +1,5 @@ /* Test of uppercase mapping for UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint16_t *input, size_t input_length, @@ -66,13 +53,13 @@ check (const uint16_t *input, size_t input_length, preallocated = (uint16_t *) malloc (length * sizeof (uint16_t)); result = u16_toupper (input, input_length, iso639_language, nf, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u16_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -110,19 +97,19 @@ main () { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint16_t input[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint16_t casemapped[] = { 'G', 'R', 0x00DC, 0x0053, 0x0053, ' ', 'G', 'O', 'T', 'T', '.', ' ', - 0x0417, 0x0414, 0x0420, 0x0410, 0x0412, 0x0421, 0x0422, 0x0412, 0x0423, - 0x0419, 0x0422, 0x0415, '!', ' ', - 'X', '=', '(', '-', 'B', 0x00B1, 'S', 'Q', 'R', 'T', '(', 'B', 0x00B2, - '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0414, 0x0420, 0x0410, 0x0412, 0x0421, 0x0422, 0x0412, 0x0423, + 0x0419, 0x0422, 0x0415, '!', ' ', + 'X', '=', '(', '-', 'B', 0x00B1, 'S', 'Q', 'R', 'T', '(', 'B', 0x00B2, + '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } @@ -185,15 +172,15 @@ main () { /* "περισσότερες πληροφορίες" */ static const uint16_t input[] = { - 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, - 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, - 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 + 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, + 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, + 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 }; static const uint16_t casemapped[] = { - 0x03A0, 0x0395, 0x03A1, 0x0399, 0x03A3, 0x03A3, 0x038C, 0x03A4, - 0x0395, 0x03A1, 0x0395, 0x03A3, 0x0020, 0x03A0, 0x039B, 0x0397, - 0x03A1, 0x039F, 0x03A6, 0x039F, 0x03A1, 0x038A, 0x0395, 0x03A3 + 0x03A0, 0x0395, 0x03A1, 0x0399, 0x03A3, 0x03A3, 0x038C, 0x03A4, + 0x0395, 0x03A1, 0x0395, 0x03A3, 0x0020, 0x03A0, 0x039B, 0x0397, + 0x03A1, 0x039F, 0x03A6, 0x039F, 0x03A1, 0x038A, 0x0395, 0x03A3 }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } diff --git a/tests/unicase/test-u32-casecmp.c b/tests/unicase/test-u32-casecmp.c index 8d58bc7..97f6277 100644 --- a/tests/unicase/test-u32-casecmp.c +++ b/tests/unicase/test-u32-casecmp.c @@ -1,5 +1,5 @@ /* Test of case and normalization insensitive comparison of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint32_t #include "test-casecmp.h" @@ -127,27 +112,27 @@ test_nonascii (int (*my_casecmp) (const uint32_t *, size_t, const uint32_t *, si { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint32_t input1[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint32_t input2[] = { 'g', 'r', 0x00FC, 0x0073, 0x0073, ' ', 'g', 'o', 't', 't', '.', ' ', - 0x0437, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0437, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint32_t input3[] = { 'G', 'R', 0x00DC, 0x0053, 0x0053, ' ', 'G', 'O', 'T', 'T', '.', ' ', - 0x0417, 0x0414, 0x0420, 0x0410, 0x0412, 0x0421, 0x0422, 0x0412, 0x0423, - 0x0419, 0x0422, 0x0415, '!', ' ', - 'X', '=', '(', '-', 'B', 0x00B1, 'S', 'Q', 'R', 'T', '(', 'B', 0x00B2, - '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0414, 0x0420, 0x0410, 0x0412, 0x0421, 0x0422, 0x0412, 0x0423, + 0x0419, 0x0422, 0x0415, '!', ' ', + 'X', '=', '(', '-', 'B', 0x00B1, 'S', 'Q', 'R', 'T', '(', 'B', 0x00B2, + '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; int cmp; @@ -277,21 +262,21 @@ test_nonascii (int (*my_casecmp) (const uint32_t *, size_t, const uint32_t *, si { /* "περισσότερες πληροφορίες" */ static const uint32_t input1[] = { - 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, - 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, - 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 + 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, + 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, + 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 }; static const uint32_t input2[] = { - 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, - 0x03B5, 0x03C1, 0x03B5, 0x03C3, 0x0020, 0x03C0, 0x03BB, 0x03B7, - 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C3 + 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, + 0x03B5, 0x03C1, 0x03B5, 0x03C3, 0x0020, 0x03C0, 0x03BB, 0x03B7, + 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C3 }; static const uint32_t input3[] = { - 0x03A0, 0x0395, 0x03A1, 0x0399, 0x03A3, 0x03A3, 0x038C, 0x03A4, - 0x0395, 0x03A1, 0x0395, 0x03A3, 0x0020, 0x03A0, 0x039B, 0x0397, - 0x03A1, 0x039F, 0x03A6, 0x039F, 0x03A1, 0x038A, 0x0395, 0x03A3 + 0x03A0, 0x0395, 0x03A1, 0x0399, 0x03A3, 0x03A3, 0x038C, 0x03A4, + 0x0395, 0x03A1, 0x0395, 0x03A3, 0x0020, 0x03A0, 0x039B, 0x0397, + 0x03A1, 0x039F, 0x03A6, 0x039F, 0x03A1, 0x038A, 0x0395, 0x03A3 }; int cmp; diff --git a/tests/unicase/test-u32-casecoll.c b/tests/unicase/test-u32-casecoll.c index 23edfbd..65e2aed 100644 --- a/tests/unicase/test-u32-casecoll.c +++ b/tests/unicase/test-u32-casecoll.c @@ -1,6 +1,6 @@ /* Test of locale dependent, case and normalization insensitive comparison of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,23 +21,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint32_t #include "test-casecmp.h" diff --git a/tests/unicase/test-u32-casefold.c b/tests/unicase/test-u32-casefold.c index d48e8dc..77b037d 100644 --- a/tests/unicase/test-u32-casefold.c +++ b/tests/unicase/test-u32-casefold.c @@ -1,5 +1,5 @@ /* Test of casefolding mapping for UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint32_t *input, size_t input_length, @@ -66,13 +53,13 @@ check (const uint32_t *input, size_t input_length, preallocated = (uint32_t *) malloc (length * sizeof (uint32_t)); result = u32_casefold (input, input_length, iso639_language, nf, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u32_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -110,19 +97,19 @@ main () { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint32_t input[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint32_t casefolded[] = { 'g', 'r', 0x00FC, 0x0073, 0x0073, ' ', 'g', 'o', 't', 't', '.', ' ', - 0x0437, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0437, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casefolded, SIZEOF (casefolded)) == 0); } @@ -186,15 +173,15 @@ main () { /* "περισσότερες πληροφορίες" */ static const uint32_t input[] = { - 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, - 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, - 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 + 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, + 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, + 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 }; static const uint32_t casefolded[] = { - 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, - 0x03B5, 0x03C1, 0x03B5, 0x03C3, 0x0020, 0x03C0, 0x03BB, 0x03B7, - 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C3 + 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, + 0x03B5, 0x03C1, 0x03B5, 0x03C3, 0x0020, 0x03C0, 0x03BB, 0x03B7, + 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C3 }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casefolded, SIZEOF (casefolded)) == 0); } diff --git a/tests/unicase/test-u32-is-cased.c b/tests/unicase/test-u32-is-cased.c index d8353fc..6f0f535 100644 --- a/tests/unicase/test-u32-is-cased.c +++ b/tests/unicase/test-u32-is-cased.c @@ -1,5 +1,5 @@ /* Test of test whether case matters for an UTF-32 string. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint32_t #include "test-is-cased.h" diff --git a/tests/unicase/test-u32-is-casefolded.c b/tests/unicase/test-u32-is-casefolded.c index d79241d..440c8d3 100644 --- a/tests/unicase/test-u32-is-casefolded.c +++ b/tests/unicase/test-u32-is-casefolded.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-32 string is already case-folded. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint32_t #include "test-is-casefolded.h" diff --git a/tests/unicase/test-u32-is-lowercase.c b/tests/unicase/test-u32-is-lowercase.c index 2cff392..a4b9511 100644 --- a/tests/unicase/test-u32-is-lowercase.c +++ b/tests/unicase/test-u32-is-lowercase.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-32 string is entirely lower case. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint32_t #include "test-is-lowercase.h" diff --git a/tests/unicase/test-u32-is-titlecase.c b/tests/unicase/test-u32-is-titlecase.c index 2c287e9..0ce2498 100644 --- a/tests/unicase/test-u32-is-titlecase.c +++ b/tests/unicase/test-u32-is-titlecase.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-32 string is entirely title case. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint32_t #include "test-is-titlecase.h" diff --git a/tests/unicase/test-u32-is-uppercase.c b/tests/unicase/test-u32-is-uppercase.c index 0044ec1..b1b8320 100644 --- a/tests/unicase/test-u32-is-uppercase.c +++ b/tests/unicase/test-u32-is-uppercase.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-32 string is entirely upper case. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint32_t #include "test-is-uppercase.h" diff --git a/tests/unicase/test-u32-tolower.c b/tests/unicase/test-u32-tolower.c index 7f348da..530f0e7 100644 --- a/tests/unicase/test-u32-tolower.c +++ b/tests/unicase/test-u32-tolower.c @@ -1,5 +1,5 @@ /* Test of lowercase mapping for UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint32_t *input, size_t input_length, @@ -66,13 +53,13 @@ check (const uint32_t *input, size_t input_length, preallocated = (uint32_t *) malloc (length * sizeof (uint32_t)); result = u32_tolower (input, input_length, iso639_language, nf, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u32_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -110,19 +97,19 @@ main () { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint32_t input[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint32_t casemapped[] = { 'g', 'r', 0x00FC, 0x00DF, ' ', 'g', 'o', 't', 't', '.', ' ', - 0x0437, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0437, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } @@ -173,15 +160,15 @@ main () { /* "ΠΕΡΙΣΣΌΤΕΡΕΣ ΠΛΗΡΟΦΟΡΊΕΣ" */ static const uint32_t input[] = { - 0x03A0, 0x0395, 0x03A1, 0x0399, 0x03A3, 0x03A3, 0x038C, 0x03A4, - 0x0395, 0x03A1, 0x0395, 0x03A3, 0x0020, 0x03A0, 0x039B, 0x0397, - 0x03A1, 0x039F, 0x03A6, 0x039F, 0x03A1, 0x038A, 0x0395, 0x03A3 + 0x03A0, 0x0395, 0x03A1, 0x0399, 0x03A3, 0x03A3, 0x038C, 0x03A4, + 0x0395, 0x03A1, 0x0395, 0x03A3, 0x0020, 0x03A0, 0x039B, 0x0397, + 0x03A1, 0x039F, 0x03A6, 0x039F, 0x03A1, 0x038A, 0x0395, 0x03A3 }; static const uint32_t casemapped[] = { - 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, - 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, - 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 + 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, + 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, + 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } diff --git a/tests/unicase/test-u32-totitle.c b/tests/unicase/test-u32-totitle.c index 82c4b0f..9e1b3e6 100644 --- a/tests/unicase/test-u32-totitle.c +++ b/tests/unicase/test-u32-totitle.c @@ -1,5 +1,5 @@ /* Test of titlecase mapping for UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint32_t *input, size_t input_length, @@ -66,13 +53,13 @@ check (const uint32_t *input, size_t input_length, preallocated = (uint32_t *) malloc (length * sizeof (uint32_t)); result = u32_totitle (input, input_length, iso639_language, nf, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u32_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -110,19 +97,19 @@ main () { /* "GRÜß GOTT. ЗДРАВСТВУЙТЕ! X=(-B±SQRT(B²-4AC))/(2A) 日本語,中文,한글" */ static const uint32_t input[] = { 'G', 'R', 0x00DC, 0x00DF, ' ', 'G', 'O', 'T', 'T', '.', ' ', - 0x0417, 0x0414, 0x0420, 0x0410, 0x0412, 0x0421, 0x0422, 0x0412, 0x0423, - 0x0419, 0x0422, 0x0415, '!', ' ', - 'X', '=', '(', '-', 'B', 0x00B1, 'S', 'Q', 'R', 'T', '(', 'B', 0x00B2, - '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0414, 0x0420, 0x0410, 0x0412, 0x0421, 0x0422, 0x0412, 0x0423, + 0x0419, 0x0422, 0x0415, '!', ' ', + 'X', '=', '(', '-', 'B', 0x00B1, 'S', 'Q', 'R', 'T', '(', 'B', 0x00B2, + '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint32_t casemapped[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'X', '=', '(', '-', 'B', 0x00B1, 'S', 'q', 'r', 't', '(', 'B', 0x00B2, - '-', '4', 'A', 'c', ')', ')', '/', '(', '2', 'A', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'X', '=', '(', '-', 'B', 0x00B1, 'S', 'q', 'r', 't', '(', 'B', 0x00B2, + '-', '4', 'A', 'c', ')', ')', '/', '(', '2', 'A', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } @@ -185,15 +172,15 @@ main () { /* "περισσότερες πληροφορίες" */ static const uint32_t input[] = { - 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, - 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, - 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 + 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, + 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, + 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 }; static const uint32_t casemapped[] = { - 0x03A0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, - 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03A0, 0x03BB, 0x03B7, - 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 + 0x03A0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, + 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03A0, 0x03BB, 0x03B7, + 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } diff --git a/tests/unicase/test-u32-toupper.c b/tests/unicase/test-u32-toupper.c index dbc1619..17ce1fe 100644 --- a/tests/unicase/test-u32-toupper.c +++ b/tests/unicase/test-u32-toupper.c @@ -1,5 +1,5 @@ /* Test of uppercase mapping for UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint32_t *input, size_t input_length, @@ -66,13 +53,13 @@ check (const uint32_t *input, size_t input_length, preallocated = (uint32_t *) malloc (length * sizeof (uint32_t)); result = u32_toupper (input, input_length, iso639_language, nf, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u32_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -110,19 +97,19 @@ main () { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint32_t input[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint32_t casemapped[] = { 'G', 'R', 0x00DC, 0x0053, 0x0053, ' ', 'G', 'O', 'T', 'T', '.', ' ', - 0x0417, 0x0414, 0x0420, 0x0410, 0x0412, 0x0421, 0x0422, 0x0412, 0x0423, - 0x0419, 0x0422, 0x0415, '!', ' ', - 'X', '=', '(', '-', 'B', 0x00B1, 'S', 'Q', 'R', 'T', '(', 'B', 0x00B2, - '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0414, 0x0420, 0x0410, 0x0412, 0x0421, 0x0422, 0x0412, 0x0423, + 0x0419, 0x0422, 0x0415, '!', ' ', + 'X', '=', '(', '-', 'B', 0x00B1, 'S', 'Q', 'R', 'T', '(', 'B', 0x00B2, + '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } @@ -185,15 +172,15 @@ main () { /* "περισσότερες πληροφορίες" */ static const uint32_t input[] = { - 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, - 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, - 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 + 0x03C0, 0x03B5, 0x03C1, 0x03B9, 0x03C3, 0x03C3, 0x03CC, 0x03C4, + 0x03B5, 0x03C1, 0x03B5, 0x03C2, 0x0020, 0x03C0, 0x03BB, 0x03B7, + 0x03C1, 0x03BF, 0x03C6, 0x03BF, 0x03C1, 0x03AF, 0x03B5, 0x03C2 }; static const uint32_t casemapped[] = { - 0x03A0, 0x0395, 0x03A1, 0x0399, 0x03A3, 0x03A3, 0x038C, 0x03A4, - 0x0395, 0x03A1, 0x0395, 0x03A3, 0x0020, 0x03A0, 0x039B, 0x0397, - 0x03A1, 0x039F, 0x03A6, 0x039F, 0x03A1, 0x038A, 0x0395, 0x03A3 + 0x03A0, 0x0395, 0x03A1, 0x0399, 0x03A3, 0x03A3, 0x038C, 0x03A4, + 0x0395, 0x03A1, 0x0395, 0x03A3, 0x0020, 0x03A0, 0x039B, 0x0397, + 0x03A1, 0x039F, 0x03A6, 0x039F, 0x03A1, 0x038A, 0x0395, 0x03A3 }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } diff --git a/tests/unicase/test-u8-casecmp.c b/tests/unicase/test-u8-casecmp.c index dbcc9d7..cb854eb 100644 --- a/tests/unicase/test-u8-casecmp.c +++ b/tests/unicase/test-u8-casecmp.c @@ -1,5 +1,5 @@ /* Test of case and normalization insensitive comparison of UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint8_t #include "test-casecmp.h" @@ -127,33 +112,33 @@ test_nonascii (int (*my_casecmp) (const uint8_t *, size_t, const uint8_t *, size { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint8_t input1[] = { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ', - 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, - 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, - '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', - 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', - ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', - 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' }; static const uint8_t input2[] = { 'g', 'r', 0xC3, 0xBC, 0x73, 0x73, ' ', 'g', 'o', 't', 't', '.', ' ', - 0xD0, 0xB7, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, - 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, - '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', - 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', - ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', - 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + 0xD0, 0xB7, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' }; static const uint8_t input3[] = { 'G', 'R', 0xC3, 0x9C, 0x53, 0x53, ' ', 'G', 'O', 'T', 'T', '.', ' ', - 0xD0, 0x97, 0xD0, 0x94, 0xD0, 0xA0, 0xD0, 0x90, 0xD0, 0x92, 0xD0, 0xA1, - 0xD0, 0xA2, 0xD0, 0x92, 0xD0, 0xA3, 0xD0, 0x99, 0xD0, 0xA2, 0xD0, 0x95, - '!', ' ', 'X', '=', '(', '-', 'B', 0xC2, 0xB1, 'S', 'Q', 'R', 'T', '(', - 'B', 0xC2, 0xB2, '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', - ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', - 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + 0xD0, 0x97, 0xD0, 0x94, 0xD0, 0xA0, 0xD0, 0x90, 0xD0, 0x92, 0xD0, 0xA1, + 0xD0, 0xA2, 0xD0, 0x92, 0xD0, 0xA3, 0xD0, 0x99, 0xD0, 0xA2, 0xD0, 0x95, + '!', ' ', 'X', '=', '(', '-', 'B', 0xC2, 0xB1, 'S', 'Q', 'R', 'T', '(', + 'B', 0xC2, 0xB2, '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' }; int cmp; @@ -283,24 +268,24 @@ test_nonascii (int (*my_casecmp) (const uint8_t *, size_t, const uint8_t *, size { /* "περισσότερες πληροφορίες" */ static const uint8_t input1[] = { - 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, - 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x82, - ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, - 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x82 + 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, + 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x82, + ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, + 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x82 }; static const uint8_t input2[] = { - 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, - 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x83, - ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, - 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x83 + 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, + 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x83, + ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, + 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x83 }; static const uint8_t input3[] = { - 0xCE, 0xA0, 0xCE, 0x95, 0xCE, 0xA1, 0xCE, 0x99, 0xCE, 0xA3, 0xCE, 0xA3, - 0xCE, 0x8C, 0xCE, 0xA4, 0xCE, 0x95, 0xCE, 0xA1, 0xCE, 0x95, 0xCE, 0xA3, - ' ', 0xCE, 0xA0, 0xCE, 0x9B, 0xCE, 0x97, 0xCE, 0xA1, 0xCE, 0x9F, - 0xCE, 0xA6, 0xCE, 0x9F, 0xCE, 0xA1, 0xCE, 0x8A, 0xCE, 0x95, 0xCE, 0xA3 + 0xCE, 0xA0, 0xCE, 0x95, 0xCE, 0xA1, 0xCE, 0x99, 0xCE, 0xA3, 0xCE, 0xA3, + 0xCE, 0x8C, 0xCE, 0xA4, 0xCE, 0x95, 0xCE, 0xA1, 0xCE, 0x95, 0xCE, 0xA3, + ' ', 0xCE, 0xA0, 0xCE, 0x9B, 0xCE, 0x97, 0xCE, 0xA1, 0xCE, 0x9F, + 0xCE, 0xA6, 0xCE, 0x9F, 0xCE, 0xA1, 0xCE, 0x8A, 0xCE, 0x95, 0xCE, 0xA3 }; int cmp; diff --git a/tests/unicase/test-u8-casecoll.c b/tests/unicase/test-u8-casecoll.c index e1b0c57..861ee2c 100644 --- a/tests/unicase/test-u8-casecoll.c +++ b/tests/unicase/test-u8-casecoll.c @@ -1,6 +1,6 @@ /* Test of locale dependent, case and normalization insensitive comparison of UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,23 +21,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint8_t #include "test-casecmp.h" diff --git a/tests/unicase/test-u8-casefold.c b/tests/unicase/test-u8-casefold.c index 225b997..b110d5c 100644 --- a/tests/unicase/test-u8-casefold.c +++ b/tests/unicase/test-u8-casefold.c @@ -1,5 +1,5 @@ /* Test of casefolding mapping for UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint8_t *input, size_t input_length, @@ -66,13 +53,13 @@ check (const uint8_t *input, size_t input_length, preallocated = (uint8_t *) malloc (length * sizeof (uint8_t)); result = u8_casefold (input, input_length, iso639_language, nf, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u8_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -110,23 +97,23 @@ main () { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint8_t input[] = { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ', - 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, - 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, - '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', - 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', - ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', - 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' }; static const uint8_t casefolded[] = { 'g', 'r', 0xC3, 0xBC, 0x73, 0x73, ' ', 'g', 'o', 't', 't', '.', ' ', - 0xD0, 0xB7, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, - 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, - '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', - 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', - ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', - 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + 0xD0, 0xB7, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casefolded, SIZEOF (casefolded)) == 0); } @@ -190,17 +177,17 @@ main () { /* "περισσότερες πληροφορίες" */ static const uint8_t input[] = { - 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, - 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x82, - ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, - 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x82 + 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, + 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x82, + ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, + 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x82 }; static const uint8_t casefolded[] = { - 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, - 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x83, - ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, - 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x83 + 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, + 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x83, + ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, + 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x83 }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casefolded, SIZEOF (casefolded)) == 0); } diff --git a/tests/unicase/test-u8-is-cased.c b/tests/unicase/test-u8-is-cased.c index 984f81b..15109ba 100644 --- a/tests/unicase/test-u8-is-cased.c +++ b/tests/unicase/test-u8-is-cased.c @@ -1,5 +1,5 @@ /* Test of test whether case matters for an UTF-8 string. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint8_t #include "test-is-cased.h" diff --git a/tests/unicase/test-u8-is-casefolded.c b/tests/unicase/test-u8-is-casefolded.c index b727f6b..fc421ab 100644 --- a/tests/unicase/test-u8-is-casefolded.c +++ b/tests/unicase/test-u8-is-casefolded.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-8 string is already case-folded. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint8_t #include "test-is-casefolded.h" diff --git a/tests/unicase/test-u8-is-lowercase.c b/tests/unicase/test-u8-is-lowercase.c index 230e77c..2b0800f 100644 --- a/tests/unicase/test-u8-is-lowercase.c +++ b/tests/unicase/test-u8-is-lowercase.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-8 string is entirely lower case. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint8_t #include "test-is-lowercase.h" diff --git a/tests/unicase/test-u8-is-titlecase.c b/tests/unicase/test-u8-is-titlecase.c index fb803ea..40716a1 100644 --- a/tests/unicase/test-u8-is-titlecase.c +++ b/tests/unicase/test-u8-is-titlecase.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-8 string is entirely title case. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint8_t #include "test-is-titlecase.h" diff --git a/tests/unicase/test-u8-is-uppercase.c b/tests/unicase/test-u8-is-uppercase.c index c66bf39..a6be37e 100644 --- a/tests/unicase/test-u8-is-uppercase.c +++ b/tests/unicase/test-u8-is-uppercase.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-8 string is entirely upper case. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint8_t #include "test-is-uppercase.h" diff --git a/tests/unicase/test-u8-tolower.c b/tests/unicase/test-u8-tolower.c index 6c0a5df..8c625e8 100644 --- a/tests/unicase/test-u8-tolower.c +++ b/tests/unicase/test-u8-tolower.c @@ -1,5 +1,5 @@ /* Test of lowercase mapping for UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint8_t *input, size_t input_length, @@ -66,13 +53,13 @@ check (const uint8_t *input, size_t input_length, preallocated = (uint8_t *) malloc (length * sizeof (uint8_t)); result = u8_tolower (input, input_length, iso639_language, nf, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u8_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -110,23 +97,23 @@ main () { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint8_t input[] = { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ', - 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, - 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, - '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', - 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', - ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', - 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' }; static const uint8_t casemapped[] = { 'g', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'g', 'o', 't', 't', '.', ' ', - 0xD0, 0xB7, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, - 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, - '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', - 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', - ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', - 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + 0xD0, 0xB7, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } @@ -177,17 +164,17 @@ main () { /* "ΠΕΡΙΣΣΌΤΕΡΕΣ ΠΛΗΡΟΦΟΡΊΕΣ" */ static const uint8_t input[] = { - 0xCE, 0xA0, 0xCE, 0x95, 0xCE, 0xA1, 0xCE, 0x99, 0xCE, 0xA3, 0xCE, 0xA3, - 0xCE, 0x8C, 0xCE, 0xA4, 0xCE, 0x95, 0xCE, 0xA1, 0xCE, 0x95, 0xCE, 0xA3, - ' ', 0xCE, 0xA0, 0xCE, 0x9B, 0xCE, 0x97, 0xCE, 0xA1, 0xCE, 0x9F, - 0xCE, 0xA6, 0xCE, 0x9F, 0xCE, 0xA1, 0xCE, 0x8A, 0xCE, 0x95, 0xCE, 0xA3 + 0xCE, 0xA0, 0xCE, 0x95, 0xCE, 0xA1, 0xCE, 0x99, 0xCE, 0xA3, 0xCE, 0xA3, + 0xCE, 0x8C, 0xCE, 0xA4, 0xCE, 0x95, 0xCE, 0xA1, 0xCE, 0x95, 0xCE, 0xA3, + ' ', 0xCE, 0xA0, 0xCE, 0x9B, 0xCE, 0x97, 0xCE, 0xA1, 0xCE, 0x9F, + 0xCE, 0xA6, 0xCE, 0x9F, 0xCE, 0xA1, 0xCE, 0x8A, 0xCE, 0x95, 0xCE, 0xA3 }; static const uint8_t casemapped[] = { - 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, - 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x82, - ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, - 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x82 + 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, + 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x82, + ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, + 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x82 }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } diff --git a/tests/unicase/test-u8-totitle.c b/tests/unicase/test-u8-totitle.c index c2506ac..93284c0 100644 --- a/tests/unicase/test-u8-totitle.c +++ b/tests/unicase/test-u8-totitle.c @@ -1,5 +1,5 @@ /* Test of titlecase mapping for UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint8_t *input, size_t input_length, @@ -66,13 +53,13 @@ check (const uint8_t *input, size_t input_length, preallocated = (uint8_t *) malloc (length * sizeof (uint8_t)); result = u8_totitle (input, input_length, iso639_language, nf, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u8_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -110,23 +97,23 @@ main () { /* "GRÜß GOTT. ЗДРАВСТВУЙТЕ! X=(-B±SQRT(B²-4AC))/(2A) 日本語,中文,한글" */ static const uint8_t input[] = { 'G', 'R', 0xC3, 0x9C, 0xC3, 0x9F, ' ', 'G', 'O', 'T', 'T', '.', ' ', - 0xD0, 0x97, 0xD0, 0x94, 0xD0, 0xA0, 0xD0, 0x90, 0xD0, 0x92, 0xD0, 0xA1, - 0xD0, 0xA2, 0xD0, 0x92, 0xD0, 0xA3, 0xD0, 0x99, 0xD0, 0xA2, 0xD0, 0x95, - '!', ' ', 'X', '=', '(', '-', 'B', 0xC2, 0xB1, 'S', 'Q', 'R', 'T', '(', - 'B', 0xC2, 0xB2, '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', - ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', - 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + 0xD0, 0x97, 0xD0, 0x94, 0xD0, 0xA0, 0xD0, 0x90, 0xD0, 0x92, 0xD0, 0xA1, + 0xD0, 0xA2, 0xD0, 0x92, 0xD0, 0xA3, 0xD0, 0x99, 0xD0, 0xA2, 0xD0, 0x95, + '!', ' ', 'X', '=', '(', '-', 'B', 0xC2, 0xB1, 'S', 'Q', 'R', 'T', '(', + 'B', 0xC2, 0xB2, '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' }; static const uint8_t casemapped[] = { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ', - 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, - 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, - '!', ' ', 'X', '=', '(', '-', 'B', 0xC2, 0xB1, 'S', 'q', 'r', 't', '(', - 'B', 0xC2, 0xB2, '-', '4', 'A', 'c', ')', ')', '/', '(', '2', 'A', ')', - ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', - 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'X', '=', '(', '-', 'B', 0xC2, 0xB1, 'S', 'q', 'r', 't', '(', + 'B', 0xC2, 0xB2, '-', '4', 'A', 'c', ')', ')', '/', '(', '2', 'A', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } @@ -189,17 +176,17 @@ main () { /* "περισσότερες πληροφορίες" */ static const uint8_t input[] = { - 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, - 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x82, - ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, - 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x82 + 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, + 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x82, + ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, + 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x82 }; static const uint8_t casemapped[] = { - 0xCE, 0xA0, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, - 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x82, - ' ', 0xCE, 0xA0, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, - 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x82 + 0xCE, 0xA0, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, + 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x82, + ' ', 0xCE, 0xA0, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, + 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x82 }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } diff --git a/tests/unicase/test-u8-toupper.c b/tests/unicase/test-u8-toupper.c index 41e536b..23e418f 100644 --- a/tests/unicase/test-u8-toupper.c +++ b/tests/unicase/test-u8-toupper.c @@ -1,5 +1,5 @@ /* Test of uppercase mapping for UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint8_t *input, size_t input_length, @@ -66,13 +53,13 @@ check (const uint8_t *input, size_t input_length, preallocated = (uint8_t *) malloc (length * sizeof (uint8_t)); result = u8_toupper (input, input_length, iso639_language, nf, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u8_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -110,23 +97,23 @@ main () { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint8_t input[] = { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ', - 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, - 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, - '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', - 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', - ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', - 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' }; static const uint8_t casemapped[] = { 'G', 'R', 0xC3, 0x9C, 0x53, 0x53, ' ', 'G', 'O', 'T', 'T', '.', ' ', - 0xD0, 0x97, 0xD0, 0x94, 0xD0, 0xA0, 0xD0, 0x90, 0xD0, 0x92, 0xD0, 0xA1, - 0xD0, 0xA2, 0xD0, 0x92, 0xD0, 0xA3, 0xD0, 0x99, 0xD0, 0xA2, 0xD0, 0x95, - '!', ' ', 'X', '=', '(', '-', 'B', 0xC2, 0xB1, 'S', 'Q', 'R', 'T', '(', - 'B', 0xC2, 0xB2, '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', - ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', - 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + 0xD0, 0x97, 0xD0, 0x94, 0xD0, 0xA0, 0xD0, 0x90, 0xD0, 0x92, 0xD0, 0xA1, + 0xD0, 0xA2, 0xD0, 0x92, 0xD0, 0xA3, 0xD0, 0x99, 0xD0, 0xA2, 0xD0, 0x95, + '!', ' ', 'X', '=', '(', '-', 'B', 0xC2, 0xB1, 'S', 'Q', 'R', 'T', '(', + 'B', 0xC2, 0xB2, '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } @@ -189,17 +176,17 @@ main () { /* "περισσότερες πληροφορίες" */ static const uint8_t input[] = { - 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, - 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x82, - ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, - 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x82 + 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, + 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x82, + ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, + 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x82 }; static const uint8_t casemapped[] = { - 0xCE, 0xA0, 0xCE, 0x95, 0xCE, 0xA1, 0xCE, 0x99, 0xCE, 0xA3, 0xCE, 0xA3, - 0xCE, 0x8C, 0xCE, 0xA4, 0xCE, 0x95, 0xCE, 0xA1, 0xCE, 0x95, 0xCE, 0xA3, - ' ', 0xCE, 0xA0, 0xCE, 0x9B, 0xCE, 0x97, 0xCE, 0xA1, 0xCE, 0x9F, - 0xCE, 0xA6, 0xCE, 0x9F, 0xCE, 0xA1, 0xCE, 0x8A, 0xCE, 0x95, 0xCE, 0xA3 + 0xCE, 0xA0, 0xCE, 0x95, 0xCE, 0xA1, 0xCE, 0x99, 0xCE, 0xA3, 0xCE, 0xA3, + 0xCE, 0x8C, 0xCE, 0xA4, 0xCE, 0x95, 0xCE, 0xA1, 0xCE, 0x95, 0xCE, 0xA3, + ' ', 0xCE, 0xA0, 0xCE, 0x9B, 0xCE, 0x97, 0xCE, 0xA1, 0xCE, 0x9F, + 0xCE, 0xA6, 0xCE, 0x9F, 0xCE, 0xA1, 0xCE, 0x8A, 0xCE, 0x95, 0xCE, 0xA3 }; ASSERT (check (input, SIZEOF (input), NULL, NULL, casemapped, SIZEOF (casemapped)) == 0); } diff --git a/tests/unicase/test-uc_tolower.c b/tests/unicase/test-uc_tolower.c index 302e26b..6ed3fde 100644 --- a/tests/unicase/test-uc_tolower.c +++ b/tests/unicase/test-uc_tolower.c @@ -1,6 +1,6 @@ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Test the Unicode character mapping functions. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-uc_totitle.c b/tests/unicase/test-uc_totitle.c index 9064a41..e187bd4 100644 --- a/tests/unicase/test-uc_totitle.c +++ b/tests/unicase/test-uc_totitle.c @@ -1,6 +1,6 @@ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Test the Unicode character mapping functions. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-uc_toupper.c b/tests/unicase/test-uc_toupper.c index ed242a0..481e9f0 100644 --- a/tests/unicase/test-uc_toupper.c +++ b/tests/unicase/test-uc_toupper.c @@ -1,6 +1,6 @@ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Test the Unicode character mapping functions. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-ulc-casecmp.c b/tests/unicase/test-ulc-casecmp.c index 5450ef3..fd86613 100644 --- a/tests/unicase/test-ulc-casecmp.c +++ b/tests/unicase/test-ulc-casecmp.c @@ -1,5 +1,5 @@ /* Test of case and normalization insensitive comparison of strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,21 +21,7 @@ #include "unicase.h" #include <locale.h> -#include <stdio.h> -#include <stdlib.h> - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT char #include "test-casecmp.h" @@ -173,33 +159,33 @@ test_utf_8 (int (*my_casecmp) (const char *, size_t, const char *, size_t, const { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const char input1[] = { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ', - 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, - 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, - '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', - 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', - ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', - 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' }; static const char input2[] = { 'g', 'r', 0xC3, 0xBC, 0x73, 0x73, ' ', 'g', 'o', 't', 't', '.', ' ', - 0xD0, 0xB7, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, - 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, - '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', - 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', - ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', - 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + 0xD0, 0xB7, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' }; static const char input3[] = { 'G', 'R', 0xC3, 0x9C, 0x53, 0x53, ' ', 'G', 'O', 'T', 'T', '.', ' ', - 0xD0, 0x97, 0xD0, 0x94, 0xD0, 0xA0, 0xD0, 0x90, 0xD0, 0x92, 0xD0, 0xA1, - 0xD0, 0xA2, 0xD0, 0x92, 0xD0, 0xA3, 0xD0, 0x99, 0xD0, 0xA2, 0xD0, 0x95, - '!', ' ', 'X', '=', '(', '-', 'B', 0xC2, 0xB1, 'S', 'Q', 'R', 'T', '(', - 'B', 0xC2, 0xB2, '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', - ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', - 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + 0xD0, 0x97, 0xD0, 0x94, 0xD0, 0xA0, 0xD0, 0x90, 0xD0, 0x92, 0xD0, 0xA1, + 0xD0, 0xA2, 0xD0, 0x92, 0xD0, 0xA3, 0xD0, 0x99, 0xD0, 0xA2, 0xD0, 0x95, + '!', ' ', 'X', '=', '(', '-', 'B', 0xC2, 0xB1, 'S', 'Q', 'R', 'T', '(', + 'B', 0xC2, 0xB2, '-', '4', 'A', 'C', ')', ')', '/', '(', '2', 'A', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' }; int cmp; @@ -329,24 +315,24 @@ test_utf_8 (int (*my_casecmp) (const char *, size_t, const char *, size_t, const { /* "περισσότερες πληροφορίες" */ static const char input1[] = { - 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, - 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x82, - ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, - 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x82 + 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, + 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x82, + ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, + 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x82 }; static const char input2[] = { - 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, - 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x83, - ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, - 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x83 + 0xCF, 0x80, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB9, 0xCF, 0x83, 0xCF, 0x83, + 0xCF, 0x8C, 0xCF, 0x84, 0xCE, 0xB5, 0xCF, 0x81, 0xCE, 0xB5, 0xCF, 0x83, + ' ', 0xCF, 0x80, 0xCE, 0xBB, 0xCE, 0xB7, 0xCF, 0x81, 0xCE, 0xBF, + 0xCF, 0x86, 0xCE, 0xBF, 0xCF, 0x81, 0xCE, 0xAF, 0xCE, 0xB5, 0xCF, 0x83 }; static const char input3[] = { - 0xCE, 0xA0, 0xCE, 0x95, 0xCE, 0xA1, 0xCE, 0x99, 0xCE, 0xA3, 0xCE, 0xA3, - 0xCE, 0x8C, 0xCE, 0xA4, 0xCE, 0x95, 0xCE, 0xA1, 0xCE, 0x95, 0xCE, 0xA3, - ' ', 0xCE, 0xA0, 0xCE, 0x9B, 0xCE, 0x97, 0xCE, 0xA1, 0xCE, 0x9F, - 0xCE, 0xA6, 0xCE, 0x9F, 0xCE, 0xA1, 0xCE, 0x8A, 0xCE, 0x95, 0xCE, 0xA3 + 0xCE, 0xA0, 0xCE, 0x95, 0xCE, 0xA1, 0xCE, 0x99, 0xCE, 0xA3, 0xCE, 0xA3, + 0xCE, 0x8C, 0xCE, 0xA4, 0xCE, 0x95, 0xCE, 0xA1, 0xCE, 0x95, 0xCE, 0xA3, + ' ', 0xCE, 0xA0, 0xCE, 0x9B, 0xCE, 0x97, 0xCE, 0xA1, 0xCE, 0x9F, + 0xCE, 0xA6, 0xCE, 0x9F, 0xCE, 0xA1, 0xCE, 0x8A, 0xCE, 0x95, 0xCE, 0xA3 }; int cmp; @@ -394,14 +380,14 @@ main (int argc, char *argv[]) switch (argv[1][0]) { case '1': - /* Locale encoding is ISO-8859-1 or ISO-8859-15. */ - test_iso_8859_1 (ulc_casecmp); - return 0; + /* Locale encoding is ISO-8859-1 or ISO-8859-15. */ + test_iso_8859_1 (ulc_casecmp); + return 0; case '2': - /* Locale encoding is UTF-8. */ - test_utf_8 (ulc_casecmp); - return 0; + /* Locale encoding is UTF-8. */ + test_utf_8 (ulc_casecmp); + return 0; } return 1; diff --git a/tests/unicase/test-ulc-casecoll.c b/tests/unicase/test-ulc-casecoll.c index a0875f4..d3b759c 100644 --- a/tests/unicase/test-ulc-casecoll.c +++ b/tests/unicase/test-ulc-casecoll.c @@ -1,6 +1,6 @@ /* Test of locale dependent, case and normalization insensitive comparison of strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,23 +22,9 @@ #include "unicase.h" #include <locale.h> -#include <stdio.h> -#include <stdlib.h> #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT char #include "test-casecmp.h" diff --git a/tests/uniconv/test-u16-conv-from-enc.c b/tests/uniconv/test-u16-conv-from-enc.c index 1d1594e..05e8b24 100644 --- a/tests/uniconv/test-u16-conv-from-enc.c +++ b/tests/uniconv/test-u16-conv-from-enc.c @@ -1,5 +1,5 @@ /* Test of conversion to UTF-16 from legacy encodings. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,24 +20,11 @@ #include "uniconv.h" -#include <stdio.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Magic number for detecting bounds violations. */ #define MAGIC 0x1983EFF1 @@ -69,31 +56,31 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; static const uint16_t expected[] = /* Ärger mit bösen Bübchen ohne Augenmaß */ - { - 0xC4, 'r', 'g', 'e', 'r', ' ', 'm', 'i', 't', ' ', 'b', 0xF6, 's', - 'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h', - 'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF - }; + { + 0xC4, 'r', 'g', 'e', 'r', ' ', 'm', 'i', 't', ' ', 'b', 0xF6, 's', + 'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h', + 'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF + }; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - size_t length; - uint16_t *result = u16_conv_from_encoding ("ISO-8859-1", handler, - input, strlen (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == SIZEOF (expected)); - ASSERT (u16_cmp (result, expected, SIZEOF (expected)) == 0); - if (o) - { - for (i = 0; i < 37; i++) - ASSERT (offsets[i] == i); - ASSERT (offsets[37] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + size_t length; + uint16_t *result = u16_conv_from_encoding ("ISO-8859-1", handler, + input, strlen (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == SIZEOF (expected)); + ASSERT (u16_cmp (result, expected, SIZEOF (expected)) == 0); + if (o) + { + for (i = 0; i < 37; i++) + ASSERT (offsets[i] == i); + ASSERT (offsets[37] == MAGIC); + free (offsets); + } + free (result); + } } /* Test conversion from ISO-8859-2 to UTF-16 with no errors. */ @@ -102,30 +89,30 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */ static const uint16_t expected[] = - { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i' - }; + { + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i' + }; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - size_t length; - uint16_t *result = u16_conv_from_encoding ("ISO-8859-2", handler, - input, strlen (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == SIZEOF (expected)); - ASSERT (u16_cmp (result, expected, SIZEOF (expected)) == 0); - if (o) - { - for (i = 0; i < 16; i++) - ASSERT (offsets[i] == i); - ASSERT (offsets[16] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + size_t length; + uint16_t *result = u16_conv_from_encoding ("ISO-8859-2", handler, + input, strlen (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == SIZEOF (expected)); + ASSERT (u16_cmp (result, expected, SIZEOF (expected)) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == i); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } } /* autodetect_jp is only supported when iconv() support ISO-2022-JP-2. */ @@ -136,93 +123,93 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\244\263\244\363\244\313\244\301\244\317"; /* こんにちは in EUC-JP */ static const uint16_t expected[] = /* こんにちは */ - { - 0x3053, 0x3093, 0x306B, 0x3061, 0x306F - }; + { + 0x3053, 0x3093, 0x306B, 0x3061, 0x306F + }; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - size_t length; - uint16_t *result = u16_conv_from_encoding ("autodetect_jp", handler, - input, strlen (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == SIZEOF (expected)); - ASSERT (u16_cmp (result, expected, SIZEOF (expected)) == 0); - if (o) - { - for (i = 0; i < 10; i++) - ASSERT (offsets[i] == ((i % 2) == 0 ? i / 2 : (size_t)(-1))); - ASSERT (offsets[10] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + size_t length; + uint16_t *result = u16_conv_from_encoding ("autodetect_jp", handler, + input, strlen (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == SIZEOF (expected)); + ASSERT (u16_cmp (result, expected, SIZEOF (expected)) == 0); + if (o) + { + for (i = 0; i < 10; i++) + ASSERT (offsets[i] == ((i % 2) == 0 ? i / 2 : (size_t)(-1))); + ASSERT (offsets[10] == MAGIC); + free (offsets); + } + free (result); + } } for (h = 0; h < SIZEOF (handlers); h++) { enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\202\261\202\361\202\311\202\277\202\315"; /* こんにちは in Shift_JIS */ static const uint16_t expected[] = /* こんにちは */ - { - 0x3053, 0x3093, 0x306B, 0x3061, 0x306F - }; + { + 0x3053, 0x3093, 0x306B, 0x3061, 0x306F + }; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - size_t length; - uint16_t *result = u16_conv_from_encoding ("autodetect_jp", handler, - input, strlen (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == SIZEOF (expected)); - ASSERT (u16_cmp (result, expected, SIZEOF (expected)) == 0); - if (o) - { - for (i = 0; i < 10; i++) - ASSERT (offsets[i] == ((i % 2) == 0 ? i / 2 : (size_t)(-1))); - ASSERT (offsets[10] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + size_t length; + uint16_t *result = u16_conv_from_encoding ("autodetect_jp", handler, + input, strlen (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == SIZEOF (expected)); + ASSERT (u16_cmp (result, expected, SIZEOF (expected)) == 0); + if (o) + { + for (i = 0; i < 10; i++) + ASSERT (offsets[i] == ((i % 2) == 0 ? i / 2 : (size_t)(-1))); + ASSERT (offsets[10] == MAGIC); + free (offsets); + } + free (result); + } } for (h = 0; h < SIZEOF (handlers); h++) { enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\033$B$3$s$K$A$O\033(B"; /* こんにちは in ISO-2022-JP-2 */ static const uint16_t expected[] = /* こんにちは */ - { - 0x3053, 0x3093, 0x306B, 0x3061, 0x306F - }; + { + 0x3053, 0x3093, 0x306B, 0x3061, 0x306F + }; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - size_t length; - uint16_t *result = u16_conv_from_encoding ("autodetect_jp", handler, - input, strlen (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == SIZEOF (expected)); - ASSERT (u16_cmp (result, expected, SIZEOF (expected)) == 0); - if (o) - { - for (i = 0; i < 16; i++) - ASSERT (offsets[i] == (i == 0 ? 0 : - i == 5 ? 1 : - i == 7 ? 2 : - i == 9 ? 3 : - i == 11 ? 4 : - i == 13 ? 5 : - (size_t)(-1))); - ASSERT (offsets[16] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + size_t length; + uint16_t *result = u16_conv_from_encoding ("autodetect_jp", handler, + input, strlen (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == SIZEOF (expected)); + ASSERT (u16_cmp (result, expected, SIZEOF (expected)) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == (i == 0 ? 0 : + i == 5 ? 1 : + i == 7 ? 2 : + i == 9 ? 3 : + i == 11 ? 4 : + i == 13 ? 5 : + (size_t)(-1))); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } } # endif diff --git a/tests/uniconv/test-u16-conv-to-enc.c b/tests/uniconv/test-u16-conv-to-enc.c index a2dc3c6..27b2b44 100644 --- a/tests/uniconv/test-u16-conv-to-enc.c +++ b/tests/uniconv/test-u16-conv-to-enc.c @@ -1,5 +1,5 @@ /* Test of conversion from UTF-16 to legacy encodings. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,22 +21,10 @@ #include "uniconv.h" #include <errno.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Magic number for detecting bounds violations. */ #define MAGIC 0x1983EFF1 @@ -67,32 +55,32 @@ main () { enum iconv_ilseq_handler handler = handlers[h]; static const uint16_t input[] = /* Ärger mit bösen Bübchen ohne Augenmaß */ - { - 0xC4, 'r', 'g', 'e', 'r', ' ', 'm', 'i', 't', ' ', 'b', 0xF6, 's', - 'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h', - 'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF - }; + { + 0xC4, 'r', 'g', 'e', 'r', ' ', 'm', 'i', 't', ' ', 'b', 0xF6, 's', + 'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h', + 'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF + }; static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (SIZEOF (input)) : NULL); - size_t length; - char *result = u16_conv_to_encoding ("ISO-8859-1", handler, - input, SIZEOF (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == strlen (expected)); - ASSERT (memcmp (result, expected, length) == 0); - if (o) - { - for (i = 0; i < 37; i++) - ASSERT (offsets[i] == i); - ASSERT (offsets[37] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (SIZEOF (input)) : NULL); + size_t length; + char *result = u16_conv_to_encoding ("ISO-8859-1", handler, + input, SIZEOF (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == strlen (expected)); + ASSERT (memcmp (result, expected, length) == 0); + if (o) + { + for (i = 0; i < 37; i++) + ASSERT (offsets[i] == i); + ASSERT (offsets[37] == MAGIC); + free (offsets); + } + free (result); + } } /* Test conversion from UTF-16 to ISO-8859-1 with EILSEQ. */ @@ -100,61 +88,61 @@ main () { enum iconv_ilseq_handler handler = handlers[h]; static const uint16_t input[] = /* Rafał Maszkowski */ - { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i' - }; + { + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i' + }; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (SIZEOF (input)) : NULL); - size_t length = 0xdead; - char *result = u16_conv_to_encoding ("ISO-8859-1", handler, - input, SIZEOF (input), - offsets, - NULL, &length); - switch (handler) - { - case iconveh_error: - ASSERT (result == NULL); - ASSERT (errno == EILSEQ); - ASSERT (length == 0xdead); - break; - case iconveh_question_mark: - { - static const char expected[] = "Rafa? Maszkowski"; - static const char expected_translit[] = "Rafal Maszkowski"; - ASSERT (result != NULL); - ASSERT (length == strlen (expected)); - ASSERT (memcmp (result, expected, length) == 0 - || memcmp (result, expected_translit, length) == 0); - if (o) - { - for (i = 0; i < 16; i++) - ASSERT (offsets[i] == i); - ASSERT (offsets[16] == MAGIC); - free (offsets); - } - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Rafa\\u0142 Maszkowski"; - ASSERT (result != NULL); - ASSERT (length == strlen (expected)); - ASSERT (memcmp (result, expected, length) == 0); - if (o) - { - for (i = 0; i < 16; i++) - ASSERT (offsets[i] == (i < 5 ? i : i + 5)); - ASSERT (offsets[16] == MAGIC); - free (offsets); - } - free (result); - } - break; - } - } + { + size_t *offsets = (o ? new_offsets (SIZEOF (input)) : NULL); + size_t length = 0xdead; + char *result = u16_conv_to_encoding ("ISO-8859-1", handler, + input, SIZEOF (input), + offsets, + NULL, &length); + switch (handler) + { + case iconveh_error: + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); + ASSERT (length == 0xdead); + break; + case iconveh_question_mark: + { + static const char expected[] = "Rafa? Maszkowski"; + static const char expected_translit[] = "Rafal Maszkowski"; + ASSERT (result != NULL); + ASSERT (length == strlen (expected)); + ASSERT (memcmp (result, expected, length) == 0 + || memcmp (result, expected_translit, length) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == i); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa\\u0142 Maszkowski"; + ASSERT (result != NULL); + ASSERT (length == strlen (expected)); + ASSERT (memcmp (result, expected, length) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == (i < 5 ? i : i + 5)); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } + break; + } + } } /* Test conversion from UTF-16 to ISO-8859-1 with EINVAL. */ @@ -163,23 +151,23 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const uint16_t input[] = { 0xD845 }; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (SIZEOF (input)) : NULL); - size_t length; - char *result = u16_conv_to_encoding ("ISO-8859-1", handler, - input, SIZEOF (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == strlen ("")); - if (o) - { - ASSERT (offsets[0] == 0); - ASSERT (offsets[1] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (SIZEOF (input)) : NULL); + size_t length; + char *result = u16_conv_to_encoding ("ISO-8859-1", handler, + input, SIZEOF (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == strlen ("")); + if (o) + { + ASSERT (offsets[0] == 0); + ASSERT (offsets[1] == MAGIC); + free (offsets); + } + free (result); + } } #endif diff --git a/tests/uniconv/test-u16-strconv-from-enc.c b/tests/uniconv/test-u16-strconv-from-enc.c index 492898d..fb6696a 100644 --- a/tests/uniconv/test-u16-strconv-from-enc.c +++ b/tests/uniconv/test-u16-strconv-from-enc.c @@ -1,5 +1,5 @@ /* Test of conversion to UTF-16 from legacy encodings. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,23 +20,10 @@ #include "uniconv.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -55,11 +42,11 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; static const uint16_t expected[] = /* Ärger mit bösen Bübchen ohne Augenmaß */ - { - 0xC4, 'r', 'g', 'e', 'r', ' ', 'm', 'i', 't', ' ', 'b', 0xF6, 's', - 'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h', - 'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF, 0 - }; + { + 0xC4, 'r', 'g', 'e', 'r', ' ', 'm', 'i', 't', ' ', 'b', 0xF6, 's', + 'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h', + 'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF, 0 + }; uint16_t *result = u16_strconv_from_encoding (input, "ISO-8859-1", handler); ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); @@ -72,10 +59,10 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */ static const uint16_t expected[] = - { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i', 0 - }; + { + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i', 0 + }; uint16_t *result = u16_strconv_from_encoding (input, "ISO-8859-2", handler); ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); @@ -90,9 +77,9 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\244\263\244\363\244\313\244\301\244\317"; /* こんにちは in EUC-JP */ static const uint16_t expected[] = /* こんにちは */ - { - 0x3053, 0x3093, 0x306B, 0x3061, 0x306F, 0 - }; + { + 0x3053, 0x3093, 0x306B, 0x3061, 0x306F, 0 + }; uint16_t *result = u16_strconv_from_encoding (input, "autodetect_jp", handler); ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); @@ -103,9 +90,9 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\202\261\202\361\202\311\202\277\202\315"; /* こんにちは in Shift_JIS */ static const uint16_t expected[] = /* こんにちは */ - { - 0x3053, 0x3093, 0x306B, 0x3061, 0x306F, 0 - }; + { + 0x3053, 0x3093, 0x306B, 0x3061, 0x306F, 0 + }; uint16_t *result = u16_strconv_from_encoding (input, "autodetect_jp", handler); ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); @@ -116,9 +103,9 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\033$B$3$s$K$A$O\033(B"; /* こんにちは in ISO-2022-JP-2 */ static const uint16_t expected[] = /* こんにちは */ - { - 0x3053, 0x3093, 0x306B, 0x3061, 0x306F, 0 - }; + { + 0x3053, 0x3093, 0x306B, 0x3061, 0x306F, 0 + }; uint16_t *result = u16_strconv_from_encoding (input, "autodetect_jp", handler); ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); diff --git a/tests/uniconv/test-u16-strconv-to-enc.c b/tests/uniconv/test-u16-strconv-to-enc.c index 95a7206..819a993 100644 --- a/tests/uniconv/test-u16-strconv-to-enc.c +++ b/tests/uniconv/test-u16-strconv-to-enc.c @@ -1,5 +1,5 @@ /* Test of conversion from UTF-16 to legacy encodings. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,22 +21,10 @@ #include "uniconv.h" #include <errno.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -54,11 +42,11 @@ main () { enum iconv_ilseq_handler handler = handlers[h]; static const uint16_t input[] = /* Ärger mit bösen Bübchen ohne Augenmaß */ - { - 0xC4, 'r', 'g', 'e', 'r', ' ', 'm', 'i', 't', ' ', 'b', 0xF6, 's', - 'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h', - 'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF, 0 - }; + { + 0xC4, 'r', 'g', 'e', 'r', ' ', 'm', 'i', 't', ' ', 'b', 0xF6, 's', + 'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h', + 'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF, 0 + }; static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; char *result = u16_strconv_to_encoding (input, "ISO-8859-1", handler); ASSERT (result != NULL); @@ -71,35 +59,35 @@ main () { enum iconv_ilseq_handler handler = handlers[h]; static const uint16_t input[] = /* Rafał Maszkowski */ - { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i', 0 - }; + { + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i', 0 + }; char *result = u16_strconv_to_encoding (input, "ISO-8859-1", handler); switch (handler) - { - case iconveh_error: - ASSERT (result == NULL && errno == EILSEQ); - break; - case iconveh_question_mark: - { - static const char expected[] = "Rafa? Maszkowski"; - static const char expected_translit[] = "Rafal Maszkowski"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0 - || strcmp (result, expected_translit) == 0); - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Rafa\\u0142 Maszkowski"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0); - free (result); - } - break; - } + { + case iconveh_error: + ASSERT (result == NULL && errno == EILSEQ); + break; + case iconveh_question_mark: + { + static const char expected[] = "Rafa? Maszkowski"; + static const char expected_translit[] = "Rafal Maszkowski"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0 + || strcmp (result, expected_translit) == 0); + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa\\u0142 Maszkowski"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + break; + } } # if 0 diff --git a/tests/uniconv/test-u32-conv-from-enc.c b/tests/uniconv/test-u32-conv-from-enc.c index 3464084..6dcb615 100644 --- a/tests/uniconv/test-u32-conv-from-enc.c +++ b/tests/uniconv/test-u32-conv-from-enc.c @@ -1,5 +1,5 @@ /* Test of conversion to UTF-32 from legacy encodings. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,24 +20,11 @@ #include "uniconv.h" -#include <stdio.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Magic number for detecting bounds violations. */ #define MAGIC 0x1983EFF1 @@ -69,31 +56,31 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; static const uint32_t expected[] = /* Ärger mit bösen Bübchen ohne Augenmaß */ - { - 0xC4, 'r', 'g', 'e', 'r', ' ', 'm', 'i', 't', ' ', 'b', 0xF6, 's', - 'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h', - 'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF - }; + { + 0xC4, 'r', 'g', 'e', 'r', ' ', 'm', 'i', 't', ' ', 'b', 0xF6, 's', + 'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h', + 'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF + }; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - size_t length; - uint32_t *result = u32_conv_from_encoding ("ISO-8859-1", handler, - input, strlen (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == SIZEOF (expected)); - ASSERT (u32_cmp (result, expected, SIZEOF (expected)) == 0); - if (o) - { - for (i = 0; i < 37; i++) - ASSERT (offsets[i] == i); - ASSERT (offsets[37] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + size_t length; + uint32_t *result = u32_conv_from_encoding ("ISO-8859-1", handler, + input, strlen (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == SIZEOF (expected)); + ASSERT (u32_cmp (result, expected, SIZEOF (expected)) == 0); + if (o) + { + for (i = 0; i < 37; i++) + ASSERT (offsets[i] == i); + ASSERT (offsets[37] == MAGIC); + free (offsets); + } + free (result); + } } /* Test conversion from ISO-8859-2 to UTF-16 with no errors. */ @@ -102,30 +89,30 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */ static const uint32_t expected[] = - { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i' - }; + { + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i' + }; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - size_t length; - uint32_t *result = u32_conv_from_encoding ("ISO-8859-2", handler, - input, strlen (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == SIZEOF (expected)); - ASSERT (u32_cmp (result, expected, SIZEOF (expected)) == 0); - if (o) - { - for (i = 0; i < 16; i++) - ASSERT (offsets[i] == i); - ASSERT (offsets[16] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + size_t length; + uint32_t *result = u32_conv_from_encoding ("ISO-8859-2", handler, + input, strlen (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == SIZEOF (expected)); + ASSERT (u32_cmp (result, expected, SIZEOF (expected)) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == i); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } } /* autodetect_jp is only supported when iconv() support ISO-2022-JP-2. */ @@ -136,93 +123,93 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\244\263\244\363\244\313\244\301\244\317"; /* こんにちは in EUC-JP */ static const uint32_t expected[] = /* こんにちは */ - { - 0x3053, 0x3093, 0x306B, 0x3061, 0x306F - }; + { + 0x3053, 0x3093, 0x306B, 0x3061, 0x306F + }; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - size_t length; - uint32_t *result = u32_conv_from_encoding ("autodetect_jp", handler, - input, strlen (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == SIZEOF (expected)); - ASSERT (u32_cmp (result, expected, SIZEOF (expected)) == 0); - if (o) - { - for (i = 0; i < 10; i++) - ASSERT (offsets[i] == ((i % 2) == 0 ? i / 2 : (size_t)(-1))); - ASSERT (offsets[10] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + size_t length; + uint32_t *result = u32_conv_from_encoding ("autodetect_jp", handler, + input, strlen (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == SIZEOF (expected)); + ASSERT (u32_cmp (result, expected, SIZEOF (expected)) == 0); + if (o) + { + for (i = 0; i < 10; i++) + ASSERT (offsets[i] == ((i % 2) == 0 ? i / 2 : (size_t)(-1))); + ASSERT (offsets[10] == MAGIC); + free (offsets); + } + free (result); + } } for (h = 0; h < SIZEOF (handlers); h++) { enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\202\261\202\361\202\311\202\277\202\315"; /* こんにちは in Shift_JIS */ static const uint32_t expected[] = /* こんにちは */ - { - 0x3053, 0x3093, 0x306B, 0x3061, 0x306F - }; + { + 0x3053, 0x3093, 0x306B, 0x3061, 0x306F + }; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - size_t length; - uint32_t *result = u32_conv_from_encoding ("autodetect_jp", handler, - input, strlen (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == SIZEOF (expected)); - ASSERT (u32_cmp (result, expected, SIZEOF (expected)) == 0); - if (o) - { - for (i = 0; i < 10; i++) - ASSERT (offsets[i] == ((i % 2) == 0 ? i / 2 : (size_t)(-1))); - ASSERT (offsets[10] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + size_t length; + uint32_t *result = u32_conv_from_encoding ("autodetect_jp", handler, + input, strlen (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == SIZEOF (expected)); + ASSERT (u32_cmp (result, expected, SIZEOF (expected)) == 0); + if (o) + { + for (i = 0; i < 10; i++) + ASSERT (offsets[i] == ((i % 2) == 0 ? i / 2 : (size_t)(-1))); + ASSERT (offsets[10] == MAGIC); + free (offsets); + } + free (result); + } } for (h = 0; h < SIZEOF (handlers); h++) { enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\033$B$3$s$K$A$O\033(B"; /* こんにちは in ISO-2022-JP-2 */ static const uint32_t expected[] = /* こんにちは */ - { - 0x3053, 0x3093, 0x306B, 0x3061, 0x306F - }; + { + 0x3053, 0x3093, 0x306B, 0x3061, 0x306F + }; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - size_t length; - uint32_t *result = u32_conv_from_encoding ("autodetect_jp", handler, - input, strlen (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == SIZEOF (expected)); - ASSERT (u32_cmp (result, expected, SIZEOF (expected)) == 0); - if (o) - { - for (i = 0; i < 16; i++) - ASSERT (offsets[i] == (i == 0 ? 0 : - i == 5 ? 1 : - i == 7 ? 2 : - i == 9 ? 3 : - i == 11 ? 4 : - i == 13 ? 5 : - (size_t)(-1))); - ASSERT (offsets[16] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + size_t length; + uint32_t *result = u32_conv_from_encoding ("autodetect_jp", handler, + input, strlen (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == SIZEOF (expected)); + ASSERT (u32_cmp (result, expected, SIZEOF (expected)) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == (i == 0 ? 0 : + i == 5 ? 1 : + i == 7 ? 2 : + i == 9 ? 3 : + i == 11 ? 4 : + i == 13 ? 5 : + (size_t)(-1))); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } } # endif diff --git a/tests/uniconv/test-u32-conv-to-enc.c b/tests/uniconv/test-u32-conv-to-enc.c index 585b737..24cb72a 100644 --- a/tests/uniconv/test-u32-conv-to-enc.c +++ b/tests/uniconv/test-u32-conv-to-enc.c @@ -1,5 +1,5 @@ /* Test of conversion from UTF-32 to legacy encodings. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,22 +21,10 @@ #include "uniconv.h" #include <errno.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Magic number for detecting bounds violations. */ #define MAGIC 0x1983EFF1 @@ -67,32 +55,32 @@ main () { enum iconv_ilseq_handler handler = handlers[h]; static const uint32_t input[] = /* Ärger mit bösen Bübchen ohne Augenmaß */ - { - 0xC4, 'r', 'g', 'e', 'r', ' ', 'm', 'i', 't', ' ', 'b', 0xF6, 's', - 'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h', - 'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF - }; + { + 0xC4, 'r', 'g', 'e', 'r', ' ', 'm', 'i', 't', ' ', 'b', 0xF6, 's', + 'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h', + 'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF + }; static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (SIZEOF (input)) : NULL); - size_t length; - char *result = u32_conv_to_encoding ("ISO-8859-1", handler, - input, SIZEOF (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == strlen (expected)); - ASSERT (memcmp (result, expected, length) == 0); - if (o) - { - for (i = 0; i < 37; i++) - ASSERT (offsets[i] == i); - ASSERT (offsets[37] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (SIZEOF (input)) : NULL); + size_t length; + char *result = u32_conv_to_encoding ("ISO-8859-1", handler, + input, SIZEOF (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == strlen (expected)); + ASSERT (memcmp (result, expected, length) == 0); + if (o) + { + for (i = 0; i < 37; i++) + ASSERT (offsets[i] == i); + ASSERT (offsets[37] == MAGIC); + free (offsets); + } + free (result); + } } /* Test conversion from UTF-32 to ISO-8859-1 with EILSEQ. */ @@ -100,61 +88,61 @@ main () { enum iconv_ilseq_handler handler = handlers[h]; static const uint32_t input[] = /* Rafał Maszkowski */ - { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i' - }; + { + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i' + }; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (SIZEOF (input)) : NULL); - size_t length = 0xdead; - char *result = u32_conv_to_encoding ("ISO-8859-1", handler, - input, SIZEOF (input), - offsets, - NULL, &length); - switch (handler) - { - case iconveh_error: - ASSERT (result == NULL); - ASSERT (errno == EILSEQ); - ASSERT (length == 0xdead); - break; - case iconveh_question_mark: - { - static const char expected[] = "Rafa? Maszkowski"; - static const char expected_translit[] = "Rafal Maszkowski"; - ASSERT (result != NULL); - ASSERT (length == strlen (expected)); - ASSERT (memcmp (result, expected, length) == 0 - || memcmp (result, expected_translit, length) == 0); - if (o) - { - for (i = 0; i < 16; i++) - ASSERT (offsets[i] == i); - ASSERT (offsets[16] == MAGIC); - free (offsets); - } - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Rafa\\u0142 Maszkowski"; - ASSERT (result != NULL); - ASSERT (length == strlen (expected)); - ASSERT (memcmp (result, expected, length) == 0); - if (o) - { - for (i = 0; i < 16; i++) - ASSERT (offsets[i] == (i < 5 ? i : i + 5)); - ASSERT (offsets[16] == MAGIC); - free (offsets); - } - free (result); - } - break; - } - } + { + size_t *offsets = (o ? new_offsets (SIZEOF (input)) : NULL); + size_t length = 0xdead; + char *result = u32_conv_to_encoding ("ISO-8859-1", handler, + input, SIZEOF (input), + offsets, + NULL, &length); + switch (handler) + { + case iconveh_error: + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); + ASSERT (length == 0xdead); + break; + case iconveh_question_mark: + { + static const char expected[] = "Rafa? Maszkowski"; + static const char expected_translit[] = "Rafal Maszkowski"; + ASSERT (result != NULL); + ASSERT (length == strlen (expected)); + ASSERT (memcmp (result, expected, length) == 0 + || memcmp (result, expected_translit, length) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == i); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa\\u0142 Maszkowski"; + ASSERT (result != NULL); + ASSERT (length == strlen (expected)); + ASSERT (memcmp (result, expected, length) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == (i < 5 ? i : i + 5)); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } + break; + } + } } #endif diff --git a/tests/uniconv/test-u32-strconv-from-enc.c b/tests/uniconv/test-u32-strconv-from-enc.c index 2c0e04b..e1a46f5 100644 --- a/tests/uniconv/test-u32-strconv-from-enc.c +++ b/tests/uniconv/test-u32-strconv-from-enc.c @@ -1,5 +1,5 @@ /* Test of conversion to UTF-32 from legacy encodings. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,23 +20,10 @@ #include "uniconv.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -55,11 +42,11 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; static const uint32_t expected[] = /* Ärger mit bösen Bübchen ohne Augenmaß */ - { - 0xC4, 'r', 'g', 'e', 'r', ' ', 'm', 'i', 't', ' ', 'b', 0xF6, 's', - 'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h', - 'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF, 0 - }; + { + 0xC4, 'r', 'g', 'e', 'r', ' ', 'm', 'i', 't', ' ', 'b', 0xF6, 's', + 'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h', + 'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF, 0 + }; uint32_t *result = u32_strconv_from_encoding (input, "ISO-8859-1", handler); ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); @@ -72,10 +59,10 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */ static const uint32_t expected[] = - { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i', 0 - }; + { + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i', 0 + }; uint32_t *result = u32_strconv_from_encoding (input, "ISO-8859-2", handler); ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); @@ -90,9 +77,9 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\244\263\244\363\244\313\244\301\244\317"; /* こんにちは in EUC-JP */ static const uint32_t expected[] = /* こんにちは */ - { - 0x3053, 0x3093, 0x306B, 0x3061, 0x306F, 0 - }; + { + 0x3053, 0x3093, 0x306B, 0x3061, 0x306F, 0 + }; uint32_t *result = u32_strconv_from_encoding (input, "autodetect_jp", handler); ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); @@ -103,9 +90,9 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\202\261\202\361\202\311\202\277\202\315"; /* こんにちは in Shift_JIS */ static const uint32_t expected[] = /* こんにちは */ - { - 0x3053, 0x3093, 0x306B, 0x3061, 0x306F, 0 - }; + { + 0x3053, 0x3093, 0x306B, 0x3061, 0x306F, 0 + }; uint32_t *result = u32_strconv_from_encoding (input, "autodetect_jp", handler); ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); @@ -116,9 +103,9 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const char input[] = "\033$B$3$s$K$A$O\033(B"; /* こんにちは in ISO-2022-JP-2 */ static const uint32_t expected[] = /* こんにちは */ - { - 0x3053, 0x3093, 0x306B, 0x3061, 0x306F, 0 - }; + { + 0x3053, 0x3093, 0x306B, 0x3061, 0x306F, 0 + }; uint32_t *result = u32_strconv_from_encoding (input, "autodetect_jp", handler); ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); diff --git a/tests/uniconv/test-u32-strconv-to-enc.c b/tests/uniconv/test-u32-strconv-to-enc.c index eef3d04..2ce125c 100644 --- a/tests/uniconv/test-u32-strconv-to-enc.c +++ b/tests/uniconv/test-u32-strconv-to-enc.c @@ -1,5 +1,5 @@ /* Test of conversion from UTF-32 to legacy encodings. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,22 +21,9 @@ #include "uniconv.h" #include <errno.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -54,11 +41,11 @@ main () { enum iconv_ilseq_handler handler = handlers[h]; static const uint32_t input[] = /* Ärger mit bösen Bübchen ohne Augenmaß */ - { - 0xC4, 'r', 'g', 'e', 'r', ' ', 'm', 'i', 't', ' ', 'b', 0xF6, 's', - 'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h', - 'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF, 0 - }; + { + 0xC4, 'r', 'g', 'e', 'r', ' ', 'm', 'i', 't', ' ', 'b', 0xF6, 's', + 'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h', + 'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF, 0 + }; static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; char *result = u32_strconv_to_encoding (input, "ISO-8859-1", handler); ASSERT (result != NULL); @@ -71,35 +58,35 @@ main () { enum iconv_ilseq_handler handler = handlers[h]; static const uint32_t input[] = /* Rafał Maszkowski */ - { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i', 0 - }; + { + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i', 0 + }; char *result = u32_strconv_to_encoding (input, "ISO-8859-1", handler); switch (handler) - { - case iconveh_error: - ASSERT (result == NULL && errno == EILSEQ); - break; - case iconveh_question_mark: - { - static const char expected[] = "Rafa? Maszkowski"; - static const char expected_translit[] = "Rafal Maszkowski"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0 - || strcmp (result, expected_translit) == 0); - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Rafa\\u0142 Maszkowski"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0); - free (result); - } - break; - } + { + case iconveh_error: + ASSERT (result == NULL && errno == EILSEQ); + break; + case iconveh_question_mark: + { + static const char expected[] = "Rafa? Maszkowski"; + static const char expected_translit[] = "Rafal Maszkowski"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0 + || strcmp (result, expected_translit) == 0); + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa\\u0142 Maszkowski"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + break; + } } #endif diff --git a/tests/uniconv/test-u8-conv-from-enc.c b/tests/uniconv/test-u8-conv-from-enc.c index ec8703c..9655c75 100644 --- a/tests/uniconv/test-u8-conv-from-enc.c +++ b/tests/uniconv/test-u8-conv-from-enc.c @@ -1,5 +1,5 @@ /* Test of conversion to UTF-8 from legacy encodings. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,24 +20,11 @@ #include "uniconv.h" -#include <stdio.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Magic number for detecting bounds violations. */ #define MAGIC 0x1983EFF1 @@ -70,28 +57,28 @@ main () static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; static const uint8_t expected[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - size_t length; - uint8_t *result = u8_conv_from_encoding ("ISO-8859-1", handler, - input, strlen (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == u8_strlen (expected)); - ASSERT (u8_cmp (result, expected, u8_strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 37; i++) - ASSERT (offsets[i] == (i < 1 ? i : - i < 12 ? i + 1 : - i < 18 ? i + 2 : - i + 3)); - ASSERT (offsets[37] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + size_t length; + uint8_t *result = u8_conv_from_encoding ("ISO-8859-1", handler, + input, strlen (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == u8_strlen (expected)); + ASSERT (u8_cmp (result, expected, u8_strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 37; i++) + ASSERT (offsets[i] == (i < 1 ? i : + i < 12 ? i + 1 : + i < 18 ? i + 2 : + i + 3)); + ASSERT (offsets[37] == MAGIC); + free (offsets); + } + free (result); + } } /* Test conversion from ISO-8859-2 to UTF-8 with no errors. */ @@ -101,26 +88,26 @@ main () static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */ static const uint8_t expected[] = "Rafa\305\202 Maszkowski"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - size_t length; - uint8_t *result = u8_conv_from_encoding ("ISO-8859-2", handler, - input, strlen (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == u8_strlen (expected)); - ASSERT (u8_cmp (result, expected, u8_strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 16; i++) - ASSERT (offsets[i] == (i < 5 ? i : - i + 1)); - ASSERT (offsets[16] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + size_t length; + uint8_t *result = u8_conv_from_encoding ("ISO-8859-2", handler, + input, strlen (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == u8_strlen (expected)); + ASSERT (u8_cmp (result, expected, u8_strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == (i < 5 ? i : + i + 1)); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } } /* autodetect_jp is only supported when iconv() support ISO-2022-JP-2. */ @@ -132,25 +119,25 @@ main () static const char input[] = "\244\263\244\363\244\313\244\301\244\317"; /* こんにちは in EUC-JP */ static const uint8_t expected[] = "\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257"; /* こんにちは */ for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - size_t length; - uint8_t *result = u8_conv_from_encoding ("autodetect_jp", handler, - input, strlen (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == u8_strlen (expected)); - ASSERT (u8_cmp (result, expected, u8_strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 10; i++) - ASSERT (offsets[i] == ((i % 2) == 0 ? (i / 2) * 3 : (size_t)(-1))); - ASSERT (offsets[10] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + size_t length; + uint8_t *result = u8_conv_from_encoding ("autodetect_jp", handler, + input, strlen (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == u8_strlen (expected)); + ASSERT (u8_cmp (result, expected, u8_strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 10; i++) + ASSERT (offsets[i] == ((i % 2) == 0 ? (i / 2) * 3 : (size_t)(-1))); + ASSERT (offsets[10] == MAGIC); + free (offsets); + } + free (result); + } } for (h = 0; h < SIZEOF (handlers); h++) { @@ -158,25 +145,25 @@ main () static const char input[] = "\202\261\202\361\202\311\202\277\202\315"; /* こんにちは in Shift_JIS */ static const uint8_t expected[] = "\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257"; /* こんにちは */ for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - size_t length; - uint8_t *result = u8_conv_from_encoding ("autodetect_jp", handler, - input, strlen (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == u8_strlen (expected)); - ASSERT (u8_cmp (result, expected, u8_strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 10; i++) - ASSERT (offsets[i] == ((i % 2) == 0 ? (i / 2) * 3 : (size_t)(-1))); - ASSERT (offsets[10] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + size_t length; + uint8_t *result = u8_conv_from_encoding ("autodetect_jp", handler, + input, strlen (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == u8_strlen (expected)); + ASSERT (u8_cmp (result, expected, u8_strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 10; i++) + ASSERT (offsets[i] == ((i % 2) == 0 ? (i / 2) * 3 : (size_t)(-1))); + ASSERT (offsets[10] == MAGIC); + free (offsets); + } + free (result); + } } for (h = 0; h < SIZEOF (handlers); h++) { @@ -184,31 +171,31 @@ main () static const char input[] = "\033$B$3$s$K$A$O\033(B"; /* こんにちは in ISO-2022-JP-2 */ static const uint8_t expected[] = "\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257"; /* こんにちは */ for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); - size_t length; - uint8_t *result = u8_conv_from_encoding ("autodetect_jp", handler, - input, strlen (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == u8_strlen (expected)); - ASSERT (u8_cmp (result, expected, u8_strlen (expected)) == 0); - if (o) - { - for (i = 0; i < 16; i++) - ASSERT (offsets[i] == (i == 0 ? 0 : - i == 5 ? 3 : - i == 7 ? 6 : - i == 9 ? 9 : - i == 11 ? 12 : - i == 13 ? 15 : - (size_t)(-1))); - ASSERT (offsets[16] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (strlen (input)) : NULL); + size_t length; + uint8_t *result = u8_conv_from_encoding ("autodetect_jp", handler, + input, strlen (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == u8_strlen (expected)); + ASSERT (u8_cmp (result, expected, u8_strlen (expected)) == 0); + if (o) + { + for (i = 0; i < 16; i++) + ASSERT (offsets[i] == (i == 0 ? 0 : + i == 5 ? 3 : + i == 7 ? 6 : + i == 9 ? 9 : + i == 11 ? 12 : + i == 13 ? 15 : + (size_t)(-1))); + ASSERT (offsets[16] == MAGIC); + free (offsets); + } + free (result); + } } # endif diff --git a/tests/uniconv/test-u8-conv-to-enc.c b/tests/uniconv/test-u8-conv-to-enc.c index 271fb05..d758e9b 100644 --- a/tests/uniconv/test-u8-conv-to-enc.c +++ b/tests/uniconv/test-u8-conv-to-enc.c @@ -1,5 +1,5 @@ /* Test of conversion from UTF-8 to legacy encodings. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,24 +21,11 @@ #include "uniconv.h" #include <errno.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Magic number for detecting bounds violations. */ #define MAGIC 0x1983EFF1 @@ -71,33 +58,33 @@ main () static const uint8_t input[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237"; static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (u8_strlen (input)) : NULL); - size_t length; - char *result = u8_conv_to_encoding ("ISO-8859-1", handler, - input, u8_strlen (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == strlen (expected)); - ASSERT (memcmp (result, expected, length) == 0); - if (o) - { - for (i = 0; i < 41; i++) - ASSERT (offsets[i] == (i < 1 ? i : - i == 1 ? (size_t)(-1) : - i < 13 ? i - 1 : - i == 13 ? (size_t)(-1) : - i < 20 ? i - 2 : - i == 20 ? (size_t)(-1) : - i < 40 ? i - 3 : - i == 40 ? (size_t)(-1) : - i - 4)); - ASSERT (offsets[41] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (u8_strlen (input)) : NULL); + size_t length; + char *result = u8_conv_to_encoding ("ISO-8859-1", handler, + input, u8_strlen (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == strlen (expected)); + ASSERT (memcmp (result, expected, length) == 0); + if (o) + { + for (i = 0; i < 41; i++) + ASSERT (offsets[i] == (i < 1 ? i : + i == 1 ? (size_t)(-1) : + i < 13 ? i - 1 : + i == 13 ? (size_t)(-1) : + i < 20 ? i - 2 : + i == 20 ? (size_t)(-1) : + i < 40 ? i - 3 : + i == 40 ? (size_t)(-1) : + i - 4)); + ASSERT (offsets[41] == MAGIC); + free (offsets); + } + free (result); + } } /* Test conversion from UTF-8 to ISO-8859-1 with EILSEQ. */ @@ -106,60 +93,60 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const uint8_t input[] = "Rafa\305\202 Maszkowski"; /* Rafał Maszkowski */ for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (u8_strlen (input)) : NULL); - size_t length = 0xdead; - char *result = u8_conv_to_encoding ("ISO-8859-1", handler, - input, u8_strlen (input), - offsets, - NULL, &length); - switch (handler) - { - case iconveh_error: - ASSERT (result == NULL); - ASSERT (errno == EILSEQ); - ASSERT (length == 0xdead); - break; - case iconveh_question_mark: - { - static const char expected[] = "Rafa? Maszkowski"; - static const char expected_translit[] = "Rafal Maszkowski"; - ASSERT (result != NULL); - ASSERT (length == strlen (expected)); - ASSERT (memcmp (result, expected, length) == 0 - || memcmp (result, expected_translit, length) == 0); - if (o) - { - for (i = 0; i < 17; i++) - ASSERT (offsets[i] == (i < 5 ? i : - i == 5 ? (size_t)(-1) : - i - 1)); - ASSERT (offsets[17] == MAGIC); - free (offsets); - } - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Rafa\\u0142 Maszkowski"; - ASSERT (result != NULL); - ASSERT (length == strlen (expected)); - ASSERT (memcmp (result, expected, length) == 0); - if (o) - { - for (i = 0; i < 17; i++) - ASSERT (offsets[i] == (i < 5 ? i : - i == 5 ? (size_t)(-1) : - i + 4)); - ASSERT (offsets[17] == MAGIC); - free (offsets); - } - free (result); - } - break; - } - } + { + size_t *offsets = (o ? new_offsets (u8_strlen (input)) : NULL); + size_t length = 0xdead; + char *result = u8_conv_to_encoding ("ISO-8859-1", handler, + input, u8_strlen (input), + offsets, + NULL, &length); + switch (handler) + { + case iconveh_error: + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); + ASSERT (length == 0xdead); + break; + case iconveh_question_mark: + { + static const char expected[] = "Rafa? Maszkowski"; + static const char expected_translit[] = "Rafal Maszkowski"; + ASSERT (result != NULL); + ASSERT (length == strlen (expected)); + ASSERT (memcmp (result, expected, length) == 0 + || memcmp (result, expected_translit, length) == 0); + if (o) + { + for (i = 0; i < 17; i++) + ASSERT (offsets[i] == (i < 5 ? i : + i == 5 ? (size_t)(-1) : + i - 1)); + ASSERT (offsets[17] == MAGIC); + free (offsets); + } + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa\\u0142 Maszkowski"; + ASSERT (result != NULL); + ASSERT (length == strlen (expected)); + ASSERT (memcmp (result, expected, length) == 0); + if (o) + { + for (i = 0; i < 17; i++) + ASSERT (offsets[i] == (i < 5 ? i : + i == 5 ? (size_t)(-1) : + i + 4)); + ASSERT (offsets[17] == MAGIC); + free (offsets); + } + free (result); + } + break; + } + } } /* Test conversion from UTF-8 to ISO-8859-1 with EINVAL. */ @@ -168,23 +155,23 @@ main () enum iconv_ilseq_handler handler = handlers[h]; static const uint8_t input[] = "\342"; for (o = 0; o < 2; o++) - { - size_t *offsets = (o ? new_offsets (u8_strlen (input)) : NULL); - size_t length; - char *result = u8_conv_to_encoding ("ISO-8859-1", handler, - input, u8_strlen (input), - offsets, - NULL, &length); - ASSERT (result != NULL); - ASSERT (length == strlen ("")); - if (o) - { - ASSERT (offsets[0] == 0); - ASSERT (offsets[1] == MAGIC); - free (offsets); - } - free (result); - } + { + size_t *offsets = (o ? new_offsets (u8_strlen (input)) : NULL); + size_t length; + char *result = u8_conv_to_encoding ("ISO-8859-1", handler, + input, u8_strlen (input), + offsets, + NULL, &length); + ASSERT (result != NULL); + ASSERT (length == strlen ("")); + if (o) + { + ASSERT (offsets[0] == 0); + ASSERT (offsets[1] == MAGIC); + free (offsets); + } + free (result); + } } #endif diff --git a/tests/uniconv/test-u8-strconv-from-enc.c b/tests/uniconv/test-u8-strconv-from-enc.c index 8c32ee6..30ebe76 100644 --- a/tests/uniconv/test-u8-strconv-from-enc.c +++ b/tests/uniconv/test-u8-strconv-from-enc.c @@ -1,5 +1,5 @@ /* Test of conversion to UTF-8 from legacy encodings. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,23 +20,10 @@ #include "uniconv.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uniconv/test-u8-strconv-to-enc.c b/tests/uniconv/test-u8-strconv-to-enc.c index 73085b5..bbdb6d8 100644 --- a/tests/uniconv/test-u8-strconv-to-enc.c +++ b/tests/uniconv/test-u8-strconv-to-enc.c @@ -1,5 +1,5 @@ /* Test of conversion from UTF-8 to legacy encodings. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,22 +21,10 @@ #include "uniconv.h" #include <errno.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -68,29 +56,29 @@ main () static const uint8_t input[] = "Rafa\305\202 Maszkowski"; /* Rafał Maszkowski */ char *result = u8_strconv_to_encoding (input, "ISO-8859-1", handler); switch (handler) - { - case iconveh_error: - ASSERT (result == NULL && errno == EILSEQ); - break; - case iconveh_question_mark: - { - static const char expected[] = "Rafa? Maszkowski"; - static const char expected_translit[] = "Rafal Maszkowski"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0 - || strcmp (result, expected_translit) == 0); - free (result); - } - break; - case iconveh_escape_sequence: - { - static const char expected[] = "Rafa\\u0142 Maszkowski"; - ASSERT (result != NULL); - ASSERT (strcmp (result, expected) == 0); - free (result); - } - break; - } + { + case iconveh_error: + ASSERT (result == NULL && errno == EILSEQ); + break; + case iconveh_question_mark: + { + static const char expected[] = "Rafa? Maszkowski"; + static const char expected_translit[] = "Rafal Maszkowski"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0 + || strcmp (result, expected_translit) == 0); + free (result); + } + break; + case iconveh_escape_sequence: + { + static const char expected[] = "Rafa\\u0142 Maszkowski"; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0); + free (result); + } + break; + } } # if 0 diff --git a/tests/unictype/test-bidi_byname.c b/tests/unictype/test-bidi_byname.c index 5b1cfec..9139131 100644 --- a/tests/unictype/test-bidi_byname.c +++ b/tests/unictype/test-bidi_byname.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,27 +18,34 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () { + ASSERT (uc_bidi_category_byname ("L") == UC_BIDI_L); + ASSERT (uc_bidi_category_byname ("LRE") == UC_BIDI_LRE); + ASSERT (uc_bidi_category_byname ("LRO") == UC_BIDI_LRO); + ASSERT (uc_bidi_category_byname ("R") == UC_BIDI_R); + ASSERT (uc_bidi_category_byname ("AL") == UC_BIDI_AL); + ASSERT (uc_bidi_category_byname ("RLE") == UC_BIDI_RLE); + ASSERT (uc_bidi_category_byname ("RLO") == UC_BIDI_RLO); + ASSERT (uc_bidi_category_byname ("PDF") == UC_BIDI_PDF); + ASSERT (uc_bidi_category_byname ("EN") == UC_BIDI_EN); + ASSERT (uc_bidi_category_byname ("ES") == UC_BIDI_ES); + ASSERT (uc_bidi_category_byname ("ET") == UC_BIDI_ET); + ASSERT (uc_bidi_category_byname ("AN") == UC_BIDI_AN); + ASSERT (uc_bidi_category_byname ("CS") == UC_BIDI_CS); ASSERT (uc_bidi_category_byname ("NSM") == UC_BIDI_NSM); + ASSERT (uc_bidi_category_byname ("BN") == UC_BIDI_BN); + ASSERT (uc_bidi_category_byname ("B") == UC_BIDI_B); + ASSERT (uc_bidi_category_byname ("S") == UC_BIDI_S); + ASSERT (uc_bidi_category_byname ("WS") == UC_BIDI_WS); + ASSERT (uc_bidi_category_byname ("ON") == UC_BIDI_ON); ASSERT (uc_bidi_category_byname ("X") < 0); + ASSERT (uc_bidi_category_byname ("") < 0); return 0; } diff --git a/tests/unictype/test-bidi_name.c b/tests/unictype/test-bidi_name.c index a444ec0..1a4ef0b 100644 --- a/tests/unictype/test-bidi_name.c +++ b/tests/unictype/test-bidi_name.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-bidi_of.c b/tests/unictype/test-bidi_of.c index 720e9f9..91fda15 100644 --- a/tests/unictype/test-bidi_of.c +++ b/tests/unictype/test-bidi_of.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-bidi_test.c b/tests/unictype/test-bidi_test.c index 3404e72..c9e7b39 100644 --- a/tests/unictype/test-bidi_test.c +++ b/tests/unictype/test-bidi_test.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-block_list.c b/tests/unictype/test-block_list.c index 140b573..d475546 100644 --- a/tests/unictype/test-block_list.c +++ b/tests/unictype/test-block_list.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -49,10 +37,10 @@ main () for (i = 0; i < nblocks; i++) { - if (strcmp (blocks[i].name, "Latin") == 0) - latin_block = &blocks[i]; - if (strcmp (blocks[i].name, "Hebrew") == 0) - hebrew_block = &blocks[i]; + if (strcmp (blocks[i].name, "Latin") == 0) + latin_block = &blocks[i]; + if (strcmp (blocks[i].name, "Hebrew") == 0) + hebrew_block = &blocks[i]; } ASSERT (latin_block == NULL); ASSERT (hebrew_block != NULL); diff --git a/tests/unictype/test-block_of.c b/tests/unictype/test-block_of.c index 9460cde..230fa87 100644 --- a/tests/unictype/test-block_of.c +++ b/tests/unictype/test-block_of.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -45,8 +33,8 @@ main () for (c = 0; c < 0x110000; c++) { - const uc_block_t *block = uc_block (c); - ASSERT (block == NULL || uc_is_block (c, block)); + const uc_block_t *block = uc_block (c); + ASSERT (block == NULL || uc_is_block (c, block)); } } @@ -59,19 +47,19 @@ main () for (i = 0; i < nblocks; i++) { - if (strcmp (blocks[i].name, "Hebrew") == 0) - { - ASSERT (uc_block (0x05DE) == &blocks[i]); - ASSERT (uc_is_block (0x05DE, &blocks[i])); - } + if (strcmp (blocks[i].name, "Hebrew") == 0) + { + ASSERT (uc_block (0x05DE) == &blocks[i]); + ASSERT (uc_is_block (0x05DE, &blocks[i])); + } } for (i = 0; i < nblocks; i++) { - unsigned int c; + unsigned int c; - for (c = blocks[i].start; c <= blocks[i].end; c++) - ASSERT (uc_block (c) == &blocks[i]); + for (c = blocks[i].start; c <= blocks[i].end; c++) + ASSERT (uc_block (c) == &blocks[i]); } } diff --git a/tests/unictype/test-block_test.c b/tests/unictype/test-block_test.c index b086cde..8971a39 100644 --- a/tests/unictype/test-block_test.c +++ b/tests/unictype/test-block_test.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-categ_and.c b/tests/unictype/test-categ_and.c index 5531ff4..70d28cc 100644 --- a/tests/unictype/test-categ_and.c +++ b/tests/unictype/test-categ_and.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-categ_and_not.c b/tests/unictype/test-categ_and_not.c index 90b40f8..72afe83 100644 --- a/tests/unictype/test-categ_and_not.c +++ b/tests/unictype/test-categ_and_not.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-categ_byname.c b/tests/unictype/test-categ_byname.c index 3bb44e9..0da1625 100644 --- a/tests/unictype/test-categ_byname.c +++ b/tests/unictype/test-categ_byname.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,26 +18,63 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> +#include <stdbool.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" + +static bool +category_equals (uc_general_category_t category1, + uc_general_category_t category2) +{ + return (category1.bitmask == category2.bitmask + && category1.generic == category2.generic + && (category1.generic + ? category1.lookup.lookup_fn == category2.lookup.lookup_fn + : category1.lookup.table == category2.lookup.table)); +} int main () { - uc_general_category_byname ("L"); + ASSERT (category_equals (uc_general_category_byname ("L"), UC_CATEGORY_L)); + ASSERT (category_equals (uc_general_category_byname ("Lu"), UC_CATEGORY_Lu)); + ASSERT (category_equals (uc_general_category_byname ("Ll"), UC_CATEGORY_Ll)); + ASSERT (category_equals (uc_general_category_byname ("Lt"), UC_CATEGORY_Lt)); + ASSERT (category_equals (uc_general_category_byname ("Lm"), UC_CATEGORY_Lm)); + ASSERT (category_equals (uc_general_category_byname ("Lo"), UC_CATEGORY_Lo)); + ASSERT (category_equals (uc_general_category_byname ("M"), UC_CATEGORY_M)); + ASSERT (category_equals (uc_general_category_byname ("Mn"), UC_CATEGORY_Mn)); + ASSERT (category_equals (uc_general_category_byname ("Mc"), UC_CATEGORY_Mc)); + ASSERT (category_equals (uc_general_category_byname ("Me"), UC_CATEGORY_Me)); + ASSERT (category_equals (uc_general_category_byname ("N"), UC_CATEGORY_N)); + ASSERT (category_equals (uc_general_category_byname ("Nd"), UC_CATEGORY_Nd)); + ASSERT (category_equals (uc_general_category_byname ("Nl"), UC_CATEGORY_Nl)); + ASSERT (category_equals (uc_general_category_byname ("No"), UC_CATEGORY_No)); + ASSERT (category_equals (uc_general_category_byname ("P"), UC_CATEGORY_P)); + ASSERT (category_equals (uc_general_category_byname ("Pc"), UC_CATEGORY_Pc)); + ASSERT (category_equals (uc_general_category_byname ("Pd"), UC_CATEGORY_Pd)); + ASSERT (category_equals (uc_general_category_byname ("Ps"), UC_CATEGORY_Ps)); + ASSERT (category_equals (uc_general_category_byname ("Pe"), UC_CATEGORY_Pe)); + ASSERT (category_equals (uc_general_category_byname ("Pi"), UC_CATEGORY_Pi)); + ASSERT (category_equals (uc_general_category_byname ("Pf"), UC_CATEGORY_Pf)); + ASSERT (category_equals (uc_general_category_byname ("Po"), UC_CATEGORY_Po)); + ASSERT (category_equals (uc_general_category_byname ("S"), UC_CATEGORY_S)); + ASSERT (category_equals (uc_general_category_byname ("Sm"), UC_CATEGORY_Sm)); + ASSERT (category_equals (uc_general_category_byname ("Sc"), UC_CATEGORY_Sc)); + ASSERT (category_equals (uc_general_category_byname ("Sk"), UC_CATEGORY_Sk)); + ASSERT (category_equals (uc_general_category_byname ("So"), UC_CATEGORY_So)); + ASSERT (category_equals (uc_general_category_byname ("Z"), UC_CATEGORY_Z)); + ASSERT (category_equals (uc_general_category_byname ("Zs"), UC_CATEGORY_Zs)); + ASSERT (category_equals (uc_general_category_byname ("Zl"), UC_CATEGORY_Zl)); + ASSERT (category_equals (uc_general_category_byname ("Zp"), UC_CATEGORY_Zp)); + ASSERT (category_equals (uc_general_category_byname ("C"), UC_CATEGORY_C)); + ASSERT (category_equals (uc_general_category_byname ("Cc"), UC_CATEGORY_Cc)); + ASSERT (category_equals (uc_general_category_byname ("Cf"), UC_CATEGORY_Cf)); + ASSERT (category_equals (uc_general_category_byname ("Cs"), UC_CATEGORY_Cs)); + ASSERT (category_equals (uc_general_category_byname ("Co"), UC_CATEGORY_Co)); + ASSERT (category_equals (uc_general_category_byname ("Cn"), UC_CATEGORY_Cn)); + uc_general_category_byname ("Nl"); { diff --git a/tests/unictype/test-categ_name.c b/tests/unictype/test-categ_name.c index b5c3f75..bef6600 100644 --- a/tests/unictype/test-categ_name.c +++ b/tests/unictype/test-categ_name.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-categ_none.c b/tests/unictype/test-categ_none.c index f800241..bc0a9a7 100644 --- a/tests/unictype/test-categ_none.c +++ b/tests/unictype/test-categ_none.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-categ_of.c b/tests/unictype/test-categ_of.c index 28ee663..26d0463 100644 --- a/tests/unictype/test-categ_of.c +++ b/tests/unictype/test-categ_of.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-categ_or.c b/tests/unictype/test-categ_or.c index 6b07de5..7973eb0 100644 --- a/tests/unictype/test-categ_or.c +++ b/tests/unictype/test-categ_or.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-categ_test_withtable.c b/tests/unictype/test-categ_test_withtable.c index b735132..8e52a37 100644 --- a/tests/unictype/test-categ_test_withtable.c +++ b/tests/unictype/test-categ_test_withtable.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-combining.c b/tests/unictype/test-combining.c index 3e66a9b..d890f1d 100644 --- a/tests/unictype/test-combining.c +++ b/tests/unictype/test-combining.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-decdigit.c b/tests/unictype/test-decdigit.c index 3d91690..f94605e 100644 --- a/tests/unictype/test-decdigit.c +++ b/tests/unictype/test-decdigit.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,22 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) -#define SIZEOF(a) (sizeof(a) / sizeof(a[0])) +#include "macros.h" static const struct { unsigned int ch; int value; } mapping[] = { @@ -50,7 +37,7 @@ main () for (i = 0; i < SIZEOF (mapping); i++) { for (; c < mapping[i].ch; c++) - ASSERT (uc_decimal_value (c) == -1); + ASSERT (uc_decimal_value (c) == -1); /* Here c = mapping[i].ch. */ ASSERT (uc_decimal_value (c) == mapping[i].value); c++; diff --git a/tests/unictype/test-digit.c b/tests/unictype/test-digit.c index efecaab..e87f3f7 100644 --- a/tests/unictype/test-digit.c +++ b/tests/unictype/test-digit.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,22 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) -#define SIZEOF(a) (sizeof(a) / sizeof(a[0])) +#include "macros.h" static const struct { unsigned int ch; int value; } mapping[] = { @@ -50,7 +37,7 @@ main () for (i = 0; i < SIZEOF (mapping); i++) { for (; c < mapping[i].ch; c++) - ASSERT (uc_digit_value (c) == -1); + ASSERT (uc_digit_value (c) == -1); /* Here c = mapping[i].ch. */ ASSERT (uc_digit_value (c) == mapping[i].value); c++; diff --git a/tests/unictype/test-mirror.c b/tests/unictype/test-mirror.c index fb4402f..457c502 100644 --- a/tests/unictype/test-mirror.c +++ b/tests/unictype/test-mirror.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-numeric.c b/tests/unictype/test-numeric.c index 5bca363..d602383 100644 --- a/tests/unictype/test-numeric.c +++ b/tests/unictype/test-numeric.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,22 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) -#define SIZEOF(a) (sizeof(a) / sizeof(a[0])) +#include "macros.h" static const struct { unsigned int ch; int numerator; int denominator; } mapping[] = @@ -52,14 +39,14 @@ main () for (i = 0; i < SIZEOF (mapping); i++) { for (; c < mapping[i].ch; c++) - { - value = uc_numeric_value (c); - ASSERT (value.numerator == 0 && value.denominator == 0); - } + { + value = uc_numeric_value (c); + ASSERT (value.numerator == 0 && value.denominator == 0); + } /* Here c = mapping[i].ch. */ value = uc_numeric_value (c); ASSERT (value.numerator == mapping[i].numerator - && value.denominator == mapping[i].denominator); + && value.denominator == mapping[i].denominator); c++; } for (; c < 0x110000; c++) diff --git a/tests/unictype/test-pr_byname.c b/tests/unictype/test-pr_byname.c index 770d4c8..aa2676f 100644 --- a/tests/unictype/test-pr_byname.c +++ b/tests/unictype/test-pr_byname.c @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-pr_test.c b/tests/unictype/test-pr_test.c index 388ae00..6bacc07 100644 --- a/tests/unictype/test-pr_test.c +++ b/tests/unictype/test-pr_test.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-predicate-part1.h b/tests/unictype/test-predicate-part1.h index e81de47..1031856 100644 --- a/tests/unictype/test-predicate-part1.h +++ b/tests/unictype/test-predicate-part1.h @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,23 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed for c = 0x%04X\n", \ - __FILE__, __LINE__, c); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) -#define SIZEOF(a) (sizeof(a) / sizeof(a[0])) +#include "macros.h" /* Interval of Unicode characters. */ typedef struct { ucs4_t start; ucs4_t end; } interval_t; diff --git a/tests/unictype/test-predicate-part2.h b/tests/unictype/test-predicate-part2.h index 60b7c24..eeeb934 100644 --- a/tests/unictype/test-predicate-part2.h +++ b/tests/unictype/test-predicate-part2.h @@ -26,9 +26,9 @@ main () for (i = 0; i < SIZEOF (set); i++) { for (; c < set[i].start; c++) - ASSERT (!PREDICATE (c)); + ASSERT (!PREDICATE (c)); for (; c <= set[i].end; c++) - ASSERT (PREDICATE (c)); + ASSERT (PREDICATE (c)); } for (; c < 0x110000; c++) ASSERT (!PREDICATE (c)); diff --git a/tests/unictype/test-scripts.c b/tests/unictype/test-scripts.c index 4b4b0f9..610b473 100644 --- a/tests/unictype/test-scripts.c +++ b/tests/unictype/test-scripts.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -57,9 +45,9 @@ main () for (c = 0; c < 0x110000; c++) { - const uc_script_t *script = uc_script (c); - if (script != NULL) - ASSERT (uc_is_script (c, script)); + const uc_script_t *script = uc_script (c); + if (script != NULL) + ASSERT (uc_is_script (c, script)); } } @@ -75,9 +63,9 @@ main () found = false; for (i = 0; i < nscripts; i++) { - ASSERT (scripts[i].name != NULL); - if (strcmp (scripts[i].name, "Hebrew") == 0) - found = true; + ASSERT (scripts[i].name != NULL); + if (strcmp (scripts[i].name, "Hebrew") == 0) + found = true; } ASSERT (found); } diff --git a/tests/unictype/test-sy_c_ident.c b/tests/unictype/test-sy_c_ident.c index 00688e1..026db18 100644 --- a/tests/unictype/test-sy_c_ident.c +++ b/tests/unictype/test-sy_c_ident.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-sy_java_ident.c b/tests/unictype/test-sy_java_ident.c index 0a4eb0a..ed9ddeb 100644 --- a/tests/unictype/test-sy_java_ident.c +++ b/tests/unictype/test-sy_java_ident.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unilbrk/test-u16-possible-linebreaks.c b/tests/unilbrk/test-u16-possible-linebreaks.c index 4e0ef34..cdfa75c 100644 --- a/tests/unilbrk/test-u16-possible-linebreaks.c +++ b/tests/unilbrk/test-u16-possible-linebreaks.c @@ -1,5 +1,5 @@ /* Test of line breaking of UTF-16 strings. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,21 +20,9 @@ #include "unilbrk.h" -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -46,11 +34,11 @@ main () static const uint16_t input[61] = /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; { @@ -59,16 +47,16 @@ main () u16_possible_linebreaks (input, SIZEOF (input), "GB18030", p); for (i = 0; i < 61; i++) - { - ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY : - i == 5 - || i == 11 || i == 25 - || i == 27 || i == 29 || i == 30 || i == 35 - || i == 45 || i == 51 - || i == 52 || i == 53 || i == 55 || i == 56 - || i == 58 || i == 59 ? UC_BREAK_POSSIBLE : - UC_BREAK_PROHIBITED)); - } + { + ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY : + i == 5 + || i == 11 || i == 25 + || i == 27 || i == 29 || i == 30 || i == 35 + || i == 45 || i == 51 + || i == 52 || i == 53 || i == 55 || i == 56 + || i == 58 || i == 59 ? UC_BREAK_POSSIBLE : + UC_BREAK_PROHIBITED)); + } free (p); } @@ -78,16 +66,16 @@ main () u16_possible_linebreaks (input, SIZEOF (input), "GB2312", p); for (i = 0; i < 61; i++) - { - ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY : - i == 5 - || i == 11 || i == 25 - || i == 27 || i == 29 || i == 30 || i == 35 - || i == 37 || i == 45 || i == 51 - || i == 52 || i == 53 || i == 55 || i == 56 - || i == 58 || i == 59 ? UC_BREAK_POSSIBLE : - UC_BREAK_PROHIBITED)); - } + { + ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY : + i == 5 + || i == 11 || i == 25 + || i == 27 || i == 29 || i == 30 || i == 35 + || i == 37 || i == 45 || i == 51 + || i == 52 || i == 53 || i == 55 || i == 56 + || i == 58 || i == 59 ? UC_BREAK_POSSIBLE : + UC_BREAK_PROHIBITED)); + } free (p); } } diff --git a/tests/unilbrk/test-u16-width-linebreaks.c b/tests/unilbrk/test-u16-width-linebreaks.c index b62d596..2523afb 100644 --- a/tests/unilbrk/test-u16-width-linebreaks.c +++ b/tests/unilbrk/test-u16-width-linebreaks.c @@ -1,5 +1,5 @@ /* Test of line breaking of UTF-16 strings. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,21 +20,9 @@ #include "unilbrk.h" -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -46,11 +34,11 @@ main () static const uint16_t input[61] = /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; { @@ -59,11 +47,11 @@ main () u16_width_linebreaks (input, SIZEOF (input), 25, 0, 0, NULL, "GB18030", p); for (i = 0; i < 61; i++) - { - ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY : - i == 25 || i == 45 ? UC_BREAK_POSSIBLE : - UC_BREAK_PROHIBITED)); - } + { + ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY : + i == 25 || i == 45 ? UC_BREAK_POSSIBLE : + UC_BREAK_PROHIBITED)); + } free (p); } @@ -73,11 +61,11 @@ main () u16_width_linebreaks (input, SIZEOF (input), 25, 0, 0, NULL, "GB2312", p); for (i = 0; i < 61; i++) - { - ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY : - i == 11 || i == 25 || i == 45 ? UC_BREAK_POSSIBLE : - UC_BREAK_PROHIBITED)); - } + { + ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY : + i == 11 || i == 25 || i == 45 ? UC_BREAK_POSSIBLE : + UC_BREAK_PROHIBITED)); + } free (p); } } diff --git a/tests/unilbrk/test-u32-possible-linebreaks.c b/tests/unilbrk/test-u32-possible-linebreaks.c index 94e276a..d775ebc 100644 --- a/tests/unilbrk/test-u32-possible-linebreaks.c +++ b/tests/unilbrk/test-u32-possible-linebreaks.c @@ -1,5 +1,5 @@ /* Test of line breaking of UTF-32 strings. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,21 +20,9 @@ #include "unilbrk.h" -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -46,11 +34,11 @@ main () static const uint32_t input[61] = /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; { @@ -59,16 +47,16 @@ main () u32_possible_linebreaks (input, SIZEOF (input), "GB18030", p); for (i = 0; i < 61; i++) - { - ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY : - i == 5 - || i == 11 || i == 25 - || i == 27 || i == 29 || i == 30 || i == 35 - || i == 45 || i == 51 - || i == 52 || i == 53 || i == 55 || i == 56 - || i == 58 || i == 59 ? UC_BREAK_POSSIBLE : - UC_BREAK_PROHIBITED)); - } + { + ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY : + i == 5 + || i == 11 || i == 25 + || i == 27 || i == 29 || i == 30 || i == 35 + || i == 45 || i == 51 + || i == 52 || i == 53 || i == 55 || i == 56 + || i == 58 || i == 59 ? UC_BREAK_POSSIBLE : + UC_BREAK_PROHIBITED)); + } free (p); } @@ -78,16 +66,16 @@ main () u32_possible_linebreaks (input, SIZEOF (input), "GB2312", p); for (i = 0; i < 61; i++) - { - ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY : - i == 5 - || i == 11 || i == 25 - || i == 27 || i == 29 || i == 30 || i == 35 - || i == 37 || i == 45 || i == 51 - || i == 52 || i == 53 || i == 55 || i == 56 - || i == 58 || i == 59 ? UC_BREAK_POSSIBLE : - UC_BREAK_PROHIBITED)); - } + { + ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY : + i == 5 + || i == 11 || i == 25 + || i == 27 || i == 29 || i == 30 || i == 35 + || i == 37 || i == 45 || i == 51 + || i == 52 || i == 53 || i == 55 || i == 56 + || i == 58 || i == 59 ? UC_BREAK_POSSIBLE : + UC_BREAK_PROHIBITED)); + } free (p); } } diff --git a/tests/unilbrk/test-u32-width-linebreaks.c b/tests/unilbrk/test-u32-width-linebreaks.c index f684dee..050c219 100644 --- a/tests/unilbrk/test-u32-width-linebreaks.c +++ b/tests/unilbrk/test-u32-width-linebreaks.c @@ -1,5 +1,5 @@ /* Test of line breaking of UTF-32 strings. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,21 +20,9 @@ #include "unilbrk.h" -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -46,11 +34,11 @@ main () static const uint32_t input[61] = /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; { @@ -59,11 +47,11 @@ main () u32_width_linebreaks (input, SIZEOF (input), 25, 0, 0, NULL, "GB18030", p); for (i = 0; i < 61; i++) - { - ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY : - i == 25 || i == 45 ? UC_BREAK_POSSIBLE : - UC_BREAK_PROHIBITED)); - } + { + ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY : + i == 25 || i == 45 ? UC_BREAK_POSSIBLE : + UC_BREAK_PROHIBITED)); + } free (p); } @@ -73,11 +61,11 @@ main () u32_width_linebreaks (input, SIZEOF (input), 25, 0, 0, NULL, "GB2312", p); for (i = 0; i < 61; i++) - { - ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY : - i == 11 || i == 25 || i == 45 ? UC_BREAK_POSSIBLE : - UC_BREAK_PROHIBITED)); - } + { + ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY : + i == 11 || i == 25 || i == 45 ? UC_BREAK_POSSIBLE : + UC_BREAK_PROHIBITED)); + } free (p); } } diff --git a/tests/unilbrk/test-u8-possible-linebreaks.c b/tests/unilbrk/test-u8-possible-linebreaks.c index c3a091d..555acf6 100644 --- a/tests/unilbrk/test-u8-possible-linebreaks.c +++ b/tests/unilbrk/test-u8-possible-linebreaks.c @@ -1,5 +1,5 @@ /* Test of line breaking of UTF-8 strings. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,21 +20,9 @@ #include "unilbrk.h" -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -53,16 +41,16 @@ main () u8_possible_linebreaks (input, SIZEOF (input), "GB18030", p); for (i = 0; i < 91; i++) - { - ASSERT (p[i] == (i == 90 ? UC_BREAK_MANDATORY : - i == 7 - || i == 13 || i == 39 - || i == 41 || i == 43 || i == 44 || i == 50 - || i == 61 || i == 67 - || i == 70 || i == 73 || i == 77 || i == 80 - || i == 84 || i == 87 ? UC_BREAK_POSSIBLE : - UC_BREAK_PROHIBITED)); - } + { + ASSERT (p[i] == (i == 90 ? UC_BREAK_MANDATORY : + i == 7 + || i == 13 || i == 39 + || i == 41 || i == 43 || i == 44 || i == 50 + || i == 61 || i == 67 + || i == 70 || i == 73 || i == 77 || i == 80 + || i == 84 || i == 87 ? UC_BREAK_POSSIBLE : + UC_BREAK_PROHIBITED)); + } free (p); } @@ -72,16 +60,16 @@ main () u8_possible_linebreaks (input, SIZEOF (input), "GB2312", p); for (i = 0; i < 91; i++) - { - ASSERT (p[i] == (i == 90 ? UC_BREAK_MANDATORY : - i == 7 - || i == 13 || i == 39 - || i == 41 || i == 43 || i == 44 || i == 50 - || i == 52 || i == 61 || i == 67 - || i == 70 || i == 73 || i == 77 || i == 80 - || i == 84 || i == 87 ? UC_BREAK_POSSIBLE : - UC_BREAK_PROHIBITED)); - } + { + ASSERT (p[i] == (i == 90 ? UC_BREAK_MANDATORY : + i == 7 + || i == 13 || i == 39 + || i == 41 || i == 43 || i == 44 || i == 50 + || i == 52 || i == 61 || i == 67 + || i == 70 || i == 73 || i == 77 || i == 80 + || i == 84 || i == 87 ? UC_BREAK_POSSIBLE : + UC_BREAK_PROHIBITED)); + } free (p); } } diff --git a/tests/unilbrk/test-u8-width-linebreaks.c b/tests/unilbrk/test-u8-width-linebreaks.c index 6c176f1..e78b075 100644 --- a/tests/unilbrk/test-u8-width-linebreaks.c +++ b/tests/unilbrk/test-u8-width-linebreaks.c @@ -1,5 +1,5 @@ /* Test of line breaking of UTF-8 strings. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,21 +20,9 @@ #include "unilbrk.h" -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -53,11 +41,11 @@ main () u8_width_linebreaks (input, SIZEOF (input), 25, 0, 0, NULL, "GB18030", p); for (i = 0; i < 91; i++) - { - ASSERT (p[i] == (i == 90 ? UC_BREAK_MANDATORY : - i == 39 || i == 61 ? UC_BREAK_POSSIBLE : - UC_BREAK_PROHIBITED)); - } + { + ASSERT (p[i] == (i == 90 ? UC_BREAK_MANDATORY : + i == 39 || i == 61 ? UC_BREAK_POSSIBLE : + UC_BREAK_PROHIBITED)); + } free (p); } @@ -67,11 +55,11 @@ main () u8_width_linebreaks (input, SIZEOF (input), 25, 0, 0, NULL, "GB2312", p); for (i = 0; i < 91; i++) - { - ASSERT (p[i] == (i == 90 ? UC_BREAK_MANDATORY : - i == 13 || i == 39 || i == 61 ? UC_BREAK_POSSIBLE : - UC_BREAK_PROHIBITED)); - } + { + ASSERT (p[i] == (i == 90 ? UC_BREAK_MANDATORY : + i == 13 || i == 39 || i == 61 ? UC_BREAK_POSSIBLE : + UC_BREAK_PROHIBITED)); + } free (p); } } diff --git a/tests/unilbrk/test-ulc-possible-linebreaks.c b/tests/unilbrk/test-ulc-possible-linebreaks.c index fdd73be..c64fade 100644 --- a/tests/unilbrk/test-ulc-possible-linebreaks.c +++ b/tests/unilbrk/test-ulc-possible-linebreaks.c @@ -1,5 +1,5 @@ /* Test of line breaking of strings. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,21 +20,9 @@ #include "unilbrk.h" -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -53,10 +41,10 @@ main () ulc_possible_linebreaks (input, SIZEOF (input), "ISO-8859-1", p); for (i = 0; i < 36; i++) { - ASSERT (p[i] == (i == 35 ? UC_BREAK_MANDATORY : - i == 5 || i == 11 || i == 13 || i == 15 || i == 16 - || i == 21 || i == 31 ? UC_BREAK_POSSIBLE : - UC_BREAK_PROHIBITED)); + ASSERT (p[i] == (i == 35 ? UC_BREAK_MANDATORY : + i == 5 || i == 11 || i == 13 || i == 15 || i == 16 + || i == 21 || i == 31 ? UC_BREAK_POSSIBLE : + UC_BREAK_PROHIBITED)); } free (p); } diff --git a/tests/unilbrk/test-ulc-width-linebreaks.c b/tests/unilbrk/test-ulc-width-linebreaks.c index c0b2301..875554a 100644 --- a/tests/unilbrk/test-ulc-width-linebreaks.c +++ b/tests/unilbrk/test-ulc-width-linebreaks.c @@ -1,5 +1,5 @@ /* Test of line breaking of strings. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,21 +20,9 @@ #include "unilbrk.h" -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -53,9 +41,9 @@ main () ulc_width_linebreaks (input, SIZEOF (input), 12, 0, 0, NULL, "ISO-8859-1", p); for (i = 0; i < 36; i++) { - ASSERT (p[i] == (i == 35 ? UC_BREAK_MANDATORY : - i == 11 || i == 21 || i == 31 ? UC_BREAK_POSSIBLE : - UC_BREAK_PROHIBITED)); + ASSERT (p[i] == (i == 35 ? UC_BREAK_MANDATORY : + i == 11 || i == 21 || i == 31 ? UC_BREAK_POSSIBLE : + UC_BREAK_PROHIBITED)); } free (p); } diff --git a/tests/uniname/test-uninames.c b/tests/uniname/test-uninames.c index 1408434..2116351 100644 --- a/tests/uniname/test-uninames.c +++ b/tests/uniname/test-uninames.c @@ -1,5 +1,6 @@ /* Test the Unicode character name functions. - Copyright (C) 2000-2003, 2005, 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2000-2003, 2005, 2007, 2009-2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -44,10 +45,10 @@ getfield (FILE *stream, char *buffer, int delim) { /* Put c into the buffer. */ if (++count >= FIELDLEN - 1) - { - fprintf (stderr, "field too long\n"); - exit (EXIT_FAILURE); - } + { + fprintf (stderr, "field too long\n"); + exit (EXIT_FAILURE); + } *buffer++ = c; } @@ -88,21 +89,21 @@ fill_names (const char *unicodedata_filename) n = getfield (stream, field0, ';'); n += getfield (stream, field1, ';'); if (n == 0) - break; + break; if (n != 2) - { - fprintf (stderr, "short line in '%s':%d\n", - unicodedata_filename, lineno); - exit (EXIT_FAILURE); - } + { + fprintf (stderr, "short line in '%s':%d\n", + unicodedata_filename, lineno); + exit (EXIT_FAILURE); + } for (; (c = getc (stream)), (c != EOF && c != '\n'); ) - ; + ; i = strtoul (field0, NULL, 16); if (i >= 0x110000) - { - fprintf (stderr, "index too large\n"); - exit (EXIT_FAILURE); - } + { + fprintf (stderr, "index too large\n"); + exit (EXIT_FAILURE); + } unicode_names[i] = xstrdup (field1); } if (ferror (stream) || fclose (stream)) @@ -125,28 +126,28 @@ test_name_lookup () char *result = unicode_character_name (i, buf); if (unicode_names[i] != NULL) - { - if (result == NULL) - { - fprintf (stderr, "\\u%04X name lookup failed!\n", i); - error = 1; - } - else if (strcmp (result, unicode_names[i]) != 0) - { - fprintf (stderr, "\\u%04X name lookup returned wrong name: %s\n", - i, result); - error = 1; - } - } + { + if (result == NULL) + { + fprintf (stderr, "\\u%04X name lookup failed!\n", i); + error = 1; + } + else if (strcmp (result, unicode_names[i]) != 0) + { + fprintf (stderr, "\\u%04X name lookup returned wrong name: %s\n", + i, result); + error = 1; + } + } else - { - if (result != NULL) - { - fprintf (stderr, "\\u%04X name lookup returned wrong name: %s\n", - i, result); - error = 1; - } - } + { + if (result != NULL) + { + fprintf (stderr, "\\u%04X name lookup returned wrong name: %s\n", + i, result); + error = 1; + } + } } for (i = 0x110000; i < 0x1000000; i++) @@ -154,11 +155,11 @@ test_name_lookup () char *result = unicode_character_name (i, buf); if (result != NULL) - { - fprintf (stderr, "\\u%04X name lookup returned wrong name: %s\n", - i, result); - error = 1; - } + { + fprintf (stderr, "\\u%04X name lookup returned wrong name: %s\n", + i, result); + error = 1; + } } return error; @@ -175,18 +176,18 @@ test_inverse_lookup () for (i = 0; i < 0x110000; i++) if (unicode_names[i] != NULL) { - unsigned int result = unicode_name_character (unicode_names[i]); - if (result != i) - { - if (result == UNINAME_INVALID) - fprintf (stderr, "inverse name lookup of \"%s\" failed\n", - unicode_names[i]); - else - fprintf (stderr, - "inverse name lookup of \"%s\" returned 0x%04X\n", - unicode_names[i], result); - error = 1; - } + unsigned int result = unicode_name_character (unicode_names[i]); + if (result != i) + { + if (result == UNINAME_INVALID) + fprintf (stderr, "inverse name lookup of \"%s\" failed\n", + unicode_names[i]); + else + fprintf (stderr, + "inverse name lookup of \"%s\" returned 0x%04X\n", + unicode_names[i], result); + error = 1; + } } /* Second, generate random but likely names and verify they are not @@ -201,13 +202,13 @@ test_inverse_lookup () unsigned int result; do i1 = ((rand () % 0x11) << 16) - + ((rand () & 0xff) << 8) - + (rand () & 0xff); + + ((rand () & 0xff) << 8) + + (rand () & 0xff); while (unicode_names[i1] == NULL); do i2 = ((rand () % 0x11) << 16) - + ((rand () & 0xff) << 8) - + (rand () & 0xff); + + ((rand () & 0xff) << 8) + + (rand () & 0xff); while (unicode_names[i2] == NULL); s1 = unicode_names[i1]; @@ -217,25 +218,25 @@ test_inverse_lookup () /* Concatenate a starting piece of s1 with an ending piece of s2. */ for (j1 = 1; j1 <= l1; j1++) - if (j1 == l1 || s1[j1] == ' ') - for (j2 = 0; j2 < l2; j2++) - if (j2 == 0 || s2[j2-1] == ' ') - { - memcpy (buf, s1, j1); - buf[j1] = ' '; - memcpy (buf + j1 + 1, s2 + j2, l2 - j2 + 1); - - result = unicode_name_character (buf); - if (result != UNINAME_INVALID - && !(unicode_names[result] != NULL - && strcmp (unicode_names[result], buf) == 0)) - { - fprintf (stderr, - "inverse name lookup of \"%s\" returned 0x%04X\n", - unicode_names[i], result); - error = 1; - } - } + if (j1 == l1 || s1[j1] == ' ') + for (j2 = 0; j2 < l2; j2++) + if (j2 == 0 || s2[j2-1] == ' ') + { + memcpy (buf, s1, j1); + buf[j1] = ' '; + memcpy (buf + j1 + 1, s2 + j2, l2 - j2 + 1); + + result = unicode_name_character (buf); + if (result != UNINAME_INVALID + && !(unicode_names[result] != NULL + && strcmp (unicode_names[result], buf) == 0)) + { + fprintf (stderr, + "inverse name lookup of \"%s\" returned 0x%04X\n", + unicode_names[i], result); + error = 1; + } + } } /* Third, some extreme case that used to loop. */ diff --git a/tests/uninorm/test-canonical-decomposition.c b/tests/uninorm/test-canonical-decomposition.c index 040011b..f97bc44 100644 --- a/tests/uninorm/test-canonical-decomposition.c +++ b/tests/uninorm/test-canonical-decomposition.c @@ -1,5 +1,5 @@ /* Test of canonical decomposition of Unicode characters. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,20 +20,7 @@ #include "uninorm.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uninorm/test-compat-decomposition.c b/tests/uninorm/test-compat-decomposition.c index 49a2b09..eeda95b 100644 --- a/tests/uninorm/test-compat-decomposition.c +++ b/tests/uninorm/test-compat-decomposition.c @@ -1,5 +1,5 @@ /* Test of compatibility decomposition of Unicode characters. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,22 +20,8 @@ #include "uninorm/decompose-internal.h" -#include <stdio.h> -#include <stdlib.h> - #include "uninorm.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uninorm/test-composition.c b/tests/uninorm/test-composition.c index dbadbba..bd089e6 100644 --- a/tests/uninorm/test-composition.c +++ b/tests/uninorm/test-composition.c @@ -1,5 +1,5 @@ /* Test of canonical composition of Unicode characters. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,20 +20,7 @@ #include "uninorm.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uninorm/test-decomposing-form.c b/tests/uninorm/test-decomposing-form.c index 3802c3f..6a1b7c4 100644 --- a/tests/uninorm/test-decomposing-form.c +++ b/tests/uninorm/test-decomposing-form.c @@ -1,5 +1,5 @@ /* Test of decomposing variant of a normalization form. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,20 +20,7 @@ #include "uninorm.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uninorm/test-decomposition.c b/tests/uninorm/test-decomposition.c index 684dee4..3cef393 100644 --- a/tests/uninorm/test-decomposition.c +++ b/tests/uninorm/test-decomposition.c @@ -1,5 +1,5 @@ /* Test of decomposition of Unicode characters. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,20 +20,7 @@ #include "uninorm.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uninorm/test-nfc.c b/tests/uninorm/test-nfc.c index ca95710..6fd86d8 100644 --- a/tests/uninorm/test-nfc.c +++ b/tests/uninorm/test-nfc.c @@ -1,5 +1,5 @@ /* Test of canonical normalization of Unicode strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uninorm/test-nfd.c b/tests/uninorm/test-nfd.c index 2a7e55b..d89ba77 100644 --- a/tests/uninorm/test-nfd.c +++ b/tests/uninorm/test-nfd.c @@ -1,5 +1,5 @@ /* Test of canonical decomposition of Unicode strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uninorm/test-nfkc.c b/tests/uninorm/test-nfkc.c index 2e57a15..68474a8 100644 --- a/tests/uninorm/test-nfkc.c +++ b/tests/uninorm/test-nfkc.c @@ -1,5 +1,5 @@ /* Test of compatibility normalization of Unicode strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uninorm/test-nfkd.c b/tests/uninorm/test-nfkd.c index 8e330fe..cb8a2df 100644 --- a/tests/uninorm/test-nfkd.c +++ b/tests/uninorm/test-nfkd.c @@ -1,5 +1,5 @@ /* Test of compatibility decomposition of Unicode strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uninorm/test-u16-nfc.c b/tests/uninorm/test-u16-nfc.c index 1bf9a94..b595500 100644 --- a/tests/uninorm/test-u16-nfc.c +++ b/tests/uninorm/test-u16-nfc.c @@ -1,5 +1,5 @@ /* Test of canonical normalization of UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,29 +18,16 @@ #include <config.h> -#if GNULIB_UNINORM_U16_NORMALIZE +#if GNULIB_TEST_UNINORM_U16_NORMALIZE #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint16_t *input, size_t input_length, @@ -68,13 +55,13 @@ check (const uint16_t *input, size_t input_length, preallocated = (uint16_t *) malloc (length * sizeof (uint16_t)); result = u16_normalize (UNINORM_NFC, input, input_length, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u16_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -241,20 +228,20 @@ test_u16_nfc (void) { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint16_t input[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint16_t decomposed[] = { 'G', 'r', 0x0075, 0x0308, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', - 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', + 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' }; ASSERT (check (input, SIZEOF (input), input, SIZEOF (input)) == 0); ASSERT (check (decomposed, SIZEOF (decomposed), input, SIZEOF (input)) == 0); @@ -272,65 +259,65 @@ test_u16_nfc (void) int pass; for (pass = 0; pass < 3; pass++) { - size_t repeat = 1; - size_t m = 100000; - uint16_t *input = (uint16_t *) malloc (2 * m * sizeof (uint16_t)); - if (input != NULL) - { - uint16_t *expected = input + m; - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint16_t *p; - size_t i; - - input[0] = 0x0041; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - break; - - case 1: - for (i = 0; i < m2; i++) - *p++ = 0x0300; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0x0319; - *p++ = 0x0300; - } - for (; i < m1; i++) - *p++ = 0x0319; - break; - - default: - abort (); - } - - expected[0] = 0x00C0; - p = expected + 1; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2 - 1; i++) - *p++ = 0x0300; - - for (; repeat > 0; repeat--) - { - ASSERT (check (input, m, expected, m - 1) == 0); - ASSERT (check (expected, m - 1, expected, m - 1) == 0); - } - - free (input); - } + size_t repeat = 1; + size_t m = 100000; + uint16_t *input = (uint16_t *) malloc (2 * m * sizeof (uint16_t)); + if (input != NULL) + { + uint16_t *expected = input + m; + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint16_t *p; + size_t i; + + input[0] = 0x0041; + p = input + 1; + switch (pass) + { + case 0: + for (i = 0; i < m1; i++) + *p++ = 0x0319; + for (i = 0; i < m2; i++) + *p++ = 0x0300; + break; + + case 1: + for (i = 0; i < m2; i++) + *p++ = 0x0300; + for (i = 0; i < m1; i++) + *p++ = 0x0319; + break; + + case 2: + for (i = 0; i < m2; i++) + { + *p++ = 0x0319; + *p++ = 0x0300; + } + for (; i < m1; i++) + *p++ = 0x0319; + break; + + default: + abort (); + } + + expected[0] = 0x00C0; + p = expected + 1; + for (i = 0; i < m1; i++) + *p++ = 0x0319; + for (i = 0; i < m2 - 1; i++) + *p++ = 0x0300; + + for (; repeat > 0; repeat--) + { + ASSERT (check (input, m, expected, m - 1) == 0); + ASSERT (check (expected, m - 1, expected, m - 1) == 0); + } + + free (input); + } } } } diff --git a/tests/uninorm/test-u16-nfd.c b/tests/uninorm/test-u16-nfd.c index 34789b8..0e084c9 100644 --- a/tests/uninorm/test-u16-nfd.c +++ b/tests/uninorm/test-u16-nfd.c @@ -1,5 +1,5 @@ /* Test of canonical decomposition of UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,29 +18,16 @@ #include <config.h> -#if GNULIB_UNINORM_U16_NORMALIZE +#if GNULIB_TEST_UNINORM_U16_NORMALIZE #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint16_t *input, size_t input_length, @@ -68,13 +55,13 @@ check (const uint16_t *input, size_t input_length, preallocated = (uint16_t *) malloc (length * sizeof (uint16_t)); result = u16_normalize (UNINORM_NFD, input, input_length, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u16_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -229,20 +216,20 @@ test_u16_nfd (void) { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint16_t input[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint16_t expected[] = { 'G', 'r', 0x0075, 0x0308, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', - 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', + 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' }; ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); } @@ -259,62 +246,62 @@ test_u16_nfd (void) int pass; for (pass = 0; pass < 3; pass++) { - size_t repeat = 1; - size_t m = 100000; - uint16_t *input = (uint16_t *) malloc (2 * m * sizeof (uint16_t)); - if (input != NULL) - { - uint16_t *expected = input + m; - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint16_t *p; - size_t i; - - input[0] = 0x0041; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - break; - - case 1: - for (i = 0; i < m2; i++) - *p++ = 0x0300; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0x0319; - *p++ = 0x0300; - } - for (; i < m1; i++) - *p++ = 0x0319; - break; - - default: - abort (); - } - - expected[0] = 0x0041; - p = expected + 1; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - - for (; repeat > 0; repeat--) - ASSERT (check (input, m, expected, m) == 0); - - free (input); - } + size_t repeat = 1; + size_t m = 100000; + uint16_t *input = (uint16_t *) malloc (2 * m * sizeof (uint16_t)); + if (input != NULL) + { + uint16_t *expected = input + m; + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint16_t *p; + size_t i; + + input[0] = 0x0041; + p = input + 1; + switch (pass) + { + case 0: + for (i = 0; i < m1; i++) + *p++ = 0x0319; + for (i = 0; i < m2; i++) + *p++ = 0x0300; + break; + + case 1: + for (i = 0; i < m2; i++) + *p++ = 0x0300; + for (i = 0; i < m1; i++) + *p++ = 0x0319; + break; + + case 2: + for (i = 0; i < m2; i++) + { + *p++ = 0x0319; + *p++ = 0x0300; + } + for (; i < m1; i++) + *p++ = 0x0319; + break; + + default: + abort (); + } + + expected[0] = 0x0041; + p = expected + 1; + for (i = 0; i < m1; i++) + *p++ = 0x0319; + for (i = 0; i < m2; i++) + *p++ = 0x0300; + + for (; repeat > 0; repeat--) + ASSERT (check (input, m, expected, m) == 0); + + free (input); + } } } } diff --git a/tests/uninorm/test-u16-nfkc.c b/tests/uninorm/test-u16-nfkc.c index 4ac8f7e..7fcec7c 100644 --- a/tests/uninorm/test-u16-nfkc.c +++ b/tests/uninorm/test-u16-nfkc.c @@ -1,5 +1,5 @@ /* Test of compatibility normalization of UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,29 +18,16 @@ #include <config.h> -#if GNULIB_UNINORM_U16_NORMALIZE +#if GNULIB_TEST_UNINORM_U16_NORMALIZE #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint16_t *input, size_t input_length, @@ -68,13 +55,13 @@ check (const uint16_t *input, size_t input_length, preallocated = (uint16_t *) malloc (length * sizeof (uint16_t)); result = u16_normalize (UNINORM_NFKC, input, input_length, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u16_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -257,7 +244,7 @@ test_u16_nfkc (void) static const uint16_t input[] = { 0xFDFA }; static const uint16_t decomposed[] = { 0x0635, 0x0644, 0x0649, 0x0020, 0x0627, 0x0644, 0x0644, 0x0647, 0x0020, - 0x0639, 0x0644, 0x064A, 0x0647, 0x0020, 0x0648, 0x0633, 0x0644, 0x0645 + 0x0639, 0x0644, 0x064A, 0x0647, 0x0020, 0x0648, 0x0633, 0x0644, 0x0645 }; ASSERT (check (input, SIZEOF (input), decomposed, SIZEOF (decomposed)) == 0); ASSERT (check (decomposed, SIZEOF (decomposed), decomposed, SIZEOF (decomposed)) == 0); @@ -280,28 +267,28 @@ test_u16_nfkc (void) { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint16_t input[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint16_t decomposed[] = { 'G', 'r', 0x0075, 0x0308, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x0032, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', - 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x0032, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', + 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' }; static const uint16_t expected[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x0032, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x0032, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); ASSERT (check (decomposed, SIZEOF (decomposed), expected, SIZEOF (expected)) == 0); @@ -320,65 +307,65 @@ test_u16_nfkc (void) int pass; for (pass = 0; pass < 3; pass++) { - size_t repeat = 1; - size_t m = 100000; - uint16_t *input = (uint16_t *) malloc (2 * m * sizeof (uint16_t)); - if (input != NULL) - { - uint16_t *expected = input + m; - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint16_t *p; - size_t i; - - input[0] = 0x0041; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - break; - - case 1: - for (i = 0; i < m2; i++) - *p++ = 0x0300; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0x0319; - *p++ = 0x0300; - } - for (; i < m1; i++) - *p++ = 0x0319; - break; - - default: - abort (); - } - - expected[0] = 0x00C0; - p = expected + 1; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2 - 1; i++) - *p++ = 0x0300; - - for (; repeat > 0; repeat--) - { - ASSERT (check (input, m, expected, m - 1) == 0); - ASSERT (check (expected, m - 1, expected, m - 1) == 0); - } - - free (input); - } + size_t repeat = 1; + size_t m = 100000; + uint16_t *input = (uint16_t *) malloc (2 * m * sizeof (uint16_t)); + if (input != NULL) + { + uint16_t *expected = input + m; + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint16_t *p; + size_t i; + + input[0] = 0x0041; + p = input + 1; + switch (pass) + { + case 0: + for (i = 0; i < m1; i++) + *p++ = 0x0319; + for (i = 0; i < m2; i++) + *p++ = 0x0300; + break; + + case 1: + for (i = 0; i < m2; i++) + *p++ = 0x0300; + for (i = 0; i < m1; i++) + *p++ = 0x0319; + break; + + case 2: + for (i = 0; i < m2; i++) + { + *p++ = 0x0319; + *p++ = 0x0300; + } + for (; i < m1; i++) + *p++ = 0x0319; + break; + + default: + abort (); + } + + expected[0] = 0x00C0; + p = expected + 1; + for (i = 0; i < m1; i++) + *p++ = 0x0319; + for (i = 0; i < m2 - 1; i++) + *p++ = 0x0300; + + for (; repeat > 0; repeat--) + { + ASSERT (check (input, m, expected, m - 1) == 0); + ASSERT (check (expected, m - 1, expected, m - 1) == 0); + } + + free (input); + } } } } diff --git a/tests/uninorm/test-u16-nfkd.c b/tests/uninorm/test-u16-nfkd.c index 6dfa39f..4395d01 100644 --- a/tests/uninorm/test-u16-nfkd.c +++ b/tests/uninorm/test-u16-nfkd.c @@ -1,5 +1,5 @@ /* Test of compatibility decomposition of UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,29 +18,16 @@ #include <config.h> -#if GNULIB_UNINORM_U16_NORMALIZE +#if GNULIB_TEST_UNINORM_U16_NORMALIZE #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint16_t *input, size_t input_length, @@ -68,13 +55,13 @@ check (const uint16_t *input, size_t input_length, preallocated = (uint16_t *) malloc (length * sizeof (uint16_t)); result = u16_normalize (UNINORM_NFKD, input, input_length, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u16_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -229,7 +216,7 @@ test_u16_nfkd (void) static const uint16_t input[] = { 0xFDFA }; static const uint16_t expected[] = { 0x0635, 0x0644, 0x0649, 0x0020, 0x0627, 0x0644, 0x0644, 0x0647, 0x0020, - 0x0639, 0x0644, 0x064A, 0x0647, 0x0020, 0x0648, 0x0633, 0x0644, 0x0645 + 0x0639, 0x0644, 0x064A, 0x0647, 0x0020, 0x0648, 0x0633, 0x0644, 0x0645 }; ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); } @@ -249,20 +236,20 @@ test_u16_nfkd (void) { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint16_t input[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint16_t expected[] = { 'G', 'r', 0x0075, 0x0308, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x0032, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', - 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x0032, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', + 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' }; ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); } @@ -279,62 +266,62 @@ test_u16_nfkd (void) int pass; for (pass = 0; pass < 3; pass++) { - size_t repeat = 1; - size_t m = 100000; - uint16_t *input = (uint16_t *) malloc (2 * m * sizeof (uint16_t)); - if (input != NULL) - { - uint16_t *expected = input + m; - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint16_t *p; - size_t i; - - input[0] = 0x0041; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - break; - - case 1: - for (i = 0; i < m2; i++) - *p++ = 0x0300; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0x0319; - *p++ = 0x0300; - } - for (; i < m1; i++) - *p++ = 0x0319; - break; - - default: - abort (); - } - - expected[0] = 0x0041; - p = expected + 1; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - - for (; repeat > 0; repeat--) - ASSERT (check (input, m, expected, m) == 0); - - free (input); - } + size_t repeat = 1; + size_t m = 100000; + uint16_t *input = (uint16_t *) malloc (2 * m * sizeof (uint16_t)); + if (input != NULL) + { + uint16_t *expected = input + m; + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint16_t *p; + size_t i; + + input[0] = 0x0041; + p = input + 1; + switch (pass) + { + case 0: + for (i = 0; i < m1; i++) + *p++ = 0x0319; + for (i = 0; i < m2; i++) + *p++ = 0x0300; + break; + + case 1: + for (i = 0; i < m2; i++) + *p++ = 0x0300; + for (i = 0; i < m1; i++) + *p++ = 0x0319; + break; + + case 2: + for (i = 0; i < m2; i++) + { + *p++ = 0x0319; + *p++ = 0x0300; + } + for (; i < m1; i++) + *p++ = 0x0319; + break; + + default: + abort (); + } + + expected[0] = 0x0041; + p = expected + 1; + for (i = 0; i < m1; i++) + *p++ = 0x0319; + for (i = 0; i < m2; i++) + *p++ = 0x0300; + + for (; repeat > 0; repeat--) + ASSERT (check (input, m, expected, m) == 0); + + free (input); + } } } } diff --git a/tests/uninorm/test-u16-normcmp.c b/tests/uninorm/test-u16-normcmp.c index 3cf947a..7adcda6 100644 --- a/tests/uninorm/test-u16-normcmp.c +++ b/tests/uninorm/test-u16-normcmp.c @@ -1,5 +1,5 @@ /* Test of normalization insensitive comparison of UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,21 +20,7 @@ #include "uninorm.h" -#include <stdio.h> -#include <stdlib.h> - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u16-normcmp.h" diff --git a/tests/uninorm/test-u16-normcmp.h b/tests/uninorm/test-u16-normcmp.h index ea7def8..85cbf00 100644 --- a/tests/uninorm/test-u16-normcmp.h +++ b/tests/uninorm/test-u16-normcmp.h @@ -1,5 +1,5 @@ /* Test of normalization insensitive comparison of UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,7 +18,7 @@ static void test_ascii (int (*my_normcmp) (const uint16_t *, size_t, const uint16_t *, size_t, uninorm_t, int *), - uninorm_t nf) + uninorm_t nf) { /* Empty string. */ { diff --git a/tests/uninorm/test-u16-normcoll.c b/tests/uninorm/test-u16-normcoll.c index d83799d..ead1561 100644 --- a/tests/uninorm/test-u16-normcoll.c +++ b/tests/uninorm/test-u16-normcoll.c @@ -1,6 +1,6 @@ /* Test of locale dependent, normalization insensitive comparison of UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,21 +21,7 @@ #include "uninorm.h" -#include <stdio.h> -#include <stdlib.h> - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u16-normcmp.h" int diff --git a/tests/uninorm/test-u32-nfc-big.c b/tests/uninorm/test-u32-nfc-big.c index 2a1b611..dee5806 100644 --- a/tests/uninorm/test-u32-nfc-big.c +++ b/tests/uninorm/test-u32-nfc-big.c @@ -1,5 +1,5 @@ /* Test of Unicode compliance of canonical normalization of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,7 +18,7 @@ #include <config.h> -#if GNULIB_UNINORM_U32_NORMALIZE +#if GNULIB_TEST_UNINORM_U32_NORMALIZE #include "uninorm.h" @@ -45,8 +45,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFC, c1, c1_length, NULL, &length); if (!(result != NULL - && length == c2_length - && u32_cmp (result, c2, c2_length) == 0)) + && length == c2_length + && u32_cmp (result, c2, c2_length) == 0)) return 1; free (result); } @@ -56,8 +56,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFC, c2, c2_length, NULL, &length); if (!(result != NULL - && length == c2_length - && u32_cmp (result, c2, c2_length) == 0)) + && length == c2_length + && u32_cmp (result, c2, c2_length) == 0)) return 2; free (result); } @@ -67,8 +67,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFC, c3, c3_length, NULL, &length); if (!(result != NULL - && length == c2_length - && u32_cmp (result, c2, c2_length) == 0)) + && length == c2_length + && u32_cmp (result, c2, c2_length) == 0)) return 3; free (result); } @@ -78,8 +78,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFC, c4, c4_length, NULL, &length); if (!(result != NULL - && length == c4_length - && u32_cmp (result, c4, c4_length) == 0)) + && length == c4_length + && u32_cmp (result, c4, c4_length) == 0)) return 4; free (result); } @@ -89,8 +89,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFC, c5, c5_length, NULL, &length); if (!(result != NULL - && length == c4_length - && u32_cmp (result, c4, c4_length) == 0)) + && length == c4_length + && u32_cmp (result, c4, c4_length) == 0)) return 5; free (result); } diff --git a/tests/uninorm/test-u32-nfc.c b/tests/uninorm/test-u32-nfc.c index 0d8311c..b154c8b 100644 --- a/tests/uninorm/test-u32-nfc.c +++ b/tests/uninorm/test-u32-nfc.c @@ -1,5 +1,5 @@ /* Test of canonical normalization of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,29 +18,16 @@ #include <config.h> -#if GNULIB_UNINORM_U32_NORMALIZE +#if GNULIB_TEST_UNINORM_U32_NORMALIZE #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint32_t *input, size_t input_length, @@ -68,13 +55,13 @@ check (const uint32_t *input, size_t input_length, preallocated = (uint32_t *) malloc (length * sizeof (uint32_t)); result = u32_normalize (UNINORM_NFC, input, input_length, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u32_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -241,20 +228,20 @@ test_u32_nfc (void) { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint32_t input[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint32_t decomposed[] = { 'G', 'r', 0x0075, 0x0308, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', - 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', + 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' }; ASSERT (check (input, SIZEOF (input), input, SIZEOF (input)) == 0); ASSERT (check (decomposed, SIZEOF (decomposed), input, SIZEOF (input)) == 0); @@ -272,65 +259,65 @@ test_u32_nfc (void) int pass; for (pass = 0; pass < 3; pass++) { - size_t repeat = 1; - size_t m = 100000; - uint32_t *input = (uint32_t *) malloc (2 * m * sizeof (uint32_t)); - if (input != NULL) - { - uint32_t *expected = input + m; - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint32_t *p; - size_t i; - - input[0] = 0x0041; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - break; - - case 1: - for (i = 0; i < m2; i++) - *p++ = 0x0300; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0x0319; - *p++ = 0x0300; - } - for (; i < m1; i++) - *p++ = 0x0319; - break; - - default: - abort (); - } - - expected[0] = 0x00C0; - p = expected + 1; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2 - 1; i++) - *p++ = 0x0300; - - for (; repeat > 0; repeat--) - { - ASSERT (check (input, m, expected, m - 1) == 0); - ASSERT (check (expected, m - 1, expected, m - 1) == 0); - } - - free (input); - } + size_t repeat = 1; + size_t m = 100000; + uint32_t *input = (uint32_t *) malloc (2 * m * sizeof (uint32_t)); + if (input != NULL) + { + uint32_t *expected = input + m; + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint32_t *p; + size_t i; + + input[0] = 0x0041; + p = input + 1; + switch (pass) + { + case 0: + for (i = 0; i < m1; i++) + *p++ = 0x0319; + for (i = 0; i < m2; i++) + *p++ = 0x0300; + break; + + case 1: + for (i = 0; i < m2; i++) + *p++ = 0x0300; + for (i = 0; i < m1; i++) + *p++ = 0x0319; + break; + + case 2: + for (i = 0; i < m2; i++) + { + *p++ = 0x0319; + *p++ = 0x0300; + } + for (; i < m1; i++) + *p++ = 0x0319; + break; + + default: + abort (); + } + + expected[0] = 0x00C0; + p = expected + 1; + for (i = 0; i < m1; i++) + *p++ = 0x0319; + for (i = 0; i < m2 - 1; i++) + *p++ = 0x0300; + + for (; repeat > 0; repeat--) + { + ASSERT (check (input, m, expected, m - 1) == 0); + ASSERT (check (expected, m - 1, expected, m - 1) == 0); + } + + free (input); + } } } } diff --git a/tests/uninorm/test-u32-nfd-big.c b/tests/uninorm/test-u32-nfd-big.c index 9bfd0d8..ccc1291 100644 --- a/tests/uninorm/test-u32-nfd-big.c +++ b/tests/uninorm/test-u32-nfd-big.c @@ -1,5 +1,5 @@ /* Test of Unicode compliance of canonical decomposition of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,7 +18,7 @@ #include <config.h> -#if GNULIB_UNINORM_U32_NORMALIZE +#if GNULIB_TEST_UNINORM_U32_NORMALIZE #include "uninorm.h" @@ -45,8 +45,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFD, c1, c1_length, NULL, &length); if (!(result != NULL - && length == c3_length - && u32_cmp (result, c3, c3_length) == 0)) + && length == c3_length + && u32_cmp (result, c3, c3_length) == 0)) return 1; free (result); } @@ -56,8 +56,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFD, c2, c2_length, NULL, &length); if (!(result != NULL - && length == c3_length - && u32_cmp (result, c3, c3_length) == 0)) + && length == c3_length + && u32_cmp (result, c3, c3_length) == 0)) return 2; free (result); } @@ -67,8 +67,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFD, c3, c3_length, NULL, &length); if (!(result != NULL - && length == c3_length - && u32_cmp (result, c3, c3_length) == 0)) + && length == c3_length + && u32_cmp (result, c3, c3_length) == 0)) return 3; free (result); } @@ -78,8 +78,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFD, c4, c4_length, NULL, &length); if (!(result != NULL - && length == c5_length - && u32_cmp (result, c5, c5_length) == 0)) + && length == c5_length + && u32_cmp (result, c5, c5_length) == 0)) return 4; free (result); } @@ -89,8 +89,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFD, c5, c5_length, NULL, &length); if (!(result != NULL - && length == c5_length - && u32_cmp (result, c5, c5_length) == 0)) + && length == c5_length + && u32_cmp (result, c5, c5_length) == 0)) return 5; free (result); } diff --git a/tests/uninorm/test-u32-nfd.c b/tests/uninorm/test-u32-nfd.c index f7b2d8d..58c97b2 100644 --- a/tests/uninorm/test-u32-nfd.c +++ b/tests/uninorm/test-u32-nfd.c @@ -1,5 +1,5 @@ /* Test of canonical decomposition of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,29 +18,16 @@ #include <config.h> -#if GNULIB_UNINORM_U32_NORMALIZE +#if GNULIB_TEST_UNINORM_U32_NORMALIZE #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint32_t *input, size_t input_length, @@ -68,13 +55,13 @@ check (const uint32_t *input, size_t input_length, preallocated = (uint32_t *) malloc (length * sizeof (uint32_t)); result = u32_normalize (UNINORM_NFD, input, input_length, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u32_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -229,20 +216,20 @@ test_u32_nfd (void) { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint32_t input[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint32_t expected[] = { 'G', 'r', 0x0075, 0x0308, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', - 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', + 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' }; ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); } @@ -259,62 +246,62 @@ test_u32_nfd (void) int pass; for (pass = 0; pass < 3; pass++) { - size_t repeat = 1; - size_t m = 100000; - uint32_t *input = (uint32_t *) malloc (2 * m * sizeof (uint32_t)); - if (input != NULL) - { - uint32_t *expected = input + m; - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint32_t *p; - size_t i; - - input[0] = 0x0041; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - break; - - case 1: - for (i = 0; i < m2; i++) - *p++ = 0x0300; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0x0319; - *p++ = 0x0300; - } - for (; i < m1; i++) - *p++ = 0x0319; - break; - - default: - abort (); - } - - expected[0] = 0x0041; - p = expected + 1; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - - for (; repeat > 0; repeat--) - ASSERT (check (input, m, expected, m) == 0); - - free (input); - } + size_t repeat = 1; + size_t m = 100000; + uint32_t *input = (uint32_t *) malloc (2 * m * sizeof (uint32_t)); + if (input != NULL) + { + uint32_t *expected = input + m; + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint32_t *p; + size_t i; + + input[0] = 0x0041; + p = input + 1; + switch (pass) + { + case 0: + for (i = 0; i < m1; i++) + *p++ = 0x0319; + for (i = 0; i < m2; i++) + *p++ = 0x0300; + break; + + case 1: + for (i = 0; i < m2; i++) + *p++ = 0x0300; + for (i = 0; i < m1; i++) + *p++ = 0x0319; + break; + + case 2: + for (i = 0; i < m2; i++) + { + *p++ = 0x0319; + *p++ = 0x0300; + } + for (; i < m1; i++) + *p++ = 0x0319; + break; + + default: + abort (); + } + + expected[0] = 0x0041; + p = expected + 1; + for (i = 0; i < m1; i++) + *p++ = 0x0319; + for (i = 0; i < m2; i++) + *p++ = 0x0300; + + for (; repeat > 0; repeat--) + ASSERT (check (input, m, expected, m) == 0); + + free (input); + } } } } diff --git a/tests/uninorm/test-u32-nfkc-big.c b/tests/uninorm/test-u32-nfkc-big.c index 340fe65..7827d33 100644 --- a/tests/uninorm/test-u32-nfkc-big.c +++ b/tests/uninorm/test-u32-nfkc-big.c @@ -1,5 +1,5 @@ /* Test of Unicode compliance of compatibility normalization of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,7 +18,7 @@ #include <config.h> -#if GNULIB_UNINORM_U32_NORMALIZE +#if GNULIB_TEST_UNINORM_U32_NORMALIZE #include "uninorm.h" @@ -42,8 +42,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFKC, c1, c1_length, NULL, &length); if (!(result != NULL - && length == c4_length - && u32_cmp (result, c4, c4_length) == 0)) + && length == c4_length + && u32_cmp (result, c4, c4_length) == 0)) return 1; free (result); } @@ -53,8 +53,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFKC, c2, c2_length, NULL, &length); if (!(result != NULL - && length == c4_length - && u32_cmp (result, c4, c4_length) == 0)) + && length == c4_length + && u32_cmp (result, c4, c4_length) == 0)) return 2; free (result); } @@ -64,8 +64,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFKC, c3, c3_length, NULL, &length); if (!(result != NULL - && length == c4_length - && u32_cmp (result, c4, c4_length) == 0)) + && length == c4_length + && u32_cmp (result, c4, c4_length) == 0)) return 3; free (result); } @@ -75,8 +75,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFKC, c4, c4_length, NULL, &length); if (!(result != NULL - && length == c4_length - && u32_cmp (result, c4, c4_length) == 0)) + && length == c4_length + && u32_cmp (result, c4, c4_length) == 0)) return 4; free (result); } @@ -86,8 +86,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFKC, c5, c5_length, NULL, &length); if (!(result != NULL - && length == c4_length - && u32_cmp (result, c4, c4_length) == 0)) + && length == c4_length + && u32_cmp (result, c4, c4_length) == 0)) return 5; free (result); } diff --git a/tests/uninorm/test-u32-nfkc.c b/tests/uninorm/test-u32-nfkc.c index 75f7e82..eb4d3ce 100644 --- a/tests/uninorm/test-u32-nfkc.c +++ b/tests/uninorm/test-u32-nfkc.c @@ -1,5 +1,5 @@ /* Test of compatibility normalization of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,29 +18,16 @@ #include <config.h> -#if GNULIB_UNINORM_U32_NORMALIZE +#if GNULIB_TEST_UNINORM_U32_NORMALIZE #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint32_t *input, size_t input_length, @@ -68,13 +55,13 @@ check (const uint32_t *input, size_t input_length, preallocated = (uint32_t *) malloc (length * sizeof (uint32_t)); result = u32_normalize (UNINORM_NFKC, input, input_length, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u32_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -257,7 +244,7 @@ test_u32_nfkc (void) static const uint32_t input[] = { 0xFDFA }; static const uint32_t decomposed[] = { 0x0635, 0x0644, 0x0649, 0x0020, 0x0627, 0x0644, 0x0644, 0x0647, 0x0020, - 0x0639, 0x0644, 0x064A, 0x0647, 0x0020, 0x0648, 0x0633, 0x0644, 0x0645 + 0x0639, 0x0644, 0x064A, 0x0647, 0x0020, 0x0648, 0x0633, 0x0644, 0x0645 }; ASSERT (check (input, SIZEOF (input), decomposed, SIZEOF (decomposed)) == 0); ASSERT (check (decomposed, SIZEOF (decomposed), decomposed, SIZEOF (decomposed)) == 0); @@ -280,28 +267,28 @@ test_u32_nfkc (void) { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint32_t input[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint32_t decomposed[] = { 'G', 'r', 0x0075, 0x0308, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x0032, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', - 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x0032, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', + 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' }; static const uint32_t expected[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x0032, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x0032, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); ASSERT (check (decomposed, SIZEOF (decomposed), expected, SIZEOF (expected)) == 0); @@ -320,65 +307,65 @@ test_u32_nfkc (void) int pass; for (pass = 0; pass < 3; pass++) { - size_t repeat = 1; - size_t m = 100000; - uint32_t *input = (uint32_t *) malloc (2 * m * sizeof (uint32_t)); - if (input != NULL) - { - uint32_t *expected = input + m; - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint32_t *p; - size_t i; - - input[0] = 0x0041; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - break; - - case 1: - for (i = 0; i < m2; i++) - *p++ = 0x0300; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0x0319; - *p++ = 0x0300; - } - for (; i < m1; i++) - *p++ = 0x0319; - break; - - default: - abort (); - } - - expected[0] = 0x00C0; - p = expected + 1; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2 - 1; i++) - *p++ = 0x0300; - - for (; repeat > 0; repeat--) - { - ASSERT (check (input, m, expected, m - 1) == 0); - ASSERT (check (expected, m - 1, expected, m - 1) == 0); - } - - free (input); - } + size_t repeat = 1; + size_t m = 100000; + uint32_t *input = (uint32_t *) malloc (2 * m * sizeof (uint32_t)); + if (input != NULL) + { + uint32_t *expected = input + m; + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint32_t *p; + size_t i; + + input[0] = 0x0041; + p = input + 1; + switch (pass) + { + case 0: + for (i = 0; i < m1; i++) + *p++ = 0x0319; + for (i = 0; i < m2; i++) + *p++ = 0x0300; + break; + + case 1: + for (i = 0; i < m2; i++) + *p++ = 0x0300; + for (i = 0; i < m1; i++) + *p++ = 0x0319; + break; + + case 2: + for (i = 0; i < m2; i++) + { + *p++ = 0x0319; + *p++ = 0x0300; + } + for (; i < m1; i++) + *p++ = 0x0319; + break; + + default: + abort (); + } + + expected[0] = 0x00C0; + p = expected + 1; + for (i = 0; i < m1; i++) + *p++ = 0x0319; + for (i = 0; i < m2 - 1; i++) + *p++ = 0x0300; + + for (; repeat > 0; repeat--) + { + ASSERT (check (input, m, expected, m - 1) == 0); + ASSERT (check (expected, m - 1, expected, m - 1) == 0); + } + + free (input); + } } } } diff --git a/tests/uninorm/test-u32-nfkd-big.c b/tests/uninorm/test-u32-nfkd-big.c index e7c1b4f..14232c5 100644 --- a/tests/uninorm/test-u32-nfkd-big.c +++ b/tests/uninorm/test-u32-nfkd-big.c @@ -1,5 +1,5 @@ /* Test of Unicode compliance of compatibility decomposition of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,7 +18,7 @@ #include <config.h> -#if GNULIB_UNINORM_U32_NORMALIZE +#if GNULIB_TEST_UNINORM_U32_NORMALIZE #include "uninorm.h" @@ -42,8 +42,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFKD, c1, c1_length, NULL, &length); if (!(result != NULL - && length == c5_length - && u32_cmp (result, c5, c5_length) == 0)) + && length == c5_length + && u32_cmp (result, c5, c5_length) == 0)) return 1; free (result); } @@ -53,8 +53,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFKD, c2, c2_length, NULL, &length); if (!(result != NULL - && length == c5_length - && u32_cmp (result, c5, c5_length) == 0)) + && length == c5_length + && u32_cmp (result, c5, c5_length) == 0)) return 2; free (result); } @@ -64,8 +64,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFKD, c3, c3_length, NULL, &length); if (!(result != NULL - && length == c5_length - && u32_cmp (result, c5, c5_length) == 0)) + && length == c5_length + && u32_cmp (result, c5, c5_length) == 0)) return 3; free (result); } @@ -75,8 +75,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFKD, c4, c4_length, NULL, &length); if (!(result != NULL - && length == c5_length - && u32_cmp (result, c5, c5_length) == 0)) + && length == c5_length + && u32_cmp (result, c5, c5_length) == 0)) return 4; free (result); } @@ -86,8 +86,8 @@ check (const uint32_t *c1, size_t c1_length, result = u32_normalize (UNINORM_NFKD, c5, c5_length, NULL, &length); if (!(result != NULL - && length == c5_length - && u32_cmp (result, c5, c5_length) == 0)) + && length == c5_length + && u32_cmp (result, c5, c5_length) == 0)) return 5; free (result); } diff --git a/tests/uninorm/test-u32-nfkd.c b/tests/uninorm/test-u32-nfkd.c index d3de7f7..b98f651 100644 --- a/tests/uninorm/test-u32-nfkd.c +++ b/tests/uninorm/test-u32-nfkd.c @@ -1,5 +1,5 @@ /* Test of compatibility decomposition of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,29 +18,16 @@ #include <config.h> -#if GNULIB_UNINORM_U32_NORMALIZE +#if GNULIB_TEST_UNINORM_U32_NORMALIZE #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint32_t *input, size_t input_length, @@ -68,13 +55,13 @@ check (const uint32_t *input, size_t input_length, preallocated = (uint32_t *) malloc (length * sizeof (uint32_t)); result = u32_normalize (UNINORM_NFKD, input, input_length, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u32_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -229,7 +216,7 @@ test_u32_nfkd (void) static const uint32_t input[] = { 0xFDFA }; static const uint32_t expected[] = { 0x0635, 0x0644, 0x0649, 0x0020, 0x0627, 0x0644, 0x0644, 0x0647, 0x0020, - 0x0639, 0x0644, 0x064A, 0x0647, 0x0020, 0x0648, 0x0633, 0x0644, 0x0645 + 0x0639, 0x0644, 0x064A, 0x0647, 0x0020, 0x0648, 0x0633, 0x0644, 0x0645 }; ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); } @@ -249,20 +236,20 @@ test_u32_nfkd (void) { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint32_t input[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint32_t expected[] = { 'G', 'r', 0x0075, 0x0308, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x0032, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', - 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x0032, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', + 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' }; ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); } @@ -279,62 +266,62 @@ test_u32_nfkd (void) int pass; for (pass = 0; pass < 3; pass++) { - size_t repeat = 1; - size_t m = 100000; - uint32_t *input = (uint32_t *) malloc (2 * m * sizeof (uint32_t)); - if (input != NULL) - { - uint32_t *expected = input + m; - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint32_t *p; - size_t i; - - input[0] = 0x0041; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - break; - - case 1: - for (i = 0; i < m2; i++) - *p++ = 0x0300; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0x0319; - *p++ = 0x0300; - } - for (; i < m1; i++) - *p++ = 0x0319; - break; - - default: - abort (); - } - - expected[0] = 0x0041; - p = expected + 1; - for (i = 0; i < m1; i++) - *p++ = 0x0319; - for (i = 0; i < m2; i++) - *p++ = 0x0300; - - for (; repeat > 0; repeat--) - ASSERT (check (input, m, expected, m) == 0); - - free (input); - } + size_t repeat = 1; + size_t m = 100000; + uint32_t *input = (uint32_t *) malloc (2 * m * sizeof (uint32_t)); + if (input != NULL) + { + uint32_t *expected = input + m; + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint32_t *p; + size_t i; + + input[0] = 0x0041; + p = input + 1; + switch (pass) + { + case 0: + for (i = 0; i < m1; i++) + *p++ = 0x0319; + for (i = 0; i < m2; i++) + *p++ = 0x0300; + break; + + case 1: + for (i = 0; i < m2; i++) + *p++ = 0x0300; + for (i = 0; i < m1; i++) + *p++ = 0x0319; + break; + + case 2: + for (i = 0; i < m2; i++) + { + *p++ = 0x0319; + *p++ = 0x0300; + } + for (; i < m1; i++) + *p++ = 0x0319; + break; + + default: + abort (); + } + + expected[0] = 0x0041; + p = expected + 1; + for (i = 0; i < m1; i++) + *p++ = 0x0319; + for (i = 0; i < m2; i++) + *p++ = 0x0300; + + for (; repeat > 0; repeat--) + ASSERT (check (input, m, expected, m) == 0); + + free (input); + } } } } diff --git a/tests/uninorm/test-u32-normalize-big.c b/tests/uninorm/test-u32-normalize-big.c index 96781ab..6c63786 100644 --- a/tests/uninorm/test-u32-normalize-big.c +++ b/tests/uninorm/test-u32-normalize-big.c @@ -1,5 +1,5 @@ /* Test of Unicode compliance of normalization of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,37 +21,26 @@ /* Specification. */ #include "test-u32-normalize-big.h" -#if GNULIB_UNINORM_U32_NORMALIZE +#if GNULIB_TEST_UNINORM_U32_NORMALIZE #include <stdio.h> #include <stdlib.h> #include "xalloc.h" #include "unistr.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define ASSERT_WITH_LINE(expr, file, line) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed for %s:%u\n", \ - __FILE__, __LINE__, file, line); \ - fflush (stderr); \ - abort (); \ - } \ - } \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed for %s:%u\n", \ + __FILE__, __LINE__, file, line); \ + fflush (stderr); \ + abort (); \ + } \ + } \ while (0) static int @@ -64,7 +53,7 @@ cmp_ucs4_t (const void *a, const void *b) void read_normalization_test_file (const char *filename, - struct normalization_test_file *file) + struct normalization_test_file *file) { FILE *stream; unsigned int lineno; @@ -106,103 +95,103 @@ read_normalization_test_file (const char *filename, /* Read a line. */ ptr = buf; do - { - c = getc (stream); - if (c == EOF || c == '\n') - break; - *ptr++ = c; - } + { + c = getc (stream); + if (c == EOF || c == '\n') + break; + *ptr++ = c; + } while (ptr < buf + 1000); *ptr = '\0'; if (c == EOF) - break; + break; /* Ignore empty lines and comment lines. */ if (buf[0] == '\0' || buf[0] == '#') - continue; + continue; /* Handle lines that introduce a new part. */ if (buf[0] == '@') - { - /* Switch to the next part. */ - if (part_index >= 0) - { - lines = - (struct normalization_test_line *) - xnrealloc (lines, lines_length, sizeof (struct normalization_test_line)); - file->parts[part_index].lines = lines; - file->parts[part_index].lines_length = lines_length; - } - part_index++; - lines = NULL; - lines_length = 0; - lines_allocated = 0; - continue; - } + { + /* Switch to the next part. */ + if (part_index >= 0) + { + lines = + (struct normalization_test_line *) + xnrealloc (lines, lines_length, sizeof (struct normalization_test_line)); + file->parts[part_index].lines = lines; + file->parts[part_index].lines_length = lines_length; + } + part_index++; + lines = NULL; + lines_length = 0; + lines_allocated = 0; + continue; + } /* It's a line containing 5 sequences of Unicode characters. - Parse it and append it to the current part. */ + Parse it and append it to the current part. */ if (!(part_index >= 0 && part_index < 4)) - { - fprintf (stderr, "unexpected structure of '%s'\n", filename); - exit (1); - } + { + fprintf (stderr, "unexpected structure of '%s'\n", filename); + exit (1); + } ptr = buf; line.lineno = lineno; for (sequence_index = 0; sequence_index < 5; sequence_index++) - line.sequences[sequence_index] = NULL; + line.sequences[sequence_index] = NULL; for (sequence_index = 0; sequence_index < 5; sequence_index++) - { - uint32_t *sequence = XNMALLOC (1, uint32_t); - size_t sequence_length = 0; - - for (;;) - { - char *endptr; - unsigned int uc; - - uc = strtoul (ptr, &endptr, 16); - if (endptr == ptr) - break; - ptr = endptr; - - /* Append uc to the sequence. */ - sequence = - (uint32_t *) - xnrealloc (sequence, sequence_length + 2, sizeof (uint32_t)); - sequence[sequence_length] = uc; - sequence_length++; - - if (*ptr == ' ') - ptr++; - } - if (sequence_length == 0) - { - fprintf (stderr, "empty character sequence in '%s'\n", filename); - exit (1); - } - sequence[sequence_length] = 0; /* terminator */ - - line.sequences[sequence_index] = sequence; - - if (*ptr != ';') - { - fprintf (stderr, "error parsing '%s'\n", filename); - exit (1); - } - ptr++; - } + { + uint32_t *sequence = XNMALLOC (1, uint32_t); + size_t sequence_length = 0; + + for (;;) + { + char *endptr; + unsigned int uc; + + uc = strtoul (ptr, &endptr, 16); + if (endptr == ptr) + break; + ptr = endptr; + + /* Append uc to the sequence. */ + sequence = + (uint32_t *) + xnrealloc (sequence, sequence_length + 2, sizeof (uint32_t)); + sequence[sequence_length] = uc; + sequence_length++; + + if (*ptr == ' ') + ptr++; + } + if (sequence_length == 0) + { + fprintf (stderr, "empty character sequence in '%s'\n", filename); + exit (1); + } + sequence[sequence_length] = 0; /* terminator */ + + line.sequences[sequence_index] = sequence; + + if (*ptr != ';') + { + fprintf (stderr, "error parsing '%s'\n", filename); + exit (1); + } + ptr++; + } /* Append the line to the current part. */ if (lines_length == lines_allocated) - { - lines_allocated = 2 * lines_allocated; - if (lines_allocated < 7) - lines_allocated = 7; - lines = - (struct normalization_test_line *) - xnrealloc (lines, lines_allocated, sizeof (struct normalization_test_line)); - } + { + lines_allocated = 2 * lines_allocated; + if (lines_allocated < 7) + lines_allocated = 7; + lines = + (struct normalization_test_line *) + xnrealloc (lines, lines_allocated, sizeof (struct normalization_test_line)); + } lines[lines_length] = line; lines_length++; } @@ -210,8 +199,8 @@ read_normalization_test_file (const char *filename, if (part_index >= 0) { lines = - (struct normalization_test_line *) - xnrealloc (lines, lines_length, sizeof (struct normalization_test_line)); + (struct normalization_test_line *) + xnrealloc (lines, lines_length, sizeof (struct normalization_test_line)); file->parts[part_index].lines = lines; file->parts[part_index].lines_length = lines_length; } @@ -224,11 +213,11 @@ read_normalization_test_file (const char *filename, for (line_index = 0; line_index < p->lines_length; line_index++) { - const uint32_t *sequence = p->lines[line_index].sequences[0]; - /* In part 1, every sequences[0] consists of a single character. */ - if (!(sequence[0] != 0 && sequence[1] == 0)) - abort (); - c1_array[line_index] = sequence[0]; + const uint32_t *sequence = p->lines[line_index].sequences[0]; + /* In part 1, every sequences[0] consists of a single character. */ + if (!(sequence[0] != 0 && sequence[1] == 0)) + abort (); + c1_array[line_index] = sequence[0]; } /* Sort this array. */ @@ -251,11 +240,11 @@ read_normalization_test_file (const char *filename, void test_specific (const struct normalization_test_file *file, - int (*check) (const uint32_t *c1, size_t c1_length, - const uint32_t *c2, size_t c2_length, - const uint32_t *c3, size_t c3_length, - const uint32_t *c4, size_t c4_length, - const uint32_t *c5, size_t c5_length)) + int (*check) (const uint32_t *c1, size_t c1_length, + const uint32_t *c2, size_t c2_length, + const uint32_t *c3, size_t c3_length, + const uint32_t *c4, size_t c4_length, + const uint32_t *c5, size_t c5_length)) { size_t part_index; @@ -265,17 +254,17 @@ test_specific (const struct normalization_test_file *file, size_t line_index; for (line_index = 0; line_index < p->lines_length; line_index++) - { - const struct normalization_test_line *l = &p->lines[line_index]; - - ASSERT_WITH_LINE (check (l->sequences[0], u32_strlen (l->sequences[0]), - l->sequences[1], u32_strlen (l->sequences[1]), - l->sequences[2], u32_strlen (l->sequences[2]), - l->sequences[3], u32_strlen (l->sequences[3]), - l->sequences[4], u32_strlen (l->sequences[4])) - == 0, - file->filename, l->lineno); - } + { + const struct normalization_test_line *l = &p->lines[line_index]; + + ASSERT_WITH_LINE (check (l->sequences[0], u32_strlen (l->sequences[0]), + l->sequences[1], u32_strlen (l->sequences[1]), + l->sequences[2], u32_strlen (l->sequences[2]), + l->sequences[3], u32_strlen (l->sequences[3]), + l->sequences[4], u32_strlen (l->sequences[4])) + == 0, + file->filename, l->lineno); + } } } @@ -291,24 +280,24 @@ test_other (const struct normalization_test_file *file, uninorm_t nf) for (uc = 0; uc < 0x110000; uc++) { if (uc >= 0xD800 && uc < 0xE000) - { - /* A surrogate, not a character. Skip uc. */ - } + { + /* A surrogate, not a character. Skip uc. */ + } else if (uc == *p) - { - /* Skip uc. */ - p++; - } + { + /* Skip uc. */ + p++; + } else - { - uint32_t input[1]; - size_t length; - uint32_t *result; - - input[0] = uc; - result = u32_normalize (nf, input, 1, NULL, &length); - ASSERT (result != NULL && length == 1 && result[0] == uc); - } + { + uint32_t input[1]; + size_t length; + uint32_t *result; + + input[0] = uc; + result = u32_normalize (nf, input, 1, NULL, &length); + ASSERT (result != NULL && length == 1 && result[0] == uc); + } } } diff --git a/tests/uninorm/test-u32-normalize-big.h b/tests/uninorm/test-u32-normalize-big.h index f154daa..2482a34 100644 --- a/tests/uninorm/test-u32-normalize-big.h +++ b/tests/uninorm/test-u32-normalize-big.h @@ -1,5 +1,5 @@ /* Test of Unicode compliance of normalization of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -54,16 +54,16 @@ struct normalization_test_file /* Read the NormalizationTest.txt file and return its contents. */ extern void read_normalization_test_file (const char *filename, - struct normalization_test_file *file); + struct normalization_test_file *file); /* Perform the first compliance test. */ extern void test_specific (const struct normalization_test_file *file, - int (*check) (const uint32_t *c1, size_t c1_length, - const uint32_t *c2, size_t c2_length, - const uint32_t *c3, size_t c3_length, - const uint32_t *c4, size_t c4_length, - const uint32_t *c5, size_t c5_length)); + int (*check) (const uint32_t *c1, size_t c1_length, + const uint32_t *c2, size_t c2_length, + const uint32_t *c3, size_t c3_length, + const uint32_t *c4, size_t c4_length, + const uint32_t *c5, size_t c5_length)); /* Perform the second compliance test. */ extern void diff --git a/tests/uninorm/test-u32-normcmp.c b/tests/uninorm/test-u32-normcmp.c index 846300a..e48ceeb 100644 --- a/tests/uninorm/test-u32-normcmp.c +++ b/tests/uninorm/test-u32-normcmp.c @@ -1,5 +1,5 @@ /* Test of normalization insensitive comparison of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,21 +20,7 @@ #include "uninorm.h" -#include <stdio.h> -#include <stdlib.h> - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u32-normcmp.h" diff --git a/tests/uninorm/test-u32-normcmp.h b/tests/uninorm/test-u32-normcmp.h index 06d5fad..56d4cdb 100644 --- a/tests/uninorm/test-u32-normcmp.h +++ b/tests/uninorm/test-u32-normcmp.h @@ -1,5 +1,5 @@ /* Test of normalization insensitive comparison of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,7 +18,7 @@ static void test_ascii (int (*my_normcmp) (const uint32_t *, size_t, const uint32_t *, size_t, uninorm_t, int *), - uninorm_t nf) + uninorm_t nf) { /* Empty string. */ { diff --git a/tests/uninorm/test-u32-normcoll.c b/tests/uninorm/test-u32-normcoll.c index 916d433..08777ee 100644 --- a/tests/uninorm/test-u32-normcoll.c +++ b/tests/uninorm/test-u32-normcoll.c @@ -1,6 +1,6 @@ /* Test of locale dependent, normalization insensitive comparison of UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,21 +21,7 @@ #include "uninorm.h" -#include <stdio.h> -#include <stdlib.h> - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u32-normcmp.h" int diff --git a/tests/uninorm/test-u8-nfc.c b/tests/uninorm/test-u8-nfc.c index 52baa68..1a7745c 100644 --- a/tests/uninorm/test-u8-nfc.c +++ b/tests/uninorm/test-u8-nfc.c @@ -1,5 +1,5 @@ /* Test of canonical normalization of UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,29 +18,16 @@ #include <config.h> -#if GNULIB_UNINORM_U8_NORMALIZE +#if GNULIB_TEST_UNINORM_U8_NORMALIZE #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint8_t *input, size_t input_length, @@ -68,13 +55,13 @@ check (const uint8_t *input, size_t input_length, preallocated = (uint8_t *) malloc (length * sizeof (uint8_t)); result = u8_normalize (UNINORM_NFC, input, input_length, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u8_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -242,25 +229,25 @@ test_u8_nfc (void) { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint8_t input[] = { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', - ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, - 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, - 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, - 's', 'q', 'r', 't', '(', 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', - '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, - 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, - 0xEA, 0xB8, 0x80, '\n' + ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, + 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, + 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, + 's', 'q', 'r', 't', '(', 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', + '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, + 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, + 0xEA, 0xB8, 0x80, '\n' }; static const uint8_t decomposed[] = { 'G', 'r', 0x75, 0xCC, 0x88, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', - ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, - 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB8, 0xCC, 0x86, - 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, - 's', 'q', 'r', 't', '(', 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', - '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, - 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xE1, 0x84, 0x92, 0xE1, 0x85, 0xA1, 0xE1, 0x86, 0xAB, - 0xE1, 0x84, 0x80, 0xE1, 0x85, 0xB3, 0xE1, 0x86, 0xAF, '\n' + ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, + 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB8, 0xCC, 0x86, + 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, + 's', 'q', 'r', 't', '(', 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', + '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, + 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xE1, 0x84, 0x92, 0xE1, 0x85, 0xA1, 0xE1, 0x86, 0xAB, + 0xE1, 0x84, 0x80, 0xE1, 0x85, 0xB3, 0xE1, 0x86, 0xAF, '\n' }; ASSERT (check (input, SIZEOF (input), input, SIZEOF (input)) == 0); ASSERT (check (decomposed, SIZEOF (decomposed), input, SIZEOF (input)) == 0); @@ -278,89 +265,89 @@ test_u8_nfc (void) int pass; for (pass = 0; pass < 3; pass++) { - size_t repeat = 1; - size_t m = 100000; - uint8_t *input = (uint8_t *) malloc (2 * (2 * m - 1) * sizeof (uint8_t)); - if (input != NULL) - { - uint8_t *expected = input + (2 * m - 1); - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint8_t *p; - size_t i; - - input[0] = 0x41; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - break; - - case 1: - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - *p++ = 0xCC; - *p++ = 0x80; - } - for (; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - break; - - default: - abort (); - } - - expected[0] = 0xC3; - expected[1] = 0x80; - p = expected + 2; - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - for (i = 0; i < m2 - 1; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - - for (; repeat > 0; repeat--) - { - ASSERT (check (input, 2 * m - 1, expected, 2 * m - 2) == 0); - ASSERT (check (expected, 2 * m - 2, expected, 2 * m - 2) == 0); - } - - free (input); - } + size_t repeat = 1; + size_t m = 100000; + uint8_t *input = (uint8_t *) malloc (2 * (2 * m - 1) * sizeof (uint8_t)); + if (input != NULL) + { + uint8_t *expected = input + (2 * m - 1); + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint8_t *p; + size_t i; + + input[0] = 0x41; + p = input + 1; + switch (pass) + { + case 0: + for (i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + for (i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + break; + + case 1: + for (i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + for (i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + break; + + case 2: + for (i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + *p++ = 0xCC; + *p++ = 0x80; + } + for (; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + break; + + default: + abort (); + } + + expected[0] = 0xC3; + expected[1] = 0x80; + p = expected + 2; + for (i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + for (i = 0; i < m2 - 1; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + + for (; repeat > 0; repeat--) + { + ASSERT (check (input, 2 * m - 1, expected, 2 * m - 2) == 0); + ASSERT (check (expected, 2 * m - 2, expected, 2 * m - 2) == 0); + } + + free (input); + } } } } diff --git a/tests/uninorm/test-u8-nfd.c b/tests/uninorm/test-u8-nfd.c index d1d840a..082ded4 100644 --- a/tests/uninorm/test-u8-nfd.c +++ b/tests/uninorm/test-u8-nfd.c @@ -1,5 +1,5 @@ /* Test of canonical decomposition of UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,29 +18,16 @@ #include <config.h> -#if GNULIB_UNINORM_U8_NORMALIZE +#if GNULIB_TEST_UNINORM_U8_NORMALIZE #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint8_t *input, size_t input_length, @@ -68,13 +55,13 @@ check (const uint8_t *input, size_t input_length, preallocated = (uint8_t *) malloc (length * sizeof (uint8_t)); result = u8_normalize (UNINORM_NFD, input, input_length, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u8_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -230,25 +217,25 @@ test_u8_nfd (void) { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint8_t input[] = { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', - ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, - 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, - 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, - 's', 'q', 'r', 't', '(', 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', - '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, - 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, - 0xEA, 0xB8, 0x80, '\n' + ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, + 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, + 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, + 's', 'q', 'r', 't', '(', 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', + '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, + 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, + 0xEA, 0xB8, 0x80, '\n' }; static const uint8_t expected[] = { 'G', 'r', 0x75, 0xCC, 0x88, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', - ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, - 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB8, 0xCC, 0x86, - 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, - 's', 'q', 'r', 't', '(', 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', - '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, - 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xE1, 0x84, 0x92, 0xE1, 0x85, 0xA1, 0xE1, 0x86, 0xAB, - 0xE1, 0x84, 0x80, 0xE1, 0x85, 0xB3, 0xE1, 0x86, 0xAF, '\n' + ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, + 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB8, 0xCC, 0x86, + 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, + 's', 'q', 'r', 't', '(', 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', + '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, + 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xE1, 0x84, 0x92, 0xE1, 0x85, 0xA1, 0xE1, 0x86, 0xAB, + 0xE1, 0x84, 0x80, 0xE1, 0x85, 0xB3, 0xE1, 0x86, 0xAF, '\n' }; ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); } @@ -265,85 +252,85 @@ test_u8_nfd (void) int pass; for (pass = 0; pass < 3; pass++) { - size_t repeat = 1; - size_t m = 100000; - uint8_t *input = (uint8_t *) malloc (2 * (2 * m - 1) * sizeof (uint8_t)); - if (input != NULL) - { - uint8_t *expected = input + (2 * m - 1); - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint8_t *p; - size_t i; - - input[0] = 0x41; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - break; - - case 1: - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - *p++ = 0xCC; - *p++ = 0x80; - } - for (; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - break; - - default: - abort (); - } - - expected[0] = 0x41; - p = expected + 1; - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - - for (; repeat > 0; repeat--) - ASSERT (check (input, 2 * m - 1, expected, 2 * m - 1) == 0); - - free (input); - } + size_t repeat = 1; + size_t m = 100000; + uint8_t *input = (uint8_t *) malloc (2 * (2 * m - 1) * sizeof (uint8_t)); + if (input != NULL) + { + uint8_t *expected = input + (2 * m - 1); + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint8_t *p; + size_t i; + + input[0] = 0x41; + p = input + 1; + switch (pass) + { + case 0: + for (i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + for (i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + break; + + case 1: + for (i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + for (i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + break; + + case 2: + for (i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + *p++ = 0xCC; + *p++ = 0x80; + } + for (; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + break; + + default: + abort (); + } + + expected[0] = 0x41; + p = expected + 1; + for (i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + for (i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + + for (; repeat > 0; repeat--) + ASSERT (check (input, 2 * m - 1, expected, 2 * m - 1) == 0); + + free (input); + } } } } diff --git a/tests/uninorm/test-u8-nfkc.c b/tests/uninorm/test-u8-nfkc.c index 0ea4636..1ca1413 100644 --- a/tests/uninorm/test-u8-nfkc.c +++ b/tests/uninorm/test-u8-nfkc.c @@ -1,5 +1,5 @@ /* Test of compatibility normalization of UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,29 +18,16 @@ #include <config.h> -#if GNULIB_UNINORM_U8_NORMALIZE +#if GNULIB_TEST_UNINORM_U8_NORMALIZE #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint8_t *input, size_t input_length, @@ -68,13 +55,13 @@ check (const uint8_t *input, size_t input_length, preallocated = (uint8_t *) malloc (length * sizeof (uint8_t)); result = u8_normalize (UNINORM_NFKC, input, input_length, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u8_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -257,8 +244,8 @@ test_u8_nfkc (void) static const uint8_t input[] = { 0xEF, 0xB7, 0xBA }; static const uint8_t decomposed[] = { 0xD8, 0xB5, 0xD9, 0x84, 0xD9, 0x89, 0x20, 0xD8, 0xA7, 0xD9, 0x84, 0xD9, - 0x84, 0xD9, 0x87, 0x20, 0xD8, 0xB9, 0xD9, 0x84, 0xD9, 0x8A, 0xD9, 0x87, - 0x20, 0xD9, 0x88, 0xD8, 0xB3, 0xD9, 0x84, 0xD9, 0x85 + 0x84, 0xD9, 0x87, 0x20, 0xD8, 0xB9, 0xD9, 0x84, 0xD9, 0x8A, 0xD9, 0x87, + 0x20, 0xD9, 0x88, 0xD8, 0xB3, 0xD9, 0x84, 0xD9, 0x85 }; ASSERT (check (input, SIZEOF (input), decomposed, SIZEOF (decomposed)) == 0); ASSERT (check (decomposed, SIZEOF (decomposed), decomposed, SIZEOF (decomposed)) == 0); @@ -282,36 +269,36 @@ test_u8_nfkc (void) { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint8_t input[] = { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', - ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, - 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, - 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, - 's', 'q', 'r', 't', '(', 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', - '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, - 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, - 0xEA, 0xB8, 0x80, '\n' + ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, + 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, + 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, + 's', 'q', 'r', 't', '(', 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', + '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, + 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, + 0xEA, 0xB8, 0x80, '\n' }; static const uint8_t decomposed[] = { 'G', 'r', 0x75, 0xCC, 0x88, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', - ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, - 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB8, 0xCC, 0x86, - 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, - 's', 'q', 'r', 't', '(', 'b', 0x32, '-', '4', 'a', 'c', ')', ')', - '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, - 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xE1, 0x84, 0x92, 0xE1, 0x85, 0xA1, 0xE1, 0x86, 0xAB, - 0xE1, 0x84, 0x80, 0xE1, 0x85, 0xB3, 0xE1, 0x86, 0xAF, '\n' + ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, + 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB8, 0xCC, 0x86, + 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, + 's', 'q', 'r', 't', '(', 'b', 0x32, '-', '4', 'a', 'c', ')', ')', + '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, + 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xE1, 0x84, 0x92, 0xE1, 0x85, 0xA1, 0xE1, 0x86, 0xAB, + 0xE1, 0x84, 0x80, 0xE1, 0x85, 0xB3, 0xE1, 0x86, 0xAF, '\n' }; static const uint8_t expected[] = { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', - ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, - 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, - 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, - 's', 'q', 'r', 't', '(', 'b', 0x32, '-', '4', 'a', 'c', ')', ')', - '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, - 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, - 0xEA, 0xB8, 0x80, '\n' + ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, + 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, + 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, + 's', 'q', 'r', 't', '(', 'b', 0x32, '-', '4', 'a', 'c', ')', ')', + '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, + 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, + 0xEA, 0xB8, 0x80, '\n' }; ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); ASSERT (check (decomposed, SIZEOF (decomposed), expected, SIZEOF (expected)) == 0); @@ -330,89 +317,89 @@ test_u8_nfkc (void) int pass; for (pass = 0; pass < 3; pass++) { - size_t repeat = 1; - size_t m = 100000; - uint8_t *input = (uint8_t *) malloc (2 * (2 * m - 1) * sizeof (uint8_t)); - if (input != NULL) - { - uint8_t *expected = input + (2 * m - 1); - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint8_t *p; - size_t i; - - input[0] = 0x41; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - break; - - case 1: - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - *p++ = 0xCC; - *p++ = 0x80; - } - for (; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - break; - - default: - abort (); - } - - expected[0] = 0xC3; - expected[1] = 0x80; - p = expected + 2; - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - for (i = 0; i < m2 - 1; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - - for (; repeat > 0; repeat--) - { - ASSERT (check (input, 2 * m - 1, expected, 2 * m - 2) == 0); - ASSERT (check (expected, 2 * m - 2, expected, 2 * m - 2) == 0); - } - - free (input); - } + size_t repeat = 1; + size_t m = 100000; + uint8_t *input = (uint8_t *) malloc (2 * (2 * m - 1) * sizeof (uint8_t)); + if (input != NULL) + { + uint8_t *expected = input + (2 * m - 1); + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint8_t *p; + size_t i; + + input[0] = 0x41; + p = input + 1; + switch (pass) + { + case 0: + for (i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + for (i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + break; + + case 1: + for (i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + for (i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + break; + + case 2: + for (i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + *p++ = 0xCC; + *p++ = 0x80; + } + for (; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + break; + + default: + abort (); + } + + expected[0] = 0xC3; + expected[1] = 0x80; + p = expected + 2; + for (i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + for (i = 0; i < m2 - 1; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + + for (; repeat > 0; repeat--) + { + ASSERT (check (input, 2 * m - 1, expected, 2 * m - 2) == 0); + ASSERT (check (expected, 2 * m - 2, expected, 2 * m - 2) == 0); + } + + free (input); + } } } } diff --git a/tests/uninorm/test-u8-nfkd.c b/tests/uninorm/test-u8-nfkd.c index 2d883a0..2e29539 100644 --- a/tests/uninorm/test-u8-nfkd.c +++ b/tests/uninorm/test-u8-nfkd.c @@ -1,5 +1,5 @@ /* Test of compatibility decomposition of UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,29 +18,16 @@ #include <config.h> -#if GNULIB_UNINORM_U8_NORMALIZE +#if GNULIB_TEST_UNINORM_U8_NORMALIZE #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint8_t *input, size_t input_length, @@ -68,13 +55,13 @@ check (const uint8_t *input, size_t input_length, preallocated = (uint8_t *) malloc (length * sizeof (uint8_t)); result = u8_normalize (UNINORM_NFKD, input, input_length, preallocated, &length); if (!(result != NULL)) - return 4; + return 4; if (!(result != preallocated)) - return 5; + return 5; if (!(length == expected_length)) - return 6; + return 6; if (!(u8_cmp (result, expected, expected_length) == 0)) - return 7; + return 7; free (result); free (preallocated); } @@ -229,8 +216,8 @@ test_u8_nfkd (void) static const uint8_t input[] = { 0xEF, 0xB7, 0xBA }; static const uint8_t expected[] = { 0xD8, 0xB5, 0xD9, 0x84, 0xD9, 0x89, 0x20, 0xD8, 0xA7, 0xD9, 0x84, 0xD9, - 0x84, 0xD9, 0x87, 0x20, 0xD8, 0xB9, 0xD9, 0x84, 0xD9, 0x8A, 0xD9, 0x87, - 0x20, 0xD9, 0x88, 0xD8, 0xB3, 0xD9, 0x84, 0xD9, 0x85 + 0x84, 0xD9, 0x87, 0x20, 0xD8, 0xB9, 0xD9, 0x84, 0xD9, 0x8A, 0xD9, 0x87, + 0x20, 0xD9, 0x88, 0xD8, 0xB3, 0xD9, 0x84, 0xD9, 0x85 }; ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); } @@ -251,25 +238,25 @@ test_u8_nfkd (void) { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint8_t input[] = { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', - ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, - 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, - 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, - 's', 'q', 'r', 't', '(', 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', - '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, - 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xED, 0x95, 0x9C, - 0xEA, 0xB8, 0x80, '\n' + ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, + 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, + 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, + 's', 'q', 'r', 't', '(', 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', + '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, + 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, + 0xEA, 0xB8, 0x80, '\n' }; static const uint8_t expected[] = { 'G', 'r', 0x75, 0xCC, 0x88, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', - ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, - 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB8, 0xCC, 0x86, - 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, - 's', 'q', 'r', 't', '(', 'b', 0x32, '-', '4', 'a', 'c', ')', ')', - '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, - 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', - 0xE1, 0x84, 0x92, 0xE1, 0x85, 0xA1, 0xE1, 0x86, 0xAB, - 0xE1, 0x84, 0x80, 0xE1, 0x85, 0xB3, 0xE1, 0x86, 0xAF, '\n' + ' ', 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, + 0x81, 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB8, 0xCC, 0x86, + 0xD1, 0x82, 0xD0, 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, + 's', 'q', 'r', 't', '(', 'b', 0x32, '-', '4', 'a', 'c', ')', ')', + '/', '(', '2', 'a', ')', ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, + 0xE8, 0xAA, 0x9E, ',', 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xE1, 0x84, 0x92, 0xE1, 0x85, 0xA1, 0xE1, 0x86, 0xAB, + 0xE1, 0x84, 0x80, 0xE1, 0x85, 0xB3, 0xE1, 0x86, 0xAF, '\n' }; ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); } @@ -286,85 +273,85 @@ test_u8_nfkd (void) int pass; for (pass = 0; pass < 3; pass++) { - size_t repeat = 1; - size_t m = 100000; - uint8_t *input = (uint8_t *) malloc (2 * (2 * m - 1) * sizeof (uint8_t)); - if (input != NULL) - { - uint8_t *expected = input + (2 * m - 1); - size_t m1 = m / 2; - size_t m2 = (m - 1) / 2; - /* NB: m1 + m2 == m - 1. */ - uint8_t *p; - size_t i; - - input[0] = 0x41; - p = input + 1; - switch (pass) - { - case 0: - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - break; - - case 1: - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - break; - - case 2: - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - *p++ = 0xCC; - *p++ = 0x80; - } - for (; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - break; - - default: - abort (); - } - - expected[0] = 0x41; - p = expected + 1; - for (i = 0; i < m1; i++) - { - *p++ = 0xCC; - *p++ = 0x99; - } - for (i = 0; i < m2; i++) - { - *p++ = 0xCC; - *p++ = 0x80; - } - - for (; repeat > 0; repeat--) - ASSERT (check (input, 2 * m - 1, expected, 2 * m - 1) == 0); - - free (input); - } + size_t repeat = 1; + size_t m = 100000; + uint8_t *input = (uint8_t *) malloc (2 * (2 * m - 1) * sizeof (uint8_t)); + if (input != NULL) + { + uint8_t *expected = input + (2 * m - 1); + size_t m1 = m / 2; + size_t m2 = (m - 1) / 2; + /* NB: m1 + m2 == m - 1. */ + uint8_t *p; + size_t i; + + input[0] = 0x41; + p = input + 1; + switch (pass) + { + case 0: + for (i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + for (i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + break; + + case 1: + for (i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + for (i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + break; + + case 2: + for (i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + *p++ = 0xCC; + *p++ = 0x80; + } + for (; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + break; + + default: + abort (); + } + + expected[0] = 0x41; + p = expected + 1; + for (i = 0; i < m1; i++) + { + *p++ = 0xCC; + *p++ = 0x99; + } + for (i = 0; i < m2; i++) + { + *p++ = 0xCC; + *p++ = 0x80; + } + + for (; repeat > 0; repeat--) + ASSERT (check (input, 2 * m - 1, expected, 2 * m - 1) == 0); + + free (input); + } } } } diff --git a/tests/uninorm/test-u8-normcmp.c b/tests/uninorm/test-u8-normcmp.c index ec47947..4f09118 100644 --- a/tests/uninorm/test-u8-normcmp.c +++ b/tests/uninorm/test-u8-normcmp.c @@ -1,5 +1,5 @@ /* Test of normalization insensitive comparison of UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,21 +20,7 @@ #include "uninorm.h" -#include <stdio.h> -#include <stdlib.h> - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u8-normcmp.h" diff --git a/tests/uninorm/test-u8-normcmp.h b/tests/uninorm/test-u8-normcmp.h index 78c887d..790e3ae 100644 --- a/tests/uninorm/test-u8-normcmp.h +++ b/tests/uninorm/test-u8-normcmp.h @@ -1,5 +1,5 @@ /* Test of normalization insensitive comparison of UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,7 +18,7 @@ static void test_ascii (int (*my_normcmp) (const uint8_t *, size_t, const uint8_t *, size_t, uninorm_t, int *), - uninorm_t nf) + uninorm_t nf) { /* Empty string. */ { diff --git a/tests/uninorm/test-u8-normcoll.c b/tests/uninorm/test-u8-normcoll.c index edf9172..d205f28 100644 --- a/tests/uninorm/test-u8-normcoll.c +++ b/tests/uninorm/test-u8-normcoll.c @@ -1,6 +1,6 @@ /* Test of locale dependent, normalization insensitive comparison of UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,21 +21,7 @@ #include "uninorm.h" -#include <stdio.h> -#include <stdlib.h> - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u8-normcmp.h" int diff --git a/tests/uninorm/test-uninorm-filter-nfc.c b/tests/uninorm/test-uninorm-filter-nfc.c index 32b77ef..65bf8a9 100644 --- a/tests/uninorm/test-uninorm-filter-nfc.c +++ b/tests/uninorm/test-uninorm-filter-nfc.c @@ -1,5 +1,5 @@ /* Test of canonical normalization of streams. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,23 +20,10 @@ #include "uninorm.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* A stream of Unicode characters that simply accumulates the contents. */ @@ -99,20 +86,20 @@ main () { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ static const uint32_t input[] = { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; static const uint32_t decomposed[] = { 'G', 'r', 0x0075, 0x0308, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', - 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', + 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' }; ASSERT (check (input, SIZEOF (input), input, SIZEOF (input)) == 0); ASSERT (check (decomposed, SIZEOF (decomposed), input, SIZEOF (input)) == 0); diff --git a/tests/unistdio/test-u16-asnprintf1.c b/tests/unistdio/test-u16-asnprintf1.c index 53fedf3..3d4897c 100644 --- a/tests/unistdio/test-u16-asnprintf1.c +++ b/tests/unistdio/test-u16-asnprintf1.c @@ -1,5 +1,5 @@ /* Test of u16_asnprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,25 +23,12 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u16-asnprintf1.h" diff --git a/tests/unistdio/test-u16-asnprintf1.h b/tests/unistdio/test-u16-asnprintf1.h index 34d4f82..9d557ba 100644 --- a/tests/unistdio/test-u16-asnprintf1.h +++ b/tests/unistdio/test-u16-asnprintf1.h @@ -1,5 +1,5 @@ /* Test of u16_[v]asnprintf() function. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,7 +29,7 @@ test_function (uint16_t * (*my_asnprintf) (uint16_t *, size_t *, const char *, . size_t length = size; uint16_t *result = my_asnprintf (NULL, &length, "%d", 12345); static const uint16_t expected[] = - { '1', '2', '3', '4', '5', 0 }; + { '1', '2', '3', '4', '5', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); ASSERT (length == 5); @@ -39,9 +39,9 @@ test_function (uint16_t * (*my_asnprintf) (uint16_t *, size_t *, const char *, . for (size = 0; size <= 8; size++) { static const uint16_t initializer[] = - { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F', 0 }; + { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F', 0 }; static const uint16_t expected[] = - { '1', '2', '3', '4', '5', 0 }; + { '1', '2', '3', '4', '5', 0 }; size_t length; uint16_t *result; @@ -52,9 +52,9 @@ test_function (uint16_t * (*my_asnprintf) (uint16_t *, size_t *, const char *, . ASSERT (u16_strcmp (result, expected) == 0); ASSERT (length == 5); if (size < 6) - ASSERT (result != buf); + ASSERT (result != buf); ASSERT (u16_cmp (buf + size, initializer + size, 8 - size) == 0); if (result != buf) - free (result); + free (result); } } diff --git a/tests/unistdio/test-u16-printf1.h b/tests/unistdio/test-u16-printf1.h index 199ece9..1965ce9 100644 --- a/tests/unistdio/test-u16-printf1.h +++ b/tests/unistdio/test-u16-printf1.h @@ -1,5 +1,5 @@ /* Test of u16_v[a]s[n]printf() function. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -67,36 +67,36 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) static const uint8_t unicode_string[] = "Hello"; { uint16_t *result = - my_xasprintf ("%U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%U %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* Width. */ uint16_t *result = - my_xasprintf ("%10U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%10U %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_LEFT. */ uint16_t *result = - my_xasprintf ("%-10U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-10U %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; + { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_ZERO: no effect. */ uint16_t *result = - my_xasprintf ("%010U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%010U %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); @@ -107,36 +107,36 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) static const uint16_t unicode_string[] = { 'H', 'e', 'l', 'l', 'o', 0 }; { uint16_t *result = - my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* Width. */ uint16_t *result = - my_xasprintf ("%10lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%10lU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_LEFT. */ uint16_t *result = - my_xasprintf ("%-10lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-10lU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; + { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_ZERO: no effect. */ uint16_t *result = - my_xasprintf ("%010lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%010lU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); @@ -147,36 +147,36 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) static const uint32_t unicode_string[] = { 'H', 'e', 'l', 'l', 'o', 0 }; { uint16_t *result = - my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* Width. */ uint16_t *result = - my_xasprintf ("%10llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%10llU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_LEFT. */ uint16_t *result = - my_xasprintf ("%-10llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-10llU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; + { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_ZERO: no effect. */ uint16_t *result = - my_xasprintf ("%010llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%010llU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); @@ -190,8 +190,8 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("Mr. %s %d", "Ronald Reagan", 33, 44, 55); static const uint16_t expected[] = { 'M', 'r', '.', ' ', 'R', 'o', 'n', 'a', 'l', 'd', - ' ', 'R', 'e', 'a', 'g', 'a', 'n', ' ', '3', '3', - 0 + ' ', 'R', 'e', 'a', 'g', 'a', 'n', ' ', '3', '3', + 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); @@ -203,8 +203,8 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("Mr. %20s %d", "Ronald Reagan", 33, 44, 55); static const uint16_t expected[] = { 'M', 'r', '.', ' ', ' ', ' ', ' ', ' ', ' ', ' ', - ' ', 'R', 'o', 'n', 'a', 'l', 'd', ' ', 'R', 'e', - 'a', 'g', 'a', 'n', ' ', '3', '3', 0 + ' ', 'R', 'o', 'n', 'a', 'l', 'd', ' ', 'R', 'e', + 'a', 'g', 'a', 'n', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); @@ -216,8 +216,8 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("Mr. %-20s %d", "Ronald Reagan", 33, 44, 55); static const uint16_t expected[] = { 'M', 'r', '.', ' ', 'R', 'o', 'n', 'a', 'l', 'd', - ' ', 'R', 'e', 'a', 'g', 'a', 'n', ' ', ' ', ' ', - ' ', ' ', ' ', ' ', ' ', '3', '3', 0 + ' ', 'R', 'e', 'a', 'g', 'a', 'n', ' ', ' ', ' ', + ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); @@ -229,8 +229,8 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("Mr. %020s %d", "Ronald Reagan", 33, 44, 55); static const uint16_t expected[] = { 'M', 'r', '.', ' ', ' ', ' ', ' ', ' ', ' ', ' ', - ' ', 'R', 'o', 'n', 'a', 'l', 'd', ' ', 'R', 'e', - 'a', 'g', 'a', 'n', ' ', '3', '3', 0 + ' ', 'R', 'o', 'n', 'a', 'l', 'd', ' ', 'R', 'e', + 'a', 'g', 'a', 'n', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); @@ -253,9 +253,9 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) { '0', 'x', 'c', '.', '9', '1', 'p', '-', '2', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0 - || u16_strcmp (result, expected3) == 0 - || u16_strcmp (result, expected4) == 0); + || u16_strcmp (result, expected2) == 0 + || u16_strcmp (result, expected3) == 0 + || u16_strcmp (result, expected4) == 0); free (result); } @@ -272,9 +272,9 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) { ' ', ' ', ' ', ' ', '0', 'x', 'e', 'p', '-', '3', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0 - || u16_strcmp (result, expected3) == 0 - || u16_strcmp (result, expected4) == 0); + || u16_strcmp (result, expected2) == 0 + || u16_strcmp (result, expected3) == 0 + || u16_strcmp (result, expected4) == 0); free (result); } @@ -283,29 +283,29 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.10a %d", 1.75, 33, 44, 55); static const uint16_t expected1[] = { '0', 'x', '1', '.', 'c', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', + 0 }; static const uint16_t expected2[] = { '0', 'x', '3', '.', '8', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', + 0 }; static const uint16_t expected3[] = { '0', 'x', '7', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', + 0 }; static const uint16_t expected4[] = { '0', 'x', 'e', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', + 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0 - || u16_strcmp (result, expected3) == 0 - || u16_strcmp (result, expected4) == 0); + || u16_strcmp (result, expected2) == 0 + || u16_strcmp (result, expected3) == 0 + || u16_strcmp (result, expected4) == 0); free (result); } @@ -314,45 +314,45 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.50a %d", 1.75, 33, 44, 55); static const uint16_t expected1[] = { '0', 'x', '1', '.', 'c', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', + 0 }; static const uint16_t expected2[] = { '0', 'x', '3', '.', '8', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', + 0 }; static const uint16_t expected3[] = { '0', 'x', '7', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', + 0 }; static const uint16_t expected4[] = { '0', 'x', 'e', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', + 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0 - || u16_strcmp (result, expected3) == 0 - || u16_strcmp (result, expected4) == 0); + || u16_strcmp (result, expected2) == 0 + || u16_strcmp (result, expected3) == 0 + || u16_strcmp (result, expected4) == 0); free (result); } @@ -361,25 +361,25 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%La %d", 3.1416015625L, 33, 44, 55); static const uint16_t expected1[] = { '0', 'x', '1', '.', '9', '2', '2', 'p', '+', '1', - ' ', '3', '3', 0 + ' ', '3', '3', 0 }; static const uint16_t expected2[] = { '0', 'x', '3', '.', '2', '4', '4', 'p', '+', '0', - ' ', '3', '3', 0 + ' ', '3', '3', 0 }; static const uint16_t expected3[] = { '0', 'x', '6', '.', '4', '8', '8', 'p', '-', '1', - ' ', '3', '3', 0 + ' ', '3', '3', 0 }; static const uint16_t expected4[] = { '0', 'x', 'c', '.', '9', '1', 'p', '-', '2', ' ', - '3', '3', 0 + '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0 - || u16_strcmp (result, expected3) == 0 - || u16_strcmp (result, expected4) == 0); + || u16_strcmp (result, expected2) == 0 + || u16_strcmp (result, expected3) == 0 + || u16_strcmp (result, expected4) == 0); free (result); } @@ -396,9 +396,9 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) { ' ', ' ', ' ', ' ', '0', 'x', 'e', 'p', '-', '3', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0 - || u16_strcmp (result, expected3) == 0 - || u16_strcmp (result, expected4) == 0); + || u16_strcmp (result, expected2) == 0 + || u16_strcmp (result, expected3) == 0 + || u16_strcmp (result, expected4) == 0); free (result); } @@ -407,29 +407,29 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.10La %d", 1.75L, 33, 44, 55); static const uint16_t expected1[] = { '0', 'x', '1', '.', 'c', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', + 0 }; static const uint16_t expected2[] = { '0', 'x', '3', '.', '8', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', + 0 }; static const uint16_t expected3[] = { '0', 'x', '7', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', + 0 }; static const uint16_t expected4[] = { '0', 'x', 'e', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', + 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0 - || u16_strcmp (result, expected3) == 0 - || u16_strcmp (result, expected4) == 0); + || u16_strcmp (result, expected2) == 0 + || u16_strcmp (result, expected3) == 0 + || u16_strcmp (result, expected4) == 0); free (result); } @@ -438,45 +438,45 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.50La %d", 1.75L, 33, 44, 55); static const uint16_t expected1[] = { '0', 'x', '1', '.', 'c', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', + 0 }; static const uint16_t expected2[] = { '0', 'x', '3', '.', '8', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', + 0 }; static const uint16_t expected3[] = { '0', 'x', '7', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', + 0 }; static const uint16_t expected4[] = { '0', 'x', 'e', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', + 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0 - || u16_strcmp (result, expected3) == 0 - || u16_strcmp (result, expected4) == 0); + || u16_strcmp (result, expected2) == 0 + || u16_strcmp (result, expected3) == 0 + || u16_strcmp (result, expected4) == 0); free (result); } @@ -591,15 +591,15 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%e %d", 12.75, 33, 44, 55); static const uint16_t expected1[] = { '1', '.', '2', '7', '5', '0', '0', '0', 'e', '+', - '0', '1', ' ', '3', '3', 0 + '0', '1', ' ', '3', '3', 0 }; static const uint16_t expected2[] = { '1', '.', '2', '7', '5', '0', '0', '0', 'e', '+', - '0', '0', '1', ' ', '3', '3', 0 + '0', '0', '1', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0); + || u16_strcmp (result, expected2) == 0); free (result); } @@ -608,15 +608,15 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%15e %d", 1.75, 33, 44, 55); static const uint16_t expected1[] = { ' ', ' ', ' ', '1', '.', '7', '5', '0', '0', '0', - '0', 'e', '+', '0', '0', ' ', '3', '3', 0 + '0', 'e', '+', '0', '0', ' ', '3', '3', 0 }; static const uint16_t expected2[] = { ' ', ' ', '1', '.', '7', '5', '0', '0', '0', '0', - 'e', '+', '0', '0', '0', ' ', '3', '3', 0 + 'e', '+', '0', '0', '0', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0); + || u16_strcmp (result, expected2) == 0); free (result); } @@ -629,7 +629,7 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) { '1', 'e', '+', '0', '0', '3', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0); + || u16_strcmp (result, expected2) == 0); free (result); } @@ -638,7 +638,7 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%Le %d", 12.75L, 33, 44, 55); static const uint16_t expected[] = { '1', '.', '2', '7', '5', '0', '0', '0', 'e', '+', - '0', '1', ' ', '3', '3', 0 + '0', '1', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); @@ -650,7 +650,7 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%15Le %d", 1.75L, 33, 44, 55); static const uint16_t expected[] = { ' ', ' ', ' ', '1', '.', '7', '5', '0', '0', '0', - '0', 'e', '+', '0', '0', ' ', '3', '3', 0 + '0', 'e', '+', '0', '0', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); @@ -698,7 +698,7 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) { '1', 'e', '+', '0', '0', '3', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0); + || u16_strcmp (result, expected2) == 0); free (result); } @@ -774,47 +774,47 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) static const uint8_t unicode_string[] = "Rafa\305\202 Maszkowski"; /* Rafał Maszkowski */ { uint16_t *result = - my_xasprintf ("%U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%U %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', - 'k', 'o', 'w', 's', 'k', 'i', ' ', '3', '3', 0 - }; + { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', + 'k', 'o', 'w', 's', 'k', 'i', ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* Width. */ uint16_t *result = - my_xasprintf ("%20U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%20U %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', - 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', + 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_LEFT. */ uint16_t *result = - my_xasprintf ("%-20U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-20U %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', - 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ', - ' ', '3', '3', 0 - }; + { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', + 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_ZERO: no effect. */ uint16_t *result = - my_xasprintf ("%020U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%020U %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', - 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', + 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); @@ -824,52 +824,52 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) { static const uint16_t unicode_string[] = /* Rafał Maszkowski */ { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i', 0 + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i', 0 }; { uint16_t *result = - my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', - 'k', 'o', 'w', 's', 'k', 'i', ' ', '3', '3', 0 - }; + { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', + 'k', 'o', 'w', 's', 'k', 'i', ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* Width. */ uint16_t *result = - my_xasprintf ("%20lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%20lU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', - 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', + 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_LEFT. */ uint16_t *result = - my_xasprintf ("%-20lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-20lU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', - 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ', - ' ', '3', '3', 0 - }; + { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', + 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_ZERO: no effect. */ uint16_t *result = - my_xasprintf ("%020lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%020lU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', - 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', + 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); @@ -879,52 +879,52 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) { static const uint32_t unicode_string[] = /* Rafał Maszkowski */ { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i', 0 + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i', 0 }; { uint16_t *result = - my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', - 'k', 'o', 'w', 's', 'k', 'i', ' ', '3', '3', 0 - }; + { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', + 'k', 'o', 'w', 's', 'k', 'i', ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* Width. */ uint16_t *result = - my_xasprintf ("%20llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%20llU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', - 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', + 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_LEFT. */ uint16_t *result = - my_xasprintf ("%-20llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-20llU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', - 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ', - ' ', '3', '3', 0 - }; + { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', + 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_ZERO: no effect. */ uint16_t *result = - my_xasprintf ("%020llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%020llU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', - 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', + 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); diff --git a/tests/unistdio/test-u16-vasnprintf1.c b/tests/unistdio/test-u16-vasnprintf1.c index b236e3f..268b32c 100644 --- a/tests/unistdio/test-u16-vasnprintf1.c +++ b/tests/unistdio/test-u16-vasnprintf1.c @@ -1,5 +1,5 @@ /* Test of u16_vasnprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,25 +23,12 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u16-asnprintf1.h" #include "test-u16-printf1.h" diff --git a/tests/unistdio/test-u16-vasnprintf2.c b/tests/unistdio/test-u16-vasnprintf2.c index 6f7b7cf..c43967c 100644 --- a/tests/unistdio/test-u16-vasnprintf2.c +++ b/tests/unistdio/test-u16-vasnprintf2.c @@ -1,5 +1,5 @@ /* Test of u16_vasnprintf() function in an ISO-8859-1 locale. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,25 +22,12 @@ #include <locale.h> #include <stdarg.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static void test_function (uint16_t * (*my_asnprintf) (uint16_t *, size_t *, const char *, ...)) @@ -52,9 +39,9 @@ test_function (uint16_t * (*my_asnprintf) (uint16_t *, size_t *, const char *, . { size_t length; uint16_t *result = - my_asnprintf (NULL, &length, "%s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%s %d", locale_string, 33, 44, 55); static const uint16_t expected[] = - { 0x00c4, 'r', 'g', 'e', 'r', ' ', '3', '3', 0 }; + { 0x00c4, 'r', 'g', 'e', 'r', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); ASSERT (length == u16_strlen (result)); @@ -63,11 +50,11 @@ test_function (uint16_t * (*my_asnprintf) (uint16_t *, size_t *, const char *, . { /* Width. */ size_t length; uint16_t *result = - my_asnprintf (NULL, &length, "%10s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%10s %d", locale_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 0x00c4, 'r', 'g', 'e', 'r', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', ' ', 0x00c4, 'r', 'g', 'e', 'r', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); ASSERT (length == u16_strlen (result)); @@ -76,11 +63,11 @@ test_function (uint16_t * (*my_asnprintf) (uint16_t *, size_t *, const char *, . { /* FLAG_LEFT. */ size_t length; uint16_t *result = - my_asnprintf (NULL, &length, "%-10s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%-10s %d", locale_string, 33, 44, 55); static const uint16_t expected[] = - { 0x00c4, 'r', 'g', 'e', 'r', ' ', ' ', ' ', ' ', ' ', - ' ', '3', '3', 0 - }; + { 0x00c4, 'r', 'g', 'e', 'r', ' ', ' ', ' ', ' ', ' ', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); ASSERT (length == u16_strlen (result)); @@ -89,11 +76,11 @@ test_function (uint16_t * (*my_asnprintf) (uint16_t *, size_t *, const char *, . { /* FLAG_ZERO: no effect. */ size_t length; uint16_t *result = - my_asnprintf (NULL, &length, "%010s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%010s %d", locale_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 0x00c4, 'r', 'g', 'e', 'r', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', ' ', 0x00c4, 'r', 'g', 'e', 'r', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); ASSERT (length == u16_strlen (result)); diff --git a/tests/unistdio/test-u16-vasnprintf3.c b/tests/unistdio/test-u16-vasnprintf3.c index 1402181..6e741c9 100644 --- a/tests/unistdio/test-u16-vasnprintf3.c +++ b/tests/unistdio/test-u16-vasnprintf3.c @@ -1,5 +1,5 @@ /* Test of u16_vasnprintf() function in an UTF-8 locale. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,25 +22,12 @@ #include <locale.h> #include <stdarg.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static void test_function (uint16_t * (*my_asnprintf) (uint16_t *, size_t *, const char *, ...)) @@ -52,9 +39,9 @@ test_function (uint16_t * (*my_asnprintf) (uint16_t *, size_t *, const char *, . { size_t length; uint16_t *result = - my_asnprintf (NULL, &length, "%s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%s %d", locale_string, 33, 44, 55); static const uint16_t expected[] = - { 0x00c4, 'r', 'g', 'e', 'r', ' ', '3', '3', 0 }; + { 0x00c4, 'r', 'g', 'e', 'r', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); ASSERT (length == u16_strlen (result)); @@ -63,11 +50,11 @@ test_function (uint16_t * (*my_asnprintf) (uint16_t *, size_t *, const char *, . { /* Width. */ size_t length; uint16_t *result = - my_asnprintf (NULL, &length, "%10s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%10s %d", locale_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 0x00c4, 'r', 'g', 'e', 'r', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', ' ', 0x00c4, 'r', 'g', 'e', 'r', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); ASSERT (length == u16_strlen (result)); @@ -76,11 +63,11 @@ test_function (uint16_t * (*my_asnprintf) (uint16_t *, size_t *, const char *, . { /* FLAG_LEFT. */ size_t length; uint16_t *result = - my_asnprintf (NULL, &length, "%-10s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%-10s %d", locale_string, 33, 44, 55); static const uint16_t expected[] = - { 0x00c4, 'r', 'g', 'e', 'r', ' ', ' ', ' ', ' ', ' ', - ' ', '3', '3', 0 - }; + { 0x00c4, 'r', 'g', 'e', 'r', ' ', ' ', ' ', ' ', ' ', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); ASSERT (length == u16_strlen (result)); @@ -89,11 +76,11 @@ test_function (uint16_t * (*my_asnprintf) (uint16_t *, size_t *, const char *, . { /* FLAG_ZERO: no effect. */ size_t length; uint16_t *result = - my_asnprintf (NULL, &length, "%010s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%010s %d", locale_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 0x00c4, 'r', 'g', 'e', 'r', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', ' ', 0x00c4, 'r', 'g', 'e', 'r', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); ASSERT (length == u16_strlen (result)); diff --git a/tests/unistdio/test-u16-vasprintf1.c b/tests/unistdio/test-u16-vasprintf1.c index 8b96126..5b60248 100644 --- a/tests/unistdio/test-u16-vasprintf1.c +++ b/tests/unistdio/test-u16-vasprintf1.c @@ -1,5 +1,5 @@ /* Test of u16_vasprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,25 +23,12 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u16-printf1.h" diff --git a/tests/unistdio/test-u16-vsnprintf1.c b/tests/unistdio/test-u16-vsnprintf1.c index 886e95b..5c2d86c 100644 --- a/tests/unistdio/test-u16-vsnprintf1.c +++ b/tests/unistdio/test-u16-vsnprintf1.c @@ -1,5 +1,5 @@ /* Test of u16_vsnprintf() function. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,7 +23,6 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> @@ -31,19 +30,7 @@ #include "unistr.h" #include "xalloc.h" #include "progname.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u16-printf1.h" diff --git a/tests/unistdio/test-u16-vsprintf1.c b/tests/unistdio/test-u16-vsprintf1.c index e6b6eab..ad42e07 100644 --- a/tests/unistdio/test-u16-vsprintf1.c +++ b/tests/unistdio/test-u16-vsprintf1.c @@ -1,5 +1,5 @@ /* Test of u16_vsprintf() function. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,7 +23,6 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> @@ -31,19 +30,7 @@ #include "unistr.h" #include "xalloc.h" #include "progname.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u16-printf1.h" diff --git a/tests/unistdio/test-u32-asnprintf1.c b/tests/unistdio/test-u32-asnprintf1.c index 252e919..c17fcc6 100644 --- a/tests/unistdio/test-u32-asnprintf1.c +++ b/tests/unistdio/test-u32-asnprintf1.c @@ -1,5 +1,5 @@ /* Test of u32_asnprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,25 +23,12 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u32-asnprintf1.h" diff --git a/tests/unistdio/test-u32-asnprintf1.h b/tests/unistdio/test-u32-asnprintf1.h index dfaed98..9f73116 100644 --- a/tests/unistdio/test-u32-asnprintf1.h +++ b/tests/unistdio/test-u32-asnprintf1.h @@ -1,5 +1,5 @@ /* Test of u32_[v]asnprintf() function. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,7 +29,7 @@ test_function (uint32_t * (*my_asnprintf) (uint32_t *, size_t *, const char *, . size_t length = size; uint32_t *result = my_asnprintf (NULL, &length, "%d", 12345); static const uint32_t expected[] = - { '1', '2', '3', '4', '5', 0 }; + { '1', '2', '3', '4', '5', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); ASSERT (length == 5); @@ -39,9 +39,9 @@ test_function (uint32_t * (*my_asnprintf) (uint32_t *, size_t *, const char *, . for (size = 0; size <= 8; size++) { static const uint32_t initializer[] = - { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F', 0 }; + { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F', 0 }; static const uint32_t expected[] = - { '1', '2', '3', '4', '5', 0 }; + { '1', '2', '3', '4', '5', 0 }; size_t length; uint32_t *result; @@ -52,9 +52,9 @@ test_function (uint32_t * (*my_asnprintf) (uint32_t *, size_t *, const char *, . ASSERT (u32_strcmp (result, expected) == 0); ASSERT (length == 5); if (size < 6) - ASSERT (result != buf); + ASSERT (result != buf); ASSERT (u32_cmp (buf + size, initializer + size, 8 - size) == 0); if (result != buf) - free (result); + free (result); } } diff --git a/tests/unistdio/test-u32-printf1.h b/tests/unistdio/test-u32-printf1.h index 240232f..00b9a60 100644 --- a/tests/unistdio/test-u32-printf1.h +++ b/tests/unistdio/test-u32-printf1.h @@ -1,5 +1,5 @@ /* Test of u32_v[a]s[n]printf() function. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -67,36 +67,36 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) static const uint8_t unicode_string[] = "Hello"; { uint32_t *result = - my_xasprintf ("%U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%U %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* Width. */ uint32_t *result = - my_xasprintf ("%10U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%10U %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* FLAG_LEFT. */ uint32_t *result = - my_xasprintf ("%-10U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-10U %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; + { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* FLAG_ZERO: no effect. */ uint32_t *result = - my_xasprintf ("%010U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%010U %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); @@ -107,36 +107,36 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) static const uint16_t unicode_string[] = { 'H', 'e', 'l', 'l', 'o', 0 }; { uint32_t *result = - my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* Width. */ uint32_t *result = - my_xasprintf ("%10lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%10lU %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* FLAG_LEFT. */ uint32_t *result = - my_xasprintf ("%-10lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-10lU %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; + { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* FLAG_ZERO: no effect. */ uint32_t *result = - my_xasprintf ("%010lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%010lU %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); @@ -147,36 +147,36 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) static const uint32_t unicode_string[] = { 'H', 'e', 'l', 'l', 'o', 0 }; { uint32_t *result = - my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* Width. */ uint32_t *result = - my_xasprintf ("%10llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%10llU %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* FLAG_LEFT. */ uint32_t *result = - my_xasprintf ("%-10llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-10llU %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; + { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* FLAG_ZERO: no effect. */ uint32_t *result = - my_xasprintf ("%010llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%010llU %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); @@ -190,8 +190,8 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("Mr. %s %d", "Ronald Reagan", 33, 44, 55); static const uint32_t expected[] = { 'M', 'r', '.', ' ', 'R', 'o', 'n', 'a', 'l', 'd', - ' ', 'R', 'e', 'a', 'g', 'a', 'n', ' ', '3', '3', - 0 + ' ', 'R', 'e', 'a', 'g', 'a', 'n', ' ', '3', '3', + 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); @@ -203,8 +203,8 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("Mr. %20s %d", "Ronald Reagan", 33, 44, 55); static const uint32_t expected[] = { 'M', 'r', '.', ' ', ' ', ' ', ' ', ' ', ' ', ' ', - ' ', 'R', 'o', 'n', 'a', 'l', 'd', ' ', 'R', 'e', - 'a', 'g', 'a', 'n', ' ', '3', '3', 0 + ' ', 'R', 'o', 'n', 'a', 'l', 'd', ' ', 'R', 'e', + 'a', 'g', 'a', 'n', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); @@ -216,8 +216,8 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("Mr. %-20s %d", "Ronald Reagan", 33, 44, 55); static const uint32_t expected[] = { 'M', 'r', '.', ' ', 'R', 'o', 'n', 'a', 'l', 'd', - ' ', 'R', 'e', 'a', 'g', 'a', 'n', ' ', ' ', ' ', - ' ', ' ', ' ', ' ', ' ', '3', '3', 0 + ' ', 'R', 'e', 'a', 'g', 'a', 'n', ' ', ' ', ' ', + ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); @@ -229,8 +229,8 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("Mr. %020s %d", "Ronald Reagan", 33, 44, 55); static const uint32_t expected[] = { 'M', 'r', '.', ' ', ' ', ' ', ' ', ' ', ' ', ' ', - ' ', 'R', 'o', 'n', 'a', 'l', 'd', ' ', 'R', 'e', - 'a', 'g', 'a', 'n', ' ', '3', '3', 0 + ' ', 'R', 'o', 'n', 'a', 'l', 'd', ' ', 'R', 'e', + 'a', 'g', 'a', 'n', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); @@ -253,9 +253,9 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) { '0', 'x', 'c', '.', '9', '1', 'p', '-', '2', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected1) == 0 - || u32_strcmp (result, expected2) == 0 - || u32_strcmp (result, expected3) == 0 - || u32_strcmp (result, expected4) == 0); + || u32_strcmp (result, expected2) == 0 + || u32_strcmp (result, expected3) == 0 + || u32_strcmp (result, expected4) == 0); free (result); } @@ -272,9 +272,9 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) { ' ', ' ', ' ', ' ', '0', 'x', 'e', 'p', '-', '3', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected1) == 0 - || u32_strcmp (result, expected2) == 0 - || u32_strcmp (result, expected3) == 0 - || u32_strcmp (result, expected4) == 0); + || u32_strcmp (result, expected2) == 0 + || u32_strcmp (result, expected3) == 0 + || u32_strcmp (result, expected4) == 0); free (result); } @@ -283,29 +283,29 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.10a %d", 1.75, 33, 44, 55); static const uint32_t expected1[] = { '0', 'x', '1', '.', 'c', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', + 0 }; static const uint32_t expected2[] = { '0', 'x', '3', '.', '8', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', + 0 }; static const uint32_t expected3[] = { '0', 'x', '7', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', + 0 }; static const uint32_t expected4[] = { '0', 'x', 'e', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', + 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected1) == 0 - || u32_strcmp (result, expected2) == 0 - || u32_strcmp (result, expected3) == 0 - || u32_strcmp (result, expected4) == 0); + || u32_strcmp (result, expected2) == 0 + || u32_strcmp (result, expected3) == 0 + || u32_strcmp (result, expected4) == 0); free (result); } @@ -314,45 +314,45 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.50a %d", 1.75, 33, 44, 55); static const uint32_t expected1[] = { '0', 'x', '1', '.', 'c', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', + 0 }; static const uint32_t expected2[] = { '0', 'x', '3', '.', '8', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', + 0 }; static const uint32_t expected3[] = { '0', 'x', '7', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', + 0 }; static const uint32_t expected4[] = { '0', 'x', 'e', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', + 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected1) == 0 - || u32_strcmp (result, expected2) == 0 - || u32_strcmp (result, expected3) == 0 - || u32_strcmp (result, expected4) == 0); + || u32_strcmp (result, expected2) == 0 + || u32_strcmp (result, expected3) == 0 + || u32_strcmp (result, expected4) == 0); free (result); } @@ -361,25 +361,25 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%La %d", 3.1416015625L, 33, 44, 55); static const uint32_t expected1[] = { '0', 'x', '1', '.', '9', '2', '2', 'p', '+', '1', - ' ', '3', '3', 0 + ' ', '3', '3', 0 }; static const uint32_t expected2[] = { '0', 'x', '3', '.', '2', '4', '4', 'p', '+', '0', - ' ', '3', '3', 0 + ' ', '3', '3', 0 }; static const uint32_t expected3[] = { '0', 'x', '6', '.', '4', '8', '8', 'p', '-', '1', - ' ', '3', '3', 0 + ' ', '3', '3', 0 }; static const uint32_t expected4[] = { '0', 'x', 'c', '.', '9', '1', 'p', '-', '2', ' ', - '3', '3', 0 + '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected1) == 0 - || u32_strcmp (result, expected2) == 0 - || u32_strcmp (result, expected3) == 0 - || u32_strcmp (result, expected4) == 0); + || u32_strcmp (result, expected2) == 0 + || u32_strcmp (result, expected3) == 0 + || u32_strcmp (result, expected4) == 0); free (result); } @@ -396,9 +396,9 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) { ' ', ' ', ' ', ' ', '0', 'x', 'e', 'p', '-', '3', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected1) == 0 - || u32_strcmp (result, expected2) == 0 - || u32_strcmp (result, expected3) == 0 - || u32_strcmp (result, expected4) == 0); + || u32_strcmp (result, expected2) == 0 + || u32_strcmp (result, expected3) == 0 + || u32_strcmp (result, expected4) == 0); free (result); } @@ -407,29 +407,29 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.10La %d", 1.75L, 33, 44, 55); static const uint32_t expected1[] = { '0', 'x', '1', '.', 'c', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', + 0 }; static const uint32_t expected2[] = { '0', 'x', '3', '.', '8', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', + 0 }; static const uint32_t expected3[] = { '0', 'x', '7', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', + 0 }; static const uint32_t expected4[] = { '0', 'x', 'e', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', + 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected1) == 0 - || u32_strcmp (result, expected2) == 0 - || u32_strcmp (result, expected3) == 0 - || u32_strcmp (result, expected4) == 0); + || u32_strcmp (result, expected2) == 0 + || u32_strcmp (result, expected3) == 0 + || u32_strcmp (result, expected4) == 0); free (result); } @@ -438,45 +438,45 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.50La %d", 1.75L, 33, 44, 55); static const uint32_t expected1[] = { '0', 'x', '1', '.', 'c', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', + 0 }; static const uint32_t expected2[] = { '0', 'x', '3', '.', '8', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', + 0 }; static const uint32_t expected3[] = { '0', 'x', '7', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', + 0 }; static const uint32_t expected4[] = { '0', 'x', 'e', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', + 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected1) == 0 - || u32_strcmp (result, expected2) == 0 - || u32_strcmp (result, expected3) == 0 - || u32_strcmp (result, expected4) == 0); + || u32_strcmp (result, expected2) == 0 + || u32_strcmp (result, expected3) == 0 + || u32_strcmp (result, expected4) == 0); free (result); } @@ -591,15 +591,15 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%e %d", 12.75, 33, 44, 55); static const uint32_t expected1[] = { '1', '.', '2', '7', '5', '0', '0', '0', 'e', '+', - '0', '1', ' ', '3', '3', 0 + '0', '1', ' ', '3', '3', 0 }; static const uint32_t expected2[] = { '1', '.', '2', '7', '5', '0', '0', '0', 'e', '+', - '0', '0', '1', ' ', '3', '3', 0 + '0', '0', '1', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected1) == 0 - || u32_strcmp (result, expected2) == 0); + || u32_strcmp (result, expected2) == 0); free (result); } @@ -608,15 +608,15 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%15e %d", 1.75, 33, 44, 55); static const uint32_t expected1[] = { ' ', ' ', ' ', '1', '.', '7', '5', '0', '0', '0', - '0', 'e', '+', '0', '0', ' ', '3', '3', 0 + '0', 'e', '+', '0', '0', ' ', '3', '3', 0 }; static const uint32_t expected2[] = { ' ', ' ', '1', '.', '7', '5', '0', '0', '0', '0', - 'e', '+', '0', '0', '0', ' ', '3', '3', 0 + 'e', '+', '0', '0', '0', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected1) == 0 - || u32_strcmp (result, expected2) == 0); + || u32_strcmp (result, expected2) == 0); free (result); } @@ -629,7 +629,7 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) { '1', 'e', '+', '0', '0', '3', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected1) == 0 - || u32_strcmp (result, expected2) == 0); + || u32_strcmp (result, expected2) == 0); free (result); } @@ -638,7 +638,7 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%Le %d", 12.75L, 33, 44, 55); static const uint32_t expected[] = { '1', '.', '2', '7', '5', '0', '0', '0', 'e', '+', - '0', '1', ' ', '3', '3', 0 + '0', '1', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); @@ -650,7 +650,7 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%15Le %d", 1.75L, 33, 44, 55); static const uint32_t expected[] = { ' ', ' ', ' ', '1', '.', '7', '5', '0', '0', '0', - '0', 'e', '+', '0', '0', ' ', '3', '3', 0 + '0', 'e', '+', '0', '0', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); @@ -698,7 +698,7 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) { '1', 'e', '+', '0', '0', '3', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected1) == 0 - || u32_strcmp (result, expected2) == 0); + || u32_strcmp (result, expected2) == 0); free (result); } @@ -774,47 +774,47 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) static const uint8_t unicode_string[] = "Rafa\305\202 Maszkowski"; /* Rafał Maszkowski */ { uint32_t *result = - my_xasprintf ("%U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%U %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', - 'k', 'o', 'w', 's', 'k', 'i', ' ', '3', '3', 0 - }; + { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', + 'k', 'o', 'w', 's', 'k', 'i', ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* Width. */ uint32_t *result = - my_xasprintf ("%20U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%20U %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', - 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', + 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* FLAG_LEFT. */ uint32_t *result = - my_xasprintf ("%-20U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-20U %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', - 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ', - ' ', '3', '3', 0 - }; + { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', + 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* FLAG_ZERO: no effect. */ uint32_t *result = - my_xasprintf ("%020U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%020U %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', - 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', + 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); @@ -824,52 +824,52 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) { static const uint16_t unicode_string[] = /* Rafał Maszkowski */ { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i', 0 + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i', 0 }; { uint32_t *result = - my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', - 'k', 'o', 'w', 's', 'k', 'i', ' ', '3', '3', 0 - }; + { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', + 'k', 'o', 'w', 's', 'k', 'i', ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* Width. */ uint32_t *result = - my_xasprintf ("%20lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%20lU %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', - 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', + 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* FLAG_LEFT. */ uint32_t *result = - my_xasprintf ("%-20lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-20lU %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', - 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ', - ' ', '3', '3', 0 - }; + { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', + 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* FLAG_ZERO: no effect. */ uint32_t *result = - my_xasprintf ("%020lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%020lU %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', - 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', + 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); @@ -879,52 +879,52 @@ test_xfunction (uint32_t * (*my_xasprintf) (const char *, ...)) { static const uint32_t unicode_string[] = /* Rafał Maszkowski */ { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i', 0 + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i', 0 }; { uint32_t *result = - my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', - 'k', 'o', 'w', 's', 'k', 'i', ' ', '3', '3', 0 - }; + { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', + 'k', 'o', 'w', 's', 'k', 'i', ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* Width. */ uint32_t *result = - my_xasprintf ("%20llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%20llU %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', - 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', + 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* FLAG_LEFT. */ uint32_t *result = - my_xasprintf ("%-20llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-20llU %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', - 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ', - ' ', '3', '3', 0 - }; + { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', + 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); } { /* FLAG_ZERO: no effect. */ uint32_t *result = - my_xasprintf ("%020llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%020llU %d", unicode_string, 33, 44, 55); static const uint32_t expected[] = - { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', - 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', + 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); free (result); diff --git a/tests/unistdio/test-u32-vasnprintf1.c b/tests/unistdio/test-u32-vasnprintf1.c index 959bdab..d2aa879 100644 --- a/tests/unistdio/test-u32-vasnprintf1.c +++ b/tests/unistdio/test-u32-vasnprintf1.c @@ -1,5 +1,5 @@ /* Test of u32_vasnprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,25 +23,12 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u32-asnprintf1.h" #include "test-u32-printf1.h" diff --git a/tests/unistdio/test-u32-vasnprintf2.c b/tests/unistdio/test-u32-vasnprintf2.c index 9d8ab00..c418e0a 100644 --- a/tests/unistdio/test-u32-vasnprintf2.c +++ b/tests/unistdio/test-u32-vasnprintf2.c @@ -1,5 +1,5 @@ /* Test of u32_vasnprintf() function in an ISO-8859-1 locale. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,25 +22,12 @@ #include <locale.h> #include <stdarg.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static void test_function (uint32_t * (*my_asnprintf) (uint32_t *, size_t *, const char *, ...)) @@ -52,9 +39,9 @@ test_function (uint32_t * (*my_asnprintf) (uint32_t *, size_t *, const char *, . { size_t length; uint32_t *result = - my_asnprintf (NULL, &length, "%s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%s %d", locale_string, 33, 44, 55); static const uint32_t expected[] = - { 0x00c4, 'r', 'g', 'e', 'r', ' ', '3', '3', 0 }; + { 0x00c4, 'r', 'g', 'e', 'r', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); ASSERT (length == u32_strlen (result)); @@ -63,11 +50,11 @@ test_function (uint32_t * (*my_asnprintf) (uint32_t *, size_t *, const char *, . { /* Width. */ size_t length; uint32_t *result = - my_asnprintf (NULL, &length, "%10s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%10s %d", locale_string, 33, 44, 55); static const uint32_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 0x00c4, 'r', 'g', 'e', 'r', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', ' ', 0x00c4, 'r', 'g', 'e', 'r', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); ASSERT (length == u32_strlen (result)); @@ -76,11 +63,11 @@ test_function (uint32_t * (*my_asnprintf) (uint32_t *, size_t *, const char *, . { /* FLAG_LEFT. */ size_t length; uint32_t *result = - my_asnprintf (NULL, &length, "%-10s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%-10s %d", locale_string, 33, 44, 55); static const uint32_t expected[] = - { 0x00c4, 'r', 'g', 'e', 'r', ' ', ' ', ' ', ' ', ' ', - ' ', '3', '3', 0 - }; + { 0x00c4, 'r', 'g', 'e', 'r', ' ', ' ', ' ', ' ', ' ', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); ASSERT (length == u32_strlen (result)); @@ -89,11 +76,11 @@ test_function (uint32_t * (*my_asnprintf) (uint32_t *, size_t *, const char *, . { /* FLAG_ZERO: no effect. */ size_t length; uint32_t *result = - my_asnprintf (NULL, &length, "%010s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%010s %d", locale_string, 33, 44, 55); static const uint32_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 0x00c4, 'r', 'g', 'e', 'r', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', ' ', 0x00c4, 'r', 'g', 'e', 'r', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); ASSERT (length == u32_strlen (result)); diff --git a/tests/unistdio/test-u32-vasnprintf3.c b/tests/unistdio/test-u32-vasnprintf3.c index 73f7c6c..f4b92d7 100644 --- a/tests/unistdio/test-u32-vasnprintf3.c +++ b/tests/unistdio/test-u32-vasnprintf3.c @@ -1,5 +1,5 @@ /* Test of u32_vasnprintf() function in an UTF-8 locale. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,25 +22,12 @@ #include <locale.h> #include <stdarg.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static void test_function (uint32_t * (*my_asnprintf) (uint32_t *, size_t *, const char *, ...)) @@ -52,9 +39,9 @@ test_function (uint32_t * (*my_asnprintf) (uint32_t *, size_t *, const char *, . { size_t length; uint32_t *result = - my_asnprintf (NULL, &length, "%s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%s %d", locale_string, 33, 44, 55); static const uint32_t expected[] = - { 0x00c4, 'r', 'g', 'e', 'r', ' ', '3', '3', 0 }; + { 0x00c4, 'r', 'g', 'e', 'r', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); ASSERT (length == u32_strlen (result)); @@ -63,11 +50,11 @@ test_function (uint32_t * (*my_asnprintf) (uint32_t *, size_t *, const char *, . { /* Width. */ size_t length; uint32_t *result = - my_asnprintf (NULL, &length, "%10s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%10s %d", locale_string, 33, 44, 55); static const uint32_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 0x00c4, 'r', 'g', 'e', 'r', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', ' ', 0x00c4, 'r', 'g', 'e', 'r', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); ASSERT (length == u32_strlen (result)); @@ -76,11 +63,11 @@ test_function (uint32_t * (*my_asnprintf) (uint32_t *, size_t *, const char *, . { /* FLAG_LEFT. */ size_t length; uint32_t *result = - my_asnprintf (NULL, &length, "%-10s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%-10s %d", locale_string, 33, 44, 55); static const uint32_t expected[] = - { 0x00c4, 'r', 'g', 'e', 'r', ' ', ' ', ' ', ' ', ' ', - ' ', '3', '3', 0 - }; + { 0x00c4, 'r', 'g', 'e', 'r', ' ', ' ', ' ', ' ', ' ', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); ASSERT (length == u32_strlen (result)); @@ -89,11 +76,11 @@ test_function (uint32_t * (*my_asnprintf) (uint32_t *, size_t *, const char *, . { /* FLAG_ZERO: no effect. */ size_t length; uint32_t *result = - my_asnprintf (NULL, &length, "%010s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%010s %d", locale_string, 33, 44, 55); static const uint32_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 0x00c4, 'r', 'g', 'e', 'r', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', ' ', 0x00c4, 'r', 'g', 'e', 'r', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u32_strcmp (result, expected) == 0); ASSERT (length == u32_strlen (result)); diff --git a/tests/unistdio/test-u32-vasprintf1.c b/tests/unistdio/test-u32-vasprintf1.c index 39e68d2..41c3057 100644 --- a/tests/unistdio/test-u32-vasprintf1.c +++ b/tests/unistdio/test-u32-vasprintf1.c @@ -1,5 +1,5 @@ /* Test of u32_vasprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,25 +23,12 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u32-printf1.h" diff --git a/tests/unistdio/test-u32-vsnprintf1.c b/tests/unistdio/test-u32-vsnprintf1.c index d772708..53317cf 100644 --- a/tests/unistdio/test-u32-vsnprintf1.c +++ b/tests/unistdio/test-u32-vsnprintf1.c @@ -1,5 +1,5 @@ /* Test of u32_vsnprintf() function. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,7 +23,6 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> @@ -31,19 +30,7 @@ #include "unistr.h" #include "xalloc.h" #include "progname.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u32-printf1.h" diff --git a/tests/unistdio/test-u32-vsprintf1.c b/tests/unistdio/test-u32-vsprintf1.c index 8398b27..c9512e8 100644 --- a/tests/unistdio/test-u32-vsprintf1.c +++ b/tests/unistdio/test-u32-vsprintf1.c @@ -1,5 +1,5 @@ /* Test of u32_vsprintf() function. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,7 +23,6 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> @@ -31,19 +30,7 @@ #include "unistr.h" #include "xalloc.h" #include "progname.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u32-printf1.h" diff --git a/tests/unistdio/test-u8-asnprintf1.c b/tests/unistdio/test-u8-asnprintf1.c index 852d76b..983cddf 100644 --- a/tests/unistdio/test-u8-asnprintf1.c +++ b/tests/unistdio/test-u8-asnprintf1.c @@ -1,5 +1,5 @@ /* Test of u8_asnprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,25 +23,12 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u8-asnprintf1.h" diff --git a/tests/unistdio/test-u8-asnprintf1.h b/tests/unistdio/test-u8-asnprintf1.h index 063f145..d4df3a3 100644 --- a/tests/unistdio/test-u8-asnprintf1.h +++ b/tests/unistdio/test-u8-asnprintf1.h @@ -1,5 +1,5 @@ /* Test of u8_[v]asnprintf() function. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -49,9 +49,9 @@ test_function (uint8_t * (*my_asnprintf) (uint8_t *, size_t *, const char *, ... ASSERT (u8_strcmp (result, expected) == 0); ASSERT (length == 5); if (size < 6) - ASSERT (result != buf); + ASSERT (result != buf); ASSERT (u8_cmp (buf + size, initializer + size, 8 - size) == 0); if (result != buf) - free (result); + free (result); } } diff --git a/tests/unistdio/test-u8-printf1.h b/tests/unistdio/test-u8-printf1.h index 4ac6573..23dc5a6 100644 --- a/tests/unistdio/test-u8-printf1.h +++ b/tests/unistdio/test-u8-printf1.h @@ -1,5 +1,5 @@ /* Test of u8_v[a]s[n]printf() function. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -63,7 +63,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t unicode_string[] = "Hello"; { uint8_t *result = - my_xasprintf ("%U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%U %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -71,7 +71,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* Width. */ uint8_t *result = - my_xasprintf ("%10U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%10U %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -79,7 +79,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_LEFT. */ uint8_t *result = - my_xasprintf ("%-10U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-10U %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -87,7 +87,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_ZERO: no effect. */ uint8_t *result = - my_xasprintf ("%010U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%010U %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -99,7 +99,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint16_t unicode_string[] = { 'H', 'e', 'l', 'l', 'o', 0 }; { uint8_t *result = - my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -107,7 +107,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* Width. */ uint8_t *result = - my_xasprintf ("%10lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%10lU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -115,7 +115,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_LEFT. */ uint8_t *result = - my_xasprintf ("%-10lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-10lU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -123,7 +123,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_ZERO: no effect. */ uint8_t *result = - my_xasprintf ("%010lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%010lU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -135,7 +135,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint32_t unicode_string[] = { 'H', 'e', 'l', 'l', 'o', 0 }; { uint8_t *result = - my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -143,7 +143,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* Width. */ uint8_t *result = - my_xasprintf ("%10llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%10llU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -151,7 +151,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_LEFT. */ uint8_t *result = - my_xasprintf ("%-10llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-10llU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -159,7 +159,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_ZERO: no effect. */ uint8_t *result = - my_xasprintf ("%010llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%010llU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -217,9 +217,9 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected4[] = "0xc.91p-2 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0 - || u8_strcmp (result, expected3) == 0 - || u8_strcmp (result, expected4) == 0); + || u8_strcmp (result, expected2) == 0 + || u8_strcmp (result, expected3) == 0 + || u8_strcmp (result, expected4) == 0); free (result); } @@ -232,9 +232,9 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected4[] = " 0xep-3 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0 - || u8_strcmp (result, expected3) == 0 - || u8_strcmp (result, expected4) == 0); + || u8_strcmp (result, expected2) == 0 + || u8_strcmp (result, expected3) == 0 + || u8_strcmp (result, expected4) == 0); free (result); } @@ -247,9 +247,9 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected4[] = "0xe.0000000000p-3 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0 - || u8_strcmp (result, expected3) == 0 - || u8_strcmp (result, expected4) == 0); + || u8_strcmp (result, expected2) == 0 + || u8_strcmp (result, expected3) == 0 + || u8_strcmp (result, expected4) == 0); free (result); } @@ -262,9 +262,9 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected4[] = "0xe.00000000000000000000000000000000000000000000000000p-3 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0 - || u8_strcmp (result, expected3) == 0 - || u8_strcmp (result, expected4) == 0); + || u8_strcmp (result, expected2) == 0 + || u8_strcmp (result, expected3) == 0 + || u8_strcmp (result, expected4) == 0); free (result); } @@ -277,9 +277,9 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected4[] = "0xc.91p-2 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0 - || u8_strcmp (result, expected3) == 0 - || u8_strcmp (result, expected4) == 0); + || u8_strcmp (result, expected2) == 0 + || u8_strcmp (result, expected3) == 0 + || u8_strcmp (result, expected4) == 0); free (result); } @@ -292,9 +292,9 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected4[] = " 0xep-3 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0 - || u8_strcmp (result, expected3) == 0 - || u8_strcmp (result, expected4) == 0); + || u8_strcmp (result, expected2) == 0 + || u8_strcmp (result, expected3) == 0 + || u8_strcmp (result, expected4) == 0); free (result); } @@ -307,9 +307,9 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected4[] = "0xe.0000000000p-3 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0 - || u8_strcmp (result, expected3) == 0 - || u8_strcmp (result, expected4) == 0); + || u8_strcmp (result, expected2) == 0 + || u8_strcmp (result, expected3) == 0 + || u8_strcmp (result, expected4) == 0); free (result); } @@ -322,9 +322,9 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected4[] = "0xe.00000000000000000000000000000000000000000000000000p-3 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0 - || u8_strcmp (result, expected3) == 0 - || u8_strcmp (result, expected4) == 0); + || u8_strcmp (result, expected2) == 0 + || u8_strcmp (result, expected3) == 0 + || u8_strcmp (result, expected4) == 0); free (result); } @@ -431,7 +431,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected2[] = "1.275000e+001 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0); + || u8_strcmp (result, expected2) == 0); free (result); } @@ -442,7 +442,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected2[] = " 1.750000e+000 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0); + || u8_strcmp (result, expected2) == 0); free (result); } @@ -453,7 +453,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected2[] = "1e+003 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0); + || u8_strcmp (result, expected2) == 0); free (result); } @@ -511,7 +511,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected2[] = "1e+003 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0); + || u8_strcmp (result, expected2) == 0); free (result); } @@ -582,7 +582,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t unicode_string[] = "Rafa\305\202 Maszkowski"; /* Rafał Maszkowski */ { uint8_t *result = - my_xasprintf ("%U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%U %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -590,7 +590,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* Width. */ uint8_t *result = - my_xasprintf ("%20U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%20U %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -598,7 +598,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_LEFT. */ uint8_t *result = - my_xasprintf ("%-20U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-20U %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -606,7 +606,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_ZERO: no effect. */ uint8_t *result = - my_xasprintf ("%020U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%020U %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -617,12 +617,12 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) { static const uint16_t unicode_string[] = /* Rafał Maszkowski */ { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i', 0 + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i', 0 }; { uint8_t *result = - my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -630,7 +630,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* Width. */ uint8_t *result = - my_xasprintf ("%20lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%20lU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -638,7 +638,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_LEFT. */ uint8_t *result = - my_xasprintf ("%-20lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-20lU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -646,7 +646,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_ZERO: no effect. */ uint8_t *result = - my_xasprintf ("%020lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%020lU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -657,12 +657,12 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) { static const uint32_t unicode_string[] = /* Rafał Maszkowski */ { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i', 0 + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i', 0 }; { uint8_t *result = - my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -670,7 +670,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* Width. */ uint8_t *result = - my_xasprintf ("%20llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%20llU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -678,7 +678,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_LEFT. */ uint8_t *result = - my_xasprintf ("%-20llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-20llU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -686,7 +686,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_ZERO: no effect. */ uint8_t *result = - my_xasprintf ("%020llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%020llU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); diff --git a/tests/unistdio/test-u8-vasnprintf1.c b/tests/unistdio/test-u8-vasnprintf1.c index 3329df4..03c73a0 100644 --- a/tests/unistdio/test-u8-vasnprintf1.c +++ b/tests/unistdio/test-u8-vasnprintf1.c @@ -1,5 +1,5 @@ /* Test of u8_vasnprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,25 +23,12 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u8-asnprintf1.h" #include "test-u8-printf1.h" diff --git a/tests/unistdio/test-u8-vasnprintf2.c b/tests/unistdio/test-u8-vasnprintf2.c index 4283be6..d801ee6 100644 --- a/tests/unistdio/test-u8-vasnprintf2.c +++ b/tests/unistdio/test-u8-vasnprintf2.c @@ -1,5 +1,5 @@ /* Test of u8_vasnprintf() function in an ISO-8859-1 locale. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,25 +22,12 @@ #include <locale.h> #include <stdarg.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static void test_function (uint8_t * (*my_asnprintf) (uint8_t *, size_t *, const char *, ...)) @@ -52,7 +39,7 @@ test_function (uint8_t * (*my_asnprintf) (uint8_t *, size_t *, const char *, ... { size_t length; uint8_t *result = - my_asnprintf (NULL, &length, "%s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%s %d", locale_string, 33, 44, 55); static const uint8_t expected[] = "\303\204rger 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -62,7 +49,7 @@ test_function (uint8_t * (*my_asnprintf) (uint8_t *, size_t *, const char *, ... { /* Width. */ size_t length; uint8_t *result = - my_asnprintf (NULL, &length, "%10s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%10s %d", locale_string, 33, 44, 55); static const uint8_t expected[] = " \303\204rger 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -72,7 +59,7 @@ test_function (uint8_t * (*my_asnprintf) (uint8_t *, size_t *, const char *, ... { /* FLAG_LEFT. */ size_t length; uint8_t *result = - my_asnprintf (NULL, &length, "%-10s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%-10s %d", locale_string, 33, 44, 55); static const uint8_t expected[] = "\303\204rger 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -82,7 +69,7 @@ test_function (uint8_t * (*my_asnprintf) (uint8_t *, size_t *, const char *, ... { /* FLAG_ZERO: no effect. */ size_t length; uint8_t *result = - my_asnprintf (NULL, &length, "%010s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%010s %d", locale_string, 33, 44, 55); static const uint8_t expected[] = " \303\204rger 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); diff --git a/tests/unistdio/test-u8-vasnprintf3.c b/tests/unistdio/test-u8-vasnprintf3.c index fc645bc..752c4c5 100644 --- a/tests/unistdio/test-u8-vasnprintf3.c +++ b/tests/unistdio/test-u8-vasnprintf3.c @@ -1,5 +1,5 @@ /* Test of u8_vasnprintf() function in an UTF-8 locale. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,25 +22,12 @@ #include <locale.h> #include <stdarg.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static void test_function (uint8_t * (*my_asnprintf) (uint8_t *, size_t *, const char *, ...)) @@ -52,7 +39,7 @@ test_function (uint8_t * (*my_asnprintf) (uint8_t *, size_t *, const char *, ... { size_t length; uint8_t *result = - my_asnprintf (NULL, &length, "%s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%s %d", locale_string, 33, 44, 55); static const uint8_t expected[] = "\303\204rger 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -62,7 +49,7 @@ test_function (uint8_t * (*my_asnprintf) (uint8_t *, size_t *, const char *, ... { /* Width. */ size_t length; uint8_t *result = - my_asnprintf (NULL, &length, "%10s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%10s %d", locale_string, 33, 44, 55); static const uint8_t expected[] = " \303\204rger 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -72,7 +59,7 @@ test_function (uint8_t * (*my_asnprintf) (uint8_t *, size_t *, const char *, ... { /* FLAG_LEFT. */ size_t length; uint8_t *result = - my_asnprintf (NULL, &length, "%-10s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%-10s %d", locale_string, 33, 44, 55); static const uint8_t expected[] = "\303\204rger 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -82,7 +69,7 @@ test_function (uint8_t * (*my_asnprintf) (uint8_t *, size_t *, const char *, ... { /* FLAG_ZERO: no effect. */ size_t length; uint8_t *result = - my_asnprintf (NULL, &length, "%010s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%010s %d", locale_string, 33, 44, 55); static const uint8_t expected[] = " \303\204rger 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); diff --git a/tests/unistdio/test-u8-vasprintf1.c b/tests/unistdio/test-u8-vasprintf1.c index 8a2caae..4076db5 100644 --- a/tests/unistdio/test-u8-vasprintf1.c +++ b/tests/unistdio/test-u8-vasprintf1.c @@ -1,5 +1,5 @@ /* Test of u8_vasprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,25 +23,12 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u8-printf1.h" diff --git a/tests/unistdio/test-u8-vsnprintf1.c b/tests/unistdio/test-u8-vsnprintf1.c index 6dd7439..1ae5876 100644 --- a/tests/unistdio/test-u8-vsnprintf1.c +++ b/tests/unistdio/test-u8-vsnprintf1.c @@ -1,5 +1,5 @@ /* Test of u8_vsnprintf() function. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,7 +23,6 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> @@ -31,19 +30,7 @@ #include "unistr.h" #include "xalloc.h" #include "progname.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u8-printf1.h" diff --git a/tests/unistdio/test-u8-vsprintf1.c b/tests/unistdio/test-u8-vsprintf1.c index 9559df0..3e13fec 100644 --- a/tests/unistdio/test-u8-vsprintf1.c +++ b/tests/unistdio/test-u8-vsprintf1.c @@ -1,5 +1,5 @@ /* Test of u8_vsprintf() function. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,7 +23,6 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> @@ -31,19 +30,7 @@ #include "unistr.h" #include "xalloc.h" #include "progname.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u8-printf1.h" diff --git a/tests/unistdio/test-ulc-asnprintf1.c b/tests/unistdio/test-ulc-asnprintf1.c index 591ae26..b9bd2ef 100644 --- a/tests/unistdio/test-ulc-asnprintf1.c +++ b/tests/unistdio/test-ulc-asnprintf1.c @@ -1,5 +1,5 @@ /* Test of ulc_asnprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,23 +22,11 @@ #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-ulc-asnprintf1.h" diff --git a/tests/unistdio/test-ulc-asnprintf1.h b/tests/unistdio/test-ulc-asnprintf1.h index 285a406..eb68248 100644 --- a/tests/unistdio/test-ulc-asnprintf1.h +++ b/tests/unistdio/test-ulc-asnprintf1.h @@ -1,5 +1,5 @@ /* Test of ulc_[v]asnprintf() functions. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -46,9 +46,9 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) ASSERT (strcmp (result, "12345") == 0); ASSERT (length == 5); if (size < 6) - ASSERT (result != buf); + ASSERT (result != buf); ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0); if (result != buf) - free (result); + free (result); } } diff --git a/tests/unistdio/test-ulc-printf1.h b/tests/unistdio/test-ulc-printf1.h index 77516d6..12149a4 100644 --- a/tests/unistdio/test-ulc-printf1.h +++ b/tests/unistdio/test-ulc-printf1.h @@ -1,5 +1,5 @@ /* Test of ulc_v[a]s[n]printf() functions. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -59,28 +59,28 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) static const uint8_t unicode_string[] = "Hello"; { char *result = - my_xasprintf ("%U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%U %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Hello 33") == 0); free (result); } { /* Width. */ char *result = - my_xasprintf ("%10U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%10U %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Hello 33") == 0); free (result); } { /* FLAG_LEFT. */ char *result = - my_xasprintf ("%-10U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-10U %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Hello 33") == 0); free (result); } { /* FLAG_ZERO: no effect. */ char *result = - my_xasprintf ("%010U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%010U %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Hello 33") == 0); free (result); @@ -91,28 +91,28 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) static const uint16_t unicode_string[] = { 'H', 'e', 'l', 'l', 'o', 0 }; { char *result = - my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Hello 33") == 0); free (result); } { /* Width. */ char *result = - my_xasprintf ("%10lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%10lU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Hello 33") == 0); free (result); } { /* FLAG_LEFT. */ char *result = - my_xasprintf ("%-10lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-10lU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Hello 33") == 0); free (result); } { /* FLAG_ZERO: no effect. */ char *result = - my_xasprintf ("%010lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%010lU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Hello 33") == 0); free (result); @@ -123,28 +123,28 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) static const uint32_t unicode_string[] = { 'H', 'e', 'l', 'l', 'o', 0 }; { char *result = - my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Hello 33") == 0); free (result); } { /* Width. */ char *result = - my_xasprintf ("%10llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%10llU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Hello 33") == 0); free (result); } { /* FLAG_LEFT. */ char *result = - my_xasprintf ("%-10llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-10llU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Hello 33") == 0); free (result); } { /* FLAG_ZERO: no effect. */ char *result = - my_xasprintf ("%010llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%010llU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Hello 33") == 0); free (result); @@ -193,9 +193,9 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%a %d", 3.1416015625, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "0x1.922p+1 33") == 0 - || strcmp (result, "0x3.244p+0 33") == 0 - || strcmp (result, "0x6.488p-1 33") == 0 - || strcmp (result, "0xc.91p-2 33") == 0); + || strcmp (result, "0x3.244p+0 33") == 0 + || strcmp (result, "0x6.488p-1 33") == 0 + || strcmp (result, "0xc.91p-2 33") == 0); free (result); } @@ -204,9 +204,9 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%10a %d", 1.75, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " 0x1.cp+0 33") == 0 - || strcmp (result, " 0x3.8p-1 33") == 0 - || strcmp (result, " 0x7p-2 33") == 0 - || strcmp (result, " 0xep-3 33") == 0); + || strcmp (result, " 0x3.8p-1 33") == 0 + || strcmp (result, " 0x7p-2 33") == 0 + || strcmp (result, " 0xep-3 33") == 0); free (result); } @@ -215,9 +215,9 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.10a %d", 1.75, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "0x1.c000000000p+0 33") == 0 - || strcmp (result, "0x3.8000000000p-1 33") == 0 - || strcmp (result, "0x7.0000000000p-2 33") == 0 - || strcmp (result, "0xe.0000000000p-3 33") == 0); + || strcmp (result, "0x3.8000000000p-1 33") == 0 + || strcmp (result, "0x7.0000000000p-2 33") == 0 + || strcmp (result, "0xe.0000000000p-3 33") == 0); free (result); } @@ -226,9 +226,9 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.50a %d", 1.75, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "0x1.c0000000000000000000000000000000000000000000000000p+0 33") == 0 - || strcmp (result, "0x3.80000000000000000000000000000000000000000000000000p-1 33") == 0 - || strcmp (result, "0x7.00000000000000000000000000000000000000000000000000p-2 33") == 0 - || strcmp (result, "0xe.00000000000000000000000000000000000000000000000000p-3 33") == 0); + || strcmp (result, "0x3.80000000000000000000000000000000000000000000000000p-1 33") == 0 + || strcmp (result, "0x7.00000000000000000000000000000000000000000000000000p-2 33") == 0 + || strcmp (result, "0xe.00000000000000000000000000000000000000000000000000p-3 33") == 0); free (result); } @@ -237,9 +237,9 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%La %d", 3.1416015625L, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "0x1.922p+1 33") == 0 - || strcmp (result, "0x3.244p+0 33") == 0 - || strcmp (result, "0x6.488p-1 33") == 0 - || strcmp (result, "0xc.91p-2 33") == 0); + || strcmp (result, "0x3.244p+0 33") == 0 + || strcmp (result, "0x6.488p-1 33") == 0 + || strcmp (result, "0xc.91p-2 33") == 0); free (result); } @@ -248,9 +248,9 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%10La %d", 1.75L, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " 0x1.cp+0 33") == 0 - || strcmp (result, " 0x3.8p-1 33") == 0 - || strcmp (result, " 0x7p-2 33") == 0 - || strcmp (result, " 0xep-3 33") == 0); + || strcmp (result, " 0x3.8p-1 33") == 0 + || strcmp (result, " 0x7p-2 33") == 0 + || strcmp (result, " 0xep-3 33") == 0); free (result); } @@ -259,9 +259,9 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.10La %d", 1.75L, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "0x1.c000000000p+0 33") == 0 - || strcmp (result, "0x3.8000000000p-1 33") == 0 - || strcmp (result, "0x7.0000000000p-2 33") == 0 - || strcmp (result, "0xe.0000000000p-3 33") == 0); + || strcmp (result, "0x3.8000000000p-1 33") == 0 + || strcmp (result, "0x7.0000000000p-2 33") == 0 + || strcmp (result, "0xe.0000000000p-3 33") == 0); free (result); } @@ -270,9 +270,9 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.50La %d", 1.75L, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "0x1.c0000000000000000000000000000000000000000000000000p+0 33") == 0 - || strcmp (result, "0x3.80000000000000000000000000000000000000000000000000p-1 33") == 0 - || strcmp (result, "0x7.00000000000000000000000000000000000000000000000000p-2 33") == 0 - || strcmp (result, "0xe.00000000000000000000000000000000000000000000000000p-3 33") == 0); + || strcmp (result, "0x3.80000000000000000000000000000000000000000000000000p-1 33") == 0 + || strcmp (result, "0x7.00000000000000000000000000000000000000000000000000p-2 33") == 0 + || strcmp (result, "0xe.00000000000000000000000000000000000000000000000000p-3 33") == 0); free (result); } @@ -367,7 +367,7 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%e %d", 12.75, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "1.275000e+01 33") == 0 - || strcmp (result, "1.275000e+001 33") == 0); + || strcmp (result, "1.275000e+001 33") == 0); free (result); } @@ -376,7 +376,7 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%15e %d", 1.75, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " 1.750000e+00 33") == 0 - || strcmp (result, " 1.750000e+000 33") == 0); + || strcmp (result, " 1.750000e+000 33") == 0); free (result); } @@ -385,7 +385,7 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.e %d", 1234.0, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "1e+03 33") == 0 - || strcmp (result, "1e+003 33") == 0); + || strcmp (result, "1e+003 33") == 0); free (result); } @@ -436,7 +436,7 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.g %d", 1234.0, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "1e+03 33") == 0 - || strcmp (result, "1e+003 33") == 0); + || strcmp (result, "1e+003 33") == 0); free (result); } diff --git a/tests/unistdio/test-ulc-vasnprintf1.c b/tests/unistdio/test-ulc-vasnprintf1.c index e2f8be6..fa4a2c9 100644 --- a/tests/unistdio/test-ulc-vasnprintf1.c +++ b/tests/unistdio/test-ulc-vasnprintf1.c @@ -1,5 +1,5 @@ /* Test of ulc_vasnprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,23 +22,11 @@ #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-ulc-asnprintf1.h" #include "test-ulc-printf1.h" diff --git a/tests/unistdio/test-ulc-vasnprintf2.c b/tests/unistdio/test-ulc-vasnprintf2.c index 9022975..d61c1cf 100644 --- a/tests/unistdio/test-ulc-vasnprintf2.c +++ b/tests/unistdio/test-ulc-vasnprintf2.c @@ -1,5 +1,5 @@ /* Test of ulc_vasnprintf() function in an ISO-8859-1 locale. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,23 +22,11 @@ #include <locale.h> #include <stdarg.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static void test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) @@ -50,40 +38,40 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { size_t length; char *result = - my_asnprintf (NULL, &length, "%U %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%U %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Rafa? Maszkowski 33") == 0 - || strcmp (result, "Rafal Maszkowski 33") == 0); + || strcmp (result, "Rafal Maszkowski 33") == 0); ASSERT (length == strlen (result)); free (result); } { /* Width. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%20U %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%20U %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Rafa? Maszkowski 33") == 0 - || strcmp (result, " Rafal Maszkowski 33") == 0); + || strcmp (result, " Rafal Maszkowski 33") == 0); ASSERT (length == strlen (result)); free (result); } { /* FLAG_LEFT. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%-20U %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%-20U %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Rafa? Maszkowski 33") == 0 - || strcmp (result, "Rafal Maszkowski 33") == 0); + || strcmp (result, "Rafal Maszkowski 33") == 0); ASSERT (length == strlen (result)); free (result); } { /* FLAG_ZERO: no effect. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%020U %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%020U %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Rafa? Maszkowski 33") == 0 - || strcmp (result, " Rafal Maszkowski 33") == 0); + || strcmp (result, " Rafal Maszkowski 33") == 0); ASSERT (length == strlen (result)); free (result); } @@ -92,46 +80,46 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { static const uint16_t unicode_string[] = /* Rafał Maszkowski */ { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i', 0 + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i', 0 }; { size_t length; char *result = - my_asnprintf (NULL, &length, "%lU %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%lU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Rafa? Maszkowski 33") == 0 - || strcmp (result, "Rafal Maszkowski 33") == 0); + || strcmp (result, "Rafal Maszkowski 33") == 0); ASSERT (length == strlen (result)); free (result); } { /* Width. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%20lU %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%20lU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Rafa? Maszkowski 33") == 0 - || strcmp (result, " Rafal Maszkowski 33") == 0); + || strcmp (result, " Rafal Maszkowski 33") == 0); ASSERT (length == strlen (result)); free (result); } { /* FLAG_LEFT. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%-20lU %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%-20lU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Rafa? Maszkowski 33") == 0 - || strcmp (result, "Rafal Maszkowski 33") == 0); + || strcmp (result, "Rafal Maszkowski 33") == 0); ASSERT (length == strlen (result)); free (result); } { /* FLAG_ZERO: no effect. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%020lU %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%020lU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Rafa? Maszkowski 33") == 0 - || strcmp (result, " Rafal Maszkowski 33") == 0); + || strcmp (result, " Rafal Maszkowski 33") == 0); ASSERT (length == strlen (result)); free (result); } @@ -140,46 +128,46 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { static const uint32_t unicode_string[] = /* Rafał Maszkowski */ { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i', 0 + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i', 0 }; { size_t length; char *result = - my_asnprintf (NULL, &length, "%llU %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%llU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Rafa? Maszkowski 33") == 0 - || strcmp (result, "Rafal Maszkowski 33") == 0); + || strcmp (result, "Rafal Maszkowski 33") == 0); ASSERT (length == strlen (result)); free (result); } { /* Width. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%20llU %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%20llU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Rafa? Maszkowski 33") == 0 - || strcmp (result, " Rafal Maszkowski 33") == 0); + || strcmp (result, " Rafal Maszkowski 33") == 0); ASSERT (length == strlen (result)); free (result); } { /* FLAG_LEFT. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%-20llU %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%-20llU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Rafa? Maszkowski 33") == 0 - || strcmp (result, "Rafal Maszkowski 33") == 0); + || strcmp (result, "Rafal Maszkowski 33") == 0); ASSERT (length == strlen (result)); free (result); } { /* FLAG_ZERO: no effect. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%020llU %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%020llU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Rafa? Maszkowski 33") == 0 - || strcmp (result, " Rafal Maszkowski 33") == 0); + || strcmp (result, " Rafal Maszkowski 33") == 0); ASSERT (length == strlen (result)); free (result); } @@ -192,7 +180,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { size_t length; char *result = - my_asnprintf (NULL, &length, "%s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%s %d", locale_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "\304rger 33") == 0); ASSERT (length == strlen (result)); @@ -201,7 +189,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { /* Width. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%10s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%10s %d", locale_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " \304rger 33") == 0); ASSERT (length == strlen (result)); @@ -210,7 +198,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { /* FLAG_LEFT. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%-10s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%-10s %d", locale_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "\304rger 33") == 0); ASSERT (length == strlen (result)); @@ -219,7 +207,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { /* FLAG_ZERO: no effect. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%010s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%010s %d", locale_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " \304rger 33") == 0); ASSERT (length == strlen (result)); diff --git a/tests/unistdio/test-ulc-vasnprintf3.c b/tests/unistdio/test-ulc-vasnprintf3.c index 1fbd925..5a3cd0d 100644 --- a/tests/unistdio/test-ulc-vasnprintf3.c +++ b/tests/unistdio/test-ulc-vasnprintf3.c @@ -1,5 +1,5 @@ /* Test of ulc_vasnprintf() function in an UTF-8 locale. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,23 +22,11 @@ #include <locale.h> #include <stdarg.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static void test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) @@ -50,7 +38,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { size_t length; char *result = - my_asnprintf (NULL, &length, "%U %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%U %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Rafa\305\202 Maszkowski 33") == 0); ASSERT (length == strlen (result)); @@ -59,7 +47,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { /* Width. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%20U %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%20U %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Rafa\305\202 Maszkowski 33") == 0); ASSERT (length == strlen (result)); @@ -68,7 +56,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { /* FLAG_LEFT. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%-20U %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%-20U %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Rafa\305\202 Maszkowski 33") == 0); ASSERT (length == strlen (result)); @@ -77,7 +65,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { /* FLAG_ZERO: no effect. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%020U %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%020U %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Rafa\305\202 Maszkowski 33") == 0); ASSERT (length == strlen (result)); @@ -88,13 +76,13 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { static const uint16_t unicode_string[] = /* Rafał Maszkowski */ { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i', 0 + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i', 0 }; { size_t length; char *result = - my_asnprintf (NULL, &length, "%lU %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%lU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Rafa\305\202 Maszkowski 33") == 0); ASSERT (length == strlen (result)); @@ -103,7 +91,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { /* Width. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%20lU %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%20lU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Rafa\305\202 Maszkowski 33") == 0); ASSERT (length == strlen (result)); @@ -112,7 +100,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { /* FLAG_LEFT. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%-20lU %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%-20lU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Rafa\305\202 Maszkowski 33") == 0); ASSERT (length == strlen (result)); @@ -121,7 +109,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { /* FLAG_ZERO: no effect. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%020lU %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%020lU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Rafa\305\202 Maszkowski 33") == 0); ASSERT (length == strlen (result)); @@ -132,13 +120,13 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { static const uint32_t unicode_string[] = /* Rafał Maszkowski */ { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i', 0 + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i', 0 }; { size_t length; char *result = - my_asnprintf (NULL, &length, "%llU %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%llU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Rafa\305\202 Maszkowski 33") == 0); ASSERT (length == strlen (result)); @@ -147,7 +135,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { /* Width. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%20llU %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%20llU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Rafa\305\202 Maszkowski 33") == 0); ASSERT (length == strlen (result)); @@ -156,7 +144,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { /* FLAG_LEFT. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%-20llU %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%-20llU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Rafa\305\202 Maszkowski 33") == 0); ASSERT (length == strlen (result)); @@ -165,7 +153,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { /* FLAG_ZERO: no effect. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%020llU %d", unicode_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%020llU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Rafa\305\202 Maszkowski 33") == 0); ASSERT (length == strlen (result)); @@ -180,7 +168,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { size_t length; char *result = - my_asnprintf (NULL, &length, "%s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%s %d", locale_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "\303\204rger 33") == 0); ASSERT (length == strlen (result)); @@ -189,7 +177,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { /* Width. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%10s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%10s %d", locale_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " \303\204rger 33") == 0); ASSERT (length == strlen (result)); @@ -198,7 +186,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { /* FLAG_LEFT. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%-10s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%-10s %d", locale_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "\303\204rger 33") == 0); ASSERT (length == strlen (result)); @@ -207,7 +195,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) { /* FLAG_ZERO: no effect. */ size_t length; char *result = - my_asnprintf (NULL, &length, "%010s %d", locale_string, 33, 44, 55); + my_asnprintf (NULL, &length, "%010s %d", locale_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " \303\204rger 33") == 0); ASSERT (length == strlen (result)); diff --git a/tests/unistdio/test-ulc-vasprintf1.c b/tests/unistdio/test-ulc-vasprintf1.c index d8ed67c..0db01c9 100644 --- a/tests/unistdio/test-ulc-vasprintf1.c +++ b/tests/unistdio/test-ulc-vasprintf1.c @@ -1,5 +1,5 @@ /* Test of ulc_vasprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,23 +22,11 @@ #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-ulc-printf1.h" diff --git a/tests/unistdio/test-ulc-vsnprintf1.c b/tests/unistdio/test-ulc-vsnprintf1.c index 7701c21..7b6de1c 100644 --- a/tests/unistdio/test-ulc-vsnprintf1.c +++ b/tests/unistdio/test-ulc-vsnprintf1.c @@ -1,5 +1,5 @@ /* Test of ulc_vsnprintf() function. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,26 +22,13 @@ #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "xalloc.h" #include "progname.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-ulc-printf1.h" diff --git a/tests/unistdio/test-ulc-vsprintf1.c b/tests/unistdio/test-ulc-vsprintf1.c index 76b85b2..51ea024 100644 --- a/tests/unistdio/test-ulc-vsprintf1.c +++ b/tests/unistdio/test-ulc-vsprintf1.c @@ -1,5 +1,5 @@ /* Test of ulc_vsprintf() function. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,26 +22,13 @@ #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "xalloc.h" #include "progname.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-ulc-printf1.h" diff --git a/tests/unistr/test-chr.h b/tests/unistr/test-chr.h new file mode 100644 index 0000000..5a021c2 --- /dev/null +++ b/tests/unistr/test-chr.h @@ -0,0 +1,103 @@ +/* Test of uN_chr() functions. + Copyright (C) 2008-2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Eric Blake and Bruno Haible <bruno@clisp.org>, 2010. */ + +int +main (void) +{ + size_t n = 0x100000; + UNIT *input = (UNIT *) malloc (n * sizeof (UNIT)); + ASSERT (input); + + input[0] = 'a'; + input[1] = 'b'; + U_SET (input + 2, 'c', 1024); + U_SET (input + 1026, 'd', n - 1028); + input[n - 2] = 'e'; + input[n - 1] = 'a'; + + /* Basic behavior tests. */ + ASSERT (U_CHR (input, n, 'a') == input); + + ASSERT (U_CHR (input, 0, 'a') == NULL); + ASSERT (U_CHR (zerosize_ptr (), 0, 'a') == NULL); + + ASSERT (U_CHR (input, n, 'b') == input + 1); + ASSERT (U_CHR (input, n, 'c') == input + 2); + ASSERT (U_CHR (input, n, 'd') == input + 1026); + + ASSERT (U_CHR (input + 1, n - 1, 'a') == input + n - 1); + ASSERT (U_CHR (input + 1, n - 1, 'e') == input + n - 2); + + ASSERT (U_CHR (input, n, 'f') == NULL); + ASSERT (U_CHR (input, n, '\0') == NULL); + + /* Check that a very long haystack is handled quickly if the byte is + found near the beginning. */ + { + size_t repeat = 10000; + for (; repeat > 0; repeat--) + { + ASSERT (U_CHR (input, n, 'c') == input + 2); + } + } + + /* Alignment tests. */ + { + int i, j; + for (i = 0; i < 32; i++) + { + for (j = 0; j < 128; j++) + input[i + j] = j; + for (j = 0; j < 128; j++) + { + ASSERT (U_CHR (input + i, 128, j) == input + i + j); + } + } + } + + /* Check that uN_chr() does not read past the first occurrence of the + byte being searched. */ + { + char *page_boundary = (char *) zerosize_ptr (); + + if (page_boundary != NULL) + { + for (n = 1; n <= 500 / sizeof (UNIT); n++) + { + UNIT *mem = (UNIT *) (page_boundary - n * sizeof (UNIT)); + U_SET (mem, 'X', n); + ASSERT (U_CHR (mem, n, 'U') == NULL); + + { + size_t i; + + for (i = 0; i < n; i++) + { + mem[i] = 'U'; + ASSERT (U_CHR (mem, 4000, 'U') == mem + i); + mem[i] = 'X'; + } + } + } + } + } + + free (input); + + return 0; +} diff --git a/tests/unistr/test-cmp.h b/tests/unistr/test-cmp.h new file mode 100644 index 0000000..e536f48 --- /dev/null +++ b/tests/unistr/test-cmp.h @@ -0,0 +1,97 @@ +/* Test of uN_cmp() functions. + Copyright (C) 2008-2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Simon Josefsson and Bruno Haible <bruno@clisp.org>, 2010. */ + +static void +test_cmp (void) +{ + /* Test equal / not equal distinction. */ + ASSERT (U_CMP (zerosize_ptr (), zerosize_ptr (), 0) == 0); + { + static const UNIT input1[] = { 'f', 'o', 'o', 0 }; + static const UNIT input2[] = { 'f', 'o', 'o', 'b', 'a', 'r', 0 }; + ASSERT (U_CMP (input1, input2, 2) == 0); + ASSERT (U_CMP (input1, input2, 3) == 0); + ASSERT (U_CMP (input1, input2, 4) != 0); + } + { + static const UNIT input1[] = { 'f', 'o', 'o', 0 }; + static const UNIT input2[] = { 'b', 'a', 'r', 0 }; + ASSERT (U_CMP (input1, input2, 1) != 0); + ASSERT (U_CMP (input1, input2, 3) != 0); + } + + /* Test less / equal / greater distinction. */ + { + static const UNIT input1[] = { 'f', 'o', 'o', 0 }; + static const UNIT input2[] = { 'm', 'o', 'o', 0 }; + ASSERT (U_CMP (input1, input2, 4) < 0); + ASSERT (U_CMP (input2, input1, 4) > 0); + } + { + static const UNIT input1[] = { 'o', 'o', 'm', 'p', 'h', 0 }; + static const UNIT input2[] = { 'o', 'o', 'p', 's', 0 }; + ASSERT (U_CMP (input1, input2, 3) < 0); + ASSERT (U_CMP (input2, input1, 3) > 0); + } + { + static const UNIT input1[] = { 'f', 'o', 'o', 0 }; + static const UNIT input2[] = { 'f', 'o', 'o', 'b', 'a', 'r', 0 }; + ASSERT (U_CMP (input1, input2, 4) < 0); + ASSERT (U_CMP (input2, input1, 4) > 0); + } + + /* Some old versions of memcmp were not 8-bit clean. */ + { + static const UNIT input1[] = { 0x40 }; + static const UNIT input2[] = { 0xC2 }; + ASSERT (U_CMP (input1, input2, 1) < 0); + ASSERT (U_CMP (input2, input1, 1) > 0); + } + { + static const UNIT input1[] = { 0xC2 }; + static const UNIT input2[] = { 0xC3 }; + ASSERT (U_CMP (input1, input2, 1) < 0); + ASSERT (U_CMP (input2, input1, 1) > 0); + } + + /* The Next x86 OpenStep bug shows up only when comparing 16 bytes + or more and with at least one buffer not starting on a 4-byte boundary. + William Lewis provided this test program. */ + { + UNIT foo[21]; + UNIT bar[21]; + int i; + for (i = 0; i < 4; i++) + { + UNIT *a = foo + i; + UNIT *b = bar + i; + int j; + for (j = 0; j < 8; j++) + a[j] = '-'; + a[8] = '0'; + for (j = 9; j < 16; j++) + a[j] = '1'; + for (j = 0; j < 8; j++) + b[j] = '-'; + b[8] = '1'; + for (j = 9; j < 16; j++) + b[j] = '0'; + ASSERT (U_CMP (a, b, 16) < 0); + } + } +} diff --git a/tests/unistr/test-cmp2.h b/tests/unistr/test-cmp2.h new file mode 100644 index 0000000..261fe36 --- /dev/null +++ b/tests/unistr/test-cmp2.h @@ -0,0 +1,56 @@ +/* Test of uN_cmp2() functions. + Copyright (C) 2008-2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Simon Josefsson and Bruno Haible <bruno@clisp.org>, 2010. */ + +int +main () +{ + { + static const UNIT input1[] = { 'a' }; + static const UNIT input2[] = { 'b' }; + ASSERT (U_CMP2 (input1, 0, input2, 0) == 0); + ASSERT (U_CMP2 (input1, 1, input2, 0) > 0); + ASSERT (U_CMP2 (input1, 0, input2, 1) < 0); + } + { + static const UNIT input1[] = { 'f', 'o', 'o', 0 }; + static const UNIT input2[] = { 'f', 'o', 'o', 'b', 'a', 'r', 0 }; + ASSERT (U_CMP2 (input1, 3, input2, 3) == 0); + ASSERT (U_CMP2 (input1, 4, input2, 3) > 0); + ASSERT (U_CMP2 (input2, 3, input1, 4) < 0); + ASSERT (U_CMP2 (input1, 3, input2, 4) < 0); + ASSERT (U_CMP2 (input2, 4, input1, 3) > 0); + ASSERT (U_CMP2 (input1, 4, input2, 4) < 0); + ASSERT (U_CMP2 (input2, 4, input1, 4) > 0); + ASSERT (U_CMP2 (input1, 3, input2, 7) < 0); + ASSERT (U_CMP2 (input2, 7, input1, 3) > 0); + } + { + static const UNIT input1[] = { 'f', 'o', 'o' }; + static const UNIT input2[] = { 'm', 'o', 'o' }; + ASSERT (U_CMP2 (input1, 3, input2, 3) < 0); + ASSERT (U_CMP2 (input2, 3, input1, 3) > 0); + } + { + static const UNIT input1[] = { 'o', 'o', 'm', 'p', 'h' }; + static const UNIT input2[] = { 'o', 'o', 'p', 's' }; + ASSERT (U_CMP2 (input1, 5, input2, 4) < 0); + ASSERT (U_CMP2 (input2, 4, input1, 5) > 0); + } + + return 0; +} diff --git a/tests/unistr/test-cpy-alloc.h b/tests/unistr/test-cpy-alloc.h new file mode 100644 index 0000000..795e0b7 --- /dev/null +++ b/tests/unistr/test-cpy-alloc.h @@ -0,0 +1,41 @@ +/* Test of uN_cpy_alloc() functions. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +int +main () +{ + /* Test small copying operations. */ + { + static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' }; + size_t n; + + for (n = 0; n <= SIZEOF (src); n++) + { + UNIT *result = U_CPY_ALLOC (src, n); + size_t i; + + ASSERT (result != NULL); + for (i = 0; i < n; i++) + ASSERT (result[i] == src[i]); + + free (result); + } + } + + return 0; +} diff --git a/tests/unistr/test-cpy.h b/tests/unistr/test-cpy.h new file mode 100644 index 0000000..b62fd14 --- /dev/null +++ b/tests/unistr/test-cpy.h @@ -0,0 +1,44 @@ +/* Test of uN_cpy() functions. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +int +main () +{ + /* Test small copying operations. */ + { + static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' }; + size_t n; + + for (n = 0; n <= SIZEOF (src); n++) + { + UNIT dest[1 + SIZEOF (src) + 1] = + { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; + UNIT *ret; + size_t i; + + ret = U_CPY (dest + 1, src, n); + ASSERT (ret == dest + 1); + ASSERT (dest[0] == MAGIC); + for (i = 0; i < n; i++) + ASSERT (dest[1 + i] == src[i]); + ASSERT (dest[1 + n] == MAGIC); + } + } + + return 0; +} diff --git a/tests/unistr/test-move.h b/tests/unistr/test-move.h new file mode 100644 index 0000000..2462367 --- /dev/null +++ b/tests/unistr/test-move.h @@ -0,0 +1,152 @@ +/* Test of uN_move() functions. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +int +main () +{ + /* Test copying operations with disjoint source and destination. */ + { + static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' }; + size_t n; + + for (n = 0; n <= SIZEOF (src); n++) + { + UNIT dest[1 + SIZEOF (src) + 1] = + { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; + UNIT *ret; + size_t i; + + ret = U_MOVE (dest + 1, src, n); + ASSERT (ret == dest + 1); + ASSERT (dest[0] == MAGIC); + for (i = 0; i < n; i++) + ASSERT (dest[1 + i] == src[i]); + ASSERT (dest[1 + n] == MAGIC); + } + } + + /* Test copying operations with overlap, in-place. */ + { + static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' }; + size_t n; + + for (n = 0; n <= SIZEOF (src); n++) + { + UNIT dest[1 + SIZEOF (src) + 1]; + UNIT *ret; + size_t i; + + dest[0] = MAGIC; + for (i = 0; i < n; i++) + dest[1 + i] = src[i]; + dest[1 + n] = MAGIC; + + ret = U_MOVE (dest + 1, dest + 1, n); + ASSERT (ret == dest + 1); + ASSERT (dest[0] == MAGIC); + for (i = 0; i < n; i++) + ASSERT (dest[1 + i] == src[i]); + ASSERT (dest[1 + n] == MAGIC); + } + } + + /* Test copying operations with overlap, moving downward. */ + { + static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' }; + static const UNIT src2[] = { 'C', 'L', 'I', 'M', 'A', 'T', 'E' }; + size_t d; + + ASSERT (SIZEOF (src) == SIZEOF (src2)); + for (d = 0; d <= SIZEOF (src); d++) + { + size_t n; + + for (n = 0; n <= SIZEOF (src); n++) + { + UNIT dest[1 + 2 * SIZEOF (src) + 1]; + UNIT *ret; + size_t i; + + dest[0] = MAGIC; + for (i = 0; i < SIZEOF (src2); i++) + dest[1 + i] = src2[i]; + for (i = 0; i < SIZEOF (src); i++) + dest[1 + SIZEOF (src) + i] = src[i]; + dest[1 + 2 * SIZEOF (src)] = MAGIC; + + ret = + U_MOVE (dest + 1 + SIZEOF (src) - d, dest + 1 + SIZEOF (src), n); + ASSERT (ret == dest + 1 + SIZEOF (src) - d); + ASSERT (dest[0] == MAGIC); + for (i = 0; i < SIZEOF (src) - d; i++) + ASSERT (dest[1 + i] == src2[i]); + for (i = 0; i < n; i++) + ASSERT (dest[1 + SIZEOF (src) - d + i] == src[i]); + for (i = SIZEOF (src) - d + n; i < SIZEOF (src2); i++) + ASSERT (dest[1 + i] == src2[i]); + for (i = (n >= d ? n - d : 0); i < SIZEOF (src); i++) + ASSERT (dest[1 + SIZEOF (src) + i] == src[i]); + ASSERT (dest[1 + 2 * SIZEOF (src)] == MAGIC); + } + } + } + + /* Test copying operations with overlap, moving upward. */ + { + static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' }; + static const UNIT src2[] = { 'C', 'L', 'I', 'M', 'A', 'T', 'E' }; + size_t d; + + ASSERT (SIZEOF (src) == SIZEOF (src2)); + for (d = 0; d <= SIZEOF (src); d++) + { + size_t n; + + for (n = 0; n <= SIZEOF (src); n++) + { + UNIT dest[1 + 2 * SIZEOF (src) + 1]; + UNIT *ret; + size_t i; + + dest[0] = MAGIC; + for (i = 0; i < SIZEOF (src); i++) + dest[1 + i] = src[i]; + for (i = 0; i < SIZEOF (src2); i++) + dest[1 + SIZEOF (src) + i] = src2[i]; + dest[1 + 2 * SIZEOF (src)] = MAGIC; + + ret = U_MOVE (dest + 1 + d, dest + 1, n); + ASSERT (ret == dest + 1 + d); + ASSERT (dest[0] == MAGIC); + for (i = 0; i < d; i++) + ASSERT (dest[1 + i] == src[i]); + for (i = 0; i < n; i++) + ASSERT (dest[1 + d + i] == src[i]); + for (i = d + n; i < SIZEOF (src); i++) + ASSERT (dest[1 + i] == src[i]); + for (i = (d + n >= SIZEOF (src) ? d + n - SIZEOF (src) : 0); + i < SIZEOF (src2); + i++) + ASSERT (dest[1 + SIZEOF (src) + i] == src2[i]); + ASSERT (dest[1 + 2 * SIZEOF (src)] == MAGIC); + } + } + } + + return 0; +} diff --git a/tests/unistr/test-set.h b/tests/unistr/test-set.h new file mode 100644 index 0000000..56924dc --- /dev/null +++ b/tests/unistr/test-set.h @@ -0,0 +1,44 @@ +/* Test of uN_set() functions. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +int +main () +{ + { +#define NMAX 7 + size_t n; + + for (n = 0; n <= NMAX; n++) + { + UNIT dest[1 + NMAX + 1] = + { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; + UNIT *ret; + size_t i; + + ret = U_SET (dest + 1, VALUE, n); + ASSERT (ret == dest + 1); + ASSERT (dest[0] == MAGIC); + for (i = 0; i < n; i++) + ASSERT (dest[1 + i] == VALUE); + ASSERT (dest[1 + n] == MAGIC); + } +#undef NMAX + } + + return 0; +} diff --git a/tests/unistr/test-stpcpy.h b/tests/unistr/test-stpcpy.h new file mode 100644 index 0000000..76065dc --- /dev/null +++ b/tests/unistr/test-stpcpy.h @@ -0,0 +1,47 @@ +/* Test of uN_stpcpy() functions. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +int +main () +{ + /* Test small copying operations. */ + { + static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e', 0 }; + size_t n; + + for (n = 1; n <= SIZEOF (src); n++) + { + UNIT dest[1 + SIZEOF (src) + 1] = + { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, + MAGIC + }; + UNIT *result; + size_t i; + + result = U_STPCPY (dest + 1, src + SIZEOF (src) - n); + ASSERT (result == dest + n); + + ASSERT (dest[0] == MAGIC); + for (i = 0; i < n; i++) + ASSERT (dest[1 + i] == src[SIZEOF (src) - n + i]); + ASSERT (dest[1 + n] == MAGIC); + } + } + + return 0; +} diff --git a/tests/unistr/test-stpncpy.h b/tests/unistr/test-stpncpy.h new file mode 100644 index 0000000..bb81ff0 --- /dev/null +++ b/tests/unistr/test-stpncpy.h @@ -0,0 +1,79 @@ +/* Test of uN_stpncpy() functions. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +static void +check_single (const UNIT *input, size_t length, size_t n) +{ + UNIT *dest; + UNIT *result; + size_t i; + + dest = (UNIT *) malloc ((1 + n + 1) * sizeof (UNIT)); + ASSERT (dest != NULL); + + for (i = 0; i < 1 + n + 1; i++) + dest[i] = MAGIC; + + result = U_STPNCPY (dest + 1, input, n); + ASSERT (result == dest + 1 + (n <= length ? n : length)); + + ASSERT (dest[0] == MAGIC); + for (i = 0; i < (n <= length ? n : length + 1); i++) + ASSERT (dest[1 + i] == input[i]); + for (; i < n; i++) + ASSERT (dest[1 + i] == 0); + ASSERT (dest[1 + n] == MAGIC); + + free (dest); +} + +static void +check (const UNIT *input, size_t input_length) +{ + size_t length; + size_t n; + + ASSERT (input_length > 0); + ASSERT (input[input_length - 1] == 0); + length = input_length - 1; /* = U_STRLEN (input) */ + + for (n = 0; n <= 2 * length + 2; n++) + check_single (input, length, n); + + /* Check that U_STPNCPY (D, S, N) does not look at more than + MIN (U_STRLEN (S) + 1, N) units. */ + { + char *page_boundary = (char *) zerosize_ptr (); + + if (page_boundary != NULL) + { + for (n = 0; n <= 2 * length + 2; n++) + { + size_t n_to_copy = (n <= length ? n : length + 1); + UNIT *copy; + size_t i; + + copy = (UNIT *) page_boundary - n_to_copy; + for (i = 0; i < n_to_copy; i++) + copy[i] = input[i]; + + check_single (copy, length, n); + } + } + } +} diff --git a/tests/unistr/test-strcat.h b/tests/unistr/test-strcat.h new file mode 100644 index 0000000..6c1f90d --- /dev/null +++ b/tests/unistr/test-strcat.h @@ -0,0 +1,56 @@ +/* Test of uN_strcat() functions. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +int +main () +{ + /* Test small copying operations. */ + { + static const UNIT base[] = { 'C', 'h', 'a', 'n', 'g', 'i', 'n', 'g', 0 }; + static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e', 0 }; + size_t m; + size_t n; + + for (m = 0; m < SIZEOF (base); m++) + for (n = 1; n <= SIZEOF (src); n++) + { + UNIT dest[1 + (SIZEOF (base) - 1) + SIZEOF (src) + 1] = + { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, + MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC + }; + UNIT *result; + size_t i; + + for (i = 0; i < m; i++) + dest[1 + i] = base[i]; + dest[1 + m] = 0; + + result = U_STRCAT (dest + 1, src + SIZEOF (src) - n); + ASSERT (result == dest + 1); + + ASSERT (dest[0] == MAGIC); + for (i = 0; i < m; i++) + ASSERT (dest[1 + i] == base[i]); + for (i = 0; i < n; i++) + ASSERT (dest[1 + m + i] == src[SIZEOF (src) - n + i]); + ASSERT (dest[1 + m + n] == MAGIC); + } + } + + return 0; +} diff --git a/tests/unistr/test-strcmp.h b/tests/unistr/test-strcmp.h new file mode 100644 index 0000000..485b6f9 --- /dev/null +++ b/tests/unistr/test-strcmp.h @@ -0,0 +1,56 @@ +/* Test of uN_strcmp() and uN_strcoll() functions. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +static void +test_strcmp (void) +{ + { + static const UNIT input1[] = { 0 }; + static const UNIT input2[] = { 0 }; + ASSERT (U_STRCMP (input1, input2) == 0); + } + { + static const UNIT input1[] = { 0 }; + static const UNIT input2[] = { 'f', 'o', 'o', 0 }; + ASSERT (U_STRCMP (input1, input2) < 0); + ASSERT (U_STRCMP (input2, input1) > 0); + } + { + static const UNIT input1[] = { 'f', 'o', 'o', 0 }; + static const UNIT input2[] = { 'f', 'o', 'o', 0 }; + ASSERT (U_STRCMP (input1, input2) == 0); + } + { + static const UNIT input1[] = { 'f', 'o', 'o', 0 }; + static const UNIT input2[] = { 'b', 'a', 'r', 0 }; + ASSERT (U_STRCMP (input1, input2) > 0); + ASSERT (U_STRCMP (input2, input1) < 0); + } + { + static const UNIT input1[] = { 'f', 'o', 'o', 0 }; + static const UNIT input2[] = { 'f', 'o', 'o', 'b', 'a', 'r', 0 }; + ASSERT (U_STRCMP (input1, input2) < 0); + ASSERT (U_STRCMP (input2, input1) > 0); + } + { + static const UNIT input1[] = { 'o', 'o', 'm', 'p', 'h', 0 }; + static const UNIT input2[] = { 'o', 'o', 'p', 's', 0 }; + ASSERT (U_STRCMP (input1, input2) < 0); + ASSERT (U_STRCMP (input2, input1) > 0); + } +} diff --git a/tests/unistr/test-strcpy.h b/tests/unistr/test-strcpy.h new file mode 100644 index 0000000..f8fe5ef --- /dev/null +++ b/tests/unistr/test-strcpy.h @@ -0,0 +1,47 @@ +/* Test of uN_strcpy() functions. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +int +main () +{ + /* Test small copying operations. */ + { + static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e', 0 }; + size_t n; + + for (n = 1; n <= SIZEOF (src); n++) + { + UNIT dest[1 + SIZEOF (src) + 1] = + { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, + MAGIC + }; + UNIT *result; + size_t i; + + result = U_STRCPY (dest + 1, src + SIZEOF (src) - n); + ASSERT (result == dest + 1); + + ASSERT (dest[0] == MAGIC); + for (i = 0; i < n; i++) + ASSERT (dest[1 + i] == src[SIZEOF (src) - n + i]); + ASSERT (dest[1 + n] == MAGIC); + } + } + + return 0; +} diff --git a/tests/unistr/test-strdup.h b/tests/unistr/test-strdup.h new file mode 100644 index 0000000..1684b39 --- /dev/null +++ b/tests/unistr/test-strdup.h @@ -0,0 +1,41 @@ +/* Test of uN_strdup() functions. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +int +main () +{ + /* Test small copying operations. */ + { + static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e', 0 }; + size_t n; + + for (n = 1; n <= SIZEOF (src); n++) + { + UNIT *result = U_STRDUP (src + SIZEOF (src) - n); + size_t i; + + ASSERT (result != NULL); + for (i = 0; i < n; i++) + ASSERT (result[i] == src[SIZEOF (src) - n + i]); + + free (result); + } + } + + return 0; +} diff --git a/tests/unistr/test-strncat.h b/tests/unistr/test-strncat.h new file mode 100644 index 0000000..0445b6d --- /dev/null +++ b/tests/unistr/test-strncat.h @@ -0,0 +1,90 @@ +/* Test of uN_strncat() functions. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +static void +check_single (const UNIT *input, size_t length, size_t n) +{ + static const UNIT base[] = { 'C', 'h', 'a', 'n', 'g', 'i', 'n', 'g', 0 }; + size_t m; + + for (m = 0; m < SIZEOF (base); m++) + { + UNIT *dest; + UNIT *result; + size_t i; + + dest = (UNIT *) malloc ((1 + m + n + 2) * sizeof (UNIT)); + ASSERT (dest != NULL); + + dest[0] = MAGIC; + for (i = 0; i < m; i++) + dest[1 + i] = base[i]; + dest[1 + m] = 0; + for (i = 1; i < n + 2; i++) + dest[1 + m + i] = MAGIC; + + result = U_STRNCAT (dest + 1, input, n); + ASSERT (result == dest + 1); + + ASSERT (dest[0] == MAGIC); + for (i = 0; i < m; i++) + ASSERT (dest[1 + i] == base[i]); + for (i = 0; i < (n <= length ? n : length); i++) + ASSERT (dest[1 + m + i] == input[i]); + ASSERT (dest[1 + m + i] == 0); + ASSERT (dest[1 + m + i + 1] == MAGIC); + + free (dest); + } +} + +static void +check (const UNIT *input, size_t input_length) +{ + size_t length; + size_t n; + + ASSERT (input_length > 0); + ASSERT (input[input_length - 1] == 0); + length = input_length - 1; /* = U_STRLEN (input) */ + + for (n = 0; n <= 2 * length + 2; n++) + check_single (input, length, n); + + /* Check that U_STRNCAT (D, S, N) does not look at more than + MIN (U_STRLEN (S) + 1, N) units. */ + { + char *page_boundary = (char *) zerosize_ptr (); + + if (page_boundary != NULL) + { + for (n = 0; n <= 2 * length + 2; n++) + { + size_t n_to_copy = (n <= length ? n : length + 1); + UNIT *copy; + size_t i; + + copy = (UNIT *) page_boundary - n_to_copy; + for (i = 0; i < n_to_copy; i++) + copy[i] = input[i]; + + check_single (copy, length, n); + } + } + } +} diff --git a/tests/unistr/test-strncmp.h b/tests/unistr/test-strncmp.h new file mode 100644 index 0000000..628db94 --- /dev/null +++ b/tests/unistr/test-strncmp.h @@ -0,0 +1,92 @@ +/* Test of uN_strncmp() functions. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +static void +test_strncmp (void) +{ + { + static const UNIT input1[] = { 0 }; + static const UNIT input2[] = { 0 }; + ASSERT (U_STRNCMP (input1, input2, 0) == 0); + ASSERT (U_STRNCMP (input1, input2, 1) == 0); + ASSERT (U_STRNCMP (input1, input2, 1000000) == 0); + } + { + static const UNIT input1[] = { 0 }; + static const UNIT input2[] = { 'f', 'o', 'o', 0 }; + ASSERT (U_STRNCMP (input1, input2, 0) == 0); + ASSERT (U_STRNCMP (input1, input2, 1) < 0); + ASSERT (U_STRNCMP (input2, input1, 1) > 0); + ASSERT (U_STRNCMP (input1, input2, 3) < 0); + ASSERT (U_STRNCMP (input2, input1, 3) > 0); + ASSERT (U_STRNCMP (input1, input2, 4) < 0); + ASSERT (U_STRNCMP (input2, input1, 4) > 0); + ASSERT (U_STRNCMP (input1, input2, 1000000) < 0); + ASSERT (U_STRNCMP (input2, input1, 1000000) > 0); + } + { + static const UNIT input1[] = { 'f', 'o', 'o', 0 }; + static const UNIT input2[] = { 'f', 'o', 'o', 0 }; + ASSERT (U_STRNCMP (input1, input2, 0) == 0); + ASSERT (U_STRNCMP (input1, input2, 1) == 0); + ASSERT (U_STRNCMP (input1, input2, 2) == 0); + ASSERT (U_STRNCMP (input1, input2, 3) == 0); + ASSERT (U_STRNCMP (input1, input2, 4) == 0); + ASSERT (U_STRNCMP (input1, input2, 1000000) == 0); + } + { + static const UNIT input1[] = { 'f', 'o', 'o', 0 }; + static const UNIT input2[] = { 'b', 'a', 'r', 0 }; + ASSERT (U_STRNCMP (input1, input2, 0) == 0); + ASSERT (U_STRNCMP (input1, input2, 1) > 0); + ASSERT (U_STRNCMP (input2, input1, 1) < 0); + ASSERT (U_STRNCMP (input1, input2, 2) > 0); + ASSERT (U_STRNCMP (input2, input1, 2) < 0); + ASSERT (U_STRNCMP (input1, input2, 1000000) > 0); + ASSERT (U_STRNCMP (input2, input1, 1000000) < 0); + } + { + static const UNIT input1[] = { 'f', 'o', 'o', 0 }; + static const UNIT input2[] = { 'f', 'o', 'o', 'b', 'a', 'r', 0 }; + ASSERT (U_STRNCMP (input1, input2, 0) == 0); + ASSERT (U_STRNCMP (input1, input2, 1) == 0); + ASSERT (U_STRNCMP (input1, input2, 2) == 0); + ASSERT (U_STRNCMP (input1, input2, 3) == 0); + ASSERT (U_STRNCMP (input1, input2, 4) < 0); + ASSERT (U_STRNCMP (input2, input1, 4) > 0); + ASSERT (U_STRNCMP (input1, input2, 1000000) < 0); + ASSERT (U_STRNCMP (input2, input1, 1000000) > 0); + } + { + static const UNIT input1[] = { 'o', 'o', 'm', 'p', 'h', 0 }; + static const UNIT input2[] = { 'o', 'o', 'p', 's', 0 }; + ASSERT (U_STRNCMP (input1, input2, 0) == 0); + ASSERT (U_STRNCMP (input1, input2, 1) == 0); + ASSERT (U_STRNCMP (input1, input2, 2) == 0); + ASSERT (U_STRNCMP (input1, input2, 3) < 0); + ASSERT (U_STRNCMP (input2, input1, 3) > 0); + ASSERT (U_STRNCMP (input1, input2, 4) < 0); + ASSERT (U_STRNCMP (input2, input1, 4) > 0); + ASSERT (U_STRNCMP (input1, input2, 5) < 0); + ASSERT (U_STRNCMP (input2, input1, 5) > 0); + ASSERT (U_STRNCMP (input1, input2, 6) < 0); + ASSERT (U_STRNCMP (input2, input1, 6) > 0); + ASSERT (U_STRNCMP (input1, input2, 1000000) < 0); + ASSERT (U_STRNCMP (input2, input1, 1000000) > 0); + } +} diff --git a/tests/unistr/test-strncpy.h b/tests/unistr/test-strncpy.h new file mode 100644 index 0000000..6fa0d12 --- /dev/null +++ b/tests/unistr/test-strncpy.h @@ -0,0 +1,79 @@ +/* Test of uN_strncpy() functions. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +static void +check_single (const UNIT *input, size_t length, size_t n) +{ + UNIT *dest; + UNIT *result; + size_t i; + + dest = (UNIT *) malloc ((1 + n + 1) * sizeof (UNIT)); + ASSERT (dest != NULL); + + for (i = 0; i < 1 + n + 1; i++) + dest[i] = MAGIC; + + result = U_STRNCPY (dest + 1, input, n); + ASSERT (result == dest + 1); + + ASSERT (dest[0] == MAGIC); + for (i = 0; i < (n <= length ? n : length + 1); i++) + ASSERT (dest[1 + i] == input[i]); + for (; i < n; i++) + ASSERT (dest[1 + i] == 0); + ASSERT (dest[1 + n] == MAGIC); + + free (dest); +} + +static void +check (const UNIT *input, size_t input_length) +{ + size_t length; + size_t n; + + ASSERT (input_length > 0); + ASSERT (input[input_length - 1] == 0); + length = input_length - 1; /* = U_STRLEN (input) */ + + for (n = 0; n <= 2 * length + 2; n++) + check_single (input, length, n); + + /* Check that U_STRNCPY (D, S, N) does not look at more than + MIN (U_STRLEN (S) + 1, N) units. */ + { + char *page_boundary = (char *) zerosize_ptr (); + + if (page_boundary != NULL) + { + for (n = 0; n <= 2 * length + 2; n++) + { + size_t n_to_copy = (n <= length ? n : length + 1); + UNIT *copy; + size_t i; + + copy = (UNIT *) page_boundary - n_to_copy; + for (i = 0; i < n_to_copy; i++) + copy[i] = input[i]; + + check_single (copy, length, n); + } + } + } +} diff --git a/tests/unistr/test-strnlen.h b/tests/unistr/test-strnlen.h new file mode 100644 index 0000000..1199126 --- /dev/null +++ b/tests/unistr/test-strnlen.h @@ -0,0 +1,60 @@ +/* Test of uN_strnlen() functions. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +static void +check_single (const UNIT *input, size_t length, size_t n) +{ + size_t result = U_STRNLEN (input, n); + ASSERT (result == (n <= length ? n : length)); +} + +static void +check (const UNIT *input, size_t input_length) +{ + size_t length; + size_t n; + + ASSERT (input_length > 0); + ASSERT (input[input_length - 1] == 0); + length = input_length - 1; /* = U_STRLEN (input) */ + + for (n = 0; n <= 2 * length + 2; n++) + check_single (input, length, n); + + /* Check that U_STRNLEN (S, N) does not look at more than + MIN (U_STRLEN (S) + 1, N) units. */ + { + char *page_boundary = (char *) zerosize_ptr (); + + if (page_boundary != NULL) + { + for (n = 0; n <= 2 * length + 2; n++) + { + size_t n_to_copy = (n <= length ? n : length + 1); + UNIT *copy; + size_t i; + + copy = (UNIT *) page_boundary - n_to_copy; + for (i = 0; i < n_to_copy; i++) + copy[i] = input[i]; + + check_single (copy, length, n); + } + } + } +} diff --git a/tests/unistr/test-u16-check.c b/tests/unistr/test-u16-check.c new file mode 100644 index 0000000..b7a9c10 --- /dev/null +++ b/tests/unistr/test-u16-check.c @@ -0,0 +1,66 @@ +/* Test of u16_check() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + /* Test empty string. */ + { + static const uint16_t input[] = { 0 }; + ASSERT (u16_check (input, 0) == NULL); + } + + /* Test valid non-empty string. */ + { + static const uint16_t input[] = /* "Данило Шеган" */ + { 0x0414, 0x0430, 0x043D, 0x0438, 0x043B, 0x043E, 0x0020, 0x0428, 0x0435, 0x0433, 0x0430, 0x043D }; + ASSERT (u16_check (input, SIZEOF (input)) == NULL); + } + + /* Test out-of-range character with 2 units: U+110000. */ + { + static const uint16_t input[] = { 0x0414, 0x0430, 0xDBFF, 0xE000 }; + ASSERT (u16_check (input, SIZEOF (input)) == input + 2); + } + + /* Test surrogate codepoints. */ + { + static const uint16_t input[] = { 0x0414, 0x0430, 0xDBFF, 0xDFFF }; + ASSERT (u16_check (input, SIZEOF (input)) == NULL); + } + { + static const uint16_t input[] = { 0x0414, 0x0430, 0xDBFF }; + ASSERT (u16_check (input, SIZEOF (input)) == input + 2); + } + { + static const uint16_t input[] = { 0x0414, 0x0430, 0xDFFF }; + ASSERT (u16_check (input, SIZEOF (input)) == input + 2); + } + { + static const uint16_t input[] = { 0x0414, 0x0430, 0xDFFF, 0xDBFF }; + ASSERT (u16_check (input, SIZEOF (input)) == input + 2); + } + + return 0; +} diff --git a/tests/unistr/test-u16-chr.c b/tests/unistr/test-u16-chr.c new file mode 100644 index 0000000..d71755c --- /dev/null +++ b/tests/unistr/test-u16-chr.c @@ -0,0 +1,31 @@ +/* Test of u16_chr() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <stdlib.h> + +#include "zerosize-ptr.h" +#include "macros.h" + +#define UNIT uint16_t +#define U_CHR u16_chr +#define U_SET u16_set +#include "test-chr.h" diff --git a/tests/test-open.c b/tests/unistr/test-u16-cmp.c index f7bb543..1ab9019 100644 --- a/tests/test-open.c +++ b/tests/unistr/test-u16-cmp.c @@ -1,5 +1,5 @@ -/* Test of opening a file descriptor. - Copyright (C) 2007-2009 Free Software Foundation, Inc. +/* Test of u16_cmp() function. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -14,34 +14,34 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ #include <config.h> -#include <fcntl.h> +#include "unistr.h" -#include <stdio.h> -#include <stdlib.h> +#include "zerosize-ptr.h" +#include "macros.h" -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#define UNIT uint16_t +#define U_CMP u16_cmp +#define MAGIC 0xBADE +#include "test-cmp.h" int main () { - ASSERT (open ("nonexist.ent/", O_CREAT | O_RDONLY, 0600) < 0); - ASSERT (open ("/dev/null/", O_RDONLY) < 0); - - ASSERT (open ("/dev/null", O_RDONLY) >= 0); + test_cmp (); + + /* Test comparison with non-BMP characters, split into surrogates. */ + { + static const UNIT input1[] = { 0xD835, 0xDD1E }; + static const UNIT input2[] = { 0xFEFF, 0xFFE5 }; + ASSERT (U_CMP (input1, input2, 2) > 0); + ASSERT (U_CMP (input2, input1, 2) < 0); + ASSERT (U_CMP (input1, input2, 1) > 0); + ASSERT (U_CMP (input2, input1, 1) < 0); + } return 0; } diff --git a/tests/unistr/test-u16-cmp2.c b/tests/unistr/test-u16-cmp2.c new file mode 100644 index 0000000..3993dcd --- /dev/null +++ b/tests/unistr/test-u16-cmp2.c @@ -0,0 +1,28 @@ +/* Test of u16_cmp2() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint16_t +#define U_CMP2 u16_cmp2 +#define MAGIC 0xBADE +#include "test-cmp2.h" diff --git a/tests/unistr/test-u16-cpy-alloc.c b/tests/unistr/test-u16-cpy-alloc.c new file mode 100644 index 0000000..d1aa211 --- /dev/null +++ b/tests/unistr/test-u16-cpy-alloc.c @@ -0,0 +1,29 @@ +/* Test of u16_cpy_alloc() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <stdlib.h> + +#include "macros.h" + +#define UNIT uint16_t +#define U_CPY_ALLOC u16_cpy_alloc +#include "test-cpy-alloc.h" diff --git a/tests/unistr/test-u16-cpy.c b/tests/unistr/test-u16-cpy.c new file mode 100644 index 0000000..168a459 --- /dev/null +++ b/tests/unistr/test-u16-cpy.c @@ -0,0 +1,28 @@ +/* Test of u16_cpy() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint16_t +#define U_CPY u16_cpy +#define MAGIC 0xBADE +#include "test-cpy.h" diff --git a/tests/unistr/test-u16-mblen.c b/tests/unistr/test-u16-mblen.c new file mode 100644 index 0000000..13186f3 --- /dev/null +++ b/tests/unistr/test-u16-mblen.c @@ -0,0 +1,84 @@ +/* Test of u16_mblen() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + int ret; + + /* Test zero-length input. */ + { + static const uint16_t input[] = { 0 }; + ret = u16_mblen (input, 0); + ASSERT (ret == -1); + } + + /* Test NUL unit input. */ + { + static const uint16_t input[] = { 0 }; + ret = u16_mblen (input, 1); + ASSERT (ret == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint16_t buf[1]; + + for (c = 1; c < 0x80; c++) + { + buf[0] = c; + ret = u16_mblen (buf, 1); + ASSERT (ret == 1); + } + } + + /* Test BMP unit input. */ + { + static const uint16_t input[] = { 0x20AC }; + ret = u16_mblen (input, 1); + ASSERT (ret == 1); + } + + /* Test 2-units character input. */ + { + static const uint16_t input[] = { 0xD835, 0xDD1F }; + ret = u16_mblen (input, 2); + ASSERT (ret == 2); + } + + /* Test incomplete/invalid 1-unit input. */ + { + static const uint16_t input[] = { 0xD835 }; + ret = u16_mblen (input, 1); + ASSERT (ret == -1); + } + { + static const uint16_t input[] = { 0xDD1F }; + ret = u16_mblen (input, 1); + ASSERT (ret == -1); + } + + return 0; +} diff --git a/tests/unistr/test-u16-mbsnlen.c b/tests/unistr/test-u16-mbsnlen.c new file mode 100644 index 0000000..a2d8b10 --- /dev/null +++ b/tests/unistr/test-u16-mbsnlen.c @@ -0,0 +1,68 @@ +/* Test of u16_mbsnlen() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint16_t input[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + }; + size_t n; + + for (n = 0; n <= SIZEOF (input); n++) + { + size_t len = u16_mbsnlen (input, n); + ASSERT (len == n); + } + } + + /* String with characters outside the BMP. */ + { + static const uint16_t input[] = + { '-', '(', 0xD835, 0xDD1E, 0x00D7, 0xD835, 0xDD1F, ')', '=', + 0xD835, 0xDD1F, 0x00D7, 0xD835, 0xDD1E + }; + static const size_t expected[SIZEOF (input) + 1] = + { 0, + 1, 2, 3, 3, 4, 5, 5, 6, 7, + 8, 8, 9, 10, 10 + }; + size_t n; + + for (n = 0; n <= SIZEOF (input); n++) + { + size_t len = u16_mbsnlen (input, n); + ASSERT (len == expected[n]); + } + } + + return 0; +} diff --git a/tests/test-fcntl.c b/tests/unistr/test-u16-mbtouc-unsafe.c index 449984c..a1d1214 100644 --- a/tests/test-fcntl.c +++ b/tests/unistr/test-u16-mbtouc-unsafe.c @@ -1,5 +1,5 @@ -/* Test of <fcntl.h> substitute. - Copyright (C) 2007 Free Software Foundation, Inc. +/* Test of u16_mbtouc_unsafe() function. + Copyright (C) 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -14,22 +14,20 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* Written by Bruno Haible <bruno@clisp.org>, 2007. */ +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ #include <config.h> -#include <fcntl.h> +#include "unistr.h" -/* Check that the various O_* macros are defined. */ -int o = O_DIRECT | O_DIRECTORY | O_DSYNC | O_NDELAY | O_NOATIME | O_NONBLOCK - | O_NOCTTY | O_NOFOLLOW | O_NOLINKS | O_RSYNC | O_SYNC - | O_BINARY | O_TEXT; +#include "macros.h" -/* Check that the various SEEK_* macros are defined. */ -int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET }; +#include "test-u16-mbtouc.h" int main () { + test_function (u16_mbtouc_unsafe); + return 0; } diff --git a/tests/unistr/test-u16-mbtouc.c b/tests/unistr/test-u16-mbtouc.c new file mode 100644 index 0000000..4545add --- /dev/null +++ b/tests/unistr/test-u16-mbtouc.c @@ -0,0 +1,33 @@ +/* Test of u16_mbtouc() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#include "test-u16-mbtouc.h" + +int +main () +{ + test_function (u16_mbtouc); + + return 0; +} diff --git a/tests/unistr/test-u16-mbtouc.h b/tests/unistr/test-u16-mbtouc.h new file mode 100644 index 0000000..ef0fb68 --- /dev/null +++ b/tests/unistr/test-u16-mbtouc.h @@ -0,0 +1,82 @@ +/* Test of u16_mbtouc() and u16_mbtouc_unsafe() functions. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +static void +test_function (int (*my_u16_mbtouc) (ucs4_t *, const uint16_t *, size_t)) +{ + ucs4_t uc; + int ret; + + /* Test NUL unit input. */ + { + static const uint16_t input[] = { 0 }; + uc = 0xBADFACE; + ret = my_u16_mbtouc (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint16_t buf[1]; + + for (c = 0; c < 0x80; c++) + { + buf[0] = c; + uc = 0xBADFACE; + ret = my_u16_mbtouc (&uc, buf, 1); + ASSERT (ret == 1); + ASSERT (uc == c); + } + } + + /* Test BMP unit input. */ + { + static const uint16_t input[] = { 0x20AC }; + uc = 0xBADFACE; + ret = my_u16_mbtouc (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0x20AC); + } + + /* Test 2-units character input. */ + { + static const uint16_t input[] = { 0xD835, 0xDD1F }; + uc = 0xBADFACE; + ret = my_u16_mbtouc (&uc, input, 2); + ASSERT (ret == 2); + ASSERT (uc == 0x1D51F); + } + + /* Test incomplete/invalid 1-unit input. */ + { + static const uint16_t input[] = { 0xD835 }; + uc = 0xBADFACE; + ret = my_u16_mbtouc (&uc, input, 1); + ASSERT (ret == 1 || ret == 2); + ASSERT (uc == 0xFFFD); + } + { + static const uint16_t input[] = { 0xDD1F }; + uc = 0xBADFACE; + ret = my_u16_mbtouc (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0xFFFD); + } +} diff --git a/tests/unistr/test-u16-mbtoucr.c b/tests/unistr/test-u16-mbtoucr.c new file mode 100644 index 0000000..fb1264d --- /dev/null +++ b/tests/unistr/test-u16-mbtoucr.c @@ -0,0 +1,90 @@ +/* Test of u16_mbtoucr() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + ucs4_t uc; + int ret; + + /* Test NUL unit input. */ + { + static const uint16_t input[] = { 0 }; + uc = 0xBADFACE; + ret = u16_mbtoucr (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint16_t buf[1]; + + for (c = 0; c < 0x80; c++) + { + buf[0] = c; + uc = 0xBADFACE; + ret = u16_mbtoucr (&uc, buf, 1); + ASSERT (ret == 1); + ASSERT (uc == c); + } + } + + /* Test BMP unit input. */ + { + static const uint16_t input[] = { 0x20AC }; + uc = 0xBADFACE; + ret = u16_mbtoucr (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0x20AC); + } + + /* Test 2-units character input. */ + { + static const uint16_t input[] = { 0xD835, 0xDD1F }; + uc = 0xBADFACE; + ret = u16_mbtoucr (&uc, input, 2); + ASSERT (ret == 2); + ASSERT (uc == 0x1D51F); + } + + /* Test incomplete/invalid 1-unit input. */ + { + static const uint16_t input[] = { 0xD835 }; + uc = 0xBADFACE; + ret = u16_mbtoucr (&uc, input, 1); + ASSERT (ret == -2); + ASSERT (uc == 0xFFFD); + } + { + static const uint16_t input[] = { 0xDD1F }; + uc = 0xBADFACE; + ret = u16_mbtoucr (&uc, input, 1); + ASSERT (ret == -1); + ASSERT (uc == 0xFFFD); + } + + return 0; +} diff --git a/tests/unistr/test-u16-move.c b/tests/unistr/test-u16-move.c new file mode 100644 index 0000000..ff1e6e3 --- /dev/null +++ b/tests/unistr/test-u16-move.c @@ -0,0 +1,28 @@ +/* Test of u16_move() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint16_t +#define U_MOVE u16_move +#define MAGIC 0xBADE +#include "test-move.h" diff --git a/tests/unistr/test-u16-next.c b/tests/unistr/test-u16-next.c new file mode 100644 index 0000000..d9ac6e9 --- /dev/null +++ b/tests/unistr/test-u16-next.c @@ -0,0 +1,91 @@ +/* Test of u16_next() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + ucs4_t uc; + const uint16_t *ret; + + /* Test NUL unit input. */ + { + static const uint16_t input[] = { 0 }; + uc = 0xBADFACE; + ret = u16_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint16_t buf[2]; + + for (c = 1; c < 0x80; c++) + { + buf[0] = c; + buf[1] = 0; + uc = 0xBADFACE; + ret = u16_next (&uc, buf); + ASSERT (ret == buf + 1); + ASSERT (uc == c); + } + } + + /* Test BMP unit input. */ + { + static const uint16_t input[] = { 0x20AC, 0 }; + uc = 0xBADFACE; + ret = u16_next (&uc, input); + ASSERT (ret == input + 1); + ASSERT (uc == 0x20AC); + } + + /* Test 2-units character input. */ + { + static const uint16_t input[] = { 0xD835, 0xDD1F, 0 }; + uc = 0xBADFACE; + ret = u16_next (&uc, input); + ASSERT (ret == input + 2); + ASSERT (uc == 0x1D51F); + } + + /* Test incomplete/invalid 1-unit input. */ + { + static const uint16_t input[] = { 0xD835, 0 }; + uc = 0xBADFACE; + ret = u16_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0xFFFD); + } + { + static const uint16_t input[] = { 0xDD1F, 0 }; + uc = 0xBADFACE; + ret = u16_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0xFFFD); + } + + return 0; +} diff --git a/tests/unistr/test-u16-prev.c b/tests/unistr/test-u16-prev.c new file mode 100644 index 0000000..90e8341 --- /dev/null +++ b/tests/unistr/test-u16-prev.c @@ -0,0 +1,175 @@ +/* Test of u16_prev() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +static int +check (const uint16_t *input, size_t input_length, ucs4_t *puc) +{ + ucs4_t uc; + + /* Test recognition when at the beginning of the string. */ + if (u16_prev (&uc, input + input_length, input) != input) + return 1; + + /* Test recognition when preceded by a 1-unit character. */ + { + uint16_t buf[100]; + uint16_t *ptr; + size_t i; + ucs4_t uc1; + + ptr = buf; + *ptr++ = 0x2102; + for (i = 0; i < input_length; i++) + ptr[i] = input[i]; + + if (u16_prev (&uc1, ptr + input_length, buf) != ptr) + return 2; + if (uc1 != uc) + return 3; + } + + /* Test recognition when preceded by a 2-unit character. */ + { + uint16_t buf[100]; + uint16_t *ptr; + size_t i; + ucs4_t uc1; + + ptr = buf; + *ptr++ = 0xD835; + *ptr++ = 0xDD1E; + for (i = 0; i < input_length; i++) + ptr[i] = input[i]; + + if (u16_prev (&uc1, ptr + input_length, buf) != ptr) + return 4; + if (uc1 != uc) + return 5; + } + + *puc = uc; + return 0; +} + +static int +check_invalid (const uint16_t *input, size_t input_length) +{ + ucs4_t uc; + + /* Test recognition when at the beginning of the string. */ + uc = 0xBADFACE; + if (u16_prev (&uc, input + input_length, input) != NULL) + return 1; + if (uc != 0xBADFACE) + return 2; + +#if CONFIG_UNICODE_SAFETY + /* Test recognition when preceded by a 1-unit character. */ + { + uint16_t buf[100]; + uint16_t *ptr; + size_t i; + + ptr = buf; + *ptr++ = 0x2102; + for (i = 0; i < input_length; i++) + ptr[i] = input[i]; + + uc = 0xBADFACE; + if (u16_prev (&uc, ptr + input_length, buf) != NULL) + return 3; + if (uc != 0xBADFACE) + return 4; + } + + /* Test recognition when preceded by a 2-unit character. */ + { + uint16_t buf[100]; + uint16_t *ptr; + size_t i; + + ptr = buf; + *ptr++ = 0xD835; + *ptr++ = 0xDD1E; + for (i = 0; i < input_length; i++) + ptr[i] = input[i]; + + uc = 0xBADFACE; + if (u16_prev (&uc, ptr + input_length, buf) != NULL) + return 5; + if (uc != 0xBADFACE) + return 6; + } +#endif + + return 0; +} + +int +main () +{ + ucs4_t uc; + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint16_t buf[1]; + + for (c = 0; c < 0x80; c++) + { + buf[0] = c; + uc = 0xBADFACE; + ASSERT (check (buf, 1, &uc) == 0); + ASSERT (uc == c); + } + } + + /* Test BMP unit input. */ + { + static const uint16_t input[] = { 0x20AC }; + uc = 0xBADFACE; + ASSERT (check (input, SIZEOF (input), &uc) == 0); + ASSERT (uc == 0x20AC); + } + + /* Test 2-units character input. */ + { + static const uint16_t input[] = { 0xD835, 0xDD1F }; + uc = 0xBADFACE; + ASSERT (check (input, SIZEOF (input), &uc) == 0); + ASSERT (uc == 0x1D51F); + } + + /* Test incomplete/invalid 1-unit input. */ + { + static const uint16_t input[] = { 0xD835 }; + ASSERT (check_invalid (input, SIZEOF (input)) == 0); + } + { + static const uint16_t input[] = { 0xDD1F }; + ASSERT (check_invalid (input, SIZEOF (input)) == 0); + } + + return 0; +} diff --git a/tests/unistr/test-u16-set.c b/tests/unistr/test-u16-set.c new file mode 100644 index 0000000..f3e6305 --- /dev/null +++ b/tests/unistr/test-u16-set.c @@ -0,0 +1,29 @@ +/* Test of u16_set() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint16_t +#define U_SET u16_set +#define MAGIC 0xBADE +#define VALUE 0x2102 +#include "test-set.h" diff --git a/tests/unistr/test-u16-stpcpy.c b/tests/unistr/test-u16-stpcpy.c new file mode 100644 index 0000000..6bf3ecb --- /dev/null +++ b/tests/unistr/test-u16-stpcpy.c @@ -0,0 +1,28 @@ +/* Test of u16_stpcpy() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint16_t +#define U_STPCPY u16_stpcpy +#define MAGIC 0xBADE +#include "test-stpcpy.h" diff --git a/tests/unistr/test-u16-stpncpy.c b/tests/unistr/test-u16-stpncpy.c new file mode 100644 index 0000000..e53ce6b --- /dev/null +++ b/tests/unistr/test-u16-stpncpy.c @@ -0,0 +1,59 @@ +/* Test of u16_stpncpy() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include <stdlib.h> + +#include "zerosize-ptr.h" +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint16_t +#define U_STPNCPY u16_stpncpy +#define MAGIC 0xBADE +#include "test-stpncpy.h" + +int +main () +{ + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint16_t input[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, 0 + }; + check (input, SIZEOF (input)); + } + + /* String with characters outside the BMP. */ + { + static const uint16_t input[] = + { '-', '(', 0xD835, 0xDD1E, 0x00D7, 0xD835, 0xDD1F, ')', '=', + 0xD835, 0xDD1F, 0x00D7, 0xD835, 0xDD1E, 0 + }; + check (input, SIZEOF (input)); + } + + return 0; +} diff --git a/tests/unistr/test-u16-strcat.c b/tests/unistr/test-u16-strcat.c new file mode 100644 index 0000000..9d6032e --- /dev/null +++ b/tests/unistr/test-u16-strcat.c @@ -0,0 +1,28 @@ +/* Test of u16_strcat() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint16_t +#define U_STRCAT u16_strcat +#define MAGIC 0xBADE +#include "test-strcat.h" diff --git a/tests/unistr/test-u16-strcmp.c b/tests/unistr/test-u16-strcmp.c new file mode 100644 index 0000000..5fc4777 --- /dev/null +++ b/tests/unistr/test-u16-strcmp.c @@ -0,0 +1,34 @@ +/* Test of u16_strcmp() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define U_STRCMP u16_strcmp +#include "test-u16-strcmp.h" + +int +main () +{ + test_u16_strcmp (); + + return 0; +} diff --git a/tests/unistr/test-u16-strcmp.h b/tests/unistr/test-u16-strcmp.h new file mode 100644 index 0000000..ad54a43 --- /dev/null +++ b/tests/unistr/test-u16-strcmp.h @@ -0,0 +1,42 @@ +/* Test of u16_strcmp() and u16_strcoll() functions. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#define UNIT uint16_t +#include "test-strcmp.h" + +static void +test_u16_strcmp (void) +{ + test_strcmp (); + + /* Test comparison between ASCII and non-ASCII characters. */ + { + static const UNIT input1[] = { 'f', 'o', 'o', 0 }; + static const UNIT input2[] = { 0x2022, 0 }; + ASSERT (U_STRCMP (input1, input2) < 0); + ASSERT (U_STRCMP (input2, input1) > 0); + } + + /* Test comparison with non-BMP characters, split into surrogates. */ + { + static const UNIT input1[] = { 0xD835, 0xDD1E, 0 }; + static const UNIT input2[] = { 0xFEFF, 0 }; + ASSERT (U_STRCMP (input1, input2) > 0); + ASSERT (U_STRCMP (input2, input1) < 0); + } +} diff --git a/tests/unistr/test-u16-strcoll.c b/tests/unistr/test-u16-strcoll.c new file mode 100644 index 0000000..e24814a --- /dev/null +++ b/tests/unistr/test-u16-strcoll.c @@ -0,0 +1,41 @@ +/* Test of u16_strcoll() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define U_STRCMP u16_strcoll +#include "test-u16-strcmp.h" + +int +main () +{ + /* This test relies on three facts: + - setlocale is not being called, therefore the locale is the "C" locale. + - In the "C" locale, strcoll is equivalent to strcmp. + - In the u16_strcoll implementation, Unicode strings that are not + convertible to the locale encoding are sorted higher than convertible + strings and compared according to u16_strcmp. */ + + test_u16_strcmp (); + + return 0; +} diff --git a/tests/unistr/test-u16-strcpy.c b/tests/unistr/test-u16-strcpy.c new file mode 100644 index 0000000..e017a11 --- /dev/null +++ b/tests/unistr/test-u16-strcpy.c @@ -0,0 +1,28 @@ +/* Test of u16_strcpy() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint16_t +#define U_STRCPY u16_strcpy +#define MAGIC 0xBADE +#include "test-strcpy.h" diff --git a/tests/unistr/test-u16-strdup.c b/tests/unistr/test-u16-strdup.c new file mode 100644 index 0000000..f0266d1 --- /dev/null +++ b/tests/unistr/test-u16-strdup.c @@ -0,0 +1,27 @@ +/* Test of u16_strdup() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint16_t +#define U_STRDUP u16_strdup +#include "test-strdup.h" diff --git a/tests/unistr/test-u16-strlen.c b/tests/unistr/test-u16-strlen.c new file mode 100644 index 0000000..7b8690b --- /dev/null +++ b/tests/unistr/test-u16-strlen.c @@ -0,0 +1,57 @@ +/* Test of u16_strlen() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + /* Empty string. */ + { + static const uint16_t input[] = { 0 }; + ASSERT (u16_strlen (input) == 0); + } + + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint16_t input[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, 0 + }; + ASSERT (u16_strlen (input) == SIZEOF (input) - 1); + } + + /* String with characters outside the BMP. */ + { + static const uint16_t input[] = + { '-', '(', 0xD835, 0xDD1E, 0x00D7, 0xD835, 0xDD1F, ')', '=', + 0xD835, 0xDD1F, 0x00D7, 0xD835, 0xDD1E, 0 + }; + ASSERT (u16_strlen (input) == SIZEOF (input) - 1); + } + + return 0; +} diff --git a/tests/unistr/test-u16-strmblen.c b/tests/unistr/test-u16-strmblen.c new file mode 100644 index 0000000..80371b0 --- /dev/null +++ b/tests/unistr/test-u16-strmblen.c @@ -0,0 +1,78 @@ +/* Test of u16_strmblen() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + int ret; + + /* Test NUL unit input. */ + { + static const uint16_t input[] = { 0 }; + ret = u16_strmblen (input); + ASSERT (ret == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint16_t buf[2]; + + for (c = 1; c < 0x80; c++) + { + buf[0] = c; + buf[1] = 0; + ret = u16_strmblen (buf); + ASSERT (ret == 1); + } + } + + /* Test BMP unit input. */ + { + static const uint16_t input[] = { 0x20AC, 0 }; + ret = u16_strmblen (input); + ASSERT (ret == 1); + } + + /* Test 2-units character input. */ + { + static const uint16_t input[] = { 0xD835, 0xDD1F, 0 }; + ret = u16_strmblen (input); + ASSERT (ret == 2); + } + + /* Test incomplete/invalid 1-unit input. */ + { + static const uint16_t input[] = { 0xD835, 0 }; + ret = u16_strmblen (input); + ASSERT (ret == -1); + } + { + static const uint16_t input[] = { 0xDD1F, 0 }; + ret = u16_strmblen (input); + ASSERT (ret == -1); + } + + return 0; +} diff --git a/tests/unistr/test-u16-strmbtouc.c b/tests/unistr/test-u16-strmbtouc.c new file mode 100644 index 0000000..ceeaf2c --- /dev/null +++ b/tests/unistr/test-u16-strmbtouc.c @@ -0,0 +1,91 @@ +/* Test of u16_strmbtouc() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + ucs4_t uc; + int ret; + + /* Test NUL unit input. */ + { + static const uint16_t input[] = { 0 }; + uc = 0xBADFACE; + ret = u16_strmbtouc (&uc, input); + ASSERT (ret == 0); + ASSERT (uc == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint16_t buf[2]; + + for (c = 1; c < 0x80; c++) + { + buf[0] = c; + buf[1] = 0; + uc = 0xBADFACE; + ret = u16_strmbtouc (&uc, buf); + ASSERT (ret == 1); + ASSERT (uc == c); + } + } + + /* Test BMP unit input. */ + { + static const uint16_t input[] = { 0x20AC, 0 }; + uc = 0xBADFACE; + ret = u16_strmbtouc (&uc, input); + ASSERT (ret == 1); + ASSERT (uc == 0x20AC); + } + + /* Test 2-units character input. */ + { + static const uint16_t input[] = { 0xD835, 0xDD1F, 0 }; + uc = 0xBADFACE; + ret = u16_strmbtouc (&uc, input); + ASSERT (ret == 2); + ASSERT (uc == 0x1D51F); + } + + /* Test incomplete/invalid 1-unit input. */ + { + static const uint16_t input[] = { 0xD835, 0 }; + uc = 0xBADFACE; + ret = u16_strmbtouc (&uc, input); + ASSERT (ret == -1); + ASSERT (uc == 0xBADFACE); + } + { + static const uint16_t input[] = { 0xDD1F, 0 }; + uc = 0xBADFACE; + ret = u16_strmbtouc (&uc, input); + ASSERT (ret == -1); + ASSERT (uc == 0xBADFACE); + } + + return 0; +} diff --git a/tests/unistr/test-u16-strncat.c b/tests/unistr/test-u16-strncat.c new file mode 100644 index 0000000..c875cfc --- /dev/null +++ b/tests/unistr/test-u16-strncat.c @@ -0,0 +1,59 @@ +/* Test of u16_strncat() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <stdlib.h> + +#include "zerosize-ptr.h" +#include "macros.h" + +#define UNIT uint16_t +#define U_STRNCAT u16_strncat +#define MAGIC 0xBADE +#include "test-strncat.h" + +int +main () +{ + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint16_t input[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, 0 + }; + check (input, SIZEOF (input)); + } + + /* String with characters outside the BMP. */ + { + static const uint16_t input[] = + { '-', '(', 0xD835, 0xDD1E, 0x00D7, 0xD835, 0xDD1F, ')', '=', + 0xD835, 0xDD1F, 0x00D7, 0xD835, 0xDD1E, 0 + }; + check (input, SIZEOF (input)); + } + + return 0; +} diff --git a/tests/unistr/test-u16-strncmp.c b/tests/unistr/test-u16-strncmp.c new file mode 100644 index 0000000..b04431b --- /dev/null +++ b/tests/unistr/test-u16-strncmp.c @@ -0,0 +1,47 @@ +/* Test of u16_strncmp() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint16_t +#define U_STRNCMP u16_strncmp +#include "test-strncmp.h" + +int +main () +{ + test_strncmp (); + + /* Test comparison with non-BMP characters, split into surrogates. */ + { + static const UNIT input1[] = { 0xD835, 0xDD1E, 0 }; + static const UNIT input2[] = { 0xFEFF, 0 }; + ASSERT (U_STRNCMP (input1, input2, 1) > 0); + ASSERT (U_STRNCMP (input2, input1, 1) < 0); + ASSERT (U_STRNCMP (input1, input2, 2) > 0); + ASSERT (U_STRNCMP (input2, input1, 2) < 0); + ASSERT (U_STRNCMP (input1, input2, 1000000) > 0); + ASSERT (U_STRNCMP (input2, input1, 1000000) < 0); + } + + return 0; +} diff --git a/tests/unistr/test-u16-strncpy.c b/tests/unistr/test-u16-strncpy.c new file mode 100644 index 0000000..102f653 --- /dev/null +++ b/tests/unistr/test-u16-strncpy.c @@ -0,0 +1,59 @@ +/* Test of u16_strncpy() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <stdlib.h> + +#include "zerosize-ptr.h" +#include "macros.h" + +#define UNIT uint16_t +#define U_STRNCPY u16_strncpy +#define MAGIC 0xBADE +#include "test-strncpy.h" + +int +main () +{ + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint16_t input[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, 0 + }; + check (input, SIZEOF (input)); + } + + /* String with characters outside the BMP. */ + { + static const uint16_t input[] = + { '-', '(', 0xD835, 0xDD1E, 0x00D7, 0xD835, 0xDD1F, ')', '=', + 0xD835, 0xDD1F, 0x00D7, 0xD835, 0xDD1E, 0 + }; + check (input, SIZEOF (input)); + } + + return 0; +} diff --git a/tests/unistr/test-u16-strnlen.c b/tests/unistr/test-u16-strnlen.c new file mode 100644 index 0000000..beeba64 --- /dev/null +++ b/tests/unistr/test-u16-strnlen.c @@ -0,0 +1,56 @@ +/* Test of u16_strnlen() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "zerosize-ptr.h" +#include "macros.h" + +#define UNIT uint16_t +#define U_STRNLEN u16_strnlen +#include "test-strnlen.h" + +int +main () +{ + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint16_t input[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, 0 + }; + check (input, SIZEOF (input)); + } + + /* String with characters outside the BMP. */ + { + static const uint16_t input[] = + { '-', '(', 0xD835, 0xDD1E, 0x00D7, 0xD835, 0xDD1F, ')', '=', + 0xD835, 0xDD1F, 0x00D7, 0xD835, 0xDD1E, 0 + }; + check (input, SIZEOF (input)); + } + + return 0; +} diff --git a/tests/unistr/test-u16-to-u32.c b/tests/unistr/test-u16-to-u32.c new file mode 100644 index 0000000..5b382b2 --- /dev/null +++ b/tests/unistr/test-u16-to-u32.c @@ -0,0 +1,156 @@ +/* Test of u16_to_u32() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <errno.h> + +#include "macros.h" + +static int +check (const uint16_t *input, size_t input_length, + const uint32_t *expected, size_t expected_length) +{ + size_t length; + uint32_t *result; + + /* Test return conventions with resultbuf == NULL. */ + result = u16_to_u32 (input, input_length, NULL, &length); + if (!(result != NULL)) + return 1; + if (!(length == expected_length)) + return 2; + if (!(u32_cmp (result, expected, expected_length) == 0)) + return 3; + free (result); + + /* Test return conventions with resultbuf too small. */ + if (expected_length > 0) + { + uint32_t *preallocated; + + length = expected_length - 1; + preallocated = (uint32_t *) malloc (length * sizeof (uint32_t)); + result = u16_to_u32 (input, input_length, preallocated, &length); + if (!(result != NULL)) + return 4; + if (!(result != preallocated)) + return 5; + if (!(length == expected_length)) + return 6; + if (!(u32_cmp (result, expected, expected_length) == 0)) + return 7; + free (result); + free (preallocated); + } + + /* Test return conventions with resultbuf large enough. */ + { + uint32_t *preallocated; + + length = expected_length; + preallocated = (uint32_t *) malloc (length * sizeof (uint32_t)); + result = u16_to_u32 (input, input_length, preallocated, &length); + if (!(result != NULL)) + return 8; + if (!(preallocated == NULL || result == preallocated)) + return 9; + if (!(length == expected_length)) + return 10; + if (!(u32_cmp (result, expected, expected_length) == 0)) + return 11; + free (preallocated); + } + + return 0; +} + +int +main () +{ + /* Empty string. */ + ASSERT (check (NULL, 0, NULL, 0) == 0); + + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint16_t input[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + }; + static const uint32_t expected[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); + } + + /* String with characters outside the BMP. */ + { + static const uint16_t input[] = + { '-', '(', 0xD835, 0xDD1E, 0x00D7, 0xD835, 0xDD1F, ')', '=', + 0xD835, 0xDD1F, 0x00D7, 0xD835, 0xDD1E + }; + static const uint32_t expected[] = + { '-', '(', 0x1D51E, 0x00D7, 0x1D51F, ')', '=', + 0x1D51F, 0x00D7, 0x1D51E + }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); + } + + /* Invalid input. */ + { + static const uint16_t input[] = { 'x', 0xDD1E, 0xD835, 'y' }; +#if 0 /* Currently invalid input is rejected, not accommodated. */ + static const uint32_t expected[] = { 'x', 0xFFFD, 0xFFFD, 'y' }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); +#else + size_t length; + uint32_t *result; + uint32_t preallocated[10]; + + /* Test return conventions with resultbuf == NULL. */ + result = u16_to_u32 (input, SIZEOF (input), NULL, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); + + /* Test return conventions with resultbuf too small. */ + length = 1; + result = u16_to_u32 (input, SIZEOF (input), preallocated, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); + + /* Test return conventions with resultbuf large enough. */ + length = SIZEOF (preallocated); + result = u16_to_u32 (input, SIZEOF (input), preallocated, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); +#endif + } + + return 0; +} diff --git a/tests/unistr/test-u16-to-u8.c b/tests/unistr/test-u16-to-u8.c new file mode 100644 index 0000000..4ef9b9b --- /dev/null +++ b/tests/unistr/test-u16-to-u8.c @@ -0,0 +1,159 @@ +/* Test of u16_to_u8() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <errno.h> + +#include "macros.h" + +static int +check (const uint16_t *input, size_t input_length, + const uint8_t *expected, size_t expected_length) +{ + size_t length; + uint8_t *result; + + /* Test return conventions with resultbuf == NULL. */ + result = u16_to_u8 (input, input_length, NULL, &length); + if (!(result != NULL)) + return 1; + if (!(length == expected_length)) + return 2; + if (!(u8_cmp (result, expected, expected_length) == 0)) + return 3; + free (result); + + /* Test return conventions with resultbuf too small. */ + if (expected_length > 0) + { + uint8_t *preallocated; + + length = expected_length - 1; + preallocated = (uint8_t *) malloc (length * sizeof (uint8_t)); + result = u16_to_u8 (input, input_length, preallocated, &length); + if (!(result != NULL)) + return 4; + if (!(result != preallocated)) + return 5; + if (!(length == expected_length)) + return 6; + if (!(u8_cmp (result, expected, expected_length) == 0)) + return 7; + free (result); + free (preallocated); + } + + /* Test return conventions with resultbuf large enough. */ + { + uint8_t *preallocated; + + length = expected_length; + preallocated = (uint8_t *) malloc (length * sizeof (uint8_t)); + result = u16_to_u8 (input, input_length, preallocated, &length); + if (!(result != NULL)) + return 8; + if (!(preallocated == NULL || result == preallocated)) + return 9; + if (!(length == expected_length)) + return 10; + if (!(u8_cmp (result, expected, expected_length) == 0)) + return 11; + free (preallocated); + } + + return 0; +} + +int +main () +{ + /* Empty string. */ + ASSERT (check (NULL, 0, NULL, 0) == 0); + + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint16_t input[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + }; + static const uint8_t expected[] = + { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ', + 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); + } + + /* String with characters outside the BMP. */ + { + static const uint16_t input[] = + { '-', '(', 0xD835, 0xDD1E, 0x00D7, 0xD835, 0xDD1F, ')', '=', + 0xD835, 0xDD1F, 0x00D7, 0xD835, 0xDD1E + }; + static const uint8_t expected[] = + { '-', '(', 0xF0, 0x9D, 0x94, 0x9E, 0xC3, 0x97, 0xF0, 0x9D, 0x94, 0x9F, + ')', '=', 0xF0, 0x9D, 0x94, 0x9F, 0xC3, 0x97, 0xF0, 0x9D, 0x94, 0x9E + }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); + } + + /* Invalid input. */ + { + static const uint16_t input[] = { 'x', 0xDD1E, 0xD835, 'y' }; +#if 0 /* Currently invalid input is rejected, not accommodated. */ + static const uint8_t expected[] = + { 'x', 0xEF, 0xBF, 0xBD, 0xEF, 0xBF, 0xBD, 'y' }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); +#else + size_t length; + uint8_t *result; + uint8_t preallocated[10]; + + /* Test return conventions with resultbuf == NULL. */ + result = u16_to_u8 (input, SIZEOF (input), NULL, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); + + /* Test return conventions with resultbuf too small. */ + length = 1; + result = u16_to_u8 (input, SIZEOF (input), preallocated, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); + + /* Test return conventions with resultbuf large enough. */ + length = SIZEOF (preallocated); + result = u16_to_u8 (input, SIZEOF (input), preallocated, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); +#endif + } + + return 0; +} diff --git a/tests/unistr/test-u16-uctomb.c b/tests/unistr/test-u16-uctomb.c new file mode 100644 index 0000000..ba50225 --- /dev/null +++ b/tests/unistr/test-u16-uctomb.c @@ -0,0 +1,110 @@ +/* Test of u16_uctomb() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define MAGIC 0xBADE + +int +main () +{ + /* Test ISO 646 character, in particular the NUL character. */ + { + ucs4_t uc; + + for (uc = 0; uc < 0x80; uc++) + { + uint16_t buf[3] = { MAGIC, MAGIC, MAGIC }; + int ret; + + ret = u16_uctomb (buf, uc, 0); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); + + ret = u16_uctomb (buf, uc, 1); + ASSERT (ret == 1); + ASSERT (buf[0] == uc); + ASSERT (buf[1] == MAGIC); + } + } + + /* Test BMP character. */ + { + ucs4_t uc = 0x20AC; + uint16_t buf[3] = { MAGIC, MAGIC, MAGIC }; + int ret; + + ret = u16_uctomb (buf, uc, 0); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); + + ret = u16_uctomb (buf, uc, 1); + ASSERT (ret == 1); + ASSERT (buf[0] == uc); + ASSERT (buf[1] == MAGIC); + } + + /* Test non-BMP character. */ + { + ucs4_t uc = 0x10FFFD; + uint16_t buf[3] = { MAGIC, MAGIC, MAGIC }; + int ret; + + ret = u16_uctomb (buf, uc, 0); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); + + ret = u16_uctomb (buf, uc, 1); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); + + ret = u16_uctomb (buf, uc, 2); + ASSERT (ret == 2); + ASSERT (buf[0] == 0xDBFF); + ASSERT (buf[1] == 0xDFFD); + ASSERT (buf[2] == MAGIC); + } + + /* Test invalid characters. */ + { + ucs4_t invalid[] = { 0x110000, 0xD800, 0xDBFF, 0xDC00, 0xDFFF }; + uint16_t buf[3] = { MAGIC, MAGIC, MAGIC }; + size_t i; + + for (i = 0; i < SIZEOF (invalid); i++) + { + ucs4_t uc = invalid[i]; + int n; + + for (n = 0; n <= 2; n++) + { + int ret = u16_uctomb (buf, uc, n); + ASSERT (ret == -1); + ASSERT (buf[0] == MAGIC); + ASSERT (buf[1] == MAGIC); + ASSERT (buf[2] == MAGIC); + } + } + } + + return 0; +} diff --git a/tests/unistr/test-u32-check.c b/tests/unistr/test-u32-check.c new file mode 100644 index 0000000..fdd64df --- /dev/null +++ b/tests/unistr/test-u32-check.c @@ -0,0 +1,66 @@ +/* Test of u32_check() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + /* Test empty string. */ + { + static const uint32_t input[] = { 0 }; + ASSERT (u32_check (input, 0) == NULL); + } + + /* Test valid non-empty string. */ + { + static const uint32_t input[] = /* "Данило Шеган" */ + { 0x0414, 0x0430, 0x043D, 0x0438, 0x043B, 0x043E, 0x0020, 0x0428, 0x0435, 0x0433, 0x0430, 0x043D }; + ASSERT (u32_check (input, SIZEOF (input)) == NULL); + } + + /* Test out-of-range character with 1 unit: U+110000. */ + { + static const uint32_t input[] = { 0x0414, 0x0430, 0x110000 }; + ASSERT (u32_check (input, SIZEOF (input)) == input + 2); + } + + /* Test surrogate codepoints. */ + { + static const uint32_t input[] = { 0x0414, 0x0430, 0xDBFF, 0xDFFF }; + ASSERT (u32_check (input, SIZEOF (input)) == input + 2); + } + { + static const uint32_t input[] = { 0x0414, 0x0430, 0xDBFF }; + ASSERT (u32_check (input, SIZEOF (input)) == input + 2); + } + { + static const uint32_t input[] = { 0x0414, 0x0430, 0xDFFF }; + ASSERT (u32_check (input, SIZEOF (input)) == input + 2); + } + { + static const uint32_t input[] = { 0x0414, 0x0430, 0xDFFF, 0xDBFF }; + ASSERT (u32_check (input, SIZEOF (input)) == input + 2); + } + + return 0; +} diff --git a/tests/unistr/test-u32-chr.c b/tests/unistr/test-u32-chr.c new file mode 100644 index 0000000..f23aa08 --- /dev/null +++ b/tests/unistr/test-u32-chr.c @@ -0,0 +1,31 @@ +/* Test of u32_chr() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <stdlib.h> + +#include "zerosize-ptr.h" +#include "macros.h" + +#define UNIT uint32_t +#define U_CHR u32_chr +#define U_SET u32_set +#include "test-chr.h" diff --git a/tests/unistr/test-u32-cmp.c b/tests/unistr/test-u32-cmp.c new file mode 100644 index 0000000..ab41b31 --- /dev/null +++ b/tests/unistr/test-u32-cmp.c @@ -0,0 +1,45 @@ +/* Test of u32_cmp() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "zerosize-ptr.h" +#include "macros.h" + +#define UNIT uint32_t +#define U_CMP u32_cmp +#define MAGIC 0xBADFACE +#include "test-cmp.h" + +int +main () +{ + test_cmp (); + + /* Test comparison with non-BMP characters. */ + { + static const UNIT input1[] = { 0x1D51F }; + static const UNIT input2[] = { 0xFEFF }; + ASSERT (U_CMP (input1, input2, 1) > 0); + ASSERT (U_CMP (input2, input1, 1) < 0); + } + + return 0; +} diff --git a/tests/unistr/test-u32-cmp2.c b/tests/unistr/test-u32-cmp2.c new file mode 100644 index 0000000..84450b5 --- /dev/null +++ b/tests/unistr/test-u32-cmp2.c @@ -0,0 +1,28 @@ +/* Test of u32_cmp2() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint32_t +#define U_CMP2 u32_cmp2 +#define MAGIC 0xBADFACE +#include "test-cmp2.h" diff --git a/tests/unistr/test-u32-cpy-alloc.c b/tests/unistr/test-u32-cpy-alloc.c new file mode 100644 index 0000000..d3675dd --- /dev/null +++ b/tests/unistr/test-u32-cpy-alloc.c @@ -0,0 +1,29 @@ +/* Test of u32_cpy_alloc() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <stdlib.h> + +#include "macros.h" + +#define UNIT uint32_t +#define U_CPY_ALLOC u32_cpy_alloc +#include "test-cpy-alloc.h" diff --git a/tests/unistr/test-u32-cpy.c b/tests/unistr/test-u32-cpy.c new file mode 100644 index 0000000..49fc995 --- /dev/null +++ b/tests/unistr/test-u32-cpy.c @@ -0,0 +1,28 @@ +/* Test of u32_cpy() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint32_t +#define U_CPY u32_cpy +#define MAGIC 0xBADFACE +#include "test-cpy.h" diff --git a/tests/unistr/test-u32-mblen.c b/tests/unistr/test-u32-mblen.c new file mode 100644 index 0000000..1ebd93e --- /dev/null +++ b/tests/unistr/test-u32-mblen.c @@ -0,0 +1,81 @@ +/* Test of u32_mblen() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + int ret; + + /* Test zero-length input. */ + { + static const uint32_t input[] = { 0 }; + ret = u32_mblen (input, 0); + ASSERT (ret == -1); + } + + /* Test NUL unit input. */ + { + static const uint32_t input[] = { 0 }; + ret = u32_mblen (input, 1); + ASSERT (ret == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint32_t buf[1]; + + for (c = 1; c < 0x80; c++) + { + buf[0] = c; + ret = u32_mblen (buf, 1); + ASSERT (ret == 1); + } + } + + /* Test BMP unit input. */ + { + static const uint32_t input[] = { 0x20AC }; + ret = u32_mblen (input, 1); + ASSERT (ret == 1); + } + + /* Test non-BMP unit input. */ + { + static const uint32_t input[] = { 0x1D51F }; + ret = u32_mblen (input, 1); + ASSERT (ret == 1); + } + +#if CONFIG_UNICODE_SAFETY + /* Test incomplete/invalid 1-unit input. */ + { + static const uint32_t input[] = { 0x340000 }; + ret = u32_mblen (input, 1); + ASSERT (ret == -1); + } +#endif + + return 0; +} diff --git a/tests/unistr/test-u32-mbsnlen.c b/tests/unistr/test-u32-mbsnlen.c new file mode 100644 index 0000000..d9e066b --- /dev/null +++ b/tests/unistr/test-u32-mbsnlen.c @@ -0,0 +1,63 @@ +/* Test of u32_mbsnlen() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint32_t input[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + }; + size_t n; + + for (n = 0; n <= SIZEOF (input); n++) + { + size_t len = u32_mbsnlen (input, n); + ASSERT (len == n); + } + } + + /* String with characters outside the BMP. */ + { + static const uint32_t input[] = + { '-', '(', 0x1D51E, 0x00D7, 0x1D51F, ')', '=', + 0x1D51F, 0x00D7, 0x1D51E + }; + size_t n; + + for (n = 0; n <= SIZEOF (input); n++) + { + size_t len = u32_mbsnlen (input, n); + ASSERT (len == n); + } + } + return 0; +} diff --git a/tests/unistr/test-u32-mbtouc-unsafe.c b/tests/unistr/test-u32-mbtouc-unsafe.c new file mode 100644 index 0000000..cb3052c --- /dev/null +++ b/tests/unistr/test-u32-mbtouc-unsafe.c @@ -0,0 +1,33 @@ +/* Test of u32_mbtouc_unsafe() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#include "test-u32-mbtouc.h" + +int +main () +{ + test_function (u32_mbtouc_unsafe); + + return 0; +} diff --git a/tests/unistr/test-u32-mbtouc.c b/tests/unistr/test-u32-mbtouc.c new file mode 100644 index 0000000..7c981b5 --- /dev/null +++ b/tests/unistr/test-u32-mbtouc.c @@ -0,0 +1,36 @@ +/* Test of u32_mbtouc() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +/* Enable all tests that may be skipped when testing u32_mbtouc_unsafe. */ +#define FULL_SAFETY 1 + +#include "test-u32-mbtouc.h" + +int +main () +{ + test_function (u32_mbtouc); + + return 0; +} diff --git a/tests/unistr/test-u32-mbtouc.h b/tests/unistr/test-u32-mbtouc.h new file mode 100644 index 0000000..7d70133 --- /dev/null +++ b/tests/unistr/test-u32-mbtouc.h @@ -0,0 +1,77 @@ +/* Test of u32_mbtouc() and u32_mbtouc_unsafe() functions. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +static void +test_function (int (*my_u32_mbtouc) (ucs4_t *, const uint32_t *, size_t)) +{ + ucs4_t uc; + int ret; + + /* Test NUL unit input. */ + { + static const uint32_t input[] = { 0 }; + uc = 0xBADFACE; + ret = my_u32_mbtouc (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint32_t buf[1]; + + for (c = 0; c < 0x80; c++) + { + buf[0] = c; + uc = 0xBADFACE; + ret = my_u32_mbtouc (&uc, buf, 1); + ASSERT (ret == 1); + ASSERT (uc == c); + } + } + + /* Test BMP unit input. */ + { + static const uint32_t input[] = { 0x20AC }; + uc = 0xBADFACE; + ret = my_u32_mbtouc (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0x20AC); + } + + /* Test non-BMP unit input. */ + { + static const uint32_t input[] = { 0x1D51F }; + uc = 0xBADFACE; + ret = my_u32_mbtouc (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0x1D51F); + } + +#if FULL_SAFETY || CONFIG_UNICODE_SAFETY + /* Test incomplete/invalid 1-unit input. */ + { + static const uint32_t input[] = { 0x340000 }; + uc = 0xBADFACE; + ret = my_u32_mbtouc (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0xFFFD); + } +#endif +} diff --git a/tests/unistr/test-u32-mbtoucr.c b/tests/unistr/test-u32-mbtoucr.c new file mode 100644 index 0000000..7b1034c --- /dev/null +++ b/tests/unistr/test-u32-mbtoucr.c @@ -0,0 +1,83 @@ +/* Test of u32_mbtoucr() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + ucs4_t uc; + int ret; + + /* Test NUL unit input. */ + { + static const uint32_t input[] = { 0 }; + uc = 0xBADFACE; + ret = u32_mbtoucr (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint32_t buf[1]; + + for (c = 0; c < 0x80; c++) + { + buf[0] = c; + uc = 0xBADFACE; + ret = u32_mbtoucr (&uc, buf, 1); + ASSERT (ret == 1); + ASSERT (uc == c); + } + } + + /* Test BMP unit input. */ + { + static const uint32_t input[] = { 0x20AC }; + uc = 0xBADFACE; + ret = u32_mbtoucr (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0x20AC); + } + + /* Test non-BMP unit input. */ + { + static const uint32_t input[] = { 0x1D51F }; + uc = 0xBADFACE; + ret = u32_mbtoucr (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0x1D51F); + } + + /* Test incomplete/invalid 1-unit input. */ + { + static const uint32_t input[] = { 0x340000 }; + uc = 0xBADFACE; + ret = u32_mbtoucr (&uc, input, 1); + ASSERT (ret == -1); + ASSERT (uc == 0xFFFD); + } + + return 0; +} diff --git a/tests/unistr/test-u32-move.c b/tests/unistr/test-u32-move.c new file mode 100644 index 0000000..44f95c0 --- /dev/null +++ b/tests/unistr/test-u32-move.c @@ -0,0 +1,28 @@ +/* Test of u32_move() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint32_t +#define U_MOVE u32_move +#define MAGIC 0xBADFACE +#include "test-move.h" diff --git a/tests/unistr/test-u32-next.c b/tests/unistr/test-u32-next.c new file mode 100644 index 0000000..a5852e2 --- /dev/null +++ b/tests/unistr/test-u32-next.c @@ -0,0 +1,86 @@ +/* Test of u32_next() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + ucs4_t uc; + const uint32_t *ret; + + /* Test NUL unit input. */ + { + static const uint32_t input[] = { 0 }; + uc = 0xBADFACE; + ret = u32_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint32_t buf[2]; + + for (c = 1; c < 0x80; c++) + { + buf[0] = c; + buf[1] = 0; + uc = 0xBADFACE; + ret = u32_next (&uc, buf); + ASSERT (ret == buf + 1); + ASSERT (uc == c); + } + } + + /* Test BMP unit input. */ + { + static const uint32_t input[] = { 0x20AC, 0 }; + uc = 0xBADFACE; + ret = u32_next (&uc, input); + ASSERT (ret == input + 1); + ASSERT (uc == 0x20AC); + } + + /* Test non-BMP unit input. */ + { + static const uint32_t input[] = { 0x1D51F, 0 }; + uc = 0xBADFACE; + ret = u32_next (&uc, input); + ASSERT (ret == input + 1); + ASSERT (uc == 0x1D51F); + } + +#if CONFIG_UNICODE_SAFETY + /* Test incomplete/invalid 1-unit input. */ + { + static const uint32_t input[] = { 0x340000, 0 }; + uc = 0xBADFACE; + ret = u32_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0xFFFD); + } +#endif + + return 0; +} diff --git a/tests/unistr/test-u32-prev.c b/tests/unistr/test-u32-prev.c new file mode 100644 index 0000000..95187af --- /dev/null +++ b/tests/unistr/test-u32-prev.c @@ -0,0 +1,133 @@ +/* Test of u32_prev() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +static int +check (const uint32_t *input, size_t input_length, ucs4_t *puc) +{ + ucs4_t uc; + + /* Test recognition when at the beginning of the string. */ + if (u32_prev (&uc, input + input_length, input) != input) + return 1; + + /* Test recognition when preceded by a 1-unit character. */ + { + uint32_t buf[100]; + uint32_t *ptr; + size_t i; + ucs4_t uc1; + + ptr = buf; + *ptr++ = 0x1D51E; + for (i = 0; i < input_length; i++) + ptr[i] = input[i]; + + if (u32_prev (&uc1, ptr + input_length, buf) != ptr) + return 2; + if (uc1 != uc) + return 3; + } + + *puc = uc; + return 0; +} + +static int +check_invalid (const uint32_t *input, size_t input_length) +{ +#if CONFIG_UNICODE_SAFETY + ucs4_t uc; + + /* Test recognition when at the beginning of the string. */ + uc = 0xBADFACE; + if (u32_prev (&uc, input + input_length, input) != NULL) + return 1; + if (uc != 0xBADFACE) + return 2; + + /* Test recognition when preceded by a 1-unit character. */ + { + uint32_t buf[100]; + uint32_t *ptr; + size_t i; + + ptr = buf; + *ptr++ = 0x1D51E; + for (i = 0; i < input_length; i++) + ptr[i] = input[i]; + + uc = 0xBADFACE; + if (u32_prev (&uc, ptr + input_length, buf) != NULL) + return 3; + if (uc != 0xBADFACE) + return 4; + } +#endif + + return 0; +} + +int +main () +{ + ucs4_t uc; + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint32_t buf[1]; + + for (c = 0; c < 0x80; c++) + { + buf[0] = c; + uc = 0xBADFACE; + ASSERT (check (buf, 1, &uc) == 0); + ASSERT (uc == c); + } + } + + /* Test BMP unit input. */ + { + static const uint32_t input[] = { 0x20AC }; + uc = 0xBADFACE; + ASSERT (check (input, SIZEOF (input), &uc) == 0); + ASSERT (uc == 0x20AC); + } + + /* Test non-BMP unit input. */ + { + static const uint32_t input[] = { 0x1D51F }; + uc = 0xBADFACE; + ASSERT (check (input, SIZEOF (input), &uc) == 0); + ASSERT (uc == 0x1D51F); + } + + /* Test incomplete/invalid 1-unit input. */ + { + static const uint32_t input[] = { 0x340000 }; + ASSERT (check_invalid (input, SIZEOF (input)) == 0); + } + + return 0; +} diff --git a/tests/unistr/test-u32-set.c b/tests/unistr/test-u32-set.c new file mode 100644 index 0000000..120804f --- /dev/null +++ b/tests/unistr/test-u32-set.c @@ -0,0 +1,29 @@ +/* Test of u32_set() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint32_t +#define U_SET u32_set +#define MAGIC 0xBADFACE +#define VALUE 0x1D51E +#include "test-set.h" diff --git a/tests/unistr/test-u32-stpcpy.c b/tests/unistr/test-u32-stpcpy.c new file mode 100644 index 0000000..9c99c52 --- /dev/null +++ b/tests/unistr/test-u32-stpcpy.c @@ -0,0 +1,28 @@ +/* Test of u32_stpcpy() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint32_t +#define U_STPCPY u32_stpcpy +#define MAGIC 0xBADFACE +#include "test-stpcpy.h" diff --git a/tests/unistr/test-u32-stpncpy.c b/tests/unistr/test-u32-stpncpy.c new file mode 100644 index 0000000..e29683b --- /dev/null +++ b/tests/unistr/test-u32-stpncpy.c @@ -0,0 +1,59 @@ +/* Test of u32_stpncpy() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <stdlib.h> + +#include "zerosize-ptr.h" +#include "macros.h" + +#define UNIT uint32_t +#define U_STPNCPY u32_stpncpy +#define MAGIC 0xBADFACE +#include "test-stpncpy.h" + +int +main () +{ + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint32_t input[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, 0 + }; + check (input, SIZEOF (input)); + } + + /* String with characters outside the BMP. */ + { + static const uint32_t input[] = + { '-', '(', 0x1D51E, 0x00D7, 0x1D51F, ')', '=', + 0x1D51F, 0x00D7, 0x1D51E, 0 + }; + check (input, SIZEOF (input)); + } + + return 0; +} diff --git a/tests/unistr/test-u32-strcat.c b/tests/unistr/test-u32-strcat.c new file mode 100644 index 0000000..66e7c85 --- /dev/null +++ b/tests/unistr/test-u32-strcat.c @@ -0,0 +1,28 @@ +/* Test of u32_strcat() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint32_t +#define U_STRCAT u32_strcat +#define MAGIC 0xBADFACE +#include "test-strcat.h" diff --git a/tests/unistr/test-u32-strcmp.c b/tests/unistr/test-u32-strcmp.c new file mode 100644 index 0000000..8364a41 --- /dev/null +++ b/tests/unistr/test-u32-strcmp.c @@ -0,0 +1,34 @@ +/* Test of u32_strcmp() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define U_STRCMP u32_strcmp +#include "test-u32-strcmp.h" + +int +main () +{ + test_u32_strcmp (); + + return 0; +} diff --git a/tests/unistr/test-u32-strcmp.h b/tests/unistr/test-u32-strcmp.h new file mode 100644 index 0000000..6d24132 --- /dev/null +++ b/tests/unistr/test-u32-strcmp.h @@ -0,0 +1,42 @@ +/* Test of u32_strcmp() and u32_strcoll() functions. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#define UNIT uint32_t +#include "test-strcmp.h" + +static void +test_u32_strcmp (void) +{ + test_strcmp (); + + /* Test comparison between ASCII and non-ASCII characters. */ + { + static const UNIT input1[] = { 'f', 'o', 'o', 0 }; + static const UNIT input2[] = { 0x2022, 0 }; + ASSERT (U_STRCMP (input1, input2) < 0); + ASSERT (U_STRCMP (input2, input1) > 0); + } + + /* Test comparison with non-BMP characters. */ + { + static const UNIT input1[] = { 0x1D51F, 0 }; + static const UNIT input2[] = { 0xFEFF, 0 }; + ASSERT (U_STRCMP (input1, input2) > 0); + ASSERT (U_STRCMP (input2, input1) < 0); + } +} diff --git a/tests/unistr/test-u32-strcoll.c b/tests/unistr/test-u32-strcoll.c new file mode 100644 index 0000000..36954e7 --- /dev/null +++ b/tests/unistr/test-u32-strcoll.c @@ -0,0 +1,41 @@ +/* Test of u32_strcoll() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define U_STRCMP u32_strcoll +#include "test-u32-strcmp.h" + +int +main () +{ + /* This test relies on three facts: + - setlocale is not being called, therefore the locale is the "C" locale. + - In the "C" locale, strcoll is equivalent to strcmp. + - In the u32_strcoll implementation, Unicode strings that are not + convertible to the locale encoding are sorted higher than convertible + strings and compared according to u32_strcmp. */ + + test_u32_strcmp (); + + return 0; +} diff --git a/tests/unistr/test-u32-strcpy.c b/tests/unistr/test-u32-strcpy.c new file mode 100644 index 0000000..2e22aad --- /dev/null +++ b/tests/unistr/test-u32-strcpy.c @@ -0,0 +1,28 @@ +/* Test of u32_strcpy() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint32_t +#define U_STRCPY u32_strcpy +#define MAGIC 0xBADFACE +#include "test-strcpy.h" diff --git a/tests/unistr/test-u32-strdup.c b/tests/unistr/test-u32-strdup.c new file mode 100644 index 0000000..ede8e54 --- /dev/null +++ b/tests/unistr/test-u32-strdup.c @@ -0,0 +1,27 @@ +/* Test of u32_strdup() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint32_t +#define U_STRDUP u32_strdup +#include "test-strdup.h" diff --git a/tests/unistr/test-u32-strlen.c b/tests/unistr/test-u32-strlen.c new file mode 100644 index 0000000..a349be7 --- /dev/null +++ b/tests/unistr/test-u32-strlen.c @@ -0,0 +1,57 @@ +/* Test of u32_strlen() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + /* Empty string. */ + { + static const uint32_t input[] = { 0 }; + ASSERT (u32_strlen (input) == 0); + } + + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint32_t input[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, 0 + }; + ASSERT (u32_strlen (input) == SIZEOF (input) - 1); + } + + /* String with characters outside the BMP. */ + { + static const uint32_t input[] = + { '-', '(', 0x1D51E, 0x00D7, 0x1D51F, ')', '=', + 0x1D51F, 0x00D7, 0x1D51E, 0 + }; + ASSERT (u32_strlen (input) == SIZEOF (input) - 1); + } + + return 0; +} diff --git a/tests/unistr/test-u32-strmblen.c b/tests/unistr/test-u32-strmblen.c new file mode 100644 index 0000000..733f8fc --- /dev/null +++ b/tests/unistr/test-u32-strmblen.c @@ -0,0 +1,75 @@ +/* Test of u32_strmblen() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + int ret; + + /* Test NUL unit input. */ + { + static const uint32_t input[] = { 0 }; + ret = u32_strmblen (input); + ASSERT (ret == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint32_t buf[2]; + + for (c = 1; c < 0x80; c++) + { + buf[0] = c; + buf[1] = 0; + ret = u32_strmblen (buf); + ASSERT (ret == 1); + } + } + + /* Test BMP unit input. */ + { + static const uint32_t input[] = { 0x20AC, 0 }; + ret = u32_strmblen (input); + ASSERT (ret == 1); + } + + /* Test non-BMP unit input. */ + { + static const uint32_t input[] = { 0x1D51F, 0 }; + ret = u32_strmblen (input); + ASSERT (ret == 1); + } + +#if CONFIG_UNICODE_SAFETY + /* Test incomplete/invalid 1-unit input. */ + { + static const uint32_t input[] = { 0x340000, 0 }; + ret = u32_strmblen (input); + ASSERT (ret == -1); + } +#endif + + return 0; +} diff --git a/tests/unistr/test-u32-strmbtouc.c b/tests/unistr/test-u32-strmbtouc.c new file mode 100644 index 0000000..79c222e --- /dev/null +++ b/tests/unistr/test-u32-strmbtouc.c @@ -0,0 +1,86 @@ +/* Test of u32_strmbtouc() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + ucs4_t uc; + int ret; + + /* Test NUL unit input. */ + { + static const uint32_t input[] = { 0 }; + uc = 0xBADFACE; + ret = u32_strmbtouc (&uc, input); + ASSERT (ret == 0); + ASSERT (uc == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint32_t buf[2]; + + for (c = 1; c < 0x80; c++) + { + buf[0] = c; + buf[1] = 0; + uc = 0xBADFACE; + ret = u32_strmbtouc (&uc, buf); + ASSERT (ret == 1); + ASSERT (uc == c); + } + } + + /* Test BMP unit input. */ + { + static const uint32_t input[] = { 0x20AC, 0 }; + uc = 0xBADFACE; + ret = u32_strmbtouc (&uc, input); + ASSERT (ret == 1); + ASSERT (uc == 0x20AC); + } + + /* Test non-BMP unit input. */ + { + static const uint32_t input[] = { 0x1D51F, 0 }; + uc = 0xBADFACE; + ret = u32_strmbtouc (&uc, input); + ASSERT (ret == 1); + ASSERT (uc == 0x1D51F); + } + +#if CONFIG_UNICODE_SAFETY + /* Test incomplete/invalid 1-unit input. */ + { + static const uint32_t input[] = { 0x340000, 0 }; + uc = 0xBADFACE; + ret = u32_strmbtouc (&uc, input); + ASSERT (ret == -1); + ASSERT (uc == 0xBADFACE); + } +#endif + + return 0; +} diff --git a/tests/unistr/test-u32-strncat.c b/tests/unistr/test-u32-strncat.c new file mode 100644 index 0000000..346bafb --- /dev/null +++ b/tests/unistr/test-u32-strncat.c @@ -0,0 +1,59 @@ +/* Test of u32_strncat() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <stdlib.h> + +#include "zerosize-ptr.h" +#include "macros.h" + +#define UNIT uint32_t +#define U_STRNCAT u32_strncat +#define MAGIC 0xBADFACE +#include "test-strncat.h" + +int +main () +{ + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint32_t input[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, 0 + }; + check (input, SIZEOF (input)); + } + + /* String with characters outside the BMP. */ + { + static const uint32_t input[] = + { '-', '(', 0x1D51E, 0x00D7, 0x1D51F, ')', '=', + 0x1D51F, 0x00D7, 0x1D51E, 0 + }; + check (input, SIZEOF (input)); + } + + return 0; +} diff --git a/tests/unistr/test-u32-strncmp.c b/tests/unistr/test-u32-strncmp.c new file mode 100644 index 0000000..d69913d --- /dev/null +++ b/tests/unistr/test-u32-strncmp.c @@ -0,0 +1,47 @@ +/* Test of u32_strncmp() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint32_t +#define U_STRNCMP u32_strncmp +#include "test-strncmp.h" + +int +main () +{ + test_strncmp (); + + /* Test comparison with non-BMP characters. */ + { + static const UNIT input1[] = { 0x1D51F, 0 }; + static const UNIT input2[] = { 0xFEFF, 0 }; + ASSERT (U_STRNCMP (input1, input2, 1) > 0); + ASSERT (U_STRNCMP (input2, input1, 1) < 0); + ASSERT (U_STRNCMP (input1, input2, 2) > 0); + ASSERT (U_STRNCMP (input2, input1, 2) < 0); + ASSERT (U_STRNCMP (input1, input2, 1000000) > 0); + ASSERT (U_STRNCMP (input2, input1, 1000000) < 0); + } + + return 0; +} diff --git a/tests/unistr/test-u32-strncpy.c b/tests/unistr/test-u32-strncpy.c new file mode 100644 index 0000000..9309c0e --- /dev/null +++ b/tests/unistr/test-u32-strncpy.c @@ -0,0 +1,59 @@ +/* Test of u32_strncpy() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <stdlib.h> + +#include "zerosize-ptr.h" +#include "macros.h" + +#define UNIT uint32_t +#define U_STRNCPY u32_strncpy +#define MAGIC 0xBADFACE +#include "test-strncpy.h" + +int +main () +{ + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint32_t input[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, 0 + }; + check (input, SIZEOF (input)); + } + + /* String with characters outside the BMP. */ + { + static const uint32_t input[] = + { '-', '(', 0x1D51E, 0x00D7, 0x1D51F, ')', '=', + 0x1D51F, 0x00D7, 0x1D51E, 0 + }; + check (input, SIZEOF (input)); + } + + return 0; +} diff --git a/tests/unistr/test-u32-strnlen.c b/tests/unistr/test-u32-strnlen.c new file mode 100644 index 0000000..6929914 --- /dev/null +++ b/tests/unistr/test-u32-strnlen.c @@ -0,0 +1,56 @@ +/* Test of u32_strnlen() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "zerosize-ptr.h" +#include "macros.h" + +#define UNIT uint32_t +#define U_STRNLEN u32_strnlen +#include "test-strnlen.h" + +int +main () +{ + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint32_t input[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, 0 + }; + check (input, SIZEOF (input)); + } + + /* String with characters outside the BMP. */ + { + static const uint32_t input[] = + { '-', '(', 0x1D51E, 0x00D7, 0x1D51F, ')', '=', + 0x1D51F, 0x00D7, 0x1D51E, 0 + }; + check (input, SIZEOF (input)); + } + + return 0; +} diff --git a/tests/unistr/test-u32-to-u16.c b/tests/unistr/test-u32-to-u16.c new file mode 100644 index 0000000..6faf537 --- /dev/null +++ b/tests/unistr/test-u32-to-u16.c @@ -0,0 +1,156 @@ +/* Test of u32_to_u16() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <errno.h> + +#include "macros.h" + +static int +check (const uint32_t *input, size_t input_length, + const uint16_t *expected, size_t expected_length) +{ + size_t length; + uint16_t *result; + + /* Test return conventions with resultbuf == NULL. */ + result = u32_to_u16 (input, input_length, NULL, &length); + if (!(result != NULL)) + return 1; + if (!(length == expected_length)) + return 2; + if (!(u16_cmp (result, expected, expected_length) == 0)) + return 3; + free (result); + + /* Test return conventions with resultbuf too small. */ + if (expected_length > 0) + { + uint16_t *preallocated; + + length = expected_length - 1; + preallocated = (uint16_t *) malloc (length * sizeof (uint16_t)); + result = u32_to_u16 (input, input_length, preallocated, &length); + if (!(result != NULL)) + return 4; + if (!(result != preallocated)) + return 5; + if (!(length == expected_length)) + return 6; + if (!(u16_cmp (result, expected, expected_length) == 0)) + return 7; + free (result); + free (preallocated); + } + + /* Test return conventions with resultbuf large enough. */ + { + uint16_t *preallocated; + + length = expected_length; + preallocated = (uint16_t *) malloc (length * sizeof (uint16_t)); + result = u32_to_u16 (input, input_length, preallocated, &length); + if (!(result != NULL)) + return 8; + if (!(preallocated == NULL || result == preallocated)) + return 9; + if (!(length == expected_length)) + return 10; + if (!(u16_cmp (result, expected, expected_length) == 0)) + return 11; + free (preallocated); + } + + return 0; +} + +int +main () +{ + /* Empty string. */ + ASSERT (check (NULL, 0, NULL, 0) == 0); + + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint32_t input[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + }; + static const uint16_t expected[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); + } + + /* String with characters outside the BMP. */ + { + static const uint32_t input[] = + { '-', '(', 0x1D51E, 0x00D7, 0x1D51F, ')', '=', + 0x1D51F, 0x00D7, 0x1D51E + }; + static const uint16_t expected[] = + { '-', '(', 0xD835, 0xDD1E, 0x00D7, 0xD835, 0xDD1F, ')', '=', + 0xD835, 0xDD1F, 0x00D7, 0xD835, 0xDD1E + }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); + } + + /* Invalid input. */ + { + static const uint32_t input[] = { 'x', 0x340000, 0x50000000, 'y' }; +#if 0 /* Currently invalid input is rejected, not accommodated. */ + static const uint16_t expected[] = { 'x', 0xFFFD, 0xFFFD, 'y' }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); +#else + size_t length; + uint16_t *result; + uint16_t preallocated[10]; + + /* Test return conventions with resultbuf == NULL. */ + result = u32_to_u16 (input, SIZEOF (input), NULL, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); + + /* Test return conventions with resultbuf too small. */ + length = 1; + result = u32_to_u16 (input, SIZEOF (input), preallocated, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); + + /* Test return conventions with resultbuf large enough. */ + length = SIZEOF (preallocated); + result = u32_to_u16 (input, SIZEOF (input), preallocated, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); +#endif + } + + return 0; +} diff --git a/tests/unistr/test-u32-to-u8.c b/tests/unistr/test-u32-to-u8.c new file mode 100644 index 0000000..933fba0 --- /dev/null +++ b/tests/unistr/test-u32-to-u8.c @@ -0,0 +1,159 @@ +/* Test of u32_to_u8() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <errno.h> + +#include "macros.h" + +static int +check (const uint32_t *input, size_t input_length, + const uint8_t *expected, size_t expected_length) +{ + size_t length; + uint8_t *result; + + /* Test return conventions with resultbuf == NULL. */ + result = u32_to_u8 (input, input_length, NULL, &length); + if (!(result != NULL)) + return 1; + if (!(length == expected_length)) + return 2; + if (!(u8_cmp (result, expected, expected_length) == 0)) + return 3; + free (result); + + /* Test return conventions with resultbuf too small. */ + if (expected_length > 0) + { + uint8_t *preallocated; + + length = expected_length - 1; + preallocated = (uint8_t *) malloc (length * sizeof (uint8_t)); + result = u32_to_u8 (input, input_length, preallocated, &length); + if (!(result != NULL)) + return 4; + if (!(result != preallocated)) + return 5; + if (!(length == expected_length)) + return 6; + if (!(u8_cmp (result, expected, expected_length) == 0)) + return 7; + free (result); + free (preallocated); + } + + /* Test return conventions with resultbuf large enough. */ + { + uint8_t *preallocated; + + length = expected_length; + preallocated = (uint8_t *) malloc (length * sizeof (uint8_t)); + result = u32_to_u8 (input, input_length, preallocated, &length); + if (!(result != NULL)) + return 8; + if (!(preallocated == NULL || result == preallocated)) + return 9; + if (!(length == expected_length)) + return 10; + if (!(u8_cmp (result, expected, expected_length) == 0)) + return 11; + free (preallocated); + } + + return 0; +} + +int +main () +{ + /* Empty string. */ + ASSERT (check (NULL, 0, NULL, 0) == 0); + + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint32_t input[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + }; + static const uint8_t expected[] = + { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ', + 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); + } + + /* String with characters outside the BMP. */ + { + static const uint32_t input[] = + { '-', '(', 0x1D51E, 0x00D7, 0x1D51F, ')', '=', + 0x1D51F, 0x00D7, 0x1D51E + }; + static const uint8_t expected[] = + { '-', '(', 0xF0, 0x9D, 0x94, 0x9E, 0xC3, 0x97, 0xF0, 0x9D, 0x94, 0x9F, + ')', '=', 0xF0, 0x9D, 0x94, 0x9F, 0xC3, 0x97, 0xF0, 0x9D, 0x94, 0x9E + }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); + } + + /* Invalid input. */ + { + static const uint32_t input[] = { 'x', 0x340000, 0x50000000, 'y' }; +#if 0 /* Currently invalid input is rejected, not accommodated. */ + static const uint8_t expected[] = + { 'x', 0xEF, 0xBF, 0xBD, 0xEF, 0xBF, 0xBD, 'y' }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); +#else + size_t length; + uint8_t *result; + uint8_t preallocated[10]; + + /* Test return conventions with resultbuf == NULL. */ + result = u32_to_u8 (input, SIZEOF (input), NULL, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); + + /* Test return conventions with resultbuf too small. */ + length = 1; + result = u32_to_u8 (input, SIZEOF (input), preallocated, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); + + /* Test return conventions with resultbuf large enough. */ + length = SIZEOF (preallocated); + result = u32_to_u8 (input, SIZEOF (input), preallocated, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); +#endif + } + + return 0; +} diff --git a/tests/unistr/test-u32-uctomb.c b/tests/unistr/test-u32-uctomb.c new file mode 100644 index 0000000..0a25177 --- /dev/null +++ b/tests/unistr/test-u32-uctomb.c @@ -0,0 +1,104 @@ +/* Test of u32_uctomb() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define MAGIC 0xBADFACE + +int +main () +{ + /* Test ISO 646 character, in particular the NUL character. */ + { + ucs4_t uc; + + for (uc = 0; uc < 0x80; uc++) + { + uint32_t buf[2] = { MAGIC, MAGIC }; + int ret; + + ret = u32_uctomb (buf, uc, 0); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); + + ret = u32_uctomb (buf, uc, 1); + ASSERT (ret == 1); + ASSERT (buf[0] == uc); + ASSERT (buf[1] == MAGIC); + } + } + + /* Test BMP character. */ + { + ucs4_t uc = 0x20AC; + uint32_t buf[2] = { MAGIC, MAGIC }; + int ret; + + ret = u32_uctomb (buf, uc, 0); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); + + ret = u32_uctomb (buf, uc, 1); + ASSERT (ret == 1); + ASSERT (buf[0] == uc); + ASSERT (buf[1] == MAGIC); + } + + /* Test non-BMP character. */ + { + ucs4_t uc = 0x10FFFD; + uint32_t buf[2] = { MAGIC, MAGIC }; + int ret; + + ret = u32_uctomb (buf, uc, 0); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); + + ret = u32_uctomb (buf, uc, 1); + ASSERT (ret == 1); + ASSERT (buf[0] == uc); + ASSERT (buf[1] == MAGIC); + } + + /* Test invalid characters. */ + { + ucs4_t invalid[] = { 0x110000, 0xD800, 0xDBFF, 0xDC00, 0xDFFF }; + uint32_t buf[2] = { MAGIC, MAGIC }; + size_t i; + + for (i = 0; i < SIZEOF (invalid); i++) + { + ucs4_t uc = invalid[i]; + int n; + + for (n = 0; n <= 2; n++) + { + int ret = u32_uctomb (buf, uc, n); + ASSERT (ret == -1); + ASSERT (buf[0] == MAGIC); + ASSERT (buf[1] == MAGIC); + } + } + } + + return 0; +} diff --git a/tests/unistr/test-u8-check.c b/tests/unistr/test-u8-check.c new file mode 100644 index 0000000..a32d385 --- /dev/null +++ b/tests/unistr/test-u8-check.c @@ -0,0 +1,188 @@ +/* Test of u8_check() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + /* Test empty string. */ + { + static const uint8_t input[] = ""; + ASSERT (u8_check (input, 0) == NULL); + } + + /* Test valid non-empty string. */ + { + static const uint8_t input[] = /* "Данило Шеган" */ + "\320\224\320\260\320\275\320\270\320\273\320\276 \320\250\320\265\320\263\320\260\320\275"; + ASSERT (u8_check (input, sizeof (input) - 1) == NULL); + } + + /* Test out-of-range character with 4 bytes: U+110000. */ + { + static const uint8_t input[] = "\320\224\320\260\364\220\200\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test out-of-range character with 5 bytes: U+200000. */ + { + static const uint8_t input[] = "\320\224\320\260\370\210\200\200\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test out-of-range character with 6 bytes: U+4000000. */ + { + static const uint8_t input[] = "\320\224\320\260\374\204\200\200\200\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test invalid lead byte. */ + { + static const uint8_t input[] = "\320\224\320\260\376\200\200\200\200\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + { + static const uint8_t input[] = "\320\224\320\260\377\200\200\200\200\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test overlong 2-byte character. */ + { + static const uint8_t input[] = "\320\224\320\260\301\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test overlong 3-byte character. */ + { + static const uint8_t input[] = "\320\224\320\260\340\200\277"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test overlong 4-byte character. */ + { + static const uint8_t input[] = "\320\224\320\260\360\200\277\277"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test invalid bytes in 2-byte character. */ + { + static const uint8_t input[] = "\320\224\320\260\302\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == NULL); + } + { + static const uint8_t input[] = "\320\224\320\260\302\100"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + { + static const uint8_t input[] = "\320\224\320\260\302\300"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test invalid bytes in 3-byte character. */ + { + static const uint8_t input[] = "\320\224\320\260\342\200\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == NULL); + } + { + static const uint8_t input[] = "\320\224\320\260\342\100\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + { + static const uint8_t input[] = "\320\224\320\260\342\300\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + { + static const uint8_t input[] = "\320\224\320\260\342\200\100"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + { + static const uint8_t input[] = "\320\224\320\260\342\200\300"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test invalid bytes in 4-byte character. */ + { + static const uint8_t input[] = "\320\224\320\260\362\200\200\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == NULL); + } + { + static const uint8_t input[] = "\320\224\320\260\362\100\200\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + { + static const uint8_t input[] = "\320\224\320\260\362\300\200\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + { + static const uint8_t input[] = "\320\224\320\260\362\200\100\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + { + static const uint8_t input[] = "\320\224\320\260\362\200\300\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + { + static const uint8_t input[] = "\320\224\320\260\362\200\200\100"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + { + static const uint8_t input[] = "\320\224\320\260\362\200\200\300"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test truncated/incomplete 2-byte character. */ + { + static const uint8_t input[] = "\320\224\320\260\302"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test truncated/incomplete 3-byte character. */ + { + static const uint8_t input[] = "\320\224\320\260\342\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test truncated/incomplete 4-byte character. */ + { + static const uint8_t input[] = "\320\224\320\260\362\200\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test missing lead byte. */ + { + static const uint8_t input[] = "\320\224\320\260\200\200\200\200\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + /* Test surrogate codepoints. */ + { + static const uint8_t input[] = "\320\224\320\260\355\240\200\355\260\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + { + static const uint8_t input[] = "\320\224\320\260\355\260\200"; + ASSERT (u8_check (input, sizeof (input) - 1) == input + 4); + } + + return 0; +} diff --git a/tests/unistr/test-u8-chr.c b/tests/unistr/test-u8-chr.c new file mode 100644 index 0000000..7c4b999 --- /dev/null +++ b/tests/unistr/test-u8-chr.c @@ -0,0 +1,31 @@ +/* Test of u8_chr() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <stdlib.h> + +#include "zerosize-ptr.h" +#include "macros.h" + +#define UNIT uint8_t +#define U_CHR u8_chr +#define U_SET u8_set +#include "test-chr.h" diff --git a/tests/unistr/test-u8-cmp.c b/tests/unistr/test-u8-cmp.c new file mode 100644 index 0000000..73778c7 --- /dev/null +++ b/tests/unistr/test-u8-cmp.c @@ -0,0 +1,45 @@ +/* Test of u8_cmp() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "zerosize-ptr.h" +#include "macros.h" + +#define UNIT uint8_t +#define U_CMP u8_cmp +#define MAGIC 0xBA +#include "test-cmp.h" + +int +main () +{ + test_cmp (); + + /* Test comparison with non-BMP characters. */ + { + static const UNIT input1[] = { 0xF0, 0x9D, 0x94, 0x9E }; + static const UNIT input2[] = { 0xEF, 0xBB, 0xBF, 0x00 }; + ASSERT (U_CMP (input1, input2, 4) > 0); + ASSERT (U_CMP (input2, input1, 4) < 0); + } + + return 0; +} diff --git a/tests/unistr/test-u8-cmp2.c b/tests/unistr/test-u8-cmp2.c new file mode 100644 index 0000000..8a7848e --- /dev/null +++ b/tests/unistr/test-u8-cmp2.c @@ -0,0 +1,28 @@ +/* Test of u8_cmp2() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint8_t +#define U_CMP2 u8_cmp2 +#define MAGIC 0xBA +#include "test-cmp2.h" diff --git a/tests/unistr/test-u8-cpy-alloc.c b/tests/unistr/test-u8-cpy-alloc.c new file mode 100644 index 0000000..2d35b8f --- /dev/null +++ b/tests/unistr/test-u8-cpy-alloc.c @@ -0,0 +1,29 @@ +/* Test of u8_cpy_alloc() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <stdlib.h> + +#include "macros.h" + +#define UNIT uint8_t +#define U_CPY_ALLOC u8_cpy_alloc +#include "test-cpy-alloc.h" diff --git a/tests/unistr/test-u8-cpy.c b/tests/unistr/test-u8-cpy.c new file mode 100644 index 0000000..8d1152d --- /dev/null +++ b/tests/unistr/test-u8-cpy.c @@ -0,0 +1,28 @@ +/* Test of u8_cpy() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint8_t +#define U_CPY u8_cpy +#define MAGIC 0xBA +#include "test-cpy.h" diff --git a/tests/unistr/test-u8-mblen.c b/tests/unistr/test-u8-mblen.c new file mode 100644 index 0000000..75e92d6 --- /dev/null +++ b/tests/unistr/test-u8-mblen.c @@ -0,0 +1,155 @@ +/* Test of u8_mblen() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + int ret; + + /* Test zero-length input. */ + { + static const uint8_t input[] = ""; + ret = u8_mblen (input, 0); + ASSERT (ret == -1); + } + + /* Test NUL unit input. */ + { + static const uint8_t input[] = ""; + ret = u8_mblen (input, 1); + ASSERT (ret == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint8_t buf[1]; + + for (c = 1; c < 0x80; c++) + { + buf[0] = c; + ret = u8_mblen (buf, 1); + ASSERT (ret == 1); + } + } + + /* Test 2-byte character input. */ + { + static const uint8_t input[] = { 0xC3, 0x97 }; + ret = u8_mblen (input, 2); + ASSERT (ret == 2); + } + + /* Test 3-byte character input. */ + { + static const uint8_t input[] = { 0xE2, 0x82, 0xAC }; + ret = u8_mblen (input, 3); + ASSERT (ret == 3); + } + + /* Test 4-byte character input. */ + { + static const uint8_t input[] = { 0xF4, 0x8F, 0xBF, 0xBD }; + ret = u8_mblen (input, 4); + ASSERT (ret == 4); + } + + /* Test incomplete/invalid 1-byte input. */ + { + static const uint8_t input[] = { 0xC1 }; + ret = u8_mblen (input, 1); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xC3 }; + ret = u8_mblen (input, 1); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xE2 }; + ret = u8_mblen (input, 1); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xF4 }; + ret = u8_mblen (input, 1); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xFE }; + ret = u8_mblen (input, 1); + ASSERT (ret == -1); + } + + /* Test incomplete/invalid 2-byte input. */ + { + static const uint8_t input[] = { 0xE0, 0x9F }; + ret = u8_mblen (input, 2); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xE2, 0x82 }; + ret = u8_mblen (input, 2); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xE2, 0xD0 }; + ret = u8_mblen (input, 2); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xF0, 0x8F }; + ret = u8_mblen (input, 2); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xF3, 0x8F }; + ret = u8_mblen (input, 2); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xF3, 0xD0 }; + ret = u8_mblen (input, 2); + ASSERT (ret == -1); + } + + /* Test incomplete/invalid 3-byte input. */ + { + static const uint8_t input[] = { 0xF3, 0x8F, 0xBF }; + ret = u8_mblen (input, 3); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xF3, 0xD0, 0xBF }; + ret = u8_mblen (input, 3); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xF3, 0x8F, 0xD0 }; + ret = u8_mblen (input, 3); + ASSERT (ret == -1); + } + + return 0; +} diff --git a/tests/unistr/test-u8-mbsnlen.c b/tests/unistr/test-u8-mbsnlen.c new file mode 100644 index 0000000..8e68550 --- /dev/null +++ b/tests/unistr/test-u8-mbsnlen.c @@ -0,0 +1,61 @@ +/* Test of u8_mbsnlen() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint8_t input[] = + { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ', + 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + }; + static const size_t expected[SIZEOF (input) + 1] = + { 0, + 1, 2, 3, 3, 4, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, + 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 31, 32, 33, 34, 35, 36, + 37, 38, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 52, 52, 53, 53, 53, 54, 54, 54, 55, + 56, 56, 56, 57, 57, 57, 58, + 59, 59, 59, 60, 60, 60, 61 + }; + size_t n; + + for (n = 0; n <= SIZEOF (input); n++) + { + size_t len = u8_mbsnlen (input, n); + ASSERT (len == expected[n]); + } + } + + return 0; +} diff --git a/tests/unistr/test-u8-mbtouc-unsafe.c b/tests/unistr/test-u8-mbtouc-unsafe.c new file mode 100644 index 0000000..b093aa8 --- /dev/null +++ b/tests/unistr/test-u8-mbtouc-unsafe.c @@ -0,0 +1,33 @@ +/* Test of u8_mbtouc_unsafe() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#include "test-u8-mbtouc.h" + +int +main () +{ + test_function (u8_mbtouc_unsafe); + + return 0; +} diff --git a/tests/unistr/test-u8-mbtouc.c b/tests/unistr/test-u8-mbtouc.c new file mode 100644 index 0000000..f6960a6 --- /dev/null +++ b/tests/unistr/test-u8-mbtouc.c @@ -0,0 +1,33 @@ +/* Test of u8_mbtouc() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#include "test-u8-mbtouc.h" + +int +main () +{ + test_function (u8_mbtouc); + + return 0; +} diff --git a/tests/unistr/test-u8-mbtouc.h b/tests/unistr/test-u8-mbtouc.h new file mode 100644 index 0000000..bcafb05 --- /dev/null +++ b/tests/unistr/test-u8-mbtouc.h @@ -0,0 +1,179 @@ +/* Test of u8_mbtouc() and u8_mbtouc_unsafe() functions. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +static void +test_function (int (*my_u8_mbtouc) (ucs4_t *, const uint8_t *, size_t)) +{ + ucs4_t uc; + int ret; + + /* Test NUL unit input. */ + { + static const uint8_t input[] = ""; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint8_t buf[1]; + + for (c = 0; c < 0x80; c++) + { + buf[0] = c; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, buf, 1); + ASSERT (ret == 1); + ASSERT (uc == c); + } + } + + /* Test 2-byte character input. */ + { + static const uint8_t input[] = { 0xC3, 0x97 }; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 2); + ASSERT (ret == 2); + ASSERT (uc == 0x00D7); + } + + /* Test 3-byte character input. */ + { + static const uint8_t input[] = { 0xE2, 0x82, 0xAC }; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 3); + ASSERT (ret == 3); + ASSERT (uc == 0x20AC); + } + + /* Test 4-byte character input. */ + { + static const uint8_t input[] = { 0xF4, 0x8F, 0xBF, 0xBD }; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 4); + ASSERT (ret == 4); + ASSERT (uc == 0x10FFFD); + } + + /* Test incomplete/invalid 1-byte input. */ + { + static const uint8_t input[] = { 0xC1 }; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xC3 }; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xE2 }; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF4 }; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xFE }; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0xFFFD); + } + + /* Test incomplete/invalid 2-byte input. */ + { + static const uint8_t input[] = { 0xE0, 0x9F }; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 2); + ASSERT (ret == 1 || ret == 2); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xE2, 0x82 }; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 2); + ASSERT (ret == 2); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xE2, 0xD0 }; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 2); + ASSERT (ret == 1 || ret == 2); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF0, 0x8F }; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 2); + ASSERT (ret == 1 || ret == 2); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF3, 0x8F }; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 2); + ASSERT (ret == 2); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF3, 0xD0 }; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 2); + ASSERT (ret == 1 || ret == 2); + ASSERT (uc == 0xFFFD); + } + + /* Test incomplete/invalid 3-byte input. */ + { + static const uint8_t input[] = { 0xF3, 0x8F, 0xBF }; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 3); + ASSERT (ret == 3); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF3, 0xD0, 0xBF }; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 3); + ASSERT (ret == 1 || ret == 3); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF3, 0x8F, 0xD0 }; + uc = 0xBADFACE; + ret = my_u8_mbtouc (&uc, input, 3); + ASSERT (ret == 1 || ret == 3); + ASSERT (uc == 0xFFFD); + } +} diff --git a/tests/unistr/test-u8-mbtoucr.c b/tests/unistr/test-u8-mbtoucr.c new file mode 100644 index 0000000..88e08d3 --- /dev/null +++ b/tests/unistr/test-u8-mbtoucr.c @@ -0,0 +1,187 @@ +/* Test of u8_mbtoucr() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + ucs4_t uc; + int ret; + + /* Test NUL unit input. */ + { + static const uint8_t input[] = ""; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 1); + ASSERT (ret == 1); + ASSERT (uc == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint8_t buf[1]; + + for (c = 0; c < 0x80; c++) + { + buf[0] = c; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, buf, 1); + ASSERT (ret == 1); + ASSERT (uc == c); + } + } + + /* Test 2-byte character input. */ + { + static const uint8_t input[] = { 0xC3, 0x97 }; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 2); + ASSERT (ret == 2); + ASSERT (uc == 0x00D7); + } + + /* Test 3-byte character input. */ + { + static const uint8_t input[] = { 0xE2, 0x82, 0xAC }; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 3); + ASSERT (ret == 3); + ASSERT (uc == 0x20AC); + } + + /* Test 4-byte character input. */ + { + static const uint8_t input[] = { 0xF4, 0x8F, 0xBF, 0xBD }; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 4); + ASSERT (ret == 4); + ASSERT (uc == 0x10FFFD); + } + + /* Test incomplete/invalid 1-byte input. */ + { + static const uint8_t input[] = { 0xC1 }; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 1); + ASSERT (ret == -1); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xC3 }; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 1); + ASSERT (ret == -2); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xE2 }; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 1); + ASSERT (ret == -2); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF4 }; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 1); + ASSERT (ret == -2); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xFE }; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 1); + ASSERT (ret == -1); + ASSERT (uc == 0xFFFD); + } + + /* Test incomplete/invalid 2-byte input. */ + { + static const uint8_t input[] = { 0xE0, 0x9F }; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 2); + ASSERT (ret == -1); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xE2, 0x82 }; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 2); + ASSERT (ret == -2); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xE2, 0xD0 }; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 2); + ASSERT (ret == -1); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF0, 0x8F }; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 2); + ASSERT (ret == -1); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF3, 0x8F }; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 2); + ASSERT (ret == -2); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF3, 0xD0 }; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 2); + ASSERT (ret == -1); + ASSERT (uc == 0xFFFD); + } + + /* Test incomplete/invalid 3-byte input. */ + { + static const uint8_t input[] = { 0xF3, 0x8F, 0xBF }; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 3); + ASSERT (ret == -2); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF3, 0xD0, 0xBF }; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 3); + ASSERT (ret == -1); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF3, 0x8F, 0xD0 }; + uc = 0xBADFACE; + ret = u8_mbtoucr (&uc, input, 3); + ASSERT (ret == -1); + ASSERT (uc == 0xFFFD); + } + + return 0; +} diff --git a/tests/unistr/test-u8-move.c b/tests/unistr/test-u8-move.c new file mode 100644 index 0000000..d18d8dd --- /dev/null +++ b/tests/unistr/test-u8-move.c @@ -0,0 +1,28 @@ +/* Test of u8_move() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint8_t +#define U_MOVE u8_move +#define MAGIC 0xBA +#include "test-move.h" diff --git a/tests/unistr/test-u8-next.c b/tests/unistr/test-u8-next.c new file mode 100644 index 0000000..c4e06b5 --- /dev/null +++ b/tests/unistr/test-u8-next.c @@ -0,0 +1,188 @@ +/* Test of u8_next() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + ucs4_t uc; + const uint8_t *ret; + + /* Test NUL unit input. */ + { + static const uint8_t input[] = ""; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint8_t buf[2]; + + for (c = 1; c < 0x80; c++) + { + buf[0] = c; + buf[1] = 0; + uc = 0xBADFACE; + ret = u8_next (&uc, buf); + ASSERT (ret == buf + 1); + ASSERT (uc == c); + } + } + + /* Test 2-byte character input. */ + { + static const uint8_t input[] = { 0xC3, 0x97, 0 }; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == input + 2); + ASSERT (uc == 0x00D7); + } + + /* Test 3-byte character input. */ + { + static const uint8_t input[] = { 0xE2, 0x82, 0xAC, 0 }; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == input + 3); + ASSERT (uc == 0x20AC); + } + + /* Test 4-byte character input. */ + { + static const uint8_t input[] = { 0xF4, 0x8F, 0xBF, 0xBD, 0 }; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == input + 4); + ASSERT (uc == 0x10FFFD); + } + + /* Test incomplete/invalid 1-byte input. */ + { + static const uint8_t input[] = { 0xC1, 0 }; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xC3, 0 }; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xE2, 0 }; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF4, 0 }; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xFE, 0 }; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0xFFFD); + } + + /* Test incomplete/invalid 2-byte input. */ + { + static const uint8_t input[] = { 0xE0, 0x9F, 0 }; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xE2, 0x82, 0 }; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xE2, 0xD0, 0 }; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF0, 0x8F, 0 }; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF3, 0x8F, 0 }; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF3, 0xD0, 0 }; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0xFFFD); + } + + /* Test incomplete/invalid 3-byte input. */ + { + static const uint8_t input[] = { 0xF3, 0x8F, 0xBF, 0 }; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF3, 0xD0, 0xBF, 0 }; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0xFFFD); + } + { + static const uint8_t input[] = { 0xF3, 0x8F, 0xD0, 0 }; + uc = 0xBADFACE; + ret = u8_next (&uc, input); + ASSERT (ret == NULL); + ASSERT (uc == 0xFFFD); + } + + return 0; +} diff --git a/tests/unistr/test-u8-prev.c b/tests/unistr/test-u8-prev.c new file mode 100644 index 0000000..61f47ef --- /dev/null +++ b/tests/unistr/test-u8-prev.c @@ -0,0 +1,315 @@ +/* Test of u8_prev() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +static int +check (const uint8_t *input, size_t input_length, ucs4_t *puc) +{ + ucs4_t uc; + + /* Test recognition when at the beginning of the string. */ + if (u8_prev (&uc, input + input_length, input) != input) + return 1; + + /* Test recognition when preceded by a 1-unit character. */ + { + uint8_t buf[100]; + uint8_t *ptr; + size_t i; + ucs4_t uc1; + + ptr = buf; + *ptr++ = 'x'; + for (i = 0; i < input_length; i++) + ptr[i] = input[i]; + + if (u8_prev (&uc1, ptr + input_length, buf) != ptr) + return 2; + if (uc1 != uc) + return 3; + } + + /* Test recognition when preceded by a 2-unit character. */ + { + uint8_t buf[100]; + uint8_t *ptr; + size_t i; + ucs4_t uc1; + + ptr = buf; + *ptr++ = 0xC3; + *ptr++ = 0x97; + for (i = 0; i < input_length; i++) + ptr[i] = input[i]; + + if (u8_prev (&uc1, ptr + input_length, buf) != ptr) + return 4; + if (uc1 != uc) + return 5; + } + + /* Test recognition when preceded by a 3-unit character. */ + { + uint8_t buf[100]; + uint8_t *ptr; + size_t i; + ucs4_t uc1; + + ptr = buf; + *ptr++ = 0xE2; + *ptr++ = 0x84; + *ptr++ = 0x82; + for (i = 0; i < input_length; i++) + ptr[i] = input[i]; + + if (u8_prev (&uc1, ptr + input_length, buf) != ptr) + return 6; + if (uc1 != uc) + return 7; + } + + /* Test recognition when preceded by a 4-unit character. */ + { + uint8_t buf[100]; + uint8_t *ptr; + size_t i; + ucs4_t uc1; + + ptr = buf; + *ptr++ = 0xF0; + *ptr++ = 0x9D; + *ptr++ = 0x94; + *ptr++ = 0x9E; + for (i = 0; i < input_length; i++) + ptr[i] = input[i]; + + if (u8_prev (&uc1, ptr + input_length, buf) != ptr) + return 8; + if (uc1 != uc) + return 9; + } + + *puc = uc; + return 0; +} + +static int +check_invalid (const uint8_t *input, size_t input_length) +{ + ucs4_t uc; + + /* Test recognition when at the beginning of the string. */ + uc = 0xBADFACE; + if (u8_prev (&uc, input + input_length, input) != NULL) + return 1; + if (uc != 0xBADFACE) + return 2; + + /* Test recognition when preceded by a 1-unit character. */ + { + uint8_t buf[100]; + uint8_t *ptr; + size_t i; + + ptr = buf; + *ptr++ = 'x'; + for (i = 0; i < input_length; i++) + ptr[i] = input[i]; + + uc = 0xBADFACE; + if (u8_prev (&uc, ptr + input_length, buf) != NULL) + return 3; + if (uc != 0xBADFACE) + return 4; + } + + /* Test recognition when preceded by a 2-unit character. */ + { + uint8_t buf[100]; + uint8_t *ptr; + size_t i; + + ptr = buf; + *ptr++ = 0xC3; + *ptr++ = 0x97; + for (i = 0; i < input_length; i++) + ptr[i] = input[i]; + + uc = 0xBADFACE; + if (u8_prev (&uc, ptr + input_length, buf) != NULL) + return 5; + if (uc != 0xBADFACE) + return 6; + } + + /* Test recognition when preceded by a 3-unit character. */ + { + uint8_t buf[100]; + uint8_t *ptr; + size_t i; + + ptr = buf; + *ptr++ = 0xE2; + *ptr++ = 0x84; + *ptr++ = 0x82; + for (i = 0; i < input_length; i++) + ptr[i] = input[i]; + + uc = 0xBADFACE; + if (u8_prev (&uc, ptr + input_length, buf) != NULL) + return 7; + if (uc != 0xBADFACE) + return 8; + } + + /* Test recognition when preceded by a 4-unit character. */ + { + uint8_t buf[100]; + uint8_t *ptr; + size_t i; + + ptr = buf; + *ptr++ = 0xF0; + *ptr++ = 0x9D; + *ptr++ = 0x94; + *ptr++ = 0x9E; + for (i = 0; i < input_length; i++) + ptr[i] = input[i]; + + uc = 0xBADFACE; + if (u8_prev (&uc, ptr + input_length, buf) != NULL) + return 9; + if (uc != 0xBADFACE) + return 10; + } + + return 0; +} + +int +main () +{ + ucs4_t uc; + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint8_t buf[1]; + + for (c = 0; c < 0x80; c++) + { + buf[0] = c; + uc = 0xBADFACE; + ASSERT (check (buf, 1, &uc) == 0); + ASSERT (uc == c); + } + } + + /* Test 2-byte character input. */ + { + static const uint8_t input[] = { 0xC3, 0x97 }; + uc = 0xBADFACE; + ASSERT (check (input, SIZEOF (input), &uc) == 0); + ASSERT (uc == 0x00D7); + } + + /* Test 3-byte character input. */ + { + static const uint8_t input[] = { 0xE2, 0x82, 0xAC }; + uc = 0xBADFACE; + ASSERT (check (input, SIZEOF (input), &uc) == 0); + ASSERT (uc == 0x20AC); + } + + /* Test 4-byte character input. */ + { + static const uint8_t input[] = { 0xF4, 0x8F, 0xBF, 0xBD }; + uc = 0xBADFACE; + ASSERT (check (input, SIZEOF (input), &uc) == 0); + ASSERT (uc == 0x10FFFD); + } + + /* Test incomplete/invalid 1-byte input. */ + { + static const uint8_t input[] = { 0xC1 }; + ASSERT (check_invalid (input, SIZEOF (input)) == 0); + } + { + static const uint8_t input[] = { 0xC3 }; + ASSERT (check_invalid (input, SIZEOF (input)) == 0); + } + { + static const uint8_t input[] = { 0xE2 }; + ASSERT (check_invalid (input, SIZEOF (input)) == 0); + } + { + static const uint8_t input[] = { 0xF4 }; + ASSERT (check_invalid (input, SIZEOF (input)) == 0); + } + { + static const uint8_t input[] = { 0xFE }; + ASSERT (check_invalid (input, SIZEOF (input)) == 0); + } + + /* Test incomplete/invalid 2-byte input. */ + { + static const uint8_t input[] = { 0xE0, 0x9F }; + ASSERT (check_invalid (input, SIZEOF (input)) == 0); + } + { + static const uint8_t input[] = { 0xE2, 0x82 }; + ASSERT (check_invalid (input, SIZEOF (input)) == 0); + } + { + static const uint8_t input[] = { 0xE2, 0xD0 }; + ASSERT (check_invalid (input, SIZEOF (input)) == 0); + } + { + static const uint8_t input[] = { 0xF0, 0x8F }; + ASSERT (check_invalid (input, SIZEOF (input)) == 0); + } + { + static const uint8_t input[] = { 0xF3, 0x8F }; + ASSERT (check_invalid (input, SIZEOF (input)) == 0); + } + { + static const uint8_t input[] = { 0xF3, 0xD0 }; + ASSERT (check_invalid (input, SIZEOF (input)) == 0); + } + + /* Test incomplete/invalid 3-byte input. */ + { + static const uint8_t input[] = { 0xF3, 0x8F, 0xBF }; + ASSERT (check_invalid (input, SIZEOF (input)) == 0); + } + { + static const uint8_t input[] = { 0xF3, 0xE4, 0xBF }; + ASSERT (check_invalid (input, SIZEOF (input)) == 0); + } + { + static const uint8_t input[] = { 0xF3, 0x8F, 0xD0 }; + ASSERT (check_invalid (input, SIZEOF (input)) == 0); + } + + return 0; +} diff --git a/tests/unistr/test-u8-set.c b/tests/unistr/test-u8-set.c new file mode 100644 index 0000000..e778fed --- /dev/null +++ b/tests/unistr/test-u8-set.c @@ -0,0 +1,29 @@ +/* Test of u8_set() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint8_t +#define U_SET u8_set +#define MAGIC 0xBA +#define VALUE 'x' +#include "test-set.h" diff --git a/tests/unistr/test-u8-stpcpy.c b/tests/unistr/test-u8-stpcpy.c new file mode 100644 index 0000000..94c0471 --- /dev/null +++ b/tests/unistr/test-u8-stpcpy.c @@ -0,0 +1,28 @@ +/* Test of u8_stpcpy() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint8_t +#define U_STPCPY u8_stpcpy +#define MAGIC 0xBA +#include "test-stpcpy.h" diff --git a/tests/unistr/test-u8-stpncpy.c b/tests/unistr/test-u8-stpncpy.c new file mode 100644 index 0000000..4809626 --- /dev/null +++ b/tests/unistr/test-u8-stpncpy.c @@ -0,0 +1,52 @@ +/* Test of u8_stpncpy() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <stdlib.h> + +#include "zerosize-ptr.h" +#include "macros.h" + +#define UNIT uint8_t +#define U_STPNCPY u8_stpncpy +#define MAGIC 0xBA +#include "test-stpncpy.h" + +int +main () +{ + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint8_t input[] = + { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ', + 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\0' + }; + check (input, SIZEOF (input)); + } + + return 0; +} diff --git a/tests/unistr/test-u8-strcat.c b/tests/unistr/test-u8-strcat.c new file mode 100644 index 0000000..7fa9e84 --- /dev/null +++ b/tests/unistr/test-u8-strcat.c @@ -0,0 +1,28 @@ +/* Test of u8_strcat() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint8_t +#define U_STRCAT u8_strcat +#define MAGIC 0xBA +#include "test-strcat.h" diff --git a/tests/unistr/test-u8-strcmp.c b/tests/unistr/test-u8-strcmp.c new file mode 100644 index 0000000..313cd11 --- /dev/null +++ b/tests/unistr/test-u8-strcmp.c @@ -0,0 +1,34 @@ +/* Test of u8_strcmp() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define U_STRCMP u8_strcmp +#include "test-u8-strcmp.h" + +int +main () +{ + test_u8_strcmp (); + + return 0; +} diff --git a/tests/unistr/test-u8-strcmp.h b/tests/unistr/test-u8-strcmp.h new file mode 100644 index 0000000..9c25dac --- /dev/null +++ b/tests/unistr/test-u8-strcmp.h @@ -0,0 +1,42 @@ +/* Test of u8_strcmp() and u8_strcoll() functions. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#define UNIT uint8_t +#include "test-strcmp.h" + +static void +test_u8_strcmp (void) +{ + test_strcmp (); + + /* Test comparison between ASCII and non-ASCII characters. */ + { + static const UNIT input1[] = { 'f', 'o', 'o', 0 }; + static const UNIT input2[] = { 0xE2, 0x80, 0xA2, 0 }; + ASSERT (U_STRCMP (input1, input2) < 0); + ASSERT (U_STRCMP (input2, input1) > 0); + } + + /* Test comparison with non-BMP characters. */ + { + static const UNIT input1[] = { 0xF0, 0x9D, 0x94, 0x9E, 0 }; + static const UNIT input2[] = { 0xEF, 0xBB, 0xBF, 0 }; + ASSERT (U_STRCMP (input1, input2) > 0); + ASSERT (U_STRCMP (input2, input1) < 0); + } +} diff --git a/tests/unistr/test-u8-strcoll.c b/tests/unistr/test-u8-strcoll.c new file mode 100644 index 0000000..ae5c9a4 --- /dev/null +++ b/tests/unistr/test-u8-strcoll.c @@ -0,0 +1,41 @@ +/* Test of u8_strcoll() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define U_STRCMP u8_strcoll +#include "test-u8-strcmp.h" + +int +main () +{ + /* This test relies on three facts: + - setlocale is not being called, therefore the locale is the "C" locale. + - In the "C" locale, strcoll is equivalent to strcmp. + - In the u8_strcoll implementation, Unicode strings that are not + convertible to the locale encoding are sorted higher than convertible + strings and compared according to u8_strcmp. */ + + test_u8_strcmp (); + + return 0; +} diff --git a/tests/unistr/test-u8-strcpy.c b/tests/unistr/test-u8-strcpy.c new file mode 100644 index 0000000..810f975 --- /dev/null +++ b/tests/unistr/test-u8-strcpy.c @@ -0,0 +1,28 @@ +/* Test of u8_strcpy() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint8_t +#define U_STRCPY u8_strcpy +#define MAGIC 0xBA +#include "test-strcpy.h" diff --git a/tests/unistr/test-u8-strdup.c b/tests/unistr/test-u8-strdup.c new file mode 100644 index 0000000..6da2151 --- /dev/null +++ b/tests/unistr/test-u8-strdup.c @@ -0,0 +1,27 @@ +/* Test of u8_strdup() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint8_t +#define U_STRDUP u8_strdup +#include "test-strdup.h" diff --git a/tests/unistr/test-u8-strlen.c b/tests/unistr/test-u8-strlen.c new file mode 100644 index 0000000..3dfa1b0 --- /dev/null +++ b/tests/unistr/test-u8-strlen.c @@ -0,0 +1,50 @@ +/* Test of u8_strlen() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + /* Empty string. */ + { + static const uint8_t input[] = { 0 }; + ASSERT (u8_strlen (input) == 0); + } + + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint8_t input[] = + { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ', + 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\0' + }; + ASSERT (u8_strlen (input) == SIZEOF (input) - 1); + } + + return 0; +} diff --git a/tests/unistr/test-u8-strmblen.c b/tests/unistr/test-u8-strmblen.c new file mode 100644 index 0000000..bde3000 --- /dev/null +++ b/tests/unistr/test-u8-strmblen.c @@ -0,0 +1,149 @@ +/* Test of u8_strmblen() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + int ret; + + /* Test NUL unit input. */ + { + static const uint8_t input[] = ""; + ret = u8_strmblen (input); + ASSERT (ret == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint8_t buf[2]; + + for (c = 1; c < 0x80; c++) + { + buf[0] = c; + buf[1] = 0; + ret = u8_strmblen (buf); + ASSERT (ret == 1); + } + } + + /* Test 2-byte character input. */ + { + static const uint8_t input[] = { 0xC3, 0x97, 0 }; + ret = u8_strmblen (input); + ASSERT (ret == 2); + } + + /* Test 3-byte character input. */ + { + static const uint8_t input[] = { 0xE2, 0x82, 0xAC, 0 }; + ret = u8_strmblen (input); + ASSERT (ret == 3); + } + + /* Test 4-byte character input. */ + { + static const uint8_t input[] = { 0xF4, 0x8F, 0xBF, 0xBD, 0 }; + ret = u8_strmblen (input); + ASSERT (ret == 4); + } + + /* Test incomplete/invalid 1-byte input. */ + { + static const uint8_t input[] = { 0xC1, 0 }; + ret = u8_strmblen (input); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xC3, 0 }; + ret = u8_strmblen (input); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xE2, 0 }; + ret = u8_strmblen (input); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xF4, 0 }; + ret = u8_strmblen (input); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xFE, 0 }; + ret = u8_strmblen (input); + ASSERT (ret == -1); + } + + /* Test incomplete/invalid 2-byte input. */ + { + static const uint8_t input[] = { 0xE0, 0x9F, 0 }; + ret = u8_strmblen (input); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xE2, 0x82, 0 }; + ret = u8_strmblen (input); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xE2, 0xD0, 0 }; + ret = u8_strmblen (input); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xF0, 0x8F, 0 }; + ret = u8_strmblen (input); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xF3, 0x8F, 0 }; + ret = u8_strmblen (input); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xF3, 0xD0, 0 }; + ret = u8_strmblen (input); + ASSERT (ret == -1); + } + + /* Test incomplete/invalid 3-byte input. */ + { + static const uint8_t input[] = { 0xF3, 0x8F, 0xBF, 0 }; + ret = u8_strmblen (input); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xF3, 0xD0, 0xBF, 0 }; + ret = u8_strmblen (input); + ASSERT (ret == -1); + } + { + static const uint8_t input[] = { 0xF3, 0x8F, 0xD0, 0 }; + ret = u8_strmblen (input); + ASSERT (ret == -1); + } + + return 0; +} diff --git a/tests/unistr/test-u8-strmbtouc.c b/tests/unistr/test-u8-strmbtouc.c new file mode 100644 index 0000000..5591357 --- /dev/null +++ b/tests/unistr/test-u8-strmbtouc.c @@ -0,0 +1,188 @@ +/* Test of u8_strmbtouc() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +int +main () +{ + ucs4_t uc; + int ret; + + /* Test NUL unit input. */ + { + static const uint8_t input[] = ""; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == 0); + ASSERT (uc == 0); + } + + /* Test ISO 646 unit input. */ + { + ucs4_t c; + uint8_t buf[2]; + + for (c = 1; c < 0x80; c++) + { + buf[0] = c; + buf[1] = 0; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, buf); + ASSERT (ret == 1); + ASSERT (uc == c); + } + } + + /* Test 2-byte character input. */ + { + static const uint8_t input[] = { 0xC3, 0x97, 0 }; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == 2); + ASSERT (uc == 0x00D7); + } + + /* Test 3-byte character input. */ + { + static const uint8_t input[] = { 0xE2, 0x82, 0xAC, 0 }; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == 3); + ASSERT (uc == 0x20AC); + } + + /* Test 4-byte character input. */ + { + static const uint8_t input[] = { 0xF4, 0x8F, 0xBF, 0xBD, 0 }; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == 4); + ASSERT (uc == 0x10FFFD); + } + + /* Test incomplete/invalid 1-byte input. */ + { + static const uint8_t input[] = { 0xC1, 0 }; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == -1); + ASSERT (uc == 0xBADFACE); + } + { + static const uint8_t input[] = { 0xC3, 0 }; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == -1); + ASSERT (uc == 0xBADFACE); + } + { + static const uint8_t input[] = { 0xE2, 0 }; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == -1); + ASSERT (uc == 0xBADFACE); + } + { + static const uint8_t input[] = { 0xF4, 0 }; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == -1); + ASSERT (uc == 0xBADFACE); + } + { + static const uint8_t input[] = { 0xFE, 0 }; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == -1); + ASSERT (uc == 0xBADFACE); + } + + /* Test incomplete/invalid 2-byte input. */ + { + static const uint8_t input[] = { 0xE0, 0x9F, 0 }; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == -1); + ASSERT (uc == 0xBADFACE); + } + { + static const uint8_t input[] = { 0xE2, 0x82, 0 }; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == -1); + ASSERT (uc == 0xBADFACE); + } + { + static const uint8_t input[] = { 0xE2, 0xD0, 0 }; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == -1); + ASSERT (uc == 0xBADFACE); + } + { + static const uint8_t input[] = { 0xF0, 0x8F, 0 }; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == -1); + ASSERT (uc == 0xBADFACE); + } + { + static const uint8_t input[] = { 0xF3, 0x8F, 0 }; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == -1); + ASSERT (uc == 0xBADFACE); + } + { + static const uint8_t input[] = { 0xF3, 0xD0, 0 }; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == -1); + ASSERT (uc == 0xBADFACE); + } + + /* Test incomplete/invalid 3-byte input. */ + { + static const uint8_t input[] = { 0xF3, 0x8F, 0xBF, 0 }; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == -1); + ASSERT (uc == 0xBADFACE); + } + { + static const uint8_t input[] = { 0xF3, 0xD0, 0xBF, 0 }; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == -1); + ASSERT (uc == 0xBADFACE); + } + { + static const uint8_t input[] = { 0xF3, 0x8F, 0xD0, 0 }; + uc = 0xBADFACE; + ret = u8_strmbtouc (&uc, input); + ASSERT (ret == -1); + ASSERT (uc == 0xBADFACE); + } + + return 0; +} diff --git a/tests/unistr/test-u8-strncat.c b/tests/unistr/test-u8-strncat.c new file mode 100644 index 0000000..bb90041 --- /dev/null +++ b/tests/unistr/test-u8-strncat.c @@ -0,0 +1,52 @@ +/* Test of u8_strncat() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <stdlib.h> + +#include "zerosize-ptr.h" +#include "macros.h" + +#define UNIT uint8_t +#define U_STRNCAT u8_strncat +#define MAGIC 0xBA +#include "test-strncat.h" + +int +main () +{ + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint8_t input[] = + { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ', + 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\0' + }; + check (input, SIZEOF (input)); + } + + return 0; +} diff --git a/tests/unistr/test-u8-strncmp.c b/tests/unistr/test-u8-strncmp.c new file mode 100644 index 0000000..f63cdaa --- /dev/null +++ b/tests/unistr/test-u8-strncmp.c @@ -0,0 +1,53 @@ +/* Test of u8_strncmp() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define UNIT uint8_t +#define U_STRNCMP u8_strncmp +#include "test-strncmp.h" + +int +main () +{ + test_strncmp (); + + /* Test comparison with non-BMP characters. */ + { + static const UNIT input1[] = { 0xF0, 0x9D, 0x94, 0x9E, 0 }; + static const UNIT input2[] = { 0xEF, 0xBB, 0xBF, 0 }; + ASSERT (U_STRNCMP (input1, input2, 1) > 0); + ASSERT (U_STRNCMP (input2, input1, 1) < 0); + ASSERT (U_STRNCMP (input1, input2, 2) > 0); + ASSERT (U_STRNCMP (input2, input1, 2) < 0); + ASSERT (U_STRNCMP (input1, input2, 3) > 0); + ASSERT (U_STRNCMP (input2, input1, 3) < 0); + ASSERT (U_STRNCMP (input1, input2, 4) > 0); + ASSERT (U_STRNCMP (input2, input1, 4) < 0); + ASSERT (U_STRNCMP (input1, input2, 5) > 0); + ASSERT (U_STRNCMP (input2, input1, 5) < 0); + ASSERT (U_STRNCMP (input1, input2, 1000000) > 0); + ASSERT (U_STRNCMP (input2, input1, 1000000) < 0); + } + + return 0; +} diff --git a/tests/unistr/test-u8-strncpy.c b/tests/unistr/test-u8-strncpy.c new file mode 100644 index 0000000..64cabdc --- /dev/null +++ b/tests/unistr/test-u8-strncpy.c @@ -0,0 +1,52 @@ +/* Test of u8_strncpy() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <stdlib.h> + +#include "zerosize-ptr.h" +#include "macros.h" + +#define UNIT uint8_t +#define U_STRNCPY u8_strncpy +#define MAGIC 0xBA +#include "test-strncpy.h" + +int +main () +{ + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint8_t input[] = + { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ', + 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\0' + }; + check (input, SIZEOF (input)); + } + + return 0; +} diff --git a/tests/unistr/test-u8-strnlen.c b/tests/unistr/test-u8-strnlen.c new file mode 100644 index 0000000..98de797 --- /dev/null +++ b/tests/unistr/test-u8-strnlen.c @@ -0,0 +1,49 @@ +/* Test of u8_strnlen() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "zerosize-ptr.h" +#include "macros.h" + +#define UNIT uint8_t +#define U_STRNLEN u8_strnlen +#include "test-strnlen.h" + +int +main () +{ + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint8_t input[] = + { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ', + 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\0' + }; + check (input, SIZEOF (input)); + } + + return 0; +} diff --git a/tests/unistr/test-u8-to-u16.c b/tests/unistr/test-u8-to-u16.c new file mode 100644 index 0000000..02ef44f --- /dev/null +++ b/tests/unistr/test-u8-to-u16.c @@ -0,0 +1,158 @@ +/* Test of u8_to_u16() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <errno.h> + +#include "macros.h" + +static int +check (const uint8_t *input, size_t input_length, + const uint16_t *expected, size_t expected_length) +{ + size_t length; + uint16_t *result; + + /* Test return conventions with resultbuf == NULL. */ + result = u8_to_u16 (input, input_length, NULL, &length); + if (!(result != NULL)) + return 1; + if (!(length == expected_length)) + return 2; + if (!(u16_cmp (result, expected, expected_length) == 0)) + return 3; + free (result); + + /* Test return conventions with resultbuf too small. */ + if (expected_length > 0) + { + uint16_t *preallocated; + + length = expected_length - 1; + preallocated = (uint16_t *) malloc (length * sizeof (uint16_t)); + result = u8_to_u16 (input, input_length, preallocated, &length); + if (!(result != NULL)) + return 4; + if (!(result != preallocated)) + return 5; + if (!(length == expected_length)) + return 6; + if (!(u16_cmp (result, expected, expected_length) == 0)) + return 7; + free (result); + free (preallocated); + } + + /* Test return conventions with resultbuf large enough. */ + { + uint16_t *preallocated; + + length = expected_length; + preallocated = (uint16_t *) malloc (length * sizeof (uint16_t)); + result = u8_to_u16 (input, input_length, preallocated, &length); + if (!(result != NULL)) + return 8; + if (!(preallocated == NULL || result == preallocated)) + return 9; + if (!(length == expected_length)) + return 10; + if (!(u16_cmp (result, expected, expected_length) == 0)) + return 11; + free (preallocated); + } + + return 0; +} + +int +main () +{ + /* Empty string. */ + ASSERT (check (NULL, 0, NULL, 0) == 0); + + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint8_t input[] = + { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ', + 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + }; + static const uint16_t expected[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); + } + + /* String with characters outside the BMP. */ + { + static const uint8_t input[] = + { '-', '(', 0xF0, 0x9D, 0x94, 0x9E, 0xC3, 0x97, 0xF0, 0x9D, 0x94, 0x9F, + ')', '=', 0xF0, 0x9D, 0x94, 0x9F, 0xC3, 0x97, 0xF0, 0x9D, 0x94, 0x9E + }; + static const uint16_t expected[] = + { '-', '(', 0xD835, 0xDD1E, 0x00D7, 0xD835, 0xDD1F, ')', '=', + 0xD835, 0xDD1F, 0x00D7, 0xD835, 0xDD1E + }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); + } + + /* Invalid input. */ + { + static const uint8_t input[] = { 'x', 0xC2, 0xC3, 'y' }; +#if 0 /* Currently invalid input is rejected, not accommodated. */ + static const uint16_t expected[] = { 'x', 0xFFFD, 0xFFFD, 'y' }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); +#else + size_t length; + uint16_t *result; + uint16_t preallocated[10]; + + /* Test return conventions with resultbuf == NULL. */ + result = u8_to_u16 (input, SIZEOF (input), NULL, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); + + /* Test return conventions with resultbuf too small. */ + length = 1; + result = u8_to_u16 (input, SIZEOF (input), preallocated, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); + + /* Test return conventions with resultbuf large enough. */ + length = SIZEOF (preallocated); + result = u8_to_u16 (input, SIZEOF (input), preallocated, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); +#endif + } + + return 0; +} diff --git a/tests/unistr/test-u8-to-u32.c b/tests/unistr/test-u8-to-u32.c new file mode 100644 index 0000000..d148e62 --- /dev/null +++ b/tests/unistr/test-u8-to-u32.c @@ -0,0 +1,158 @@ +/* Test of u8_to_u32() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include <errno.h> + +#include "macros.h" + +static int +check (const uint8_t *input, size_t input_length, + const uint32_t *expected, size_t expected_length) +{ + size_t length; + uint32_t *result; + + /* Test return conventions with resultbuf == NULL. */ + result = u8_to_u32 (input, input_length, NULL, &length); + if (!(result != NULL)) + return 1; + if (!(length == expected_length)) + return 2; + if (!(u32_cmp (result, expected, expected_length) == 0)) + return 3; + free (result); + + /* Test return conventions with resultbuf too small. */ + if (expected_length > 0) + { + uint32_t *preallocated; + + length = expected_length - 1; + preallocated = (uint32_t *) malloc (length * sizeof (uint32_t)); + result = u8_to_u32 (input, input_length, preallocated, &length); + if (!(result != NULL)) + return 4; + if (!(result != preallocated)) + return 5; + if (!(length == expected_length)) + return 6; + if (!(u32_cmp (result, expected, expected_length) == 0)) + return 7; + free (result); + free (preallocated); + } + + /* Test return conventions with resultbuf large enough. */ + { + uint32_t *preallocated; + + length = expected_length; + preallocated = (uint32_t *) malloc (length * sizeof (uint32_t)); + result = u8_to_u32 (input, input_length, preallocated, &length); + if (!(result != NULL)) + return 8; + if (!(preallocated == NULL || result == preallocated)) + return 9; + if (!(length == expected_length)) + return 10; + if (!(u32_cmp (result, expected, expected_length) == 0)) + return 11; + free (preallocated); + } + + return 0; +} + +int +main () +{ + /* Empty string. */ + ASSERT (check (NULL, 0, NULL, 0) == 0); + + /* Simple string. */ + { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ + static const uint8_t input[] = + { 'G', 'r', 0xC3, 0xBC, 0xC3, 0x9F, ' ', 'G', 'o', 't', 't', '.', ' ', + 0xD0, 0x97, 0xD0, 0xB4, 0xD1, 0x80, 0xD0, 0xB0, 0xD0, 0xB2, 0xD1, 0x81, + 0xD1, 0x82, 0xD0, 0xB2, 0xD1, 0x83, 0xD0, 0xB9, 0xD1, 0x82, 0xD0, 0xB5, + '!', ' ', 'x', '=', '(', '-', 'b', 0xC2, 0xB1, 's', 'q', 'r', 't', '(', + 'b', 0xC2, 0xB2, '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', + ' ', ' ', 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC, 0xE8, 0xAA, 0x9E, ',', + 0xE4, 0xB8, 0xAD, 0xE6, 0x96, 0x87, ',', + 0xED, 0x95, 0x9C, 0xEA, 0xB8, 0x80, '\n' + }; + static const uint32_t expected[] = + { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); + } + + /* String with characters outside the BMP. */ + { + static const uint8_t input[] = + { '-', '(', 0xF0, 0x9D, 0x94, 0x9E, 0xC3, 0x97, 0xF0, 0x9D, 0x94, 0x9F, + ')', '=', 0xF0, 0x9D, 0x94, 0x9F, 0xC3, 0x97, 0xF0, 0x9D, 0x94, 0x9E + }; + static const uint32_t expected[] = + { '-', '(', 0x1D51E, 0x00D7, 0x1D51F, ')', '=', + 0x1D51F, 0x00D7, 0x1D51E + }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); + } + + /* Invalid input. */ + { + static const uint8_t input[] = { 'x', 0xC2, 0xC3, 'y' }; +#if 0 /* Currently invalid input is rejected, not accommodated. */ + static const uint32_t expected[] = { 'x', 0xFFFD, 0xFFFD, 'y' }; + ASSERT (check (input, SIZEOF (input), expected, SIZEOF (expected)) == 0); +#else + size_t length; + uint32_t *result; + uint32_t preallocated[10]; + + /* Test return conventions with resultbuf == NULL. */ + result = u8_to_u32 (input, SIZEOF (input), NULL, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); + + /* Test return conventions with resultbuf too small. */ + length = 1; + result = u8_to_u32 (input, SIZEOF (input), preallocated, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); + + /* Test return conventions with resultbuf large enough. */ + length = SIZEOF (preallocated); + result = u8_to_u32 (input, SIZEOF (input), preallocated, &length); + ASSERT (result == NULL); + ASSERT (errno == EILSEQ); +#endif + } + + return 0; +} diff --git a/tests/unistr/test-u8-uctomb.c b/tests/unistr/test-u8-uctomb.c new file mode 100644 index 0000000..8fbdc42 --- /dev/null +++ b/tests/unistr/test-u8-uctomb.c @@ -0,0 +1,157 @@ +/* Test of u8_uctomb() function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Bruno Haible <bruno@clisp.org>, 2010. */ + +#include <config.h> + +#include "unistr.h" + +#include "macros.h" + +#define MAGIC 0xBA + +int +main () +{ + /* Test ISO 646 character, in particular the NUL character. */ + { + ucs4_t uc; + + for (uc = 0; uc < 0x80; uc++) + { + uint8_t buf[5] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; + int ret; + + ret = u8_uctomb (buf, uc, 0); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); + + ret = u8_uctomb (buf, uc, 1); + ASSERT (ret == 1); + ASSERT (buf[0] == uc); + ASSERT (buf[1] == MAGIC); + } + } + + /* Test 2-byte character. */ + { + ucs4_t uc = 0x00D7; + uint8_t buf[5] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; + int ret; + + ret = u8_uctomb (buf, uc, 0); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); + + ret = u8_uctomb (buf, uc, 1); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); + + ret = u8_uctomb (buf, uc, 2); + ASSERT (ret == 2); + ASSERT (buf[0] == 0xC3); + ASSERT (buf[1] == 0x97); + ASSERT (buf[2] == MAGIC); + } + + /* Test 3-byte character. */ + { + ucs4_t uc = 0x20AC; + uint8_t buf[5] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; + int ret; + + ret = u8_uctomb (buf, uc, 0); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); + + ret = u8_uctomb (buf, uc, 1); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); + + ret = u8_uctomb (buf, uc, 2); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); + ASSERT (buf[1] == MAGIC); + + ret = u8_uctomb (buf, uc, 3); + ASSERT (ret == 3); + ASSERT (buf[0] == 0xE2); + ASSERT (buf[1] == 0x82); + ASSERT (buf[2] == 0xAC); + ASSERT (buf[3] == MAGIC); + } + + /* Test 4-byte character. */ + { + ucs4_t uc = 0x10FFFD; + uint8_t buf[5] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; + int ret; + + ret = u8_uctomb (buf, uc, 0); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); + + ret = u8_uctomb (buf, uc, 1); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); + + ret = u8_uctomb (buf, uc, 2); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); + ASSERT (buf[1] == MAGIC); + + ret = u8_uctomb (buf, uc, 3); + ASSERT (ret == -2); + ASSERT (buf[0] == MAGIC); + ASSERT (buf[1] == MAGIC); + ASSERT (buf[2] == MAGIC); + + ret = u8_uctomb (buf, uc, 4); + ASSERT (ret == 4); + ASSERT (buf[0] == 0xF4); + ASSERT (buf[1] == 0x8F); + ASSERT (buf[2] == 0xBF); + ASSERT (buf[3] == 0xBD); + ASSERT (buf[4] == MAGIC); + } + + /* Test invalid characters. */ + { + ucs4_t invalid[] = { 0x110000, 0xD800, 0xDBFF, 0xDC00, 0xDFFF }; + uint8_t buf[5] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC }; + size_t i; + + for (i = 0; i < SIZEOF (invalid); i++) + { + ucs4_t uc = invalid[i]; + int n; + + for (n = 0; n <= 4; n++) + { + int ret = u8_uctomb (buf, uc, n); + ASSERT (ret == -1); + ASSERT (buf[0] == MAGIC); + ASSERT (buf[1] == MAGIC); + ASSERT (buf[2] == MAGIC); + ASSERT (buf[3] == MAGIC); + ASSERT (buf[4] == MAGIC); + } + } + } + + return 0; +} diff --git a/tests/uniwbrk/test-u16-wordbreaks.c b/tests/uniwbrk/test-u16-wordbreaks.c index b5eb26c..c9a4f2a 100644 --- a/tests/uniwbrk/test-u16-wordbreaks.c +++ b/tests/uniwbrk/test-u16-wordbreaks.c @@ -1,5 +1,5 @@ /* Test of word breaks in UTF-16 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,21 +20,9 @@ #include "uniwbrk.h" -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -46,11 +34,11 @@ main () static const uint16_t input[61] = /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; char *p = (char *) malloc (SIZEOF (input)); size_t i; @@ -59,14 +47,14 @@ main () for (i = 0; i < 61; i++) { - ASSERT (p[i] == ((i >= 4 && i <= 5) - || (i >= 9 && i <= 11) - || (i >= 23 && i <= 31) - || (i >= 35 && i <= 39) - || (i >= 42 && i <= 46) - || (i >= 48 && i <= 58) - || i == 60 - ? 1 : 0)); + ASSERT (p[i] == ((i >= 4 && i <= 5) + || (i >= 9 && i <= 11) + || (i >= 23 && i <= 31) + || (i >= 35 && i <= 39) + || (i >= 42 && i <= 46) + || (i >= 48 && i <= 58) + || i == 60 + ? 1 : 0)); } free (p); } @@ -76,12 +64,12 @@ main () static const uint16_t input[67] = /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ { 'G', 'r', 0x0075, 0x0308, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', - 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', + 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' }; char *p = (char *) malloc (SIZEOF (input)); size_t i; @@ -90,14 +78,14 @@ main () for (i = 0; i < 67; i++) { - ASSERT (p[i] == ((i >= 5 && i <= 6) - || (i >= 10 && i <= 12) - || (i >= 25 && i <= 33) - || (i >= 37 && i <= 41) - || (i >= 44 && i <= 48) - || (i >= 50 && i <= 60) - || i == 66 - ? 1 : 0)); + ASSERT (p[i] == ((i >= 5 && i <= 6) + || (i >= 10 && i <= 12) + || (i >= 25 && i <= 33) + || (i >= 37 && i <= 41) + || (i >= 44 && i <= 48) + || (i >= 50 && i <= 60) + || i == 66 + ? 1 : 0)); } free (p); } diff --git a/tests/uniwbrk/test-u32-wordbreaks.c b/tests/uniwbrk/test-u32-wordbreaks.c index c6feb84..4bb3232 100644 --- a/tests/uniwbrk/test-u32-wordbreaks.c +++ b/tests/uniwbrk/test-u32-wordbreaks.c @@ -1,5 +1,5 @@ /* Test of word breaks in UTF-32 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,21 +20,9 @@ #include "uniwbrk.h" -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -46,11 +34,11 @@ main () static const uint32_t input[61] = /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ { 'G', 'r', 0x00FC, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0439, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0439, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n' }; char *p = (char *) malloc (SIZEOF (input)); size_t i; @@ -59,14 +47,14 @@ main () for (i = 0; i < 61; i++) { - ASSERT (p[i] == ((i >= 4 && i <= 5) - || (i >= 9 && i <= 11) - || (i >= 23 && i <= 31) - || (i >= 35 && i <= 39) - || (i >= 42 && i <= 46) - || (i >= 48 && i <= 58) - || i == 60 - ? 1 : 0)); + ASSERT (p[i] == ((i >= 4 && i <= 5) + || (i >= 9 && i <= 11) + || (i >= 23 && i <= 31) + || (i >= 35 && i <= 39) + || (i >= 42 && i <= 46) + || (i >= 48 && i <= 58) + || i == 60 + ? 1 : 0)); } free (p); } @@ -76,12 +64,12 @@ main () static const uint32_t input[67] = /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글" */ { 'G', 'r', 0x0075, 0x0308, 0x00DF, ' ', 'G', 'o', 't', 't', '.', ' ', - 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, - 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', - 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, - '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', - 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', - 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' + 0x0417, 0x0434, 0x0440, 0x0430, 0x0432, 0x0441, 0x0442, 0x0432, 0x0443, + 0x0438, 0x0306, 0x0442, 0x0435, '!', ' ', + 'x', '=', '(', '-', 'b', 0x00B1, 's', 'q', 'r', 't', '(', 'b', 0x00B2, + '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ', + 0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', + 0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n' }; char *p = (char *) malloc (SIZEOF (input)); size_t i; @@ -90,14 +78,14 @@ main () for (i = 0; i < 67; i++) { - ASSERT (p[i] == ((i >= 5 && i <= 6) - || (i >= 10 && i <= 12) - || (i >= 25 && i <= 33) - || (i >= 37 && i <= 41) - || (i >= 44 && i <= 48) - || (i >= 50 && i <= 60) - || i == 66 - ? 1 : 0)); + ASSERT (p[i] == ((i >= 5 && i <= 6) + || (i >= 10 && i <= 12) + || (i >= 25 && i <= 33) + || (i >= 37 && i <= 41) + || (i >= 44 && i <= 48) + || (i >= 50 && i <= 60) + || i == 66 + ? 1 : 0)); } free (p); } diff --git a/tests/uniwbrk/test-u8-wordbreaks.c b/tests/uniwbrk/test-u8-wordbreaks.c index c263302..a87ea19 100644 --- a/tests/uniwbrk/test-u8-wordbreaks.c +++ b/tests/uniwbrk/test-u8-wordbreaks.c @@ -1,5 +1,5 @@ /* Test of word breaks in UTF-8 strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,21 +20,9 @@ #include "uniwbrk.h" -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -53,16 +41,16 @@ main () for (i = 0; i < 91; i++) { - ASSERT (p[i] == ((i >= 6 && i <= 7) - || (i >= 11 && i <= 13) - || (i >= 37 && i <= 44) - || i == 46 || (i >= 50 && i <= 52) - || (i >= 54 && i <= 55) - || (i >= 58 && i <= 62) || (i >= 64 && i <= 67) - || i == 70 || i == 73 || i == 76 - || i == 77 || i == 80 || i == 83 - || i == 84 || i == 90 - ? 1 : 0)); + ASSERT (p[i] == ((i >= 6 && i <= 7) + || (i >= 11 && i <= 13) + || (i >= 37 && i <= 44) + || i == 46 || (i >= 50 && i <= 52) + || (i >= 54 && i <= 55) + || (i >= 58 && i <= 62) || (i >= 64 && i <= 67) + || i == 70 || i == 73 || i == 76 + || i == 77 || i == 80 || i == 83 + || i == 84 || i == 90 + ? 1 : 0)); } free (p); } @@ -79,16 +67,16 @@ main () for (i = 0; i < 106; i++) { - ASSERT (p[i] == ((i >= 7 && i <= 8) - || (i >= 12 && i <= 14) - || (i >= 40 && i <= 47) - || i == 49 || (i >= 53 && i <= 55) - || (i >= 57 && i <= 58) - || (i >= 61 && i <= 65) || (i >= 67 && i <= 70) - || i == 73 || i == 76 || i == 79 - || i == 80 || i == 83 || i == 86 - || i == 87 || i == 105 - ? 1 : 0)); + ASSERT (p[i] == ((i >= 7 && i <= 8) + || (i >= 12 && i <= 14) + || (i >= 40 && i <= 47) + || i == 49 || (i >= 53 && i <= 55) + || (i >= 57 && i <= 58) + || (i >= 61 && i <= 65) || (i >= 67 && i <= 70) + || i == 73 || i == 76 || i == 79 + || i == 80 || i == 83 || i == 86 + || i == 87 || i == 105 + ? 1 : 0)); } free (p); } diff --git a/tests/uniwbrk/test-ulc-wordbreaks.c b/tests/uniwbrk/test-ulc-wordbreaks.c index 80284ab..732a412 100644 --- a/tests/uniwbrk/test-ulc-wordbreaks.c +++ b/tests/uniwbrk/test-ulc-wordbreaks.c @@ -1,5 +1,5 @@ /* Test of word breaks in strings. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,21 +21,9 @@ #include "uniwbrk.h" #include <locale.h> -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -59,12 +47,12 @@ main () for (i = 0; i < 36; i++) { - ASSERT (p[i] == ((i >= 4 && i <= 5) - || (i >= 9 && i <= 17) - || (i >= 21 && i <= 25) - || (i >= 28 && i <= 32) - || (i >= 34 && i <= 35) - ? 1 : 0)); + ASSERT (p[i] == ((i >= 4 && i <= 5) + || (i >= 9 && i <= 17) + || (i >= 21 && i <= 25) + || (i >= 28 && i <= 32) + || (i >= 34 && i <= 35) + ? 1 : 0)); } free (p); } diff --git a/tests/uniwidth/test-u16-strwidth.c b/tests/uniwidth/test-u16-strwidth.c index 7365426..1d7750c 100644 --- a/tests/uniwidth/test-u16-strwidth.c +++ b/tests/uniwidth/test-u16-strwidth.c @@ -1,5 +1,5 @@ /* Test of u16_strwidth() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,20 +20,7 @@ #include "uniwidth.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -53,8 +40,8 @@ main () { static const uint16_t input[] = /* "Данило Шеган" */ { - 0x0414, 0x0430, 0x043D, 0x0438, 0x043B, 0x043E, ' ', - 0x0428, 0x0435, 0x0433, 0x0430, 0x043D, 0 + 0x0414, 0x0430, 0x043D, 0x0438, 0x043B, 0x043E, ' ', + 0x0428, 0x0435, 0x0433, 0x0430, 0x043D, 0 }; ASSERT (u16_strwidth (input, "UTF-8") == 12); ASSERT (u16_strwidth (input, "EUC-JP") == 23); diff --git a/tests/uniwidth/test-u16-width.c b/tests/uniwidth/test-u16-width.c index b3e2b59..2d10c6c 100644 --- a/tests/uniwidth/test-u16-width.c +++ b/tests/uniwidth/test-u16-width.c @@ -1,5 +1,5 @@ /* Test of u16_width() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,20 +20,7 @@ #include "uniwidth.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uniwidth/test-u32-strwidth.c b/tests/uniwidth/test-u32-strwidth.c index 3976daa..47ae8e9 100644 --- a/tests/uniwidth/test-u32-strwidth.c +++ b/tests/uniwidth/test-u32-strwidth.c @@ -1,5 +1,5 @@ /* Test of u32_strwidth() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,20 +20,7 @@ #include "uniwidth.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () @@ -53,8 +40,8 @@ main () { static const uint32_t input[] = /* "Данило Шеган" */ { - 0x0414, 0x0430, 0x043D, 0x0438, 0x043B, 0x043E, ' ', - 0x0428, 0x0435, 0x0433, 0x0430, 0x043D, 0 + 0x0414, 0x0430, 0x043D, 0x0438, 0x043B, 0x043E, ' ', + 0x0428, 0x0435, 0x0433, 0x0430, 0x043D, 0 }; ASSERT (u32_strwidth (input, "UTF-8") == 12); ASSERT (u32_strwidth (input, "EUC-JP") == 23); diff --git a/tests/uniwidth/test-u32-width.c b/tests/uniwidth/test-u32-width.c index 05fd856..ffb649f 100644 --- a/tests/uniwidth/test-u32-width.c +++ b/tests/uniwidth/test-u32-width.c @@ -1,5 +1,5 @@ /* Test of u32_width() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,20 +20,7 @@ #include "uniwidth.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uniwidth/test-u8-strwidth.c b/tests/uniwidth/test-u8-strwidth.c index 3fbb39e..bb739a5 100644 --- a/tests/uniwidth/test-u8-strwidth.c +++ b/tests/uniwidth/test-u8-strwidth.c @@ -1,5 +1,5 @@ /* Test of u8_strwidth() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,20 +20,7 @@ #include "uniwidth.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uniwidth/test-u8-width.c b/tests/uniwidth/test-u8-width.c index b253289..c100d6f 100644 --- a/tests/uniwidth/test-u8-width.c +++ b/tests/uniwidth/test-u8-width.c @@ -1,5 +1,5 @@ /* Test of u8_width() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,20 +20,7 @@ #include "uniwidth.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uniwidth/test-uc_width.c b/tests/uniwidth/test-uc_width.c index d7335cf..7cfab61 100644 --- a/tests/uniwidth/test-uc_width.c +++ b/tests/uniwidth/test-uc_width.c @@ -1,5 +1,5 @@ /* Test of uc_width() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,20 +20,7 @@ #include "uniwidth.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uniwidth/test-uc_width2.c b/tests/uniwidth/test-uc_width2.c index 2bf143c..3126d4c 100644 --- a/tests/uniwidth/test-uc_width2.c +++ b/tests/uniwidth/test-uc_width2.c @@ -1,5 +1,5 @@ /* Test of uc_width() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,19 +21,8 @@ #include "uniwidth.h" #include <stdio.h> -#include <stdlib.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* One of 0, '0', '1', 'A', '2'. */ static char current_width; @@ -47,10 +36,10 @@ finish_interval (void) if (current_width != 0) { if (current_start == current_end) - printf ("%04X\t\t%c\n", (unsigned) current_start, current_width); + printf ("%04X\t\t%c\n", (unsigned) current_start, current_width); else - printf ("%04X..%04X\t%c\n", (unsigned) current_start, - (unsigned) current_end, current_width); + printf ("%04X..%04X\t%c\n", (unsigned) current_start, + (unsigned) current_end, current_width); current_width = 0; } } @@ -78,18 +67,18 @@ main () int w1 = uc_width (uc, "UTF-8"); int w2 = uc_width (uc, "GBK"); char width = - (w1 == 0 && w2 == 0 ? '0' : - w1 == 1 && w2 == 1 ? '1' : - w1 == 1 && w2 == 2 ? 'A' : - w1 == 2 && w2 == 2 ? '2' : - 0); + (w1 == 0 && w2 == 0 ? '0' : + w1 == 1 && w2 == 1 ? '1' : + w1 == 1 && w2 == 2 ? 'A' : + w1 == 2 && w2 == 2 ? '2' : + 0); if (width == 0) - { - /* uc must be a control character. */ - ASSERT (w1 < 0 && w2 < 0); - } + { + /* uc must be a control character. */ + ASSERT (w1 < 0 && w2 < 0); + } else - add_to_interval (uc, width); + add_to_interval (uc, width); } finish_interval (); diff --git a/tests/unsetenv.c b/tests/unsetenv.c index 73ea878..65a19cc 100644 --- a/tests/unsetenv.c +++ b/tests/unsetenv.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992,1995-1999,2000-2002,2005-2008 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1995-2002, 2005-2010 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -16,6 +16,10 @@ #include <config.h> +/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc + optimizes away the name == NULL test below. */ +#define _GL_ARG_NONNULL(params) + /* Specification. */ #include <stdlib.h> @@ -28,15 +32,15 @@ #include <unistd.h> #if !_LIBC -# define __environ environ +# define __environ environ #endif #if _LIBC /* This lock protects against simultaneous modifications of `environ'. */ # include <bits/libc-lock.h> __libc_lock_define_initialized (static, envlock) -# define LOCK __libc_lock_lock (envlock) -# define UNLOCK __libc_lock_unlock (envlock) +# define LOCK __libc_lock_lock (envlock) +# define UNLOCK __libc_lock_unlock (envlock) #else # define LOCK # define UNLOCK @@ -47,6 +51,7 @@ __libc_lock_define_initialized (static, envlock) # define unsetenv __unsetenv #endif +#if _LIBC || !HAVE_UNSETENV int unsetenv (const char *name) @@ -68,13 +73,13 @@ unsetenv (const char *name) while (*ep != NULL) if (!strncmp (*ep, name, len) && (*ep)[len] == '=') { - /* Found it. Remove this pointer by moving later ones back. */ - char **dp = ep; + /* Found it. Remove this pointer by moving later ones back. */ + char **dp = ep; - do - dp[0] = dp[1]; - while (*dp++); - /* Continue the loop in case NAME appears again. */ + do + dp[0] = dp[1]; + while (*dp++); + /* Continue the loop in case NAME appears again. */ } else ++ep; @@ -88,3 +93,28 @@ unsetenv (const char *name) # undef unsetenv weak_alias (__unsetenv, unsetenv) #endif + +#else /* HAVE_UNSETENV */ + +# undef unsetenv + +/* Call the underlying unsetenv, in case there is hidden bookkeeping + that needs updating beyond just modifying environ. */ +int +rpl_unsetenv (const char *name) +{ + int result = 0; + if (!name || !*name || strchr (name, '=')) + { + errno = EINVAL; + return -1; + } + while (getenv (name)) +# if !VOID_UNSETENV + result = +# endif + unsetenv (name); + return result; +} + +#endif /* HAVE_UNSETENV */ diff --git a/tests/wctob.c b/tests/wctob.c index 4fa71b0..1d1cc7b 100644 --- a/tests/wctob.c +++ b/tests/wctob.c @@ -1,5 +1,5 @@ /* Convert wide character to unibyte character. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2008. This program is free software: you can redistribute it and/or modify diff --git a/tests/xalloc-die.c b/tests/xalloc-die.c index 0a0694f..4b22040 100644 --- a/tests/xalloc-die.c +++ b/tests/xalloc-die.c @@ -1,7 +1,7 @@ /* Report a memory allocation failure and exit. - Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2006 Free - Software Foundation, Inc. + Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2006, 2009, 2010 + Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/xalloc.h b/tests/xalloc.h index 57a13e0..6122cc5 100644 --- a/tests/xalloc.h +++ b/tests/xalloc.h @@ -1,7 +1,8 @@ /* xalloc.h -- malloc with out-of-memory checking - Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2003, 2004, 2006, 2007, 2008 Free Software Foundation, Inc. + Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, + 2000, 2003, 2004, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -105,10 +106,10 @@ char *xstrdup (char const *str) ATTRIBUTE_MALLOC; # if HAVE_INLINE # define static_inline static inline # else - void *xnmalloc (size_t n, size_t s) ATTRIBUTE_MALLOC; - void *xnrealloc (void *p, size_t n, size_t s); - void *x2nrealloc (void *p, size_t *pn, size_t s); - char *xcharalloc (size_t n) ATTRIBUTE_MALLOC; +void *xnmalloc (size_t n, size_t s) ATTRIBUTE_MALLOC; +void *xnrealloc (void *p, size_t n, size_t s); +void *x2nrealloc (void *p, size_t *pn, size_t s); +char *xcharalloc (size_t n) ATTRIBUTE_MALLOC; # endif # ifdef static_inline @@ -161,9 +162,9 @@ xnrealloc (void *p, size_t n, size_t s) void append_int (int value) { - if (used == allocated) - p = x2nrealloc (p, &allocated, sizeof *p); - p[used++] = value; + if (used == allocated) + p = x2nrealloc (p, &allocated, sizeof *p); + p[used++] = value; } This causes x2nrealloc to allocate a block of some nonzero size the @@ -181,12 +182,12 @@ xnrealloc (void *p, size_t n, size_t s) void append_int (int value) { - if (used == allocated) - { - p = x2nrealloc (p, &allocated1, sizeof *p); - allocated = allocated1; - } - p[used++] = value; + if (used == allocated) + { + p = x2nrealloc (p, &allocated1, sizeof *p); + allocated = allocated1; + } + p[used++] = value; } */ @@ -199,25 +200,25 @@ x2nrealloc (void *p, size_t *pn, size_t s) if (! p) { if (! n) - { - /* The approximate size to use for initial small allocation - requests, when the invoking code specifies an old size of - zero. 64 bytes is the largest "small" request for the - GNU C library malloc. */ - enum { DEFAULT_MXFAST = 64 }; - - n = DEFAULT_MXFAST / s; - n += !n; - } + { + /* The approximate size to use for initial small allocation + requests, when the invoking code specifies an old size of + zero. 64 bytes is the largest "small" request for the + GNU C library malloc. */ + enum { DEFAULT_MXFAST = 64 }; + + n = DEFAULT_MXFAST / s; + n += !n; + } } else { /* Set N = ceil (1.5 * N) so that progress is made if N == 1. - Check for overflow, so that N * S stays in size_t range. - The check is slightly conservative, but an exact check isn't - worth the trouble. */ + Check for overflow, so that N * S stays in size_t range. + The check is slightly conservative, but an exact check isn't + worth the trouble. */ if ((size_t) -1 / 3 * 2 / s <= n) - xalloc_die (); + xalloc_die (); n += (n + 1) / 2; } diff --git a/tests/xmalloc.c b/tests/xmalloc.c index 585fb4b..ecce529 100644 --- a/tests/xmalloc.c +++ b/tests/xmalloc.c @@ -1,8 +1,8 @@ /* xmalloc.c -- malloc with out of memory checking - Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2008-2009 Free Software Foundation, - Inc. + Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, + 2000, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/zerosize-ptr.h b/tests/zerosize-ptr.h index a38a2cf..cfab200 100644 --- a/tests/zerosize-ptr.h +++ b/tests/zerosize-ptr.h @@ -1,5 +1,5 @@ /* Return a pointer to a zero-size object in memory. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -57,11 +57,11 @@ zerosize_ptr (void) { int pagesize = getpagesize (); char *two_pages = - (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, - flags, fd, 0); + (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, + flags, fd, 0); if (two_pages != (char *)(-1) - && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0) - return two_pages + pagesize; + && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0) + return two_pages + pagesize; } #endif return NULL; |