[Bioperl-guts-l] bioperl commit
Heikki Lehvaslaiho
heikki at pub.open-bio.org
Tue Mar 9 06:33:26 EST 2004
heikki
Tue Mar 9 06:33:26 EST 2004
Update of /home/repository/bioperl/bioperl-live/t
In directory pub.open-bio.org:/tmp/cvs-serv18896
Modified Files:
sirna.t
Log Message:
fuller use of the Test module and bioperl conventions
bioperl-live/t sirna.t,1.3,1.4
===================================================================
RCS file: /home/repository/bioperl/bioperl-live/t/sirna.t,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- /home/repository/bioperl/bioperl-live/t/sirna.t 2004/03/09 02:51:11 1.3
+++ /home/repository/bioperl/bioperl-live/t/sirna.t 2004/03/09 11:33:26 1.4
@@ -1,64 +1,62 @@
+# This is -*-Perl-*- code
+## Bioperl Test Harness Script for Modules
+##
+## $Id$
+
+use strict;
+use vars qw($NUMTESTS $DEBUG $ERROR);
+$DEBUG = $ENV{'BIOPERLDEBUG'} || 0;
+BEGIN {
+ # to handle systems with no installed Test module
+ # we include the t dir (where a copy of Test.pm is located)
+ # as a fallback
+ eval { require Test; };
+ $ERROR = 0;
+ if( $@ ) {
+ use lib 't';
+ }
+ use Test;
-use Test;
-
-BEGIN { plan tests => 4 };
+ $NUMTESTS = 7;
+ plan tests => $NUMTESTS;
+}
use Bio::Tools::SiRNA;
use Bio::Seq;
use Bio::SeqIO;
+
# modules compile
-print "ok 1\n";
+ok 1;
my $input = Bio::SeqIO->new( -file => 't/data/NM_002254.gb',
-format => 'Genbank' );
-
my $seq = $input->next_seq;
-my $sirna = Bio::Tools::SiRNA->new( -target => $seq,
- );
+#object creation
+ok my $sirna = Bio::Tools::SiRNA->new( -target => $seq,
+ );
# first test - cds only
- my @pairs = $sirna->design;
-
- print "CDS only: got ",scalar(@pairs),"\n";
-
- if( scalar(@pairs) == 65 ) {
- print "ok 2\n";
- } else {
- print "not ok 2\n";
- }
-
+my @pairs = $sirna->design;
+ok scalar(@pairs), 65, "CDS only: got ". scalar(@pairs) ;
# next test - include 3prime utr
my @feats = $seq->remove_SeqFeatures;
-
foreach my $feat (@feats) {
- $seq->add_SeqFeature($feat) unless
+ $seq->add_SeqFeature($feat) unless
($feat->primary_tag eq 'Target' or $feat->isa('Bio::SeqFeature::SiRNA::Pair'));
}
-$sirna->include_3pr(1);
-
- at pairs2 = $sirna->design;
- print "With 3p UTR: got ",scalar(@pairs2),"\n";
+ok $sirna->include_3pr(1);
+ at pairs = $sirna->design;
+print "With 3p UTR: got ",scalar(@pairs),"\n" if $DEBUG;
+ok scalar(@pairs), 140;
-if( scalar(@pairs2) == 140 ) {
- print "ok 3\n";
-} else {
- print "not ok 3\n";
-}
#third test - naked sequence
my $newseq = Bio::Seq->new( -seq => $seq->seq);
-
-$sirna->target($newseq);
-
- at pairs3 = $sirna->design;
- print "Bare sequence: got ",scalar(@pairs3),"\n";
-
-if( scalar(@pairs3) == 142 ) {
- print "ok 4\n";
-} else {
- print "not ok 4\n";
-}
+ok $sirna->target($newseq);
+ at pairs = $sirna->design;
+print "Bare sequence: got ",scalar(@pairs),"\n" if $DEBUG;
+ok scalar(@pairs), 142;
More information about the Bioperl-guts-l
mailing list