OSDN Git Service

614db7865556097dbbfda6d3cba839edce375c2b
[lha/lha.git] / tests / lha-test13
1 # -*- shell-script -*-
2 message testing the kanji code conversion.
3
4 # printf '\xb4\xc1\xbb\xfa\n' > test-tmp-euc
5 echo abcd | LANG=C tr abcd '\264\301\273\372'  > test-tmp-euc
6                                                         check $? $LINENO
7 # printf '\x8a\xbf\x8e\x9a\n' > test-tmp-sjis
8 echo abcd | LANG=C tr abcd '\212\277\216\232'  > test-tmp-sjis
9                                                         check $? $LINENO
10 # no convert
11 $lha c test-tmp-euc.lzh test-tmp-euc
12                                                         check $? $LINENO
13 # file size is too small, so no compressed
14 $lha v test-tmp-euc.lzh | egrep lh0
15                                                         check $? $LINENO
16 # no convert
17 $lha xw=test-tmp-euc-d test-tmp-euc.lzh
18                                                         check $? $LINENO
19 diff -r test-tmp-euc test-tmp-euc-d/test-tmp-euc
20                                                         check $? $LINENO
21 # sjis to euc
22 $lha xew=test-tmp-unknown-d test-tmp-euc.lzh
23                                                         check $? $LINENO
24 diff -r test-tmp-euc test-tmp-unknown-d/test-tmp-euc 2>/dev/null
25 test $? -ne 0
26                                                         check $? $LINENO
27 diff -r test-tmp-sjis test-tmp-unknown-d/test-tmp-euc 2>/dev/null
28 test $? -ne 0
29                                                         check $? $LINENO
30
31 # euc to sjis (LF to CR LF)
32 $lha ce test-tmp-sjis.lzh test-tmp-euc
33                                                         check $? $LINENO
34 # file size is too small, so no compressed
35 $lha v test-tmp-euc.lzh | egrep lh0
36                                                         check $? $LINENO
37 # no convert (CR LF to LF)
38 $lha xtw=test-tmp-sjis-d test-tmp-sjis.lzh
39                                                         check $? $LINENO
40 diff test-tmp-sjis test-tmp-sjis-d/test-tmp-euc
41                                                         check $? $LINENO
42 # sjis to euc (CR LF to LF)
43 $lha xew=test-tmp-euc-d2 test-tmp-sjis.lzh
44                                                         check $? $LINENO
45 diff test-tmp-euc test-tmp-euc-d2/test-tmp-euc
46                                                         check $? $LINENO
47
48 i=0
49 while ((i < 10))
50 do
51   cat test-tmp-euc
52   ((i = i + 1))
53 done > test-tmp-euc2
54
55 i=0
56 while ((i < 10))
57 do
58   cat test-tmp-sjis
59   ((i = i + 1))
60 done > test-tmp-sjis2
61
62 # no convert
63 $lha c test-tmp-euc2.lzh test-tmp-euc2
64                                                         check $? $LINENO
65 $lha v test-tmp-euc2.lzh | egrep 'lh[567]'
66                                                         check $? $LINENO
67 # no convert
68 $lha xw=test-tmp-euc2-d test-tmp-euc2.lzh
69                                                         check $? $LINENO
70 diff -r test-tmp-euc2 test-tmp-euc2-d/test-tmp-euc2
71                                                         check $? $LINENO
72 # sjis to euc
73 $lha xew=test-tmp-unknown2-d test-tmp-euc2.lzh
74                                                         check $? $LINENO
75 diff -r test-tmp-euc2 test-tmp-unknown2-d/test-tmp-euc2
76 test $? -ne 0
77                                                         check $? $LINENO
78 diff -r test-tmp-sjis2 test-tmp-unknown2-d/test-tmp-euc2 2>/dev/null
79 test $? -ne 0
80                                                         check $? $LINENO
81
82 # euc to sjis (LF to CR LF)
83 $lha ce test-tmp-sjis2.lzh test-tmp-euc2
84                                                         check $? $LINENO
85 $lha v test-tmp-euc2.lzh | egrep 'lh[567]'
86                                                         check $? $LINENO
87 # no convert (CR LF to LF)
88 $lha xtw=test-tmp-sjis2-d test-tmp-sjis2.lzh
89                                                         check $? $LINENO
90 diff test-tmp-sjis2 test-tmp-sjis2-d/test-tmp-euc2
91                                                         check $? $LINENO
92 # sjis to euc (CR LF to LF)
93 $lha xew=test-tmp-euc2-d2 test-tmp-sjis2.lzh
94                                                         check $? $LINENO
95 diff test-tmp-euc2 test-tmp-euc2-d2/test-tmp-euc2
96                                                         check $? $LINENO