From 73b87a66aeb59de08cad0db92d37334a6cfcf9f2 Mon Sep 17 00:00:00 2001 From: Erik Aronesty Date: Mon, 12 May 2014 11:25:28 -0400 Subject: [PATCH 1/2] add simple tests --- t/simple.t | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ t/test1.fq | 12 ++++++++++++ t/test2.fq | 12 ++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 t/simple.t create mode 100644 t/test1.fq create mode 100644 t/test2.fq diff --git a/t/simple.t b/t/simple.t new file mode 100644 index 0000000..84a075a --- /dev/null +++ b/t/simple.t @@ -0,0 +1,54 @@ +#!/usr/bin/perl + +use strict; +use Test::More tests=>20; +use File::Basename; +use File::Spec; + +chdir(dirname(__FILE__)); + +# set of very simple tests to check options and fastq i/o +my $dsrc=File::Spec->catfile("..", "bin", "dsrc"); + +for my $m (qw(m0 m1)) { +for my $f (qw(test1 test2)) { + + # remove prev out, if any + unlink "$f-$m.fq.out.dz", "$f-$m.fq.out"; + + # ****5 tests per loop***** + + + # standard test + sys("$dsrc c -m$m $f.fq $f-$m.fq.out.dz", "compress $m $f"); + sys("$dsrc d $f-$m.fq.out.dz $f-$m.fq.out", "decompress $m $f"); + same("$f.fq", "$f-$m.fq.out"); + + # stream decompress + sys("$dsrc d -s $f-$m.fq.out.dz > $f-$m-s.fq.out", "decompress stream $m $f"); + same("$f.fq", "$f-$m-s.fq.out"); +} +} + +sub sys { + if (!ok(!system($_[0]), $_[1])) { + diag($_[0]); + } +} + +sub slurp { + my ($f) = @_; + local $/= undef; + open S, $f; + my $r=; + close S; + return $r; +} + +sub same { + my ($f1, $f2) = @_; + my $r1=slurp($f1); + my $r2=slurp($f2); + ok($r1 && $r2 && ($r1 eq $r2), "$f1 = $f2"); +} + diff --git a/t/test1.fq b/t/test1.fq new file mode 100644 index 0000000..12a15ca --- /dev/null +++ b/t/test1.fq @@ -0,0 +1,12 @@ +@1 CLIP IS AGTCCCGTAC AT >= +ATATGCTACGTTTGTGACCTAGTCCCGTAC ++ +hhhhhhhhhhhhhhhhhhhhhhhffgffaa +@2 CLIP AGTCCCGTAC + AAAA's +ATGTTCGTATATGAGCAGTCCCGTACAAAA ++ +hhbhhhhhhhhhhhhhhhhhhhhfffffaa +@3 CLIP JUST AGTCC +TATAGCCTCTAGCTTGACTCTAGCTAGTCC ++ +hhhhhhhhhhhhhhhhhhhhhhfffffaaa diff --git a/t/test2.fq b/t/test2.fq new file mode 100644 index 0000000..04ef3df --- /dev/null +++ b/t/test2.fq @@ -0,0 +1,12 @@ +@1 CLIP IS AGTCCCGTAC AT END +ATATGCTACGTTTGTGACCTAGTCCCGTAC ++ +hhhhhhhhhhhhhhhhhhhhhhhffgffaa +@2 CLIP AGTCCCGTAC + AAAAs +ATGTTCGTATATGAGCAGTCCCGTACAAAA ++ +hhbhhhhhhhhhhhhhhhhhhhhfffffhh +@3 CLIP JUST AGTCC +TATAGCCTCTAGCTTGACTCTAGCTAGTCC ++ +hhhhhhhhhhhhhhhhhhhhhhfffffhhh From 6c99a6c4773c8d202961d0c4b6b1324543d01435 Mon Sep 17 00:00:00 2001 From: Erik Aronesty Date: Wed, 13 Aug 2014 12:05:34 -0400 Subject: [PATCH 2/2] t2 --- t/test2.fq | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/t/test2.fq b/t/test2.fq index 04ef3df..fce79c8 100644 --- a/t/test2.fq +++ b/t/test2.fq @@ -1,12 +1,12 @@ -@1 CLIP IS AGTCCCGTAC AT END +@1 a b c; ; ;=< ATATGCTACGTTTGTGACCTAGTCCCGTAC + hhhhhhhhhhhhhhhhhhhhhhhffgffaa -@2 CLIP AGTCCCGTAC + AAAAs +@2 a b c ATGTTCGTATATGAGCAGTCCCGTACAAAA + hhbhhhhhhhhhhhhhhhhhhhhfffffhh -@3 CLIP JUST AGTCC +@3 a b c TATAGCCTCTAGCTTGACTCTAGCTAGTCC + hhhhhhhhhhhhhhhhhhhhhhfffffhhh