Permalink
Browse files

t/ will not work with make test because server has to be running, cod…

…e does work

svn path=/bioperl-corba-client/trunk/; revision=29
  • Loading branch information...
1 parent 55063ed commit a03537dc0cbfdf90551fe9ceac4592ee1fc4f2d2 @hyphaltip hyphaltip committed Feb 8, 2001
Showing with 67 additions and 67 deletions.
  1. +17 −25 t/Client.t
  2. +20 −42 t/DB.t
  3. +30 −0 t/Seq.t
View
@@ -8,30 +8,22 @@
use Test;
use strict;
+BEGIN { plan tests => 5 }
use Bio::CorbaClient::Client;
+use Bio::SeqIO;
my $ior_file = 'seqdbsrv.ior';
-
-#eval {
- my $client = new Bio::CorbaClient::Client( -idl => 'biocorba.idl',
- -ior => $ior_file,
- -orbname => 'orbit-local-orb');
-
- my $db = $client->new_object('Bio::DB::Biocorba');
-
- my @ids = $db->get_all_primary_ids();
- print STDERR "ids are ", join("\n", @ids), "\n";
-
- my $iter = $db->get_PrimarySeq_stream;
- while( defined(my $seq = $iter->next_primary_seq()) ) {
- print "display id is ", $seq->display_id, " seq is ", $seq->seq, "\n";
- }
-#};
-
-if ($@) {
- print STDERR "test Failed: Make sure a the file $ior_file exists and was created by a running SeqDB server\n";
- print "not ok 2\n";
-} else {
- print "ok 2\n";
-}
-
-
+my $client = new Bio::CorbaClient::Client( -idl => 'biocorba.idl',
+ -ior => $ior_file,
+ -orbname => 'orbit-local-orb');
+
+ok($client);
+my $db = $client->new_object('Bio::DB::Biocorba');
+ok($db);
+my @ids = $db->get_all_primary_ids();
+print STDERR "ids are ", join("\n", @ids), "\n";
+
+my $iter = $db->get_PrimarySeq_stream;
+my $seq = $iter->next_primary_seq();
+ok($seq);
+ok($seq->display_id, '');
+ok($seq->seq, '');
View
62 t/DB.t
@@ -1,60 +1,38 @@
+# -*-Perl-*-
## Bioperl Test Harness Script for Modules
##
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl test.t'
-#-----------------------------------------------------------------------
-## perl test harness expects the following output syntax only!
-## 1..3
-## ok 1 [not ok 1 (if test fails)]
-## 2..3
-## ok 2 [not ok 2 (if test fails)]
-##
-## etc. etc. etc. (continue on for each tested function in the .t file)
-#-----------------------------------------------------------------------
-
-
-## We start with some black magic to print on failure.
-BEGIN { $| = 1; print "1..2\n";
- use vars qw($loaded); }
-
-END {print "not ok 1\n" unless $loaded;}
+use Test;
+use strict;
+BEGIN { plan tests => 2 }
use CORBA::ORBit idl => [ 'biocorba.idl' ];
-use Error;
-$ior_file = "seqdbsrv.ior";
-$orb = CORBA::ORB_init("orbit-local-orb");
-
use Bio::DB::Biocorba;
-$loaded = 1;
-print "ok 1\n"; # 1st test passes.
+use Error;
-## End of black magic.
-##
-## Insert additional test code below but remember to change
-## the print "1..x\n" in the BEGIN block to reflect the
-## total number of tests that will be run.
+my $ior_file = "seqdbsrv.ior";
+my $orb = CORBA::ORB_init("orbit-local-orb");
-eval {
- open(F,"$ior_file") || die "Could not open $ior_file";
- $ior = <F>;
- chomp $ior;
- close(F);
- print STDERR "Got file $ior_file\n";
+open(F,"$ior_file") || die "Could not open $ior_file";
+my $ior = <F>;
+chomp $ior;
+close(F);
+print STDERR "Got file $ior_file\n";
- my $db = new Bio::DB::Biocorba($orb->string_to_object($ior));
- my @ids = $db->get_all_primary_ids();
- print "ids are ", join("\n", @ids), "\n";
+my $db = new Bio::DB::Biocorba($orb->string_to_object($ior));
+my @ids = $db->get_all_primary_ids();
+print "ids are ", join("\n", @ids), "\n";
- my $iter = $db->get_PrimarySeq_stream;
- my $seq;
- while( defined($seq = $iter->next_primary_seq()) ) {
- print "display id is ", $seq->display_id, " seq is ", $seq->seq, "\n";
- }
-};
+my $iter = $db->get_PrimarySeq_stream;
+my $seq;
+while( defined($seq = $iter->next_primary_seq()) ) {
+ print "display id is ", $seq->display_id, " seq is ", $seq->seq, "\n";
+}
if ($@) {
print STDERR "test Failed: Make sure a the file $ior_file exists and was created by a running SeqDB server\n";
View
30 t/Seq.t
@@ -0,0 +1,30 @@
+# -*-Perl-*-
+## Bioperl Test Harness Script for Modules
+##
+
+# Before `make install' is performed this script should be runnable with
+# `make test'. After `make install' it should work as `perl test.t'
+
+use Test;
+use strict;
+BEGIN { plan tests => 3 }
+
+use CORBA::ORBit idl => [ 'biocorba.idl' ];
+use Bio::CorbaClient::PrimarySeq;
+
+my $ior_file = "simpleseq.ior";
+my $orb = CORBA::ORB_init("orbit-local-orb");
+
+open(F,"$ior_file") || die "Could not open $ior_file";
+my $ior = <F>;
+chomp $ior;
+close(F);
+
+my $ref = $orb->string_to_object($ior);
+ok(ref($ref));
+my $seq = Bio::CorbaClient::PrimarySeq->new('-corbaref'=>
+ $ref);
+
+ok($seq);
+ok($seq->display_id, 'HSEARLOBE');
+ok($seq->length, 321);

0 comments on commit a03537d

Please sign in to comment.