added bio::ext support
[bioperl-live.git] / t / Fasta.t
blobe7cc97725e0a1b93218f91612cc444b7e3830b64
1 ## Bioperl Test Harness Script for Modules
2 ## $Id$
4 # Before `make install' is performed this script should be runnable with
5 # `make test'. After `make install' it should work as `perl test.t'
7 #-----------------------------------------------------------------------
8 # Test script for Bio::Tools::Fasta.pm
9 # Steve A. Chervitz, sac@neomorphic.com
10 # Fairly rudimentary.
11 # Strategy for this test was borrowed from L. Stein's BoulderIO package.
13 ## perl test harness expects the following output syntax only!
14 ## 1..3
15 ## ok 1  [not ok 1 (if test fails)]
16 ## 2..3
17 ## ok 2  [not ok 2 (if test fails)]
18 ## 3..3
19 ## ok 3  [not ok 3 (if test fails)]
21 ## etc. etc. etc. (continue on for each tested function in the .t file)
22 #-----------------------------------------------------------------------
24 ## We start with some black magic to print on failure.
25 BEGIN { $| = 1; print "1..5\n"; }
26 END {print "not ok 1\n" unless $loaded;}
28 use lib '../';
29 use Bio::Tools::Fasta;
31 $loaded = 1;
32 print "ok 1\n";    # 1st test passes.
34 sub test ($$;$) {
35     my($num, $true,$msg) = @_;
36     print($true ? "ok $num\n" : "not ok $num $msg\n");
39 my @seqs;
41 test 2, $fasta = new Bio::Tools::Fasta (-file => 't/seqs.fas',
42                                         -seqs => 1,
43                                         -save_array => \@seqs,
44                                         -parse => 1,
45                                         -edit_id => 1,
46                                        );
48 test 3, scalar(@seqs) == 6, "Number of seqs = ${\scalar(@seqs)}";
50 test 4, $fasta->num_seqs == 6, "Number of seqs = ${\$fasta->num_seqs}";
52 print "First sequence:\n";
54 test 5, print $seqs[0]->layout('fasta');