xref: /openbsd-src/gnu/usr.bin/perl/dist/Unicode-Normalize/t/form.t (revision 256a93a44f36679bee503f12e49566c2183f6181)
15759b3d2Safresh1
25759b3d2Safresh1BEGIN {
35759b3d2Safresh1    if ($ENV{PERL_CORE}) {
45759b3d2Safresh1	chdir('t') if -d 't';
55759b3d2Safresh1	@INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib);
65759b3d2Safresh1    }
75759b3d2Safresh1}
85759b3d2Safresh1
95759b3d2Safresh1#########################
105759b3d2Safresh1
115759b3d2Safresh1use strict;
125759b3d2Safresh1use warnings;
135759b3d2Safresh1BEGIN { $| = 1; print "1..37\n"; }
145759b3d2Safresh1my $count = 0;
15*256a93a4Safresh1sub ok { Unicode::Normalize::ok(\$count, @_) }
165759b3d2Safresh1
175759b3d2Safresh1use Unicode::Normalize qw(:all);
185759b3d2Safresh1
195759b3d2Safresh1ok(1);
205759b3d2Safresh1
215759b3d2Safresh1sub answer { defined $_[0] ? $_[0] ? "YES" : "NO" : "MAYBE" }
225759b3d2Safresh1
235759b3d2Safresh1#########################
245759b3d2Safresh1
255759b3d2Safresh1ok(NFD ("\x{304C}\x{FF76}"), "\x{304B}\x{3099}\x{FF76}");
265759b3d2Safresh1ok(NFC ("\x{304C}\x{FF76}"), "\x{304C}\x{FF76}");
275759b3d2Safresh1ok(NFKD("\x{304C}\x{FF76}"), "\x{304B}\x{3099}\x{30AB}");
285759b3d2Safresh1ok(NFKC("\x{304C}\x{FF76}"), "\x{304C}\x{30AB}");
295759b3d2Safresh1
305759b3d2Safresh1ok(answer(checkNFD ("\x{304C}")), "NO");
315759b3d2Safresh1ok(answer(checkNFC ("\x{304C}")), "YES");
325759b3d2Safresh1ok(answer(checkNFKD("\x{304C}")), "NO");
335759b3d2Safresh1ok(answer(checkNFKC("\x{304C}")), "YES");
345759b3d2Safresh1ok(answer(checkNFD ("\x{FF76}")), "YES");
355759b3d2Safresh1ok(answer(checkNFC ("\x{FF76}")), "YES");
365759b3d2Safresh1ok(answer(checkNFKD("\x{FF76}")), "NO");
375759b3d2Safresh1ok(answer(checkNFKC("\x{FF76}")), "NO");
385759b3d2Safresh1
395759b3d2Safresh1ok(normalize('D', "\x{304C}\x{FF76}"), "\x{304B}\x{3099}\x{FF76}");
405759b3d2Safresh1ok(normalize('C', "\x{304C}\x{FF76}"), "\x{304C}\x{FF76}");
415759b3d2Safresh1ok(normalize('KD',"\x{304C}\x{FF76}"), "\x{304B}\x{3099}\x{30AB}");
425759b3d2Safresh1ok(normalize('KC',"\x{304C}\x{FF76}"), "\x{304C}\x{30AB}");
435759b3d2Safresh1
445759b3d2Safresh1ok(answer(check('D', "\x{304C}")), "NO");
455759b3d2Safresh1ok(answer(check('C', "\x{304C}")), "YES");
465759b3d2Safresh1ok(answer(check('KD',"\x{304C}")), "NO");
475759b3d2Safresh1ok(answer(check('KC',"\x{304C}")), "YES");
485759b3d2Safresh1ok(answer(check('D' ,"\x{FF76}")), "YES");
495759b3d2Safresh1ok(answer(check('C' ,"\x{FF76}")), "YES");
505759b3d2Safresh1ok(answer(check('KD',"\x{FF76}")), "NO");
515759b3d2Safresh1ok(answer(check('KC',"\x{FF76}")), "NO");
525759b3d2Safresh1
535759b3d2Safresh1ok(normalize('NFD', "\x{304C}\x{FF76}"), "\x{304B}\x{3099}\x{FF76}");
545759b3d2Safresh1ok(normalize('NFC', "\x{304C}\x{FF76}"), "\x{304C}\x{FF76}");
555759b3d2Safresh1ok(normalize('NFKD',"\x{304C}\x{FF76}"), "\x{304B}\x{3099}\x{30AB}");
565759b3d2Safresh1ok(normalize('NFKC',"\x{304C}\x{FF76}"), "\x{304C}\x{30AB}");
575759b3d2Safresh1
585759b3d2Safresh1ok(answer(check('NFD', "\x{304C}")), "NO");
595759b3d2Safresh1ok(answer(check('NFC', "\x{304C}")), "YES");
605759b3d2Safresh1ok(answer(check('NFKD',"\x{304C}")), "NO");
615759b3d2Safresh1ok(answer(check('NFKC',"\x{304C}")), "YES");
625759b3d2Safresh1ok(answer(check('NFD' ,"\x{FF76}")), "YES");
635759b3d2Safresh1ok(answer(check('NFC' ,"\x{FF76}")), "YES");
645759b3d2Safresh1ok(answer(check('NFKD',"\x{FF76}")), "NO");
655759b3d2Safresh1ok(answer(check('NFKC',"\x{FF76}")), "NO");
665759b3d2Safresh1
67