#!perl -w use strict; # test functions package main; use Test::More tests => 10; { BEGIN { use_ok('Seq'); } can_ok('Seq', qw/new read concatenate dna2rna print_dna revcom/); my $seq = Seq->new("GCAT"); isa_ok($seq, 'Seq'); # run tests my $seq1 = new Seq("AGCT"); is($seq1->concatenate("GATC")->print_dna,"AGCTGATC\n", 'Test $seq->concatenate()'); is($seq1->revcom()->print_dna,"AGCT\n", 'Test $seq->revcom()'); is($seq1->dna2rna()->print_dna,"AGCU\n",'Test $seq->dna2rna()'); my $seq2 = $seq1->new("TAG"); isa_ok($seq2, 'Seq'); is($seq2->print_dna( ), "TAG\n", '$seq2->print_dna()'); my $data = "CATGCATTAG"; my $filename = "testseq.dna"; open(FILE, "> $filename") || die("open err $filename: $!\n"); print FILE $data; close FILE; my $seq_read = Seq->read($filename); is($seq_read->print_dna( ), $data."\n", 'Test Seq->read(<file>)'); $seq_read = Seq::read Seq($filename); is($seq_read->print_dna( ), $data."\n", 'Test Seq::read Seq(<file>)'); unlink $filename; # successful exit exit (0); }