#!perl -w use strict; # test functions in SeqFun.pm =head1 EXAMPLES perl t/seqfun.t =cut package main; use Test::More tests => 5; # 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"); my @lines = show_eg(`podselect -s "EXAMPLES" $0`); my @answer = ("\n", " perl t/seqfun.t\n"); is_deeply(\@lines, \@answer, 'Test show_eg(`podselect -s "EXAMPLES" $0`)'); is(print_dna("gcat"), "gcat\n", 'print_dna("gcat")'); # 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"); # successful exit exit (0); }