2 if ($ENV{'PERL_CORE'}){
4 unshift @INC, '../lib';
6 require Config; import Config;
7 if ($Config{'extensions'} !~ /\bEncode\b/) {
8 print "1..0 # Skip: Encode was not built\n";
15 use Test::More tests => 21;
18 # The specification of GSM 03.38 is not awfully clear.
19 # (http://www.unicode.org/Public/MAPPINGS/ETSI/GSM0338.TXT)
20 # The various combinations of 0x00 and 0x1B as leading bytes
21 # are unclear, as is the semantics of those bytes as standalone
22 # or as final single bytes.
24 sub t { is(decode("gsm0338", my $t = $_[0]), $_[1]) }
26 # t("\x00", "\x00"); # ???
36 t("\x00\x00", "\x00\x00"); # Maybe?
37 t("\x00\x1B", "\x40\xA0"); # Maybe?
38 t("\x00\x41", "\x40\x41");
40 # t("\x1B", "\x1B"); # ???
42 # Escape with no special second byte is just a NBSP.
43 t("\x1B\x41", "\xA0\x41");
45 t("\x1B\x00", "\xA0\x40"); # Maybe?
47 # Special escape characters.
48 t("\x1B\x0A", "\x0C");
49 t("\x1B\x14", "\x5E");
50 t("\x1B\x28", "\x7B");
51 t("\x1B\x29", "\x7D");
52 t("\x1B\x2F", "\x5C");
53 t("\x1B\x3C", "\x5B");
54 t("\x1B\x3D", "\x7E");
55 t("\x1B\x3E", "\x5D");
56 t("\x1B\x40", "\x7C");
57 t("\x1B\x40", "\x7C");
58 t("\x1B\x65", "\x{20AC}");