Sources for character class and mapping tests.
authordrepper <drepper>
Thu, 9 Dec 1999 07:51:17 +0000 (07:51 +0000)
committerdrepper <drepper>
Thu, 9 Dec 1999 07:51:17 +0000 (07:51 +0000)
localedata/tests/test6.c [new file with mode: 0644]
localedata/tests/test6.cm [new file with mode: 0644]
localedata/tests/test6.def [new file with mode: 0644]
localedata/tests/test6.mne [new file with mode: 0644]

diff --git a/localedata/tests/test6.c b/localedata/tests/test6.c
new file mode 100644 (file)
index 0000000..735b1ad
--- /dev/null
@@ -0,0 +1,138 @@
+/* Test program for character classes and mappings.
+   Copyright (C) 1999 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <ctype.h>
+#include <locale.h>
+#include <wchar.h>
+
+
+int
+main (void)
+{
+  const char lower[] = "abcdefghijklmnopqrstuvwxyz";
+  const char upper[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+#define LEN (sizeof (upper) - 1)
+  const wchar_t wlower[] = L"abcdefghijklmnopqrstuvwxyz";
+  const wchar_t wupper[] = L"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+  int i;
+  int result = 0;
+
+  setlocale (LC_ALL, "test6");
+
+  for (i = 0; i < LEN; ++i)
+    {
+      /* Test basic table handling (basic == not more than 256 characters).
+        The charmaps swaps the normal lower-upper case meaning of the
+        ASCII characters used in the source code while the Unicode mapping
+        in the repertoire map has the normal correspondants.  This test
+        shows the independence of the tables for `char' and `wchar_t'
+        characters.  */
+
+      if (islower (lower[i]))
+       {
+         printf ("islower ('%c') false\n", lower[i]);
+         result = 1;
+       }
+      if (! isupper (lower[i]))
+       {
+         printf ("isupper ('%c') false\n", lower[i]);
+         result = 1;
+       }
+
+      if (! islower (upper[i]))
+       {
+         printf ("islower ('%c') false\n", upper[i]);
+         result = 1;
+       }
+      if (isupper (upper[i]))
+       {
+         printf ("isupper ('%c') false\n", upper[i]);
+         result = 1;
+       }
+
+      if (toupper (lower[i]) != lower[i])
+       {
+         printf ("toupper ('%c') false\n", lower[i]);
+         result = 1;
+       }
+      if (tolower (lower[i]) != upper[i])
+       {
+         printf ("tolower ('%c') false\n", lower[i]);
+         result = 1;
+       }
+
+      if (tolower (upper[i]) != upper[i])
+       {
+         printf ("tolower ('%c') false\n", upper[i]);
+         result = 1;
+       }
+      if (toupper (upper[i]) != lower[i])
+       {
+         printf ("toupper ('%c') false\n", upper[i]);
+         result = 1;
+       }
+
+      if (iswlower (wupper[i]))
+       {
+         printf ("iswlower (L'%c') false\n", upper[i]);
+         result = 1;
+       }
+      if (! iswupper (wupper[i]))
+       {
+         printf ("iswupper (L'%c') false\n", upper[i]);
+         result = 1;
+       }
+
+      if (iswupper (wlower[i]))
+       {
+         printf ("iswupper (L'%c') false\n", lower[i]);
+         result = 1;
+       }
+      if (! iswlower (wlower[i]))
+       {
+         printf ("iswlower (L'%c') false\n", lower[i]);
+         result = 1;
+       }
+
+      if (towupper (wlower[i]) != wupper[i])
+       {
+         printf ("towupper ('%c') false\n", lower[i]);
+         result = 1;
+       }
+      if (towlower (wlower[i]) != wlower[i])
+       {
+         printf ("towlower ('%c') false\n", lower[i]);
+         result = 1;
+       }
+
+      if (towlower (wupper[i]) != wlower[i])
+       {
+         printf ("towlower ('%c') false\n", upper[i]);
+         result = 1;
+       }
+      if (towupper (wupper[i]) != wupper[i])
+       {
+         printf ("towupper ('%c') false\n", upper[i]);
+         result = 1;
+       }
+    }
+
+  return result;
+}
diff --git a/localedata/tests/test6.cm b/localedata/tests/test6.cm
new file mode 100644 (file)
index 0000000..3711495
--- /dev/null
@@ -0,0 +1,93 @@
+<code_set_name> test6
+
+CHARMAP
+<tab>                  \x09
+<newline>              \x0A
+<vertical-tab>         \x0B
+<form-feed>            \x0C
+<carriage-return>      \x0D
+<SP>                   \x20
+<space>                \x20
+<!>                    \x21
+<">                    \x22
+<%>                    \x25
+<&>                    \x26
+<'>                    \x27
+<(>                    \x28
+<)>                    \x29
+<*>                    \x2A
+<+>                    \x2B
+<,>                    \x2C
+<->                    \x2D
+<.>                    \x2E
+<\\>                   \x2F
+<0>                    \x30
+<1>                    \x31
+<2>                    \x32
+<3>                    \x33
+<4>                    \x34
+<5>                    \x35
+<6>                    \x36
+<7>                    \x37
+<8>                    \x38
+<9>                    \x39
+<:>                    \x3A
+<;>                    \x3B
+<<>                    \x3C
+<=>                    \x3D
+<\>>                   \x3E
+<?>                    \x3F
+<a>                    \x41
+<b>                    \x42
+<c>                    \x43
+<d>                    \x44
+<e>                    \x45
+<f>                    \x46
+<g>                    \x47
+<h>                    \x48
+<i>                    \x49
+<j>                    \x4A
+<k>                    \x4B
+<l>                    \x4C
+<m>                    \x4D
+<n>                    \x4E
+<o>                    \x4F
+<p>                    \x50
+<q>                    \x51
+<r>                    \x52
+<s>                    \x53
+<t>                    \x54
+<u>                    \x55
+<v>                    \x56
+<w>                    \x57
+<x>                    \x58
+<y>                    \x59
+<z>                    \x5A
+<_>                    \x5F
+<A>                    \x61
+<B>                    \x62
+<C>                    \x63
+<D>                    \x64
+<E>                    \x65
+<F>                    \x66
+<G>                    \x67
+<H>                    \x68
+<I>                    \x69
+<J>                    \x6A
+<K>                    \x6B
+<L>                    \x6C
+<M>                    \x6D
+<N>                    \x6E
+<O>                    \x6F
+<P>                    \x70
+<Q>                    \x71
+<R>                    \x72
+<S>                    \x73
+<T>                    \x74
+<U>                    \x75
+<V>                    \x76
+<W>                    \x77
+<X>                    \x78
+<Y>                    \x79
+<Z>                    \x7A
+END CHARMAP
diff --git a/localedata/tests/test6.def b/localedata/tests/test6.def
new file mode 100644 (file)
index 0000000..f8f88b3
--- /dev/null
@@ -0,0 +1,20 @@
+LC_CTYPE
+
+lower <a>;<b>;<c>;<d>;<e>;<f>;<g>;<h>;<i>;<j>;<k>;<l>;<m>;<n>;<o>;<p>;<q>; \
+      <r>;<s>;<t>;<u>;<v>;<w>;<x>;<y>;<z>
+upper <A>;<B>;<C>;<D>;<E>;<F>;<G>;<H>;<I>;<J>;<K>;<L>;<M>;<N>;<O>;<P>;<Q>; \
+      <R>;<S>;<T>;<U>;<V>;<W>;<X>;<Y>;<Z>
+
+tolower (<A>,<a>);(<B>,<b>);(<C>,<c>);(<D>,<d>);(<E>,<e>);(<F>,<f>); \
+        (<G>,<g>);(<H>,<h>);(<I>,<i>);(<J>,<j>);(<K>,<k>);(<L>,<l>); \
+        (<M>,<m>);(<N>,<n>);(<O>,<o>);(<P>,<p>);(<Q>,<q>);(<R>,<r>); \
+        (<S>,<s>);(<T>,<t>);(<U>,<u>);(<V>,<v>);(<W>,<w>);(<X>,<x>); \
+        (<Y>,<y>);(<Z>,<z>)
+
+toupper (<a>,<A>);(<b>,<B>);(<c>,<C>);(<d>,<D>);(<e>,<E>);(<f>,<F>); \
+        (<g>,<G>);(<h>,<H>);(<i>,<I>);(<j>,<J>);(<k>,<K>);(<l>,<L>); \
+        (<m>,<M>);(<n>,<N>);(<o>,<O>);(<p>,<P>);(<q>,<Q>);(<r>,<R>); \
+        (<s>,<S>);(<t>,<T>);(<u>,<U>);(<v>,<V>);(<w>,<W>);(<x>,<X>); \
+        (<y>,<Y>);(<z>,<Z>)
+
+END LC_CTYPE
diff --git a/localedata/tests/test6.mne b/localedata/tests/test6.mne
new file mode 100644 (file)
index 0000000..bb12185
--- /dev/null
@@ -0,0 +1,113 @@
+<tab>                  <U0009> HORIZONTAL TABULATION
+<newline>              <U000A> LINE FEED
+<vertical-tab>         <U000B> VERTICAL TABULATION
+<form-feed>            <U000C> FORM FEED
+<carriage-return>      <U000D> CARRIAGE RETURN
+<SP>                   <U0020> SPACE
+<space>                <U0020> SPACE
+<!>                    <U0021> EXCLAMATION MARK
+<">                    <U0022> QUOTATION MARK
+<Nb>                   <U0023> NUMBER SIGN
+<DO>                   <U0024> DOLLAR SIGN
+<!S>                   <U0024> DOLLAR SIGN
+<%>                    <U0025> PERCENT SIGN
+<&>                    <U0026> AMPERSAND
+<'>                    <U0027> APOSTROPHE
+<(>                    <U0028> LEFT PARENTHESIS
+<)>                    <U0029> RIGHT PARENTHESIS
+<*>                    <U002A> ASTERISK
+<+>                    <U002B> PLUS SIGN
+<,>                    <U002C> COMMA
+<->                    <U002D> HYPHEN-MINUS
+<.>                    <U002E> FULL STOP
+</>                    <U002F> SOLIDUS
+<0>                    <U0030> DIGIT ZERO
+<1>                    <U0031> DIGIT ONE
+<2>                    <U0032> DIGIT TWO
+<3>                    <U0033> DIGIT THREE
+<4>                    <U0034> DIGIT FOUR
+<5>                    <U0035> DIGIT FIVE
+<6>                    <U0036> DIGIT SIX
+<7>                    <U0037> DIGIT SEVEN
+<8>                    <U0038> DIGIT EIGHT
+<9>                    <U0039> DIGIT NINE
+<:>                    <U003A> COLON
+<;>                    <U003B> SEMICOLON
+<<>                    <U003C> LESS-THAN SIGN
+<=>                    <U003D> EQUALS SIGN
+<\>>                   <U003E> GREATER-THAN SIGN
+<?>                    <U003F> QUESTION MARK
+<@>                    <U0040> COMMERCIAL AT
+<A>                    <U0041> LATIN CAPITAL LETTER A
+<B>                    <U0042> LATIN CAPITAL LETTER B
+<C>                    <U0043> LATIN CAPITAL LETTER C
+<D>                    <U0044> LATIN CAPITAL LETTER D
+<E>                    <U0045> LATIN CAPITAL LETTER E
+<F>                    <U0046> LATIN CAPITAL LETTER F
+<G>                    <U0047> LATIN CAPITAL LETTER G
+<H>                    <U0048> LATIN CAPITAL LETTER H
+<I>                    <U0049> LATIN CAPITAL LETTER I
+<J>                    <U004A> LATIN CAPITAL LETTER J
+<K>                    <U004B> LATIN CAPITAL LETTER K
+<L>                    <U004C> LATIN CAPITAL LETTER L
+<M>                    <U004D> LATIN CAPITAL LETTER M
+<N>                    <U004E> LATIN CAPITAL LETTER N
+<O>                    <U004F> LATIN CAPITAL LETTER O
+<P>                    <U0050> LATIN CAPITAL LETTER P
+<Q>                    <U0051> LATIN CAPITAL LETTER Q
+<R>                    <U0052> LATIN CAPITAL LETTER R
+<S>                    <U0053> LATIN CAPITAL LETTER S
+<T>                    <U0054> LATIN CAPITAL LETTER T
+<U>                    <U0055> LATIN CAPITAL LETTER U
+<V>                    <U0056> LATIN CAPITAL LETTER V
+<W>                    <U0057> LATIN CAPITAL LETTER W
+<X>                    <U0058> LATIN CAPITAL LETTER X
+<Y>                    <U0059> LATIN CAPITAL LETTER Y
+<Z>                    <U005A> LATIN CAPITAL LETTER Z
+<<(>                   <U005B> LEFT SQUARE BRACKET
+<left-square-bracket>  <U005B> LEFT SQUARE BRACKET
+<//>                 <U005C> REVERSE SOLIDUS
+<backslash>            <U005C> REVERSE SOLIDUS
+<reverse-solidus>      <U005C> REVERSE SOLIDUS
+<)\>>                  <U005D> RIGHT SQUARE BRACKET
+<right-square-bracket> <U005D> RIGHT SQUARE BRACKET
+<'\>>                  <U005E> CIRCUMFLEX ACCENT
+<circumflex>           <U005E> CIRCUMFLEX ACCENT
+<circumflex-accent>    <U005E> CIRCUMFLEX ACCENT
+<_>                    <U005F> LOW LINE
+<low-line>             <U005F> LOW LINE
+<underscore>           <U005F> LOW LINE
+<'!>                   <U0060> GRAVE ACCENT
+<grave-accent>         <U0060> GRAVE ACCENT
+<a>                    <U0061> LATIN SMALL LETTER A
+<b>                    <U0062> LATIN SMALL LETTER B
+<c>                    <U0063> LATIN SMALL LETTER C
+<d>                    <U0064> LATIN SMALL LETTER D
+<e>                    <U0065> LATIN SMALL LETTER E
+<f>                    <U0066> LATIN SMALL LETTER F
+<g>                    <U0067> LATIN SMALL LETTER G
+<h>                    <U0068> LATIN SMALL LETTER H
+<i>                    <U0069> LATIN SMALL LETTER I
+<j>                    <U006A> LATIN SMALL LETTER J
+<k>                    <U006B> LATIN SMALL LETTER K
+<l>                    <U006C> LATIN SMALL LETTER L
+<m>                    <U006D> LATIN SMALL LETTER M
+<n>                    <U006E> LATIN SMALL LETTER N
+<o>                    <U006F> LATIN SMALL LETTER O
+<p>                    <U0070> LATIN SMALL LETTER P
+<q>                    <U0071> LATIN SMALL LETTER Q
+<r>                    <U0072> LATIN SMALL LETTER R
+<s>                    <U0073> LATIN SMALL LETTER S
+<t>                    <U0074> LATIN SMALL LETTER T
+<u>                    <U0075> LATIN SMALL LETTER U
+<v>                    <U0076> LATIN SMALL LETTER V
+<w>                    <U0077> LATIN SMALL LETTER W
+<x>                    <U0078> LATIN SMALL LETTER X
+<y>                    <U0079> LATIN SMALL LETTER Y
+<z>                    <U007A> LATIN SMALL LETTER Z
+<(!>                   <U007B> LEFT CURLY BRACKET
+<!!>                   <U007C> VERTICAL LINE
+<vertical-line>        <U007C> VERTICAL LINE
+<!)>                   <U007D> RIGHT CURLY BRACKET
+<'?>                   <U007E> TILDE
+<DT>                   <U007F> DELETE