OSDN Git Service

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