diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2002-10-18 18:18:49 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2002-10-18 18:18:49 +0000 |
commit | 94c5b430a1a635ffcbc99962de04df537dd62802 (patch) | |
tree | 93f1bf6797446b6ae73f45a2ca276c85ab46dfc9 | |
parent | 5d8c2b592de4ecd8c870d1112ae3ecc9a456c8bc (diff) | |
download | newlib-94c5b430a1a635ffcbc99962de04df537dd62802.zip newlib-94c5b430a1a635ffcbc99962de04df537dd62802.tar.gz newlib-94c5b430a1a635ffcbc99962de04df537dd62802.tar.bz2 |
2002-10-18 Jeff Johnston <jjohnstn@redhat.com>
* testsuite/include/check.h: New header file to use with
test cases.
* testsuite/lib/newlib.exp: Add testsuite/include directory
to list of header files to use.
* testsuite/newlib.wctype/twctype.c: New test case for iswctype fns.
* testsuite/newlib.wctype/wctype.exp: New file.
-rw-r--r-- | newlib/ChangeLog | 9 | ||||
-rw-r--r-- | newlib/testsuite/include/check.h | 7 | ||||
-rw-r--r-- | newlib/testsuite/lib/newlib.exp | 3 | ||||
-rw-r--r-- | newlib/testsuite/newlib.wctype/twctype.c | 64 | ||||
-rw-r--r-- | newlib/testsuite/newlib.wctype/wctype.exp | 12 |
5 files changed, 95 insertions, 0 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 0f17fc9..f717546 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,12 @@ +2002-10-18 Jeff Johnston <jjohnstn@redhat.com> + + * testsuite/include/check.h: New header file to use with + test cases. + * testsuite/lib/newlib.exp: Add testsuite/include directory + to list of header files to use. + * testsuite/newlib.wctype/twctype.c: New test case for iswctype fns. + * testsuite/newlib.wctype/wctype.exp: New file. + 2002-10-11 Graham Stott <graham.stott@btinternet.com> Richard Sandiford <rsandifo@redhat.com> diff --git a/newlib/testsuite/include/check.h b/newlib/testsuite/include/check.h new file mode 100644 index 0000000..df7f0cf --- /dev/null +++ b/newlib/testsuite/include/check.h @@ -0,0 +1,7 @@ +#define CHECK(a) { \ + if (!(a)) \ + { \ + printf ("Failed " #a " in <%s> at line %d\n", __FILE__, __LINE__); \ + abort(); \ + } \ +} diff --git a/newlib/testsuite/lib/newlib.exp b/newlib/testsuite/lib/newlib.exp index 48f527e..c53a8a8 100644 --- a/newlib/testsuite/lib/newlib.exp +++ b/newlib/testsuite/lib/newlib.exp @@ -58,6 +58,9 @@ proc newlib_target_compile { source dest type options } { global host_triplet target_triplet verbose "In newlib_target_compile...\n" + + lappend options "libs=-I$srcdir/include" + verbose "srcdir is $srcdir" if {[target_info needs_status_wrapper] != "" && \ [target_info needs_status_wrapper] != "0" && \ diff --git a/newlib/testsuite/newlib.wctype/twctype.c b/newlib/testsuite/newlib.wctype/twctype.c new file mode 100644 index 0000000..7adf508 --- /dev/null +++ b/newlib/testsuite/newlib.wctype/twctype.c @@ -0,0 +1,64 @@ +#include <wctype.h> +#include <ctype.h> +#include <stdio.h> +#include <string.h> +#include <newlib.h> +#include <locale.h> +#include "check.h" + +int main() +{ + if (_ELIX_LEVEL == 1) + { /* no testing..wctype functions aren't present */ } + else if (_MB_LEN_MAX == 1) + { + CHECK (iswalpha(L'a')); + CHECK (!iswalpha(L'3')); + CHECK (iswalnum(L'9')); + CHECK (!iswalnum(L'$')); + CHECK (iswcntrl(L'\n')); + CHECK (!iswcntrl(L'#')); + CHECK (iswdigit(L'2')); + CHECK (!iswdigit(L'a')); + CHECK (iswgraph(L'2')); + CHECK (!iswgraph(L' ')); + CHECK (iswlower(L'g')); + CHECK (!iswlower(L'G')); + CHECK (iswprint(L'*')); + CHECK (!iswprint(L'\n')); + CHECK (iswpunct(L',')); + CHECK (!iswpunct(L'\n')); + CHECK (iswspace(L'\t')); + CHECK (!iswspace(L':')); + CHECK (iswupper(L'G')); + CHECK (!iswupper(L'g')); + CHECK (iswxdigit(L'A')); + CHECK (!iswxdigit(L'g')); + } + else + { + setlocale (LC_CTYPE, "C-UTF-8"); + CHECK (iswalpha(0x0967)); + CHECK (!iswalpha(0x128e)); + CHECK (iswalnum(0x1d7ce)); + CHECK (!iswalnum(0x1d800)); + CHECK (iswcntrl(0x007f)); + CHECK (!iswcntrl(0x2027)); + CHECK (iswdigit(L'2')); + CHECK (!iswdigit(0x0009)); + CHECK (iswlower(0x03b3)); + CHECK (!iswlower(0x04aa)); + CHECK (iswprint(0x0b13)); + CHECK (!iswprint(0x0ce2)); + CHECK (iswpunct(0x002d)); + CHECK (!iswpunct(0x0a84)); + CHECK (iswspace(0x000a)); + CHECK (!iswspace(0x2060)); + CHECK (iswupper(0x01a4)); + CHECK (!iswupper(0x1e6d)); + CHECK (iswxdigit(L'A')); + CHECK (!iswxdigit(0x1f48)); + } + + exit (0); +} diff --git a/newlib/testsuite/newlib.wctype/wctype.exp b/newlib/testsuite/newlib.wctype/wctype.exp new file mode 100644 index 0000000..cd5d7d6 --- /dev/null +++ b/newlib/testsuite/newlib.wctype/wctype.exp @@ -0,0 +1,12 @@ +# Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved. +# +# Permission to use, copy, modify, and distribute this software +# is freely granted, provided that this notice is preserved. +# + +load_lib passfail.exp + +set exclude_list { +} + +newlib_pass_fail_all -x $exclude_list |