OSDN Git Service

should not add signed operand to unsigned
[lha/olha.git] / randtest / randtest.rb
1 ary = [8, 16, 32, 64]
2
3 begin
4   ary.each {|v|
5     file = "seq_rand#{v}k_seq.bin"
6     begin
7       lzh  = "rand#{v}k.lzh"
8       system("cat seq.bin rand#{v}k.bin seq.bin > #{file}")
9
10       puts "creating..."
11       case :olha7
12       when :jlha5 then system("jlha a -o5 #{lzh} #{file}")
13       when :jlha6 then system("jlha a -o6 #{lzh} #{file}")
14       when :jlha7 then system("jlha a -o7 #{lzh} #{file}")
15       when :lha5  then system("lha c -o5 #{lzh} #{file}")
16       when :lha6  then system("lha c -o6 #{lzh} #{file}")
17       when :lha7  then system("lha c -o7 #{lzh} #{file}")
18       when :olha5 then system("olha c -o5 #{lzh} #{file}")
19       when :olha6 then system("olha c -o6 #{lzh} #{file}")
20       when :olha7 then system("olha c -o7 #{lzh} #{file}")
21       else raise
22       end
23
24       puts "testing..."
25       system("lha t #{lzh} > /dev/null")
26       raise "error #{"%x" % $?.to_i}" if $?.to_i > 0
27       system("lha vvq #{lzh} >> tmp")
28
29       puts "extracting..."
30       File.rename(file, file + ".tmp")
31       system("olha x #{lzh}")
32       raise "error #{"%x" % $?.to_i}" if $?.to_i > 0
33
34       puts "comparing..."
35       system("cmp %s %s" % [file, file + ".tmp"])
36       raise if $?.to_i > 0
37
38     ensure
39       File.unlink(file) rescue nil
40       File.unlink(file + ".tmp") rescue nil
41     end
42   }
43
44   puts "---- result ---"
45   puts File.read("tmp")
46 ensure
47   File.unlink("tmp") rescue nil
48 end