From 96e29f203b96004078856ff27345d5e6ee693be8 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 1 Jul 2009 01:10:07 +0200 Subject: [PATCH] Tests for module 'unicase/cased'. --- ChangeLog | 8 +++ modules/unicase/cased-tests | 14 ++++ tests/unicase/test-cased.c | 135 +++++++++++++++++++++++++++++++++++ tests/unicase/test-predicate-part1.h | 45 ++++++++++++ tests/unicase/test-predicate-part2.h | 37 ++++++++++ 5 files changed, 239 insertions(+) create mode 100644 modules/unicase/cased-tests create mode 100644 tests/unicase/test-cased.c create mode 100644 tests/unicase/test-predicate-part1.h create mode 100644 tests/unicase/test-predicate-part2.h diff --git a/ChangeLog b/ChangeLog index 108e19b73..e1b28079b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2009-06-30 Bruno Haible + Tests for module 'unicase/cased'. + * modules/unicase/cased-tests: New file. + * tests/unicase/test-cased.c: New file, generated by gen-uni-tables. + * tests/unicase/test-predicate-part1.h: New file, derived from + tests/unictype/test-predicate-part1.h. + * tests/unicase/test-predicate-part2.h: New file, same as + tests/unictype/test-predicate-part2.h. + Fix evaluation of "Before C" condition of FINAL_SIGMA. * lib/gen-uni-tables.c (is_cased, is_case_ignorable): New functions. (output_casing_properties): New function. diff --git a/modules/unicase/cased-tests b/modules/unicase/cased-tests new file mode 100644 index 000000000..018a2254c --- /dev/null +++ b/modules/unicase/cased-tests @@ -0,0 +1,14 @@ +Files: +tests/unicase/test-cased.c +tests/unicase/test-predicate-part1.h +tests/unicase/test-predicate-part2.h + +Depends-on: + +configure.ac: + +Makefile.am: +TESTS += test-cased +check_PROGRAMS += test-cased +test_cased_SOURCES = unicase/test-cased.c + diff --git a/tests/unicase/test-cased.c b/tests/unicase/test-cased.c new file mode 100644 index 000000000..37af3d225 --- /dev/null +++ b/tests/unicase/test-cased.c @@ -0,0 +1,135 @@ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* Test the Unicode character type functions. + Copyright (C) 2007 Free Software Foundation, Inc. + + This 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 . */ + +#include "test-predicate-part1.h" + + { 0x0041, 0x005A }, + { 0x0061, 0x007A }, + { 0x00AA, 0x00AA }, + { 0x00B5, 0x00B5 }, + { 0x00BA, 0x00BA }, + { 0x00C0, 0x00D6 }, + { 0x00D8, 0x00F6 }, + { 0x00F8, 0x01BA }, + { 0x01BC, 0x01BF }, + { 0x01C4, 0x0293 }, + { 0x0295, 0x02B8 }, + { 0x02C0, 0x02C1 }, + { 0x02E0, 0x02E4 }, + { 0x0345, 0x0345 }, + { 0x0370, 0x0373 }, + { 0x0376, 0x0377 }, + { 0x037A, 0x037D }, + { 0x0386, 0x0386 }, + { 0x0388, 0x038A }, + { 0x038C, 0x038C }, + { 0x038E, 0x03A1 }, + { 0x03A3, 0x03F5 }, + { 0x03F7, 0x0481 }, + { 0x048A, 0x0523 }, + { 0x0531, 0x0556 }, + { 0x0561, 0x0587 }, + { 0x10A0, 0x10C5 }, + { 0x1D00, 0x1DBF }, + { 0x1E00, 0x1F15 }, + { 0x1F18, 0x1F1D }, + { 0x1F20, 0x1F45 }, + { 0x1F48, 0x1F4D }, + { 0x1F50, 0x1F57 }, + { 0x1F59, 0x1F59 }, + { 0x1F5B, 0x1F5B }, + { 0x1F5D, 0x1F5D }, + { 0x1F5F, 0x1F7D }, + { 0x1F80, 0x1FB4 }, + { 0x1FB6, 0x1FBC }, + { 0x1FBE, 0x1FBE }, + { 0x1FC2, 0x1FC4 }, + { 0x1FC6, 0x1FCC }, + { 0x1FD0, 0x1FD3 }, + { 0x1FD6, 0x1FDB }, + { 0x1FE0, 0x1FEC }, + { 0x1FF2, 0x1FF4 }, + { 0x1FF6, 0x1FFC }, + { 0x2071, 0x2071 }, + { 0x207F, 0x207F }, + { 0x2090, 0x2094 }, + { 0x2102, 0x2102 }, + { 0x2107, 0x2107 }, + { 0x210A, 0x2113 }, + { 0x2115, 0x2115 }, + { 0x2119, 0x211D }, + { 0x2124, 0x2124 }, + { 0x2126, 0x2126 }, + { 0x2128, 0x2128 }, + { 0x212A, 0x212D }, + { 0x212F, 0x2134 }, + { 0x2139, 0x2139 }, + { 0x213C, 0x213F }, + { 0x2145, 0x2149 }, + { 0x214E, 0x214E }, + { 0x2160, 0x217F }, + { 0x2183, 0x2184 }, + { 0x24B6, 0x24E9 }, + { 0x2C00, 0x2C2E }, + { 0x2C30, 0x2C5E }, + { 0x2C60, 0x2C6F }, + { 0x2C71, 0x2C7D }, + { 0x2C80, 0x2CE4 }, + { 0x2D00, 0x2D25 }, + { 0xA640, 0xA65F }, + { 0xA662, 0xA66D }, + { 0xA680, 0xA697 }, + { 0xA722, 0xA787 }, + { 0xA78B, 0xA78C }, + { 0xFB00, 0xFB06 }, + { 0xFB13, 0xFB17 }, + { 0xFF21, 0xFF3A }, + { 0xFF41, 0xFF5A }, + { 0x10400, 0x1044F }, + { 0x1D400, 0x1D454 }, + { 0x1D456, 0x1D49C }, + { 0x1D49E, 0x1D49F }, + { 0x1D4A2, 0x1D4A2 }, + { 0x1D4A5, 0x1D4A6 }, + { 0x1D4A9, 0x1D4AC }, + { 0x1D4AE, 0x1D4B9 }, + { 0x1D4BB, 0x1D4BB }, + { 0x1D4BD, 0x1D4C3 }, + { 0x1D4C5, 0x1D505 }, + { 0x1D507, 0x1D50A }, + { 0x1D50D, 0x1D514 }, + { 0x1D516, 0x1D51C }, + { 0x1D51E, 0x1D539 }, + { 0x1D53B, 0x1D53E }, + { 0x1D540, 0x1D544 }, + { 0x1D546, 0x1D546 }, + { 0x1D54A, 0x1D550 }, + { 0x1D552, 0x1D6A5 }, + { 0x1D6A8, 0x1D6C0 }, + { 0x1D6C2, 0x1D6DA }, + { 0x1D6DC, 0x1D6FA }, + { 0x1D6FC, 0x1D714 }, + { 0x1D716, 0x1D734 }, + { 0x1D736, 0x1D74E }, + { 0x1D750, 0x1D76E }, + { 0x1D770, 0x1D788 }, + { 0x1D78A, 0x1D7A8 }, + { 0x1D7AA, 0x1D7C2 }, + { 0x1D7C4, 0x1D7CB } + +#define PREDICATE(c) uc_is_cased (c) +#include "test-predicate-part2.h" diff --git a/tests/unicase/test-predicate-part1.h b/tests/unicase/test-predicate-part1.h new file mode 100644 index 000000000..76d804e18 --- /dev/null +++ b/tests/unicase/test-predicate-part1.h @@ -0,0 +1,45 @@ +/* Test the Unicode character type 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 . */ + +#include + +#include "unicase/caseprop.h" + +#include +#include +#include + +#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])) + +/* Interval of Unicode characters. */ +typedef struct { ucs4_t start; ucs4_t end; } interval_t; + +/* Set of Unicode characters, described as list of intervals, in increasing + order. */ +static const interval_t set[] = + { diff --git a/tests/unicase/test-predicate-part2.h b/tests/unicase/test-predicate-part2.h new file mode 100644 index 000000000..60b7c2467 --- /dev/null +++ b/tests/unicase/test-predicate-part2.h @@ -0,0 +1,37 @@ +/* Test the Unicode character type functions. + Copyright (C) 2007 Free Software Foundation, Inc. + + This 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 . */ + + }; + +int +main () +{ + unsigned int c; + size_t i; + + c = 0; + for (i = 0; i < SIZEOF (set); i++) + { + for (; c < set[i].start; c++) + ASSERT (!PREDICATE (c)); + for (; c <= set[i].end; c++) + ASSERT (PREDICATE (c)); + } + for (; c < 0x110000; c++) + ASSERT (!PREDICATE (c)); + + return 0; +} -- 2.11.0