Changeset 122 for util/title_testharness
- Timestamp:
- 10/23/06 00:25:16 (7 years ago)
- Files:
-
- 1 modified
-
util/title_testharness (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
util/title_testharness
r121 r122 32 32 'show_matches' => \$opt->{show_matches}, 33 33 'test=s' => \$opt->{test}, 34 'compare=s' => \$opt->{compare}, 34 35 'help' => \$opt->{help}); 35 36 36 37 printf "tiele-matching test harness\n"; 37 if (($opt->{help}) || (!defined $opt->{test}) && (!defined $opt->{create}) ) {38 if (($opt->{help}) || (!defined $opt->{test}) && (!defined $opt->{create}) && !defined $opt->{compare} ) { 38 39 print " usage:\n". 39 40 "\t$0 --create (title_file) [FILE(s)]\n". … … 51 52 52 53 @ARGV = ('-') if not @ARGV; 53 54 $opt->{test} = $opt->{compare} if ($opt->{compare}); 54 55 &create_programme_lineup($opt->{create}) if ($opt->{create}); 55 56 &test_algorithms($opt->{test}) if ($opt->{test}); … … 201 202 } 202 203 204 &test_alg() if ($opt->{compare}); 205 203 206 printf STDERR "\n"; 204 207 printf STDERR "to see details on matches, use the --show_matches option.\n" unless $opt->{show_matches}; … … 215 218 my $alg_start = [gettimeofday]; 216 219 220 my ($al1, $al2); 221 if ($opt->{compare} and $opt->{compare} =~ /(.*),(.*)/) { 222 if ($algorithms{$1} and $algorithms{$2}) { 223 ($al1, $al2) = ($1, $2); 224 print "Comparing $al1 to $al2.\n"; 225 } 226 } 227 217 228 foreach my $timeslot (0..$#{$prog_lineup}) { 218 229 foreach my $source (0..$datafile_num) { … … 232 243 foreach my $prog1 (@c1) { 233 244 foreach my $prog2 (@c2) { 234 if ($algorithms{$alg}->($prog1,$prog2)) { 245 246 # No point comparing the same string, is there? 247 next if ($prog1 eq $prog2); 248 249 if ($al1 and $al2) { 250 my $m1 = $algorithms{$al1}->($prog1,$prog2); 251 my $m2 = $algorithms{$al2}->($prog1,$prog2); 252 if ($m1 != $m2) { 253 print "\"$prog1\" vs \"$prog2\": $al1 says " . 254 ($m1 ? "MATCH" : "NON-MATCH") . 255 " and $al2 says " . 256 ($m2 ? "MATCH" : "NON-MATCH") . 257 ".\n"; 258 } 259 } 260 else { 261 if ($algorithms{$alg}->($prog1,$prog2)) { 235 262 printf "algorithm $alg said '$prog1' and '$prog2' DO match\n" if ($opt->{show_matches}); 236 263 $matches++; 237 } else {264 } else { 238 265 printf "algorithm $alg said '$prog1' and '$prog2' don't match\n" if ($opt->{show_non_matches}); 239 266 $non_matches++; 267 } 240 268 } 241 269 }
