3 # Copyright (C) 1998, 1999 Tom Tromey
4 # Copyright (C) 2001 Red Hat Software
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21 # gen-casefold-test.pl - Generate test cases for casefolding from Unicode data.
22 # See http://www.unicode.org/Public/UNIDATA/UnicodeCharacterDatabase.html
24 # I consider the output of this program to be unrestricted. Use it as
27 # Names of fields in the CaseFolding table
37 die "Usage: $0 UNICODE-VERSION CaseFolding.txt\n";
41 # Test cases generated from Unicode $ARGV[0] data
42 # by gen-casefold-test.pl. Do not edit.
44 # Some special hand crafted tests
48 # Now the automatic tests
52 open (INPUT, "< $ARGV[1]") || exit 1;
63 my @fields = split ('\s*;\s*', $_, 30);
65 my $raw_code = $fields[$FOLDING_CODE];
66 my $code = hex ($raw_code);
68 next if $code > 0xffff; # FIXME!
72 printf STDERR ("Entry for $raw_code has wrong number of fields (%d)\n", $#fields);
76 next if ($fields[$FOLDING_STATUS] eq 'S');
78 @values = map { hex ($_) } split /\s+/, $fields[$FOLDING_MAPPING];
79 printf ("%s\t%s\n", pack ("U", $code), pack ("U*", @values));