OSDN Git Service

Merge pull request #11 from yoheie/fix_path_compare
[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 # sjis to euc (CR LF to LF)
56 $lha xew=test-tmp-euc-d2 test-tmp-sjis.lzh
57                                                         check $? $LINENO
58 diff test-tmp-euc test-tmp-euc-d2/test-tmp-euc
59                                                         check $? $LINENO
60
61 i=0
62 while ((i < 10))
63 do
64   cat test-tmp-euc
65   ((i = i + 1))
66 done > test-tmp-euc2
67
68 i=0
69 while ((i < 10))
70 do
71   cat test-tmp-sjis
72   ((i = i + 1))
73 done > test-tmp-sjis2
74
75 # no convert
76 $lha c test-tmp-euc2.lzh test-tmp-euc2
77                                                         check $? $LINENO
78 $lha v test-tmp-euc2.lzh | egrep 'lh[567]'
79                                                         check $? $LINENO
80 # no convert
81 $lha xw=test-tmp-euc2-d test-tmp-euc2.lzh
82                                                         check $? $LINENO
83 diff -r test-tmp-euc2 test-tmp-euc2-d/test-tmp-euc2
84                                                         check $? $LINENO
85 # sjis to euc
86 $lha xew=test-tmp-unknown2-d test-tmp-euc2.lzh
87                                                         check $? $LINENO
88 diff -r test-tmp-euc2 test-tmp-unknown2-d/test-tmp-euc2
89 test $? -ne 0
90                                                         check $? $LINENO
91 diff -r test-tmp-sjis2 test-tmp-unknown2-d/test-tmp-euc2 2>/dev/null
92 test $? -ne 0
93                                                         check $? $LINENO
94
95 # euc to sjis (LF to CR LF)
96 $lha ce test-tmp-sjis2.lzh test-tmp-euc2
97                                                         check $? $LINENO
98 $lha v test-tmp-euc2.lzh | egrep 'lh[567]'
99                                                         check $? $LINENO
100 # no convert (CR LF to LF)
101 $lha xtw=test-tmp-sjis2-d test-tmp-sjis2.lzh
102                                                         check $? $LINENO
103 diff test-tmp-sjis2 test-tmp-sjis2-d/test-tmp-euc2
104                                                         check $? $LINENO
105 # sjis to euc (CR LF to LF)
106 $lha xew=test-tmp-euc2-d2 test-tmp-sjis2.lzh
107                                                         check $? $LINENO
108 diff test-tmp-euc2 test-tmp-euc2-d2/test-tmp-euc2
109                                                         check $? $LINENO