Commit | Line | Data |
---|---|---|
d5b98071 KW |
1 | #!./perl |
2 | ||
3 | # Verify round trip of translations from the native character set to unicode | |
4 | # and back work. If this is wrong, nothing will be reliable. | |
5 | ||
6 | print "1..257\n"; # 0-255 plus one beyond | |
7 | ||
8 | for my $i (0 .. 255) { | |
9 | my $uni = utf8::native_to_unicode($i); | |
10 | if ($uni < 0 || $uni >= 256) { | |
11 | print "not "; | |
12 | } | |
13 | elsif (utf8::unicode_to_native(utf8::native_to_unicode($i)) != $i) { | |
14 | print "not "; | |
15 | } | |
16 | print "ok "; | |
17 | print $i + 1; | |
18 | print "\n"; | |
19 | } | |
20 | ||
21 | # Choose a largish number that might cause a seg fault if inappropriate array | |
22 | # lookup | |
23 | if (utf8::unicode_to_native(utf8::native_to_unicode(100000)) != 100000) { | |
24 | print "not "; | |
25 | } | |
26 | print "ok "; | |
27 | print "257\n"; |