2009-02-08 Bruno Haible <bruno@clisp.org>
+ Tests for module 'unicase/toupper'.
+ * modules/unicase/toupper-tests: New file.
+ * tests/unicase/test-mapping-part1.h: New file.
+ * tests/unicase/test-mapping-part2.h: New file.
+
New module 'unicase/totitle'.
* modules/unicase/totitle: New file.
* lib/unicase/totitle.c: New file.
--- /dev/null
+Files:
+tests/unicase/test-uc_toupper.c
+tests/unicase/test-mapping-part1.h
+tests/unicase/test-mapping-part2.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-uc_toupper
+check_PROGRAMS += test-uc_toupper
+test_uc_toupper_SOURCES = unicase/test-uc_toupper.c
+
--- /dev/null
+/* Test of single character case mapping functions.
+ 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/>. */
+
+#include <config.h>
+
+#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]))
+
+/* Pair of Unicode characters. */
+typedef struct { ucs4_t ch; ucs4_t value; } pair_t;
+
+/* Characters and their mapping values, ignoring no-op mappings, in increasing
+ order. */
+static const pair_t mapping[] =
+ {
--- /dev/null
+/* Test of single character case mapping functions.
+ 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/>. */
+
+ };
+
+int
+main ()
+{
+ unsigned int c;
+ size_t i;
+
+ c = 0;
+ for (i = 0; i < SIZEOF (mapping); i++)
+ {
+ for (; c < mapping[i].ch; c++)
+ ASSERT (MAP (c) == c);
+ ASSERT (MAP (c) == mapping[i].value);
+ c++;
+ }
+ for (; c < 0x110000; c++)
+ ASSERT (MAP (c) == c);
+
+ return 0;
+}