Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions t/simple.t
Original file line number Diff line number Diff line change
@@ -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=<S>;
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");
}

12 changes: 12 additions & 0 deletions t/test1.fq
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@1 CLIP IS AGTCCCGTAC AT >=
ATATGCTACGTTTGTGACCTAGTCCCGTAC
+
hhhhhhhhhhhhhhhhhhhhhhhffgffaa
@2 CLIP AGTCCCGTAC + AAAA's
ATGTTCGTATATGAGCAGTCCCGTACAAAA
+
hhbhhhhhhhhhhhhhhhhhhhhfffffaa
@3 CLIP JUST AGTCC
TATAGCCTCTAGCTTGACTCTAGCTAGTCC
+
hhhhhhhhhhhhhhhhhhhhhhfffffaaa
12 changes: 12 additions & 0 deletions t/test2.fq
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@1 a b c; ; ;=<
ATATGCTACGTTTGTGACCTAGTCCCGTAC
+
hhhhhhhhhhhhhhhhhhhhhhhffgffaa
@2 a b c
ATGTTCGTATATGAGCAGTCCCGTACAAAA
+
hhbhhhhhhhhhhhhhhhhhhhhfffffhh
@3 a b c
TATAGCCTCTAGCTTGACTCTAGCTAGTCC
+
hhhhhhhhhhhhhhhhhhhhhhfffffhhh