1 # This is -*-Perl-*- code
2 ## Bioperl Test Harness Script for Modules
4 # This test file is adapted from EMBL_DB.t
6 # Before `make install' is performed this script should be runnable with
7 # `make test'. After `make install' it should work as `perl SeqHound_DB.t'
10 use vars qw($NUMTESTS $DEBUG);
11 $DEBUG = $ENV{'BIOPERLDEBUG'} || 0;
19 plan tests => $NUMTESTS;
20 eval { require IO::String;
21 require LWP::UserAgent;
24 for( $Test::ntest..$NUMTESTS ) {
25 skip("IO::String or LWP::UserAgent not installed. This means the Bio::DB::* modules are not usable. Skipping tests",1);
31 foreach ( $Test::ntest..$NUMTESTS) {
32 skip('Unable to run all of the SeqHound_DB tests',1);
34 unlink $Bio::DB::SeqHound::LOGFILENAME if -f $Bio::DB::SeqHound::LOGFILENAME;
41 use Bio::DB::SeqHound;
45 ## End of black magic.
47 ## Insert additional test code below but remember to change
48 ## the print "1..x\n" in the BEGIN block to reflect the
49 ## total number of tests that will be run.
54 $seq = $seqio = undef;
57 $db = new Bio::DB::SeqHound(-verbose=>$verbose);
58 ok(defined($seq = $db->get_Seq_by_acc('J00522')));
59 ok( $seq->length, 408);
60 ok defined ($db->request_format('fasta'));
61 ok(defined($seq = $db->get_Seq_by_acc('NP_862707')));
62 ok( $seq->accession, 'NP_862707');
63 ok( $seq->length, 227);
64 ok( defined($db = new Bio::DB::SeqHound(-verbose=>$verbose,
65 -retrievaltype => 'tempfile')));
66 ok(defined($seqio = $db->get_Stream_by_id(['BTACHRE'])));
67 undef $db; # testing to see if we can remove db
68 ok( defined($seq = $seqio->next_seq()));
69 ok( $seq->length, 1621);
74 warn "Warning: Couldn't connect to SeqHound with Bio::DB::SeqHound.pm!\n$@";
76 foreach ( $Test::ntest..$NUMTESTS) {
77 skip('Skip could not connect to seqhound',1);
82 $seq = $seqio = undef;
85 $db = Bio::DB::SeqHound->new(-verbose => $verbose,
86 -retrievaltype => 'tempfile',
89 ok( defined($seqio = $db->get_Stream_by_acc(['J00522', 'AF303112', 'J02231'])));
90 ok($seqio->next_seq->length, 408);
91 ok($seqio->next_seq->length, 1611);
92 ok($seqio->next_seq->length, 200);
97 warn "Batch access test failed.\nError: $@\n";
99 foreach ( $Test::ntest..$NUMTESTS ) { skip('could not connect to seqhound',1); }