def init_system
sleep 1
$sp.print("echo off \r")
+ print("DBG i: " + "echo off \r"+"\n") if $debug
# line = $sp.readlines()
# print("DBG 0.0: ")
# print(line)
# sleep 1
$sp.print("shavs_set #{$algo_select} \r")
+ print("DBG i: " + "shavs_set #{$algo_select} \r"+"\n") if $debug
# line = $sp.readlines()
# print("DBG 0.1: ")
# print(line)
# sleep 1
$sp.print("shavs_test1 \r")
+ print("DBG i: " + "shavs_test1 \r"+"\n") if $debug
# line = $sp.readlines()
# print("DBG 0.2: ")
# print(line)
def send_md(md_string)
for i in 0..md_string.length-1
$sp.print(md_string[i].chr)
-# print(md_string[i].chr)
+# print("DBG s: "+ md_string[i].chr) if $debug
if(i%20==19)
- sleep(0.1)
+ sleep(0.01)
end
end
end
def run_test(filename)
errors = 0
+ line=1
if not File.exist?(filename)
puts("ERROR file "+filename+" does not exist!")
end
b = (/[\s]*MD[\s]*=[\s]*([0-9a-fA-F]*).*/.match(avr_md))[1];
a.upcase!
b.upcase!
- puts("") if (pos%$linewidth==0 and $linewidth!=0)
+ printf("\n%4d (%4d): ", line, (line-1)*$linewidth) if (pos%$linewidth==0 and $linewidth!=0)
+ line += 1 if (pos%$linewidth==0 and $linewidth!=0)
#putc((a==b)?'*':'!')
if(a==b)
putc('*')
else
putc('!')
+ # printf("\nshould: %s\ngot: %s\n",lb,avr_md)
errors += 1;
end
pos += 1
for i in (5..(ARGV.size-1))
errors = run_test(ARGV[i])
if errors == 0
- puts("[ok]")
+ puts("\n[ok]")
else
- puts("[errors: "+errors.to_s+"]")
+ puts("\n[errors: "+errors.to_s+"]")
end
end
$sp.print("EXIT\r");