~ubuntu-branches/ubuntu/trusty/ruby1.9/trusty

« back to all changes in this revision

Viewing changes to ext/nkf/test.rb

  • Committer: Bazaar Package Importer
  • Author(s): Lucas Nussbaum
  • Date: 2006-05-08 22:23:12 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060508222312-w2wqeaz030ifi59j
Tags: 1.9.0+20060423-3ubuntu1
* Resynchronized with Debian.
* Only change from Debian is the addition of
  debian/patches/903_sparc_fix_define.patch to fix illegal instructions
  at runtime on sparc. (change from 1.9.0+20050921-1ubuntu1)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/local/bin/ruby
2
 
#
3
 
# nkf test program for nkf-2
4
 
#
5
 
# $Id: test.rb,v 1.7 2004/12/01 21:07:22 naruse Exp $
6
 
#
7
 
#    Shinji KONO <kono@ie.u-ryukyu.ac.jp>
8
 
# Sun Aug 18 12:25:40 JST 1996
9
 
# Sun Nov  8 00:16:06 JST 1998
10
 
#
11
 
# This is useful when you add new patch on nkf.
12
 
# Since this test is too strict, faileurs may not mean
13
 
# wrong conversion. 
14
 
#
15
 
# nkf 1.5 differs on MIME decoding
16
 
# nkf 1.4 passes Basic Conversion tests
17
 
# nkf PDS version passes Basic Conversion tests  using "nkf -iB -oB "
18
 
#
19
 
 
20
 
$counter = 0
21
 
def result(result, message = nil)
22
 
  $counter += 1
23
 
  printf("%s %d%s\n",
24
 
         result ? 'ok' : 'no', 
25
 
         $counter, 
26
 
         message ? ' ... ' + message : '')
27
 
end
28
 
 
29
 
begin
30
 
  require 'nkf'
31
 
  include NKF
32
 
rescue LoadError
33
 
  result(false)
34
 
end
35
 
result(true)
36
 
 
37
 
if nkf('-me', '1')
38
 
  result(true);
39
 
else
40
 
  result(false);
41
 
end
42
 
 
43
 
output = nkf('-e', "\033\$@#1#3#2%B")
44
 
if output
45
 
  # print output, "\n"
46
 
  result(true, output)
47
 
else
48
 
  result(false)
49
 
end
50
 
 
51
 
output = nkf('-Zj', "\033\$@#1#3#2%B")
52
 
if output
53
 
  # print output, "\n"
54
 
  result(true, output)
55
 
else
56
 
  result(false)
57
 
end
58
 
 
59
 
output = "\244\306 " * 1024
60
 
old =  output.length
61
 
output = nkf("-j", output)
62
 
if output
63
 
  # print output, "\n"
64
 
  result(true, "#{old} #{output.length}")
65
 
else
66
 
    result(false)
67
 
end
68
 
 
69
 
 
70
 
$detail = false
71
 
def test(opt, input, expects)
72
 
  print "\nINPUT:\n", input if $detail
73
 
  print "\nEXPECT:\n", expects.to_s if $detail
74
 
  result = nkf(opt, input)
75
 
  result.delete!(' ') if opt.include?('-m')
76
 
  print "\nGOT:\n", result if $detail
77
 
 
78
 
  expects.each do |e|
79
 
    e.delete!(' ') if opt.include?('-m')
80
 
    if result == e then
81
 
      puts "Ok"
82
 
      return result
83
 
    end
84
 
  end
85
 
  puts "Fail"
86
 
  puts result.unpack('H*').first
87
 
  puts expects.map{|x|x.unpack('H*').first}.join("\n\n")
88
 
end
89
 
 
90
 
 
91
 
$example = Hash.new
92
 
 
93
 
 
94
 
# Basic Conversion
95
 
print "\nBasic Conversion test\n\n";
96
 
 
97
 
# I gave up simple literal quote because there are big difference
98
 
# on perl4 and perl5 on literal quote. Of course we cannot use
99
 
# jperl.
100
 
 
101
 
$example['jis'] = <<'eofeof'.unpack('u')[0]
102
 
M1FER<W0@4W1A9V4@&R1"(3DQ(3%^2R%+?D]3&RA"(%-E8V]N9"!3=&%G92`;
103
 
M)$)0)TU:&RA"($AI<F%G86YA(!LD0B0B)"0D)B0H)"HD;R1R)',;*$(*2V%T
104
 
M86MA;F$@&R1")2(E)"4F)2@E*B5O)7(E<QLH0B!+:6=O=2`;)$(A)B%G(S`C
105
 
/029!)E@G(B=!*$`;*$(*
106
 
eofeof
107
 
 
108
 
$example['sjis'] = <<'eofeof'.unpack('u')[0]
109
 
M1FER<W0@4W1A9V4@@5B)0(F>ED"6GIAR(%-E8V]N9"!3=&%G92"8I9=Y($AI
110
 
M<F%G86YA((*@@J*"I(*F@JB"[8+P@O$*2V%T86MA;F$@@T&#0X-%@T>#28./
111
 
>@Y*#DR!+:6=O=2"!18&'@D^"8(._@]:$081@A+X*
112
 
eofeof
113
 
 
114
 
$example['euc'] = <<'eofeof'.unpack('u')[0]
115
 
M1FER<W0@4W1A9V4@H;FQH;'^RZ'+_L_3(%-E8V]N9"!3=&%G92#0I\W:($AI
116
 
M<F%G86YA(*2BI*2DIJ2HI*JD[Z3RI/,*2V%T86MA;F$@I:*EI*6FI:BEJJ7O
117
 
>I?*E\R!+:6=O=2"AIJ'GH["CP:;!IMBGHJ?!J,`*
118
 
eofeof
119
 
 
120
 
$example['utf8'] = <<'eofeof'.unpack('u')[0]
121
 
M[[N_1FER<W0@4W1A9V4@XX"%Z9FBY;^<YK.5YKJ`Z(65(%-E8V]N9"!3=&%G
122
 
M92#DN+SI@:4@2&ER86=A;F$@XX&"XX&$XX&&XX&(XX&*XX*/XX*2XX*3"DMA
123
 
M=&%K86YA(.."HN."I.."IN."J.."JN.#K^.#LN.#LR!+:6=O=2#C@[OBB)[O
124
 
1O)#OO*'.L<^)T)'0K^*5@@H`
125
 
eofeof
126
 
 
127
 
$example['utf8N'] = <<'eofeof'.unpack('u')[0]
128
 
M1FER<W0@4W1A9V4@XX"%Z9FBY;^<YK.5YKJ`Z(65(%-E8V]N9"!3=&%G92#D
129
 
MN+SI@:4@2&ER86=A;F$@XX&"XX&$XX&&XX&(XX&*XX*/XX*2XX*3"DMA=&%K
130
 
M86YA(.."HN."I.."IN."J.."JN.#K^.#LN.#LR!+:6=O=2#C@[OBB)[OO)#O
131
 
.O*'.L<^)T)'0K^*5@@H`
132
 
eofeof
133
 
 
134
 
$example['u16L'] = <<'eofeof'.unpack('u')[0]
135
 
M__Y&`&D`<@!S`'0`(`!3`'0`80!G`&4`(``%,&*6W%_5;(!N58$@`%,`90!C
136
 
M`&\`;@!D`"``4P!T`&$`9P!E`"``/$YED"``2`!I`'(`80!G`&$`;@!A`"``
137
 
M0C!$,$8P2#!*,(\PDC"3,`H`2P!A`'0`80!K`&$`;@!A`"``HC"D,*8PJ#"J
138
 
I,.\P\C#S,"``2P!I`&<`;P!U`"``^S`>(A#_(?^Q`\D#$00O!$(E"@``
139
 
eofeof
140
 
 
141
 
$example['u16L0'] = <<'eofeof'.unpack('u')[0]
142
 
M1@!I`'(`<P!T`"``4P!T`&$`9P!E`"``!3!BEMQ?U6R`;E6!(`!3`&4`8P!O
143
 
M`&X`9``@`%,`=`!A`&<`90`@`#Q.99`@`$@`:0!R`&$`9P!A`&X`80`@`$(P
144
 
M1#!&,$@P2C"/,)(PDS`*`$L`80!T`&$`:P!A`&X`80`@`*(PI#"F,*@PJC#O
145
 
G,/(P\S`@`$L`:0!G`&\`=0`@`/LP'B(0_R'_L0/)`Q$$+P1")0H`
146
 
eofeof
147
 
 
148
 
$example['u16B'] = <<'eofeof'.unpack('u')[0]
149
 
M_O\`1@!I`'(`<P!T`"``4P!T`&$`9P!E`"`P!99B7]QLU6Z`@54`(`!3`&4`
150
 
M8P!O`&X`9``@`%,`=`!A`&<`90`@3CR090`@`$@`:0!R`&$`9P!A`&X`80`@
151
 
M,$(P1#!&,$@P2C"/,)(PDP`*`$L`80!T`&$`:P!A`&X`80`@,*(PI#"F,*@P
152
 
IJC#O,/(P\P`@`$L`:0!G`&\`=0`@,/LB'O\0_R$#L0/)!!$$+R5"``H`
153
 
eofeof
154
 
 
155
 
$example['u16B0'] = <<'eofeof'.unpack('u')[0]
156
 
M`$8`:0!R`',`=``@`%,`=`!A`&<`90`@,`668E_<;-5N@(%5`"``4P!E`&,`
157
 
M;P!N`&0`(`!3`'0`80!G`&4`($X\D&4`(`!(`&D`<@!A`&<`80!N`&$`(#!"
158
 
M,$0P1C!(,$HPCS"2,),`"@!+`&$`=`!A`&L`80!N`&$`(#"B,*0PIC"H,*HP
159
 
G[S#R,/,`(`!+`&D`9P!O`'4`(##[(A[_$/\A`[$#R001!"\E0@`*
160
 
eofeof
161
 
 
162
 
$example['jis1'] = <<'eofeof'.unpack('u')[0]
163
 
M&R1";3%Q<$$L&RA""ALD0F4Z3F\;*$(*&R1"<FT;*$()&R1"/F5.3D]+&RA"
164
 
#"0D*
165
 
eofeof
166
 
 
167
 
$example['sjis1'] = <<'eofeof'.unpack('u')[0]
168
 
8YU#ID)%+"N-9E^T*Z>L)C^.7S)AJ"0D*
169
 
eofeof
170
 
 
171
 
$example['euc1'] = <<'eofeof'.unpack('u')[0]
172
 
8[;'Q\,&L"N6ZSN\*\NT)ON7.SL_+"0D*
173
 
eofeof
174
 
 
175
 
$example['utf1'] = <<'eofeof'.unpack('u')[0]
176
 
AZ+J%Z:N/Z8JM"N>VNNFZEPKIM(D)Y+B*Z:"8Y+J8"0D*
177
 
eofeof
178
 
 
179
 
$example['jis2'] = <<'eofeof'.unpack('u')[0]
180
 
+&R1".EA&(QLH0@H`
181
 
eofeof
182
 
 
183
 
$example['sjis2'] = <<'eofeof'.unpack('u')[0]
184
 
%C=:3H0H`
185
 
eofeof
186
 
 
187
 
$example['euc2'] = <<'eofeof'.unpack('u')[0]
188
 
%NMC&HPH`
189
 
eofeof
190
 
 
191
 
$example['utf2'] = <<'eofeof'.unpack('u')[0]
192
 
'YI:.Z)>D"@``
193
 
eofeof
194
 
 
195
 
# From JIS
196
 
 
197
 
print "JIS  to JIS ... ";test("-j",$example['jis'],[$example['jis']])
198
 
print "JIS  to SJIS... ";test("-s",$example['jis'],[$example['sjis']])
199
 
print "JIS  to EUC ... ";test("-e",$example['jis'],[$example['euc']])
200
 
print "JIS  to UTF8... ";test("-w",$example['jis'],[$example['utf8N']])
201
 
print "JIS  to U16L... ";test("-w16L",$example['jis'],[$example['u16L']])
202
 
print "JIS  to U16B... ";test("-w16B",$example['jis'],[$example['u16B']])
203
 
 
204
 
# From SJIS
205
 
 
206
 
print "SJIS to JIS ... ";test("-j",$example['sjis'],[$example['jis']])
207
 
print "SJIS to SJIS... ";test("-s",$example['sjis'],[$example['sjis']])
208
 
print "SJIS to EUC ... ";test("-e",$example['sjis'],[$example['euc']])
209
 
print "SJIS to UTF8... ";test("-w",$example['sjis'],[$example['utf8N']])
210
 
print "SJIS to U16L... ";test("-w16L",$example['sjis'],[$example['u16L']])
211
 
print "SJIS to U16B... ";test("-w16B",$example['sjis'],[$example['u16B']])
212
 
 
213
 
# From EUC
214
 
 
215
 
print "EUC  to JIS ... ";test("-j",$example['euc'],[$example['jis']])
216
 
print "EUC  to SJIS... ";test("-s",$example['euc'],[$example['sjis']])
217
 
print "EUC  to EUC ... ";test("-e",$example['euc'],[$example['euc']])
218
 
print "EUC  to UTF8... ";test("-w",$example['euc'],[$example['utf8N']])
219
 
print "EUC  to U16L... ";test("-w16L",$example['euc'],[$example['u16L']])
220
 
print "EUC  to U16B... ";test("-w16B",$example['euc'],[$example['u16B']])
221
 
 
222
 
# From UTF8
223
 
 
224
 
print "UTF8 to JIS ... ";test("-j",     $example['utf8N'],[$example['jis']])
225
 
print "UTF8 to SJIS... ";test("-s",     $example['utf8N'],[$example['sjis']])
226
 
print "UTF8 to EUC ... ";test("-e",     $example['utf8N'],[$example['euc']])
227
 
print "UTF8 to UTF8N.. ";test("-w",     $example['utf8N'],[$example['utf8N']])
228
 
print "UTF8 to UTF8... ";test("-w8",    $example['utf8N'],[$example['utf8']])
229
 
print "UTF8 to UTF8N.. ";test("-w80",   $example['utf8N'],[$example['utf8N']])
230
 
print "UTF8 to U16L... ";test("-w16L",  $example['utf8N'],[$example['u16L']])
231
 
print "UTF8 to U16L0.. ";test("-w16L0", $example['utf8N'],[$example['u16L0']])
232
 
print "UTF8 to U16B... ";test("-w16B",  $example['utf8N'],[$example['u16B']])
233
 
print "UTF8 to U16B0.. ";test("-w16B0", $example['utf8N'],[$example['u16B0']])
234
 
 
235
 
 
236
 
 
237
 
# From JIS
238
 
 
239
 
print "JIS  to JIS ... ";test("-j",$example['jis1'],[$example['jis1']])
240
 
print "JIS  to SJIS... ";test("-s",$example['jis1'],[$example['sjis1']])
241
 
print "JIS  to EUC ... ";test("-e",$example['jis1'],[$example['euc1']])
242
 
print "JIS  to UTF8... ";test("-w",$example['jis1'],[$example['utf1']])
243
 
 
244
 
# From SJIS
245
 
 
246
 
print "SJIS to JIS ... ";test("-j",$example['sjis1'],[$example['jis1']])
247
 
print "SJIS to SJIS... ";test("-s",$example['sjis1'],[$example['sjis1']])
248
 
print "SJIS to EUC ... ";test("-e",$example['sjis1'],[$example['euc1']])
249
 
print "SJIS to UTF8... ";test("-w",$example['sjis1'],[$example['utf1']])
250
 
 
251
 
# From EUC
252
 
 
253
 
print "EUC  to JIS ... ";test("-j",$example['euc1'],[$example['jis1']])
254
 
print "EUC  to SJIS... ";test("-s",$example['euc1'],[$example['sjis1']])
255
 
print "EUC  to EUC ... ";test("-e",$example['euc1'],[$example['euc1']])
256
 
print "EUC  to UTF8... ";test("-w",$example['euc1'],[$example['utf1']])
257
 
 
258
 
# From UTF8
259
 
 
260
 
print "UTF8 to JIS ... ";test("-j",$example['utf1'],[$example['jis1']])
261
 
print "UTF8 to SJIS... ";test("-s",$example['utf1'],[$example['sjis1']])
262
 
print "UTF8 to EUC ... ";test("-e",$example['utf1'],[$example['euc1']])
263
 
print "UTF8 to UTF8... ";test("-w",$example['utf1'],[$example['utf1']])
264
 
 
265
 
# Ambigous Case
266
 
 
267
 
$example['amb'] = <<'eofeof'.unpack('u')[0]
268
 
MI<*PL:7"L+&EPK"QI<*PL:7"L+&EPK"QI<*PL:7"L+&EPK"QI<*PL:7"L+&E
269
 
MPK"QI<*PL:7"L+&EPK"QI<(*I<*PL:7"L+&EPK"QI<*PL:7"L+&EPK"QI<*P
270
 
ML:7"L+&EPK"QI<*PL:7"L+&EPK"QI<*PL:7"L+&EPK"QI<(*I<*PL:7"L+&E
271
 
MPK"QI<*PL:7"L+&EPK"QI<*PL:7"L+&EPK"QI<*PL:7"L+&EPK"QI<*PL:7"
272
 
ML+&EPK"QI<(*I<*PL:7"L+&EPK"QI<*PL:7"L+&EPK"QI<*PL:7"L+&EPK"Q
273
 
MI<*PL:7"L+&EPK"QI<*PL:7"L+&EPK"QI<(*I<*PL:7"L+&EPK"QI<*PL:7"
274
 
ML+&EPK"QI<*PL:7"L+&EPK"QI<*PL:7"L+&EPK"QI<*PL:7"L+&EPK"QI<(*
275
 
eofeof
276
 
 
277
 
$example['amb.euc'] = <<'eofeof'.unpack('u')[0]
278
 
M&R1")4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25"
279
 
M,#$E0C`Q)4(P,25",#$E0C`Q)4(;*$(*&R1")4(P,25",#$E0C`Q)4(P,25"
280
 
M,#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(;
281
 
M*$(*&R1")4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P
282
 
M,25",#$E0C`Q)4(P,25",#$E0C`Q)4(;*$(*&R1")4(P,25",#$E0C`Q)4(P
283
 
M,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q
284
 
M)4(;*$(*&R1")4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q
285
 
>)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(;*$(*
286
 
eofeof
287
 
 
288
 
$example['amb.sjis'] = <<'eofeof'.unpack('u')[0]
289
 
M&RA))4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25"
290
 
M,#$E0C`Q)4(P,25",#$E0C`Q)4(;*$(*&RA))4(P,25",#$E0C`Q)4(P,25"
291
 
M,#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(;
292
 
M*$(*&RA))4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P
293
 
M,25",#$E0C`Q)4(P,25",#$E0C`Q)4(;*$(*&RA))4(P,25",#$E0C`Q)4(P
294
 
M,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q
295
 
M)4(;*$(*&RA))4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q
296
 
>)4(P,25",#$E0C`Q)4(P,25",#$E0C`Q)4(;*$(*
297
 
eofeof
298
 
 
299
 
print "Ambiguous Case. ";
300
 
    test("-j",$example['amb'],[$example['amb.euc']])
301
 
 
302
 
# Input assumption
303
 
 
304
 
print "SJIS  Input assumption ";
305
 
    test("-jSx",$example['amb'],[$example['amb.sjis']])
306
 
 
307
 
# Broken JIS
308
 
 
309
 
print "Broken JIS ";
310
 
    $input = $example['jis'];
311
 
    $input.gsub!("\033",'')
312
 
    test("-Be",$input,[$example['euc']]);
313
 
print "Broken JIS is safe on Normal JIS? ";
314
 
    $input = $example['jis'];
315
 
    test("-Be",$input,[$example['euc']]);
316
 
 
317
 
# test_data/cp932
318
 
 
319
 
$example['test_data/cp932'] = <<'eofeof'.unpack('u')[0]
320
 
%^D`@_$L`
321
 
eofeof
322
 
 
323
 
$example['test_data/cp932.ans'] = <<'eofeof'.unpack('u')[0]
324
 
%_/$@_.X`
325
 
eofeof
326
 
 
327
 
print "test_data/cp932    ";
328
 
    test("-eS",$example['test_data/cp932'],[$example['test_data/cp932.ans']])
329
 
 
330
 
# test_data/cp932inv
331
 
print "test_data/cp932inv    ";
332
 
    test("-sE --cp932inv",$example['test_data/cp932.ans'],[$example['test_data/cp932']])
333
 
 
334
 
# test_data/no-cp932inv
335
 
 
336
 
$example['test_data/no-cp932inv.ans'] = <<'eofeof'.unpack('u')[0]
337
 
%[N\@[NP`
338
 
eofeof
339
 
 
340
 
print "test_data/no-cp932inv    ";
341
 
test("-sE --no-cp932",$example['test_data/cp932.ans'],[$example['test_data/no-cp932inv.ans']])
342
 
 
343
 
# test_data/irv
344
 
 
345
 
# $example['test_data/irv'] = <<'eofeof'.unpack('u')[0]
346
 
# %#B`/(!L`
347
 
# eofeof
348
 
349
 
# $example['test_data/irv.ans'] = <<'eofeof'.unpack('u')[0]
350
 
# %#B`/(!L`
351
 
# eofeof
352
 
353
 
# print "test_data/irv    ";
354
 
#    test("-wE",$example['test_data/irv'],[$example['test_data/irv.ans']])
355
 
 
356
 
 
357
 
# UCS Mapping Test
358
 
print "\n\nUCS Mapping Test\n";
359
 
 
360
 
print "Shift_JIS to UTF-16\n";
361
 
$example['ms_ucs_map_1_sjis'] = "\x81\x60\x81\x61\x81\x7C\x81\x91\x81\x92\x81\xCA";
362
 
$example['ms_ucs_map_1_utf16'] = "\x30\x1C\x20\x16\x22\x12\x00\xA2\x00\xA3\x00\xAC";
363
 
$example['ms_ucs_map_1_utf16_ms'] = "\xFF\x5E\x22\x25\xFF\x0D\xFF\xE0\xFF\xE1\xFF\xE2";
364
 
 
365
 
print "Normal UCS Mapping : ";
366
 
    test("-w16B0 -S",$example['ms_ucs_map_1_sjis'],[$example['ms_ucs_map_1_utf16']])
367
 
 
368
 
print "Microsoft UCS Mapping : ";
369
 
    test("-w16B0 -S --ms-ucs-map",$example['ms_ucs_map_1_sjis'],[$example['ms_ucs_map_1_utf16_ms']])
370
 
 
371
 
print"\n";
372
 
 
373
 
# X0201 ��̾
374
 
# X0201->X0208 conversion
375
 
# X0208 aphabet -> ASCII
376
 
# X0201 ����Ѵ�
377
 
 
378
 
print "\nX0201 test\n\n";
379
 
 
380
 
$example['x0201.sjis'] = <<'eofeof'.unpack('u')[0]
381
 
MD5.*<(-*@TR#3H-0@U*#2X--@T^#48-3"I%3B7""8()A@F*"8X)D@F6"9H*!
382
 
M@H*"@X*$@H6"AH*'"I%3BTR-AH%)@9>!E(&0@9.!3X&5@9:!:8%J@7R!>X&!
383
 
M@6V!;H%O@7"!CPJ4O(IPMK>X/;FZMMZWWKC>N=ZZWH+&"I2\BG#*W\O?S-_-
384
 
MW\[?M]^QW@K*W\O?S`IH86YK86MU(,K?R]_,I`K*W\O?S-VA"I2\BG""S(SC
385
 
!"@!"
386
 
eofeof
387
 
 
388
 
$example['x0201.euc'] = <<'eofeof'.unpack('u')[0]
389
 
MP;2ST:6KI:VEKZ6QI;.EK*6NI;"ELJ6T"L&TL=&CP:/"H\.CQ*/%H\:CQZ/A
390
 
MH^*CXZ/DH^6CYJ/G"L&TM:VYYJ&JH?>A]*'PH?.AL*'UH?:ARJ'+H=VAW*'A
391
 
MH<ZASZ'0H=&A[PK(OK/1CK:.MXZX/8ZYCKJ.MH[>CK>.WHZXCMZ.N8[>CKJ.
392
 
MWJ3("LB^L]&.RH[?CLN.WX[,CM^.S8[?CLZ.WXZWCM^.L8[>"H[*CM^.RX[?
393
 
MCLP*:&%N:V%K=2".RH[?CLN.WX[,CJ0*CLJ.WX[+CM^.S([=CJ$*R+ZST:3.
394
 
#N.4*
395
 
eofeof
396
 
 
397
 
$example['x0201.utf'] = <<'eofeof'.unpack('u')[0]
398
 
MY86HZ*>2XX*KXX*MXX*OXX*QXX*SXX*LXX*NXX*PXX*RXX*T"N6%J.B+L>^\
399
 
MH>^\HN^\H^^\I.^\I>^\IN^\I^^]@>^]@N^]@^^]A.^]A>^]AN^]APKEA:CH
400
 
MJ)CEC[?OO('OO*#OO(/OO(3OO(7OO+[OO(;OO(KOO(COO(GBB)+OO(OOO)WO
401
 
MO+OOO+WOO9OOO9WOOZ4*Y8V*Z*>2[[VV[[VW[[VX/>^]N>^]NN^]MN^^GN^]
402
 
MM^^^GN^]N.^^GN^]N>^^GN^]NN^^GN.!J`KEC8KHIY+OOHKOOI_OOHOOOI_O
403
 
MOHSOOI_OOHWOOI_OOH[OOI_OO;?OOI_OO;'OOIX*[[Z*[[Z?[[Z+[[Z?[[Z,
404
 
M"FAA;FMA:W4@[[Z*[[Z?[[Z+[[Z?[[Z,[[VD"N^^BN^^G^^^B^^^G^^^C.^^
405
 
2G>^]H0KEC8KHIY+C@:[EOHP*
406
 
eofeof
407
 
 
408
 
$example['x0201.jis'] = <<'eofeof'.unpack('u')[0]
409
 
M&R1"030S424K)2TE+R4Q)3,E+"4N)3`E,B4T&RA""ALD0D$T,5$C02-"(T,C
410
 
M1"-%(T8C1R-A(V(C8R-D(V4C9B-G&RA""ALD0D$T-2TY9B$J(7<A="%P(7,A
411
 
M,"%U(78A2B%+(5TA7"%A(4XA3R%0(5$A;QLH0@H;)$)(/C-1&RA)-C<X&RA"
412
 
M/1LH23DZ-EXW7CA>.5XZ7ALD0B1(&RA""ALD0D@^,U$;*$E*7TM?3%]-7TY?
413
 
M-U\Q7ALH0@H;*$E*7TM?3!LH0@IH86YK86MU(!LH24I?2U],)!LH0@H;*$E*
414
 
97TM?3%TA&RA""ALD0D@^,U$D3CAE&RA""@``
415
 
eofeof
416
 
 
417
 
$example['x0201.sosi'] = <<'eofeof'.unpack('u')[0]
418
 
M&R1"030S424K)2TE+R4Q)3,E+"4N)3`E,B4T&RA*"ALD0D$T,5$C02-"(T,C
419
 
M1"-%(T8C1R-A(V(C8R-D(V4C9B-G&RA*"ALD0D$T-2TY9B$J(7<A="%P(7,A
420
 
M,"%U(78A2B%+(5TA7"%A(4XA3R%0(5$A;QLH2@H;)$)(/C-1&RA*#C8W.`\;
421
 
M*$H]#CDZ-EXW7CA>.5XZ7@\;)$(D2!LH2@H;)$)(/C-1&RA*#DI?2U],7TU?
422
 
M3E\W7S%>#PH.2E]+7TP/&RA*"FAA;FMA:W4@#DI?2U],)`\;*$H*#DI?2U],
423
 
672$/&RA*"ALD0D@^,U$D3CAE&RA""@``
424
 
eofeof
425
 
 
426
 
$example['x0201.x0208'] = <<'eofeof'.unpack('u')[0]
427
 
M&R1"030S424K)2TE+R4Q)3,E+"4N)3`E,B4T&RA""ALD0D$T,5$;*$)!0D-$
428
 
M149'86)C9&5F9PH;)$)!-#4M.68;*$(A0",D)5XF*B@I+2L]6UU[?1LD0B%O
429
 
M&RA""ALD0D@^,U$E*R4M)2\;*$(]&R1")3$E,R4L)2XE,"4R)30D2!LH0@H;
430
 
M)$)(/C-1)5$E5"57)5HE724M(2PE(B$K&RA""ALD0B51)50E51LH0@IH86YK
431
 
M86MU(!LD0B51)50E52$B&RA""ALD0B51)50E525S(2,;*$(*&R1"2#XS421.
432
 
&.&4;*$(*
433
 
eofeof
434
 
 
435
 
# -X is necessary to allow X0201 in SJIS
436
 
# -Z convert X0208 alphabet to ASCII
437
 
print "X0201 conversion: SJIS ";
438
 
    test("-jXZ",$example['x0201.sjis'],[$example['x0201.x0208']])
439
 
print "X0201 conversion: JIS  ";
440
 
    test("-jZ",$example['x0201.jis'],[$example['x0201.x0208']])
441
 
print "X0201 conversion:SI/SO ";
442
 
    test("-jZ",$example['x0201.sosi'],[$example['x0201.x0208']])
443
 
print "X0201 conversion: EUC  ";
444
 
    test("-jZ",$example['x0201.euc'],[$example['x0201.x0208']])
445
 
print "X0201 conversion: UTF8 ";
446
 
    test("-jZ",$example['x0201.utf'],[$example['x0201.x0208']])
447
 
# -x means X0201 output
448
 
print "X0201 output: SJIS     ";
449
 
    test("-xs",$example['x0201.euc'],[$example['x0201.sjis']])
450
 
print "X0201 output: JIS      ";
451
 
    test("-xj",$example['x0201.sjis'],[$example['x0201.jis']])
452
 
print "X0201 output: EUC      ";
453
 
    test("-xe",$example['x0201.jis'],[$example['x0201.euc']])
454
 
print "X0201 output: UTF8     ";
455
 
    test("-xw",$example['x0201.jis'],[$example['x0201.utf']])
456
 
 
457
 
# MIME decode
458
 
 
459
 
print "\nMIME test\n\n";
460
 
 
461
 
# MIME ISO-2022-JP
462
 
 
463
 
$example['mime.iso2022'] = <<'eofeof'.unpack('u')[0]
464
 
M/3])4T\M,C`R,BU*4#]"/T=Y4D%.144W96E23TI566Q/4U9)1WEH2S\]"CT_
465
 
M:7-O+3(P,C(M2E`_0C]'>5)!3D5%-V5I4D]*55EL3U-624=Y:$L_/0H]/VES
466
 
M;RTR,#(R+4I0/U$_/3%")$(D1B11/3%"*$)?96YD/ST*&R1`)#TD)B0K)$H;
467
 
M*$H@/3])4T\M,C`R,BU*4#]"/T=Y4D%.144W96E23U!Y:S=D:'-O4V<]/3\]
468
 
M(&5N9"!O9B!L:6YE"CT_25-/+3(P,C(M2E`_0C]'>5)!3D5%-V5I4D]0>6LW
469
 
M9&AS;U-G/3T_/2`]/TE33RTR,#(R+4I0/T(_1WE204Y%13=E:5)/4'EK-V1H
470
 
M<V]39ST]/ST*0G)O:V5N(&-A<V4*/3])4T\M,C`R,BU*4#]"/T=Y4D%.144W
471
 
M96E23U!Y:S=D"FAS;U-G/3T_/2`]/TE33RTR,`HR,BU*4#]"/T=Y4D%.144W
472
 
M96E23U!Y:S=D:'-O4V<]/3\]"CT_25-/+3(P,C(M2E`_0C]'>5)!3D5%-V5I
473
 
44D]*55EL3QM;2U-624=Y:$L_/0H_
474
 
eofeof
475
 
 
476
 
$example['mime.ans.strict'] = <<'eofeof'.unpack('u')[0]
477
 
M&R1"-$$[>B1.)48E.25(&RA""ALD0C1!.WHD3B5&)3DE2!LH0@H;)$(D1B11
478
 
M&RA"(&5N9`H;)$(D/20F)"LD2ALH0B`;)$(T03MZ)$X_*3MV&RA"96YD(&]F
479
 
M(&QI;F4*&R1"-$$[>B1./RD[=C1!.WHD3C\I.W8;*$(*0G)O:V5N(&-A<V4*
480
 
M/3])4T\M,C`R,BU*4#]"/T=Y4D%.144W96E23U!Y:S=D"FAS;U-G/3T_/2`]
481
 
M/TE33RTR,`HR,BU*4#]"/T=Y4D%.144W96E23U!Y:S=D:'-O4V<]/3\]"CT_
482
 
L25-/+3(P,C(M2E`_0C]'>5)!3D5%-V5I4D]*55EL3QM;2U-624=Y:$L_/0H_
483
 
eofeof
484
 
 
485
 
$example['mime.unbuf.strict'] = <<'eofeof'.unpack('u')[0]
486
 
M&R1"-$$[>B1.)48E.25(&RA""ALD0C1!.WHD3B5&)3DE2!LH0@H;)$(D1B11
487
 
M&RA"(&5N9`H;)$(D/20F)"LD2ALH0B`;)$(T03MZ)$X_*3MV&RA"96YD(&]F
488
 
M(&QI;F4*&R1"-$$[>B1./RD[=C1!.WHD3C\I.W8;*$(*0G)O:V5N(&-A<V4*
489
 
M&R1"-$$[>B1./RD;*$)H<V]39ST]/ST@/3])4T\M,C`*,C(M2E`_0C]'>5)!
490
 
M3D5%-V5I4D]0>6LW9&AS;U-G/3T_/0H;)$(T03MZ)$XE1ALH0EM+4U9)1WEH
491
 
$2S\]"F5I
492
 
eofeof
493
 
 
494
 
$example['mime.ans'] = <<'eofeof'.unpack('u')[0]
495
 
M&R1"-$$[>B1.)48E.25(&RA""ALD0C1!.WHD3B5&)3DE2!LH0@H;)$(D1B11
496
 
M&RA"(&5N9`H;)$(D/20F)"LD2ALH0B`;)$(T03MZ)$X_*3MV&RA"96YD(&]F
497
 
M(&QI;F4*&R1"-$$[>B1./RD[=C1!.WHD3C\I.W8;*$(*0G)O:V5N(&-A<V4*
498
 
M&R1"-$$[>B1./RD;*$)H<V]39ST]/ST@&R1"-$$[>B1./RD[=ALH0@H;)$(T
499
 
603MZ)$XE1ALH0EM+4U9)1WEH2S\]"@`*
500
 
eofeof
501
 
 
502
 
$example['mime.unbuf'] = <<'eofeof'.unpack('u')[0]
503
 
M&R1"-$$[>B1.)48E.25(&RA""ALD0C1!.WHD3B5&)3DE2!LH0@H;)$(D1B11
504
 
M&RA"(&5N9`H;)$(D/20F)"LD2ALH0B`;)$(T03MZ)$X_*3MV&RA"96YD(&]F
505
 
M(&QI;F4*&R1"-$$[>B1./RD[=C1!.WHD3C\I.W8;*$(*0G)O:V5N(&-A<V4*
506
 
M&R1"-$$[>B1./RD;*$)H<V]39ST]/ST@&R1"-$$[>B1./RD[=ALH0@H;)$(T
507
 
603MZ)$XE1ALH0EM+4U9)1WEH2S\]"@`*
508
 
eofeof
509
 
 
510
 
$example['mime.base64'] = <<'eofeof'.unpack('u')[0]
511
 
M9W-M5"])3&YG<FU#>$I+-&=Q=4,S24LS9W%Q0E%:3TUI-39,,S0Q-&=S5T)1
512
 
M43!+9VUA1%9O3T@*9S)+1%1O3'=K8C)1;$E+;V=Q2T-X24MG9W5M0W%*3EEG
513
 
<<T=#>$E+9V=U;4,X64Q&9W)70S592VMG<6U""F=Q
514
 
eofeof
515
 
 
516
 
$example['mime.base64.ans'] = <<'eofeof'.unpack('u')[0]
517
 
M&R1")$M&?B1I)#LD1D0Z)"TD7B0Y)"PA(D5L-7XV83E9)$<A(ALH0@T*&R1"
518
 
M(T<E-R5G)4,E+R1R0C\_="0J)"0D1B0B)&LD*D4Y)$,D1B0B)&LD<R1')#<D
519
 
(9R0F)"L;*$(E
520
 
eofeof
521
 
 
522
 
# print "Next test is expected to Fail.\n";
523
 
print "MIME decode (strict)   ";
524
 
    $tmp = test("-j -mS",$example['mime.iso2022'],[$example['mime.ans.strict']])
525
 
 
526
 
$example['mime.ans.alt'] = <<'eofeof'.unpack('u')[0]
527
 
M&R1"-$$[>B1.)48E.25(&RA""ALD0C1!.WHD3B5&)3DE2!LH0@H;)$(D1B11
528
 
M&RA"96YD"ALD0B0])"8D*R1*&RA"&R1"-$$[>B1./RD[=ALH0F5N9&]F;&EN
529
 
M90H;)$(T03MZ)$X_*3MV-$$[>B1./RD[=ALH0@I"<F]K96YC87-E"ALD0C1!
530
 
H.WHD3C\I.W8T03MZ)$X_*3MV&RA""ALD0C1!.WHD3B5&)3DE)!LH0@``
531
 
eofeof
532
 
 
533
 
$example['mime.unbuf.alt'] = <<'eofeof'.unpack('u')[0]
534
 
M&R1"-$$[>B1.)48E.25(&RA""ALD0C1!.WHD3B5&)3DE2!LH0@H;)$(D1B11
535
 
M&RA"96YD"ALD0B0])"8D*R1*&RA"&R1"-$$[>B1./RD[=ALH0F5N9&]F;&EN
536
 
M90H;)$(T03MZ)$X_*3MV-$$[>B1./RD[=ALH0@I"<F]K96YC87-E"ALD0C1!
537
 
H.WHD3C\I.W8T03MZ)$X_*3MV&RA""ALD0C1!.WHD3B5&)3DE)!LH0@``
538
 
eofeof
539
 
 
540
 
print "MIME decode (nonstrict)";
541
 
    $tmp = test("-j -mN",$example['mime.iso2022'],[$example['mime.ans'],$example['mime.ans.alt']])
542
 
    # open(OUT,">tmp1");print OUT pack('u',$tmp);close(OUT);
543
 
# unbuf mode implies more pessimistic decode
544
 
print "MIME decode (unbuf)    ";
545
 
    $tmp = test("-j -mNu",$example['mime.iso2022'],[$example['mime.unbuf'],$example['mime.unbuf.alt']])
546
 
    # open(OUT,">tmp2");print OUT pack('u',$tmp);close(OUT);
547
 
print "MIME decode (base64)   ";
548
 
    test("-j -mB",$example['mime.base64'],[$example['mime.base64.ans']])
549
 
 
550
 
# MIME ISO-8859-1
551
 
 
552
 
$example['mime.is8859'] = <<'eofeof'.unpack('u')[0]
553
 
M/3])4T\M.#@U.2TQ/U$_*CU#-V%V83\_/2`*4&5E<B!4]G)N9W)E;@I,87-S
554
 
M92!(:6QL97+X92!0971E<G-E;B`@7"`B36EN(&MA97!H97-T(&AA<B!F86%E
555
 
M="!E="!F;V5L(2(*06%R:'5S(%5N:79E<G-I='DL($1%3DU!4DL@(%P@(DUI
556
 
<;B!KYG!H97-T(&AA<B!FY65T(&5T(&;X;"$B"@!K
557
 
eofeof
558
 
 
559
 
$example['mime.is8859.ans'] = <<'eofeof'.unpack('u')[0]
560
 
M*L=A=F$_(`I0965R(%3V<FYG<F5N"DQA<W-E($AI;&QE<OAE(%!E=&5R<V5N
561
 
M("!<(")-:6X@:V%E<&AE<W0@:&%R(&9A865T(&5T(&9O96PA(@I!87)H=7,@
562
 
M56YI=F5R<VET>2P@1$5.34%22R`@7"`B36EN(&OF<&AE<W0@:&%R(&;E970@
563
 
)970@9OAL(2(*
564
 
eofeof
565
 
 
566
 
# Without -l, ISO-8859-1 was handled as X0201.
567
 
 
568
 
print "MIME ISO-8859-1 (Q)    ";
569
 
    test("-ml",$example['mime.is8859'],[$example['mime.is8859.ans']])
570
 
 
571
 
# test for -f is not so simple.
572
 
 
573
 
print "\nBug Fixes\n\n";
574
 
 
575
 
# test_data/cr
576
 
 
577
 
$example['test_data/cr'] = <<'eofeof'.unpack('u')[0]
578
 
1I,:DN:3(#71E<W0-=&5S=`T`
579
 
eofeof
580
 
 
581
 
$example['test_data/cr.ans'] = <<'eofeof'.unpack('u')[0]
582
 
7&R1")$8D.21(&RA""G1E<W0*=&5S=`H`
583
 
eofeof
584
 
 
585
 
print "test_data/cr    ";
586
 
    test("-jd",$example['test_data/cr'],[$example['test_data/cr.ans']])
587
 
# test_data/fixed-qencode
588
 
 
589
 
$example['test_data/fixed-qencode'] = <<'eofeof'.unpack('u')[0]
590
 
M("`@("`@("`],4(D0CYE/STS1#TQ0BA""B`@("`@("`@/3%")$(^93TS1CTS
591
 
'1#TQ0BA""@``
592
 
eofeof
593
 
 
594
 
$example['test_data/fixed-qencode.ans'] = <<'eofeof'.unpack('u')[0]
595
 
F("`@("`@("`;)$(^93\]&RA""B`@("`@("`@&R1"/F4_/1LH0@H`
596
 
eofeof
597
 
 
598
 
print "test_data/fixed-qencode    ";
599
 
    test("-jmQ",$example['test_data/fixed-qencode'],[$example['test_data/fixed-qencode.ans']])
600
 
# test_data/long-fold-1
601
 
 
602
 
$example['test_data/long-fold-1'] = <<'eofeof'.unpack('u')[0]
603
 
MI,JDK*2DI,JDK*2DI,JDK*'!I*2DKJ3GI*:DK*2BI.JDWJ2WI,:AHJ2SI.RD
604
 
M\J2]I,ZDWJ3>I**DQ*2KI*:DR*&BI,FDIJ3BI-^DT*2HI*RD[Z3KI*2DMZ&B
605
 
MI,BDP:3EI*:DQZ3!I.>D\Z2NI.RDZZ2KI.*DMZ3SI,JDI*&C"J2SI+.DSR!#
606
 
M4B],1B"DSKG4H:,-"J2SI+.DSR!#4B"DSKG4H:,-I+.DLZ3/($Q&+T-2(*3.
607
 
9N=2AHPH-"J2SI+.DSR!,1B"DSKG4H:,*"@``
608
 
eofeof
609
 
 
610
 
$example['test_data/long-fold-1.ans'] = <<'eofeof'.unpack('u')[0]
611
 
M&R1")$HD+"0D)$HD+"0D)$HD+"%!)"0D+B1G)"8D+"0B)&HD7B0W)$8A(B0S
612
 
M)&PD<B0])$XD7B1>)"(D1"0K&RA""ALD0B0F)$@A(B1))"8D8B1?)%`D*"0L
613
 
M)&\D:R0D)#<A(B1()$$D920F)$<D021G)',D+B1L)&LD*R1B)#<D<QLH0@H;
614
 
M)$(D2B0D(2,;*$(*&R1")#,D,R1/&RA"($-2+TQ&(!LD0B1..50A(QLH0@H;
615
 
M)$(D,R0S)$\;*$(@0U(@&R1")$XY5"$C&RA""ALD0B0S)#,D3QLH0B!,1B]#
616
 
M4B`;)$(D3CE4(2,;*$(*"ALD0B0S)#,D3QLH0B!,1B`;)$(D3CE4(2,;*$(*
617
 
!"@``
618
 
eofeof
619
 
 
620
 
print "test_data/long-fold-1    ";
621
 
    test("-jF60",$example['test_data/long-fold-1'],[$example['test_data/long-fold-1.ans']])
622
 
# test_data/long-fold
623
 
 
624
 
$example['test_data/long-fold'] = <<'eofeof'.unpack('u')[0]
625
 
MI,JDK*2DI,JDK*2DI,JDK*'!I*2DKJ3GI*:DK*2BI.JDWJ2WI,:AHJ2SI.RD
626
 
M\J2]I,ZDWJ3>I**DQ*2KI*:DR*&BI,FDIJ3BI-^DT*2HI*RD[Z3KI*2DMZ&B
627
 
MI,BDP:3EI*:DQZ3!I.>D\Z2NI.RDZZ2KI.*DMZ3SI,JDI*&C"J2SI+.DS\.[
628
 
'I*2YU*&C"@``
629
 
eofeof
630
 
 
631
 
$example['test_data/long-fold.ans'] = <<'eofeof'.unpack('u')[0]
632
 
M&R1")$HD+"0D)$HD+"0D)$HD+"%!)"0D+B1G)"8D+"0B)&HD7B0W)$8A(B0S
633
 
M)&PD<B0])$XD7B1>)"(D1"0K&RA""ALD0B0F)$@A(B1))"8D8B1?)%`D*"0L
634
 
M)&\D:R0D)#<A(B1()$$D920F)$<D021G)',D+B1L)&LD*R1B)#<D<QLH0@H;
635
 
:)$(D2B0D(2,D,R0S)$]#.R0D.50A(QLH0@H`
636
 
eofeof
637
 
 
638
 
print "test_data/long-fold    ";
639
 
    test("-jf60",$example['test_data/long-fold'],[$example['test_data/long-fold.ans']])
640
 
# test_data/mime_out
641
 
 
642
 
$example['test_data/mime_out'] = <<'eofeof'.unpack('u')[0]
643
 
M"BTM+2T*4W5B:F5C=#H@86%A82!A86%A(&%A86$@86%A82!A86%A(&%A86$@
644
 
M86%A82!A86%A(&%A86$@86%A82!A86%A(&%A86$@86%A82!A86%A"BTM+2T*
645
 
M4W5B:F5C=#H@I**DI*2FI*BDJJ2KI*VDKZ2QI+.DM:2WI+FDNZ2]I+^DP:3$
646
 
MI,:DR*3*I,NDS*3-I,ZDSZ32I-6DV*3;I-ZDWZ3@I.&DXJ3DI*2DYJ2HI.@*
647
 
M+2TM+0I3=6)J96-T.B!A86%A(&%A86$@86%A82!A86%A(&%A86$@86%A82!A
648
 
I86%A(*2BI*2DIJ2HI*H@86%A82!A86%A(&%A86$@86%A80HM+2TM"@H`
649
 
eofeof
650
 
 
651
 
$example['test_data/mime_out.ans'] = <<'eofeof'.unpack('u')[0]
652
 
M"BTM+2T*4W5B:F5C=#H@86%A82!A86%A(&%A86$@86%A82!A86%A(&%A86$@
653
 
M86%A82!A86%A(&%A86$@86%A80H@86%A82!A86%A(&%A86$@86%A82!A86%A
654
 
M"BTM+2T*4W5B:F5C=#H@/3])4T\M,C`R,BU*4#]"/T=Y4D-*0TEK2D-1;4I#
655
 
M9VM+:5%R2D,P:TQY47A*1$UK3E-1,T=Y:$,_/0H@/3])4T\M,C`R,BU*4#]"
656
 
M/T=Y4D-*1&MK3WE1.4I$.&M14U)%2D59:U-#4DM*17-K5$-23DI%-&M4>5)3
657
 
M2D95:U=#4F)'>6A#/ST*(#T_25-/+3(P,C(M2E`_0C]'>5)#2D8T:UAY4F=*
658
 
M1T5K66E2:TI#46M::5%O2D=G8DM%23T_/0HM+2TM"E-U8FIE8W0Z(&%A86$@
659
 
M86%A82!A86%A(&%A86$@86%A82!A86%A(&%A86$*(#T_25-/+3(P,C(M2E`_
660
 
M0C]'>5)#2D-):TI#46U*0V=K2VAS;U%G/3T_/2!A86%A(&%A86$@86%A82!A
661
 
086%A"B!A86%A"BTM+2T*"@``
662
 
eofeof
663
 
 
664
 
print "test_data/mime_out    ";
665
 
    test("-jM",$example['test_data/mime_out'],[$example['test_data/mime_out.ans']])
666
 
# test_data/mime_out2
667
 
 
668
 
$example['test_data/mime_out2'] = <<'eofeof'.unpack('u')[0]
669
 
M5&AI<R!M96UO(&1E<V-R:6)E<R!S:6UI;&%R('1E8VAN:7%U97,@=&\@86QL
670
 
M;W<@=&AE(&5N8V]D:6YG(&]F(&YO;BU!4T-)22!T97AT(&EN('9A<FEO=7,@
671
 
M<&]R=&EO;G,@;V8@82!21D,@.#(R(%LR72!M97-S86=E(&AE861E<BP@:6X@
672
 
M82!M86YN97(@=VAI8V@@:7,@=6YL:6ME;'D@=&\@8V]N9G5S92!E>&ES=&EN
673
 
M9R!M97-S86=E(&AA;F1L:6YG('-O9G1W87)E+@H*4W5B:F5C=#H@=&5S=#$@
674
 
M=&5S=#(@@L2"MX+&@J<@=&5S=#,@@L2"MX+&@O$@=&5S=#0*"E-U8FIE8W0Z
675
 
M('1E<W0Q("!T97-T,B""Q"""MR""QB""IR!T97-T,R`@@L2"MX+&@O$@('1E
676
 
M<W0T"@I!4T-)22"3^I9[C.H@05-#24D@05-#24D@D_J6>XSJ()/ZEGN,ZB!!
677
 
M4T-)22!!4T-)29/ZEGN,ZB!!4T-)20H*@J`@@J(@@J0@@J8@@J@@@JD@@JL@
678
 
M@JT@@J\@@K$@@K,@@K4@@K<@@KD@@KL@@KT@@K\@@L(@@L0@@L8@@L@@@LD@
679
 
8@LH@@LL@@LP*"@H*"@H*"@H*"@H*"@H*
680
 
eofeof
681
 
 
682
 
$example['test_data/mime_out2.ans'] = <<'eofeof'.unpack('u')[0]
683
 
M5&AI<R!M96UO(&1E<V-R:6)E<R!S:6UI;&%R('1E8VAN:7%U97,@=&\@86QL
684
 
M;W<@=&AE(&5N8V]D:6YG(&5N8V]D:6YG"B!O9B!N;VXM05-#24D@=&5X="!I
685
 
M;B!V87)I;W5S('!O<G1I;VYS(&]F(&$@80H@4D9#(#@R,B!;,ET@;65S<V%G
686
 
M92!H96%D97(L(&EN(&$@;6%N;F5R('=H:6-H(&ES('5N;&EK96QY('5N;&EK
687
 
M96QY"B!T;R!C;VYF=7-E(&5X:7-T:6YG(&UE<W-A9V4@:&%N9&QI;F<@<V]F
688
 
M='=A<F4N"@I3=6)J96-T.B!T97-T,2!T97-T,B`]/TE33RTR,#(R+4I0/T(_
689
 
M1WE20TI%66M/4U))2D-K8DM%23T_/2!T97-T,PH@/3])4T\M,C`R,BU*4#]"
690
 
M/T=Y4D-*15EK3U-224I(36)+14D]/ST@=&5S=#0*"E-U8FIE8W0Z('1E<W0Q
691
 
M("!T97-T,B`]/TE33RTR,#(R+4I0/T(_1WE20TI%66)+14EG1WE20TI$:V)+
692
 
M14EG1WE20TI%9V)+14D]/ST*(#T_25-/+3(P,C(M2E`_0C]'>5)#1WEH0TE"
693
 
M<VM1:5%P1WEH0S\]('1E<W0S(`H@/3])4T\M,C`R,BU*4#]"/T=Y4D-*15EK
694
 
M3U-224I(36)+14D]/ST@('1E<W0T"@I!4T-)22`]/TE33RTR,#(R+4I0/T(_
695
 
M1WE20U)N>$Q81&AS1WEH0S\]($%30TE)($%30TE)"B`]/TE33RTR,#(R+4I0
696
 
M/T(_1WE20U)N>$Q81&AS1WEH0TE"<VM1:UHX4S%W-&)"<V]19ST]/ST@05-#
697
 
M24D*(#T_25-/+3(P,C(M2E`_0C]15DY$4U5K8DI%2D=F171C3T=W8DM%23T_
698
 
M/2!!4T-)20H*/3])4T\M,C`R,BU*4#]"/T=Y4D-*0TEB2T5)9T=Y4D-*0U%B
699
 
M2T5)9T=Y4D-*0UEB2T5)9T=Y4D-*0V=B2T5)/3\]"B`]/TE33RTR,#(R+4I0
700
 
M/T(_24)S:U%I47%'>6A#24)S:U%I47)'>6A#24)S:U%I471'>6A#24)S:U%I
701
 
M479'>6A#/ST*(#T_25-/+3(P,C(M2E`_0C])0G-K46E1>$=Y:$-)0G-K46E1
702
 
M>D=Y:$-)0G-K46E1,4=Y:$-)0G-K46E1,T=Y:$,_/0H@/3])4T\M,C`R,BU*
703
 
M4#]"/TE"<VM1:5$U1WEH0TE"<VM1:5$W1WEH0TE"<VM1:5$Y1WEH0TE"<VM1
704
 
M:5$O1WEH0S\]"B`]/TE33RTR,#(R+4I0/T(_24)S:U%I4D)'>6A#24)S:U%I
705
 
M4D5'>6A#24)S:U%I4D='>6A#24)S:U%I4DE'>6A#/ST*(#T_25-/+3(P,C(M
706
 
M2E`_0C])0G-K46E22T=Y:$-)0G-K46E23$=Y:$-)0G-K46E234=Y:$-)0G-K
707
 
M46E23D=Y:$,_/0H@/3])4T\M,C`R,BU*4#]"/TE"<VM1:5)/1WEH0S\]"@H*
708
 
-"@H*"@H*"@H*"@H*"@``
709
 
eofeof
710
 
 
711
 
print "test_data/mime_out2    ";
712
 
    test("-jM",$example['test_data/mime_out2'],[$example['test_data/mime_out2.ans']])
713
 
# test_data/multi-line
714
 
 
715
 
$example['test_data/multi-line'] = <<'eofeof'.unpack('u')[0]
716
 
MI,JDK*2DI,JDK*2DI,JDK*'!I*2DKJ3GI*:DK*2BI.JDWJ2WI,:AH@"DLZ3L
717
 
MI/*DO:3.I-ZDWJ2BI,2DJZ2FI,BAHJ3)I*:DXJ3?I-"DJ*2LI.^DZZ2DI+>A
718
 
MHJ3(I,&DY:2FI,>DP:3GI/.DKJ3LI.NDJZ3BI+>D\Z3*I*2AHPJDLZ2SI,_#
719
 
8NZ2DN=2AHP`*I+.DLZ3/P[NDI+G4H:,*
720
 
eofeof
721
 
 
722
 
$example['test_data/multi-line.ans'] = <<'eofeof'.unpack('u')[0]
723
 
MI,JDK*2DI,JDK*2DI,JDK*'!I*2DKJ3GI*:DK*2BI.JDWJ2WI,:AH@"DLZ3L
724
 
MI/*DO:3.I-ZDWJ2BI,2DJZ2FI,BAHJ3)I*:DXJ3?I-"DJ*2LI.^DZZ2DI+>A
725
 
MHJ3(I,&DY:2FI,>DP:3GI/.DKJ3LI.NDJZ3BI+>D\Z3*I*2AHPJDLZ2SI,_#
726
 
8NZ2DN=2AHP`*I+.DLZ3/P[NDI+G4H:,*
727
 
eofeof
728
 
 
729
 
print "test_data/multi-line    ";
730
 
    test("-e",$example['test_data/multi-line'],[$example['test_data/multi-line.ans']])
731
 
# test_data/nkf-19-bug-1
732
 
 
733
 
$example['test_data/nkf-19-bug-1'] = <<'eofeof'.unpack('u')[0]
734
 
,I*:DJZ2D"KK8QJ,*
735
 
eofeof
736
 
 
737
 
$example['test_data/nkf-19-bug-1.ans'] = <<'eofeof'.unpack('u')[0]
738
 
8&R1")"8D*R0D&RA""ALD0CI81B,;*$(*
739
 
eofeof
740
 
 
741
 
print "test_data/nkf-19-bug-1    ";
742
 
    test("-Ej",$example['test_data/nkf-19-bug-1'],[$example['test_data/nkf-19-bug-1.ans']])
743
 
# test_data/nkf-19-bug-2
744
 
 
745
 
$example['test_data/nkf-19-bug-2'] = <<'eofeof'.unpack('u')[0]
746
 
%I-NDL@H`
747
 
eofeof
748
 
 
749
 
$example['test_data/nkf-19-bug-2.ans'] = <<'eofeof'.unpack('u')[0]
750
 
%I-NDL@H`
751
 
eofeof
752
 
 
753
 
print "test_data/nkf-19-bug-2    ";
754
 
    test("-Ee",$example['test_data/nkf-19-bug-2'],[$example['test_data/nkf-19-bug-2.ans']])
755
 
# test_data/nkf-19-bug-3
756
 
 
757
 
$example['test_data/nkf-19-bug-3'] = <<'eofeof'.unpack('u')[0]
758
 
8[;'Q\,&L"N6ZSN\*\NT)ON7.SL_+"0D*
759
 
eofeof
760
 
 
761
 
$example['test_data/nkf-19-bug-3.ans'] = <<'eofeof'.unpack('u')[0]
762
 
8[;'Q\,&L"N6ZSN\*\NT)ON7.SL_+"0D*
763
 
eofeof
764
 
 
765
 
print "test_data/nkf-19-bug-3    ";
766
 
    test("-e",$example['test_data/nkf-19-bug-3'],[$example['test_data/nkf-19-bug-3.ans']])
767
 
# test_data/non-strict-mime
768
 
 
769
 
$example['test_data/non-strict-mime'] = <<'eofeof'.unpack('u')[0]
770
 
M/3])4T\M,C`R,BU*4#]"/PIG<U-#;V]+.6=R-D-O;TQ%9W1Y0W0T1D-$46].
771
 
M0V\V16=S,D]N;T999S1Y1%=)3$IG=4-0:UD*2W!G<FU#>$E+:6=R,D-V;TMI
772
 
,9W-30V]O3&,*/ST*
773
 
eofeof
774
 
 
775
 
$example['test_data/non-strict-mime.ans'] = <<'eofeof'.unpack('u')[0]
776
 
M&R1")$8D)"0_)$`D)"1&)%XD.2$C&RA"#0H-"ALD0CMD)$\[?B$Y)6PE.21+
777
 
<)&(]<20K)#LD1B0D)#\D0"0D)$8D)"1>&RA""@``
778
 
eofeof
779
 
 
780
 
print "test_data/non-strict-mime    ";
781
 
    test("-jmN",$example['test_data/non-strict-mime'],[$example['test_data/non-strict-mime.ans']])
782
 
# test_data/q-encode-softrap
783
 
 
784
 
$example['test_data/q-encode-softrap'] = <<'eofeof'.unpack('u')[0]
785
 
H/3%")$(T03MZ)3T*,R$\)4DD3CTQ0BA""CTQ0B1"2E$T.3TQ0BA""@``
786
 
eofeof
787
 
 
788
 
$example['test_data/q-encode-softrap.ans'] = <<'eofeof'.unpack('u')[0]
789
 
>&R1"-$$[>B4S(3PE221.&RA""ALD0DI1-#D;*$(*
790
 
eofeof
791
 
 
792
 
print "test_data/q-encode-softrap    ";
793
 
    test("-jmQ",$example['test_data/q-encode-softrap'],[$example['test_data/q-encode-softrap.ans']])
794
 
# test_data/rot13
795
 
 
796
 
$example['test_data/rot13'] = <<'eofeof'.unpack('u')[0]
797
 
MI+.D\Z3+I,&DSZ&BS:W"]*3(I*2DI*3>I+FAHPH*;FMF('9E<BXQ+CDR(*3R
798
 
MS?C-T:2UI+NDQJ2DI+^DP*2DI,:DI*3>I+FDK*&B05-#24D@I,O"T*2WI,8@
799
 
M4D]4,3,@I*P*P+6DMZ2OQK"DI*3&I*2DRJ2DI.BDIJ3'H:*PRK*\I,ZDZ*2F
800
 
MI,O*T;2YI+6D[*3>I+ND\Z&C"@HE(&5C:&\@)VAO9V4G('P@;FMF("UR"FAO
801
 
#9V4*
802
 
eofeof
803
 
 
804
 
$example['test_data/rot13.ans'] = <<'eofeof'.unpack('u')[0]
805
 
M&R1"4V)31%-Z4W!3?E!1?%QQ15-W4U-34U,O4VA04ALH0@H*87AS(&ER92XQ
806
 
M+CDR(!LD0E-#?$E\(E-D4VI3=5-34VY3;U-34W534U,O4VA36U!1&RA"3D90
807
 
M5E8@&R1"4WIQ(5-F4W4;*$(@14)',3,@&R1"4UL;*$(*&R1";V139E->=5]3
808
 
M4U-U4U-3>5-34SE355-V4%%?>6%K4WU3.5-54WIY(F-H4V13/5,O4VI31%!2
809
 
A&RA""@HE(')P=6(@)W5B='(G('P@87AS("UE"G5B='(*
810
 
eofeof
811
 
 
812
 
print "test_data/rot13    ";
813
 
    test("-jr",$example['test_data/rot13'],[$example['test_data/rot13.ans']])
814
 
# test_data/slash
815
 
 
816
 
$example['test_data/slash'] = <<'eofeof'.unpack('u')[0]
817
 
7("`]/U8\5"U5.5=%2RTK.U<U32LE+PH`
818
 
eofeof
819
 
 
820
 
$example['test_data/slash.ans'] = <<'eofeof'.unpack('u')[0]
821
 
7("`]/U8\5"U5.5=%2RTK.U<U32LE+PH`
822
 
eofeof
823
 
 
824
 
print "test_data/slash    ";
825
 
    test(" ",$example['test_data/slash'],[$example['test_data/slash.ans']])
826
 
# test_data/z1space-0
827
 
 
828
 
$example['test_data/z1space-0'] = <<'eofeof'.unpack('u')[0]
829
 
"H:$`
830
 
eofeof
831
 
 
832
 
$example['test_data/z1space-0.ans'] = <<'eofeof'.unpack('u')[0]
833
 
"H:$`
834
 
eofeof
835
 
 
836
 
print "test_data/z1space-0    ";
837
 
    test("-e -Z",$example['test_data/z1space-0'],[$example['test_data/z1space-0.ans']])
838
 
# test_data/z1space-1
839
 
 
840
 
$example['test_data/z1space-1'] = <<'eofeof'.unpack('u')[0]
841
 
"H:$`
842
 
eofeof
843
 
 
844
 
$example['test_data/z1space-1.ans'] = <<'eofeof'.unpack('u')[0]
845
 
!(```
846
 
eofeof
847
 
 
848
 
print "test_data/z1space-1    ";
849
 
    test("-e -Z1",$example['test_data/z1space-1'],[$example['test_data/z1space-1.ans']])
850
 
# test_data/z1space-2
851
 
 
852
 
$example['test_data/z1space-2'] = <<'eofeof'.unpack('u')[0]
853
 
"H:$`
854
 
eofeof
855
 
 
856
 
$example['test_data/z1space-2.ans'] = <<'eofeof'.unpack('u')[0]
857
 
"("``
858
 
eofeof
859
 
 
860
 
print "test_data/z1space-2    ";
861
 
    test("-e -Z2",$example['test_data/z1space-2'],[$example['test_data/z1space-2.ans']])
862
 
 
863
 
 
864
 
# end