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
|
# Swissknife Test Harness Script for fullparse
#
# Purpose:
# After a full parse, the output file should be identical
# to the input.
# * Test loading
BEGIN {
$| = 1; print "1..2\n";
use vars qw($loaded);
$^W = 0;
}
END {print "not ok 1\n" unless $loaded;}
$loaded = 1;
print "ok 1\n"; # 1st test passes.
sub test ($$;$) {
my($num, $true,$msg) = @_;
print($true ? "ok $num\n" : "not ok $num $msg\n");
}
my $where = -d 't' ? "t/" : "";
my $testin = "${where}identity.txl";
my $testout = "${where}identity.txl.out";
my $expectedout = "${where}identity.txl.expected";
open (IN, $testin);
open (OUT, ">$testout");
use SWISS::Entry;
# Read an entire record at a time
$/ = "\/\/\n";
while (<IN>){
# Read the entry
$entry = SWISS::Entry->fromText($_);
$entry->reformat;
$entry->DRs->update();
$entry->SQs->update();
print OUT $entry->toText;
}
close IN;
close OUT;
print "checking expected output...\n";
test 2, system('diff', $testout, $expectedout) == 0, "diff $testout $expectedout";
|