8 test_begin(-tests => 18);
10 use_ok('Bio::Tools::Run::Alignment::Amap');
16 # Things to do right at the very end, just
17 # when the interpreter finishes/exits
18 # E.g. deleting intermediate files produced during the test
19 foreach my $file ( qw(cysprot.dnd cysprot1a.dnd mlc) ) {
24 # if we got to here, thats OK!
25 # is this really needed?
26 #ok( 1, 'All the required modules are present');
28 # setup input files etc
29 my $inputfilename = test_input_file("cysprot.fa");
30 ok( -e $inputfilename, 'Found input file' );
32 # setup output files etc
35 # setup global objects that are to be used in more than one test
36 # Also test they were initialised correctly
38 my $factory = Bio::Tools::Run::Alignment::Amap->new(@params);
39 isa_ok( $factory, 'Bio::Tools::Run::Alignment::Amap');
41 # test factory default values
42 is( $factory->program_dir, undef, 'program_dir returned correct default' );
43 is( $factory->error_string, '', 'error_string returned correct default' );
44 is( $factory->aformat, 'fasta', 'aformat returned correct default' );
45 is( $factory->outfile_name, 'mlc', 'outfile_name returned correct default' );
47 # Now onto the nitty gritty tests of the modules methods
48 is( $factory->program_name(), 'amap', 'Correct exe default name' );
50 # block of tests to skip if you know the tests will fail
51 # under some condition. E.g.:
52 # Need network access,
53 # Wont work on particular OS,
54 # Cant find the exectuable
55 # DO NOT just skip tests that seem to fail for an unknown reason
58 # condition used to skip this block of tests
59 #skip($why, $how_many_in_block);
60 test_skip(-requires_executable => $factory,
63 # test all factory methods that depend on the executable
64 # TODO: isnt( $factory->program_dir, undef, 'program found in ENV variable' );
65 ok( $factory->version >= 2.0, 'Correct minimum program version' );
67 # test execution using filename
68 my $aln = $factory->align($inputfilename);
70 # now test the factory error methods etc
71 is( $factory->error_string, '', 'No error occured' );
72 isnt( $factory->outfile_name, undef, 'outfile_name returned something' );
75 isa_ok( $aln, 'Bio::SimpleAlign');
76 is( $aln->num_sequences, 7, 'Correct number of seqs returned' );
78 # test execution using an array of Seq objects
79 my $str = Bio::SeqIO->new(
80 '-file' => $inputfilename,
84 while ( my $seq = $str->next_seq() ) {
85 push (@seq_array, $seq) ;
87 $aln = $factory->align(\@seq_array);
89 isa_ok( $aln, 'Bio::SimpleAlign');
90 is( $aln->num_sequences, 7, 'Correct number of seqs returned' );
92 # Use this alignment to fully test the methods
93 is( int($aln->average_percentage_identity), 45, 'Got the correct ave % identity' );
97 # TODO: test factory methods that change parameters
99 # local $TODO = 'program_name setting is unfinished';
100 # $factory->program_name('something_silly');
101 # is( $factory->program_name, 'something_silly', 'Set and got program_name correctly') ;