OSDN Git Service

fbe192fa8e837a8e6d0c1b0e295df1044a72f917
[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 od -ct x1 test-tmp-sjis >&2
43 od -ct x1 test-tmp-sjis-d/test-tmp-euc >&2
44 # sjis to euc (CR LF to LF)
45 $lha xew=test-tmp-euc-d2 test-tmp-sjis.lzh
46                                                         check $? $LINENO
47 diff test-tmp-euc test-tmp-euc-d2/test-tmp-euc
48                                                         check $? $LINENO
49 od -ct x1 test-tmp-euc >&2
50 od -ct x1 test-tmp-euc-d2/test-tmp-euc >&2
51
52 i=0
53 while ((i < 10))
54 do
55   cat test-tmp-euc
56   ((i = i + 1))
57 done > test-tmp-euc2
58
59 i=0
60 while ((i < 10))
61 do
62   cat test-tmp-sjis
63   ((i = i + 1))
64 done > test-tmp-sjis2
65
66 # no convert
67 $lha c test-tmp-euc2.lzh test-tmp-euc2
68                                                         check $? $LINENO
69 $lha v test-tmp-euc2.lzh | egrep 'lh[567]'
70                                                         check $? $LINENO
71 # no convert
72 $lha xw=test-tmp-euc2-d test-tmp-euc2.lzh
73                                                         check $? $LINENO
74 diff -r test-tmp-euc2 test-tmp-euc2-d/test-tmp-euc2
75                                                         check $? $LINENO
76 # sjis to euc
77 $lha xew=test-tmp-unknown2-d test-tmp-euc2.lzh
78                                                         check $? $LINENO
79 diff -r test-tmp-euc2 test-tmp-unknown2-d/test-tmp-euc2
80 test $? -ne 0
81                                                         check $? $LINENO
82 diff -r test-tmp-sjis2 test-tmp-unknown2-d/test-tmp-euc2 2>/dev/null
83 test $? -ne 0
84                                                         check $? $LINENO
85
86 # euc to sjis (LF to CR LF)
87 $lha ce test-tmp-sjis2.lzh test-tmp-euc2
88                                                         check $? $LINENO
89 $lha v test-tmp-euc2.lzh | egrep 'lh[567]'
90                                                         check $? $LINENO
91 # no convert (CR LF to LF)
92 $lha xtw=test-tmp-sjis2-d test-tmp-sjis2.lzh
93                                                         check $? $LINENO
94 diff test-tmp-sjis2 test-tmp-sjis2-d/test-tmp-euc2
95                                                         check $? $LINENO
96 # sjis to euc (CR LF to LF)
97 $lha xew=test-tmp-euc2-d2 test-tmp-sjis2.lzh
98                                                         check $? $LINENO
99 diff test-tmp-euc2 test-tmp-euc2-d2/test-tmp-euc2
100                                                         check $? $LINENO