Commit b188d4bb authored by Mikaël Salson's avatar Mikaël Salson

Tests: Test OnlineFasta

parent 1e61c363
...@@ -2,6 +2,29 @@ ...@@ -2,6 +2,29 @@
#include <core/fasta.h> #include <core/fasta.h>
#include "tests.h" #include "tests.h"
void testOnlineFasta1() {
OnlineFasta fa("../../data/test1.fa");
OnlineFasta fq("../../data/test1.fq");
int nb_seq = 0;
TAP_TEST(fa.getLineNb() == 1, TEST_O_FASTA_LINE_NB, "");
TAP_TEST(fq.getLineNb() == 1, TEST_O_FASTA_LINE_NB, "");
while (fa.hasNext()) {
TAP_TEST(fq.hasNext(), TEST_O_FASTA_HAS_NEXT, "");
fa.next();
fq.next();
Sequence s1 = fa.getSequence();
Sequence s2 = fq.getSequence();
TAP_TEST(s1.label == s2.label && s1.label_full == s2.label_full
&& s1.sequence == s2.sequence, TEST_O_FASTA_GET_SEQUENCE, "fa: " << fa.getSequence() << endl << "fq: " << fq.getSequence());
nb_seq++;
}
TAP_TEST(fq.getLineNb() == 20, TEST_O_FASTA_LINE_NB, "");
TAP_TEST(! fq.hasNext(), TEST_O_FASTA_HAS_NEXT, "");
TAP_TEST(nb_seq == 5, TEST_O_FASTA_HAS_NEXT, "");
}
void testFasta1() { void testFasta1() {
Fasta fa("../../data/test1.fa"); Fasta fa("../../data/test1.fa");
Fasta fq("../../data/test1.fq"); Fasta fq("../../data/test1.fq");
...@@ -123,6 +146,7 @@ void testExtractBasename() { ...@@ -123,6 +146,7 @@ void testExtractBasename() {
} }
void testTools() { void testTools() {
testOnlineFasta1();
testFasta1(); testFasta1();
testRevcomp(); testRevcomp();
testCreateSequence(); testCreateSequence();
......
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
enum { enum {
/* Tools tests */ /* Tools tests */
TEST_REVCOMP, TEST_REVCOMP,
TEST_O_FASTA_HAS_NEXT,
TEST_O_FASTA_GET_SEQUENCE,
TEST_O_FASTA_LINE_NB,
TEST_FASTA_SIZE, TEST_FASTA_SIZE,
TEST_FASTA_LABEL, TEST_FASTA_LABEL,
TEST_FASTA_LABEL_FULL, TEST_FASTA_LABEL_FULL,
...@@ -101,6 +104,9 @@ enum { ...@@ -101,6 +104,9 @@ enum {
inline void declare_tests() { inline void declare_tests() {
RECORD_TAP_TEST(TEST_REVCOMP, "revcomp"); RECORD_TAP_TEST(TEST_REVCOMP, "revcomp");
RECORD_TAP_TEST(TEST_O_FASTA_HAS_NEXT, "OnlineFasta hasNext()");
RECORD_TAP_TEST(TEST_O_FASTA_GET_SEQUENCE, "OnlineFasta next()");
RECORD_TAP_TEST(TEST_O_FASTA_LINE_NB, "OnlineFasta getLineNb()");
RECORD_TAP_TEST(TEST_FASTA_SIZE, "Fasta/Fastq size"); RECORD_TAP_TEST(TEST_FASTA_SIZE, "Fasta/Fastq size");
RECORD_TAP_TEST(TEST_FASTA_LABEL, "Fasta/Fastq label"); RECORD_TAP_TEST(TEST_FASTA_LABEL, "Fasta/Fastq label");
RECORD_TAP_TEST(TEST_FASTA_LABEL_FULL, "Fasta/Fastq full label"); RECORD_TAP_TEST(TEST_FASTA_LABEL_FULL, "Fasta/Fastq full label");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment