#!perl -w use strict; # test functions package main; use Test::More tests => 6; # use SeqFun qw/:all/; { BEGIN { use_ok('SeqFun', qw/:all/); } # set up data my $sequence = "throwawayslurp.data"; my $data = ' AGCTAGCTCATCATCATCATTAGBAGDADTATGAGCGCAAAAAAAA BADBADGGGGCCCCATATATATATATATATAAAAAAAAAAAAAAAA '; open(FILE, "> $sequence") or die("Unable to write: $sequence: $!"); print FILE $data; close(FILE); # run tests my $slurp = slurp($sequence); is($$slurp,$data,"Test data written with data read by slurp"); # Clean up any test files unlink($sequence) or die("Unable to delete $sequence: $!"); my $text = count($sequence,$slurp); # note the use of tab as \t and newline as \n # These are hard to spot in testing # I let the test tell me the answers: # is($text,"tell me", "Test of counts and output"); is($text,"throwawayslurp.data:\tA=45 C=12 G=11 T=17 errors=7\n", "Test of counts and output"); my $dna1 = "AGCT"; my $dna2 = "GATC"; is(concatenate($dna1,$dna2),"AGCTGATC",'Test concatenate( )'); is(revcom($dna1),"AGCT",'Test revcom( )'); is(dna2rna($dna1),"AGCU",'Test dna2rna( )'); # successful exit exit (0); }