forked from liblouis/liblouis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlou_compare.pl
executable file
·60 lines (47 loc) · 948 Bytes
/
lou_compare.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/perl
$exe = "lou_compare";
$tmp_pass = "tmp_pass.txt";
$tmp_fail = "tmp_fail.txt";
@percents = ();
if($#ARGV < 1){ die; }
foreach $file (@ARGV)
{
chomp($file);
@output = `./tools/$exe < $file`;
$last = $output[$#output];
chomp($last);
$last =~ /^([0-9\.]+)%/;
print("$file: $1\n");
push(@percents, $1);
open(TMP, ">>:encoding(UCS-2le)", "$tmp_fail");
print(TMP "#######################\n");
print(TMP "$file\n\n");
open(FAIL, "<:encoding(UTF-16)", "fail.txt");
foreach (<FAIL>)
{
print(TMP "$_");
}
close(FAIL);
close(TMP);
open(TMP, ">>", "$tmp_pass");
print(TMP "#######################\n");
print(TMP "$file\n\n");
open(PASS, "<", "pass.txt");
foreach (<PASS>)
{
print(TMP "$_");
}
print(TMP "\n");
close(PASS);
close(TMP);
}
$total = 0;
foreach (@percents)
{
$total += $_;
}
$avg = $total / ($#percents + 1);
print("$avg\n");
`mv $tmp_pass pass.txt`;
`mv $tmp_fail fail.txt`;
__END__