1 # -*-Perl-*- Test Harness script for Bioperl
10 test_begin(-tests => 26,
11 -requires_modules => ['Text::Wrap 98', 'XML::Writer']);
13 use_ok('Bio::Variation::IO');
17 my ($t_file, $o_file, $out_format) = @_;
20 my ($o_ext) = $out_format eq 'flat' ? 'dat' : 'xml';
21 my ($o_format) = $out_format;
22 my ($t_name) = $t_file =~ /(.*)....$/;
28 open(BEFORE, "$t_name.$o_ext") || die "couldn't open $t_name.$o_ext\n";;
33 ok $before;#"Error in reading input file [$t_name.$o_ext]";
35 my $in = Bio::Variation::IO->new( -file => $t_file);
37 while (my $e = $in->next) {
40 my $count = scalar @entries;
41 cmp_ok @entries, '>', 0;# "No SeqDiff objects [$count]";
43 my $out = Bio::Variation::IO->new( -FILE => ">$o_file",
44 -FORMAT => $o_format);
46 foreach my $e (@entries) {
47 $out->write($e) or $out_ok = 0;
49 undef($out); # Flush to disk
50 ok $out_ok;# "error writing variants";
61 ok $after;# "Error in reading in again the output file [$o_file]";
62 is $before, $after, "test output file compared to input";
63 print STDERR `diff $t_file $o_file` if $before ne $after;
66 io (test_input_file('mutations.dat'),
67 test_output_file(), 'flat'); #1..5
68 io (test_input_file('polymorphism.dat'),
69 test_output_file(), 'flat'); #6..10
72 test_skip(-tests => 15, -requires_modules => [qw(XML::Twig
77 if( $XML::Writer::VERSION >= 0.5 ) {
78 io (test_input_file('mutations.xml'),
79 test_output_file(), 'xml'); #10..12
81 io (test_input_file('mutations.old.xml'),
82 test_output_file(), 'xml'); #10..12
87 if( $XML::Writer::VERSION >= 0.5 ) {
88 io (test_input_file('polymorphism.xml'),
89 test_output_file(), 'xml'); #13..14
91 io (test_input_file('polymorphism.old.xml'),
92 test_output_file(), 'xml'); #13..14
98 if( $XML::Writer::VERSION >= 0.5 ) {
99 io (test_input_file('mutations.dat'),
100 test_output_file(), 'xml'); #15..25
102 io (test_input_file('mutations.old.dat'),
103 test_output_file(), 'xml'); #15..25