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 6print "1..257\n"; # 0-255 plus one beyond 7 8for 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 . " - native_to_unicode $i"; 18 print "\n"; 19} 20 21# Choose a largish number that might cause a seg fault if inappropriate array 22# lookup 23if (utf8::unicode_to_native(utf8::native_to_unicode(100000)) != 100000) { 24 print "not "; 25} 26print "ok 257 - native_to_unicode of large number\n"; 27