Commit d7006c79 authored by Mathieu Giraud's avatar Mathieu Giraud

tests: use #TAP_TEST_EQUAL in some tests, again

Now with TAP_TEST[(]\([^()&]*[(][^()&]*[)]\)
See #2989.
parent f7c8a087
......@@ -13,29 +13,29 @@ void testAffectAnalyser1() {
string sequence = "AAAACCCCCGGGGG";
KmerAffectAnalyser kaa(*index, sequence);
CountKmerAffectAnalyser ckaa(*index, sequence);
TAP_TEST(ckaa.getAllowedOverlap() == 0, TEST_COUNT_AA_GET_OVERLAP, "");
TAP_TEST_EQUAL(ckaa.getAllowedOverlap(), 0, TEST_COUNT_AA_GET_OVERLAP, "");
ckaa.setAllowedOverlap(k-1);
set<KmerAffect> forbidden;
forbidden.insert(KmerAffect::getAmbiguous());
forbidden.insert(KmerAffect::getUnknown());
TAP_TEST(ckaa.getAllowedOverlap() == k-1, TEST_COUNT_AA_GET_OVERLAP, "");
TAP_TEST(ckaa.getSequence() == "AAAACCCCCGGGGG", TEST_AA_GET_SEQUENCE, "actual: " << ckaa.getSequence());
TAP_TEST_EQUAL(ckaa.getAllowedOverlap(), k-1, TEST_COUNT_AA_GET_OVERLAP, "");
TAP_TEST_EQUAL(ckaa.getSequence(), "AAAACCCCCGGGGG", TEST_AA_GET_SEQUENCE, "actual: " << ckaa.getSequence());
for (int i = 2; i < nb_seq-1; i++) {
// i starts at 2 because AAAA is not found: there is an ambiguity with
// AAAA coming from AAAACAAAACAAAAC or AAAAAAAAAAAAAAA
KmerAffect current_affect(seq[2*i+1], 1, k);
TAP_TEST(kaa.count(current_affect) == 0, TEST_AA_COUNT, "");
TAP_TEST(ckaa.count(current_affect) == 0, TEST_COUNT_AA_COUNT, ckaa.count(current_affect));
TAP_TEST_EQUAL(kaa.count(current_affect), 0, TEST_AA_COUNT, "");
TAP_TEST_EQUAL(ckaa.count(current_affect), 0, TEST_COUNT_AA_COUNT, ckaa.count(current_affect));
TAP_TEST(kaa.first(current_affect) == (int)string::npos, TEST_AA_FIRST, "");
TAP_TEST(kaa.last(current_affect) == (int)string::npos, TEST_AA_LAST, "");
}
for (int i = 0; i < 2; i++) {
KmerAffect current_affect(seq[2*i+1], 1, k);
TAP_TEST(kaa.count(current_affect) == 2, TEST_AA_COUNT, kaa.count(current_affect));
TAP_TEST(ckaa.count(current_affect) == 2, TEST_COUNT_AA_COUNT, ckaa.count(current_affect));
TAP_TEST_EQUAL(kaa.count(current_affect), 2, TEST_AA_COUNT, kaa.count(current_affect));
TAP_TEST_EQUAL(ckaa.count(current_affect), 2, TEST_COUNT_AA_COUNT, ckaa.count(current_affect));
TAP_TEST(kaa.getAffectation(kaa.first(current_affect)) == current_affect, TEST_AA_GET_AFFECT, "");
TAP_TEST(kaa.getAffectation(kaa.last(current_affect)) == current_affect, TEST_AA_GET_AFFECT, "");
}
......@@ -59,51 +59,51 @@ void testAffectAnalyser1() {
KmerAffect cAffect = KmerAffect(seq[1], 1, k);
KmerAffect gAffect = KmerAffect(seq[3], 1, k);
TAP_TEST(ckaa.countBefore(cAffect, 0) == 0, TEST_COUNT_AA_COUNT_BEFORE, "");
TAP_TEST(ckaa.countBefore(gAffect, 0) == 0, TEST_COUNT_AA_COUNT_BEFORE, "");
TAP_TEST(ckaa.countAfter(cAffect, 10) == 0, TEST_COUNT_AA_COUNT_BEFORE, "");
TAP_TEST(ckaa.countAfter(gAffect, 13 - k + 1) == 0, TEST_COUNT_AA_COUNT_BEFORE, "");
TAP_TEST(ckaa.countBefore(cAffect, 7 - k + 1) == 0, TEST_COUNT_AA_COUNT_BEFORE, "");
TAP_TEST(ckaa.countBefore(cAffect, 8 - k + 1) == 1, TEST_COUNT_AA_COUNT_BEFORE, "");
TAP_TEST(ckaa.countAfter(cAffect, 7 - k + 1) == 1, TEST_COUNT_AA_COUNT_AFTER, "");
TAP_TEST(ckaa.countAfter(cAffect, 8 - k + 1) == 0, TEST_COUNT_AA_COUNT_AFTER, "");
TAP_TEST(ckaa.countAfter(gAffect, 7 - k + 1) == 2, TEST_COUNT_AA_COUNT_AFTER, "");
TAP_TEST(ckaa.countAfter(gAffect, 8 - k + 1) == 2, TEST_COUNT_AA_COUNT_AFTER, "");
TAP_TEST(ckaa.countBefore(gAffect, 7 - k + 1) == 0, TEST_COUNT_AA_COUNT_BEFORE, "");
TAP_TEST(ckaa.countBefore(gAffect, 8 - k + 1 ) == 0, TEST_COUNT_AA_COUNT_BEFORE, "");
TAP_TEST(ckaa.countBefore(cAffect, 12 - k + 1) == 2, TEST_COUNT_AA_COUNT_BEFORE, "");
TAP_TEST(ckaa.countBefore(cAffect, 13 - k + 1) == 2, TEST_COUNT_AA_COUNT_BEFORE, "");
TAP_TEST(ckaa.countAfter(cAffect, 12 - k + 1) == 0, TEST_COUNT_AA_COUNT_AFTER, "");
TAP_TEST(ckaa.countAfter(cAffect, 13 - k + 1) == 0, TEST_COUNT_AA_COUNT_AFTER, "");
TAP_TEST(ckaa.countAfter(gAffect, 12 - k + 1) == 1, TEST_COUNT_AA_COUNT_AFTER, "");
TAP_TEST(ckaa.countAfter(gAffect, 13 - k + 1) == 0, TEST_COUNT_AA_COUNT_AFTER, "");
TAP_TEST(ckaa.countBefore(gAffect, 12 - k + 1) == 0, TEST_COUNT_AA_COUNT_BEFORE, "");
TAP_TEST(ckaa.countBefore(gAffect, 13 - k + 1) == 1, TEST_COUNT_AA_COUNT_BEFORE, "");
TAP_TEST(ckaa.firstMax(cAffect, gAffect) == 9 - k + 1, TEST_COUNT_AA_FIRST_MAX, "");
TAP_TEST(ckaa.lastMax(cAffect, gAffect) == 11 - k + 1, TEST_COUNT_AA_LAST_MAX, ckaa.lastMax(cAffect, gAffect));
TAP_TEST_EQUAL(ckaa.countBefore(cAffect, 0), 0, TEST_COUNT_AA_COUNT_BEFORE, "");
TAP_TEST_EQUAL(ckaa.countBefore(gAffect, 0), 0, TEST_COUNT_AA_COUNT_BEFORE, "");
TAP_TEST_EQUAL(ckaa.countAfter(cAffect, 10), 0, TEST_COUNT_AA_COUNT_BEFORE, "");
TAP_TEST_EQUAL(ckaa.countAfter(gAffect, 13 - k + 1), 0, TEST_COUNT_AA_COUNT_BEFORE, "");
TAP_TEST_EQUAL(ckaa.countBefore(cAffect, 7 - k + 1), 0, TEST_COUNT_AA_COUNT_BEFORE, "");
TAP_TEST_EQUAL(ckaa.countBefore(cAffect, 8 - k + 1), 1, TEST_COUNT_AA_COUNT_BEFORE, "");
TAP_TEST_EQUAL(ckaa.countAfter(cAffect, 7 - k + 1), 1, TEST_COUNT_AA_COUNT_AFTER, "");
TAP_TEST_EQUAL(ckaa.countAfter(cAffect, 8 - k + 1), 0, TEST_COUNT_AA_COUNT_AFTER, "");
TAP_TEST_EQUAL(ckaa.countAfter(gAffect, 7 - k + 1), 2, TEST_COUNT_AA_COUNT_AFTER, "");
TAP_TEST_EQUAL(ckaa.countAfter(gAffect, 8 - k + 1), 2, TEST_COUNT_AA_COUNT_AFTER, "");
TAP_TEST_EQUAL(ckaa.countBefore(gAffect, 7 - k + 1), 0, TEST_COUNT_AA_COUNT_BEFORE, "");
TAP_TEST_EQUAL(ckaa.countBefore(gAffect, 8 - k + 1 ), 0, TEST_COUNT_AA_COUNT_BEFORE, "");
TAP_TEST_EQUAL(ckaa.countBefore(cAffect, 12 - k + 1), 2, TEST_COUNT_AA_COUNT_BEFORE, "");
TAP_TEST_EQUAL(ckaa.countBefore(cAffect, 13 - k + 1), 2, TEST_COUNT_AA_COUNT_BEFORE, "");
TAP_TEST_EQUAL(ckaa.countAfter(cAffect, 12 - k + 1), 0, TEST_COUNT_AA_COUNT_AFTER, "");
TAP_TEST_EQUAL(ckaa.countAfter(cAffect, 13 - k + 1), 0, TEST_COUNT_AA_COUNT_AFTER, "");
TAP_TEST_EQUAL(ckaa.countAfter(gAffect, 12 - k + 1), 1, TEST_COUNT_AA_COUNT_AFTER, "");
TAP_TEST_EQUAL(ckaa.countAfter(gAffect, 13 - k + 1), 0, TEST_COUNT_AA_COUNT_AFTER, "");
TAP_TEST_EQUAL(ckaa.countBefore(gAffect, 12 - k + 1), 0, TEST_COUNT_AA_COUNT_BEFORE, "");
TAP_TEST_EQUAL(ckaa.countBefore(gAffect, 13 - k + 1), 1, TEST_COUNT_AA_COUNT_BEFORE, "");
TAP_TEST_EQUAL(ckaa.firstMax(cAffect, gAffect), 9 - k + 1, TEST_COUNT_AA_FIRST_MAX, "");
TAP_TEST_EQUAL(ckaa.lastMax(cAffect, gAffect), 11 - k + 1, TEST_COUNT_AA_LAST_MAX, ckaa.lastMax(cAffect, gAffect));
// Test affectation with two affects that are not in the sequence
KmerAffect aAffect = KmerAffect(seq[5], 1, k);
KmerAffect tAffect = KmerAffect(seq[7], 1, k);
TAP_TEST(ckaa.firstMax(aAffect, tAffect) == -1, TEST_COUNT_AA_FIRST_MAX, "");
TAP_TEST(ckaa.lastMax(aAffect, tAffect) == - 1,
TAP_TEST_EQUAL(ckaa.firstMax(aAffect, tAffect), -1, TEST_COUNT_AA_FIRST_MAX, "");
TAP_TEST_EQUAL(ckaa.lastMax(aAffect, tAffect), - 1,
TEST_COUNT_AA_LAST_MAX, "");
TAP_TEST(ckaa.countAfter(tAffect, 7 - k + 1) == 0, TEST_COUNT_AA_COUNT_AFTER, "");
TAP_TEST(ckaa.countBefore(tAffect, 7 - k + 1) == 0, TEST_COUNT_AA_COUNT_BEFORE, "");
TAP_TEST_EQUAL(ckaa.countAfter(tAffect, 7 - k + 1), 0, TEST_COUNT_AA_COUNT_AFTER, "");
TAP_TEST_EQUAL(ckaa.countBefore(tAffect, 7 - k + 1), 0, TEST_COUNT_AA_COUNT_BEFORE, "");
// Test affectation with one affect not in the sequence
TAP_TEST(ckaa.firstMax(cAffect, tAffect) == -1, TEST_COUNT_AA_FIRST_MAX, "");
TAP_TEST(ckaa.lastMax(cAffect, tAffect) == -1,
TAP_TEST_EQUAL(ckaa.firstMax(cAffect, tAffect), -1, TEST_COUNT_AA_FIRST_MAX, "");
TAP_TEST_EQUAL(ckaa.lastMax(cAffect, tAffect), -1,
TEST_COUNT_AA_LAST_MAX, "");
TAP_TEST(ckaa.firstMax(aAffect, gAffect) == -1, TEST_COUNT_AA_FIRST_MAX, "");
TAP_TEST(ckaa.lastMax(aAffect, gAffect) == -1, TEST_COUNT_AA_LAST_MAX, "");
TAP_TEST_EQUAL(ckaa.firstMax(aAffect, gAffect), -1, TEST_COUNT_AA_FIRST_MAX, "");
TAP_TEST_EQUAL(ckaa.lastMax(aAffect, gAffect), -1, TEST_COUNT_AA_LAST_MAX, "");
delete index;
}
......@@ -122,8 +122,8 @@ void testAffectAnalyser2() {
forbidden.insert(KmerAffect::getAmbiguous());
forbidden.insert(KmerAffect::getUnknown());
TAP_TEST(kaa.getSequence() == "TTTTTGGGGG", TEST_AA_GET_SEQUENCE, "actual: ");
TAP_TEST(ckaa.getSequence() == "TTTTTGGGGG", TEST_AA_GET_SEQUENCE, "actual: " << ckaa.getSequence());
TAP_TEST_EQUAL(kaa.getSequence(), "TTTTTGGGGG", TEST_AA_GET_SEQUENCE, "actual: ");
TAP_TEST_EQUAL(ckaa.getSequence(), "TTTTTGGGGG", TEST_AA_GET_SEQUENCE, "actual: " << ckaa.getSequence());
TAP_TEST(kaa.getAffectation(1) == KmerAffect(seq[2*(nb_seq-1)+1], -1, k), TEST_AA_GET_AFFECT, "");
TAP_TEST(kaa.count(kaa.getAffectation(1)) == 1, TEST_AA_GET_AFFECT, "");
......@@ -218,13 +218,13 @@ void testAffectAnalyserSpaced() {
TAP_TEST(kaa.toString().find("+V _ _ _+C _ _ _ _+G") != string::npos,
TEST_AA_TO_STRING, "");
TAP_TEST(kaa.count(affect_AAAC) == 1, TEST_AA_COUNT, "Expected 1, got " << kaa.count(affect_AAAC) << " in " << __PRETTY_FUNCTION__);
TAP_TEST(kaa.count(affect_CCCC) == 1, TEST_AA_COUNT, "Expected 1, got " << kaa.count(affect_CCCC) << " in " << __PRETTY_FUNCTION__);
TAP_TEST(kaa.count(affect_GGGG) == 1, TEST_AA_COUNT, "Expected 1, got " << kaa.count(affect_GGGG) << " in " << __PRETTY_FUNCTION__);
TAP_TEST_EQUAL(kaa.count(affect_AAAC), 1, TEST_AA_COUNT, "Expected 1, got " << kaa.count(affect_AAAC) << " in " << __PRETTY_FUNCTION__);
TAP_TEST_EQUAL(kaa.count(affect_CCCC), 1, TEST_AA_COUNT, "Expected 1, got " << kaa.count(affect_CCCC) << " in " << __PRETTY_FUNCTION__);
TAP_TEST_EQUAL(kaa.count(affect_GGGG), 1, TEST_AA_COUNT, "Expected 1, got " << kaa.count(affect_GGGG) << " in " << __PRETTY_FUNCTION__);
TAP_TEST(kaa.count(affect_AAAC_bad) == 0, TEST_AA_COUNT, "Expected 0, got " << kaa.count(affect_AAAC_bad) << " in " << __PRETTY_FUNCTION__);
TAP_TEST(kaa.count(affect_CCCC_bad) == 0, TEST_AA_COUNT, "Expected 0, got " << kaa.count(affect_CCCC_bad) << " in " << __PRETTY_FUNCTION__);
TAP_TEST(kaa.count(affect_GGGG_bad) == 0, TEST_AA_COUNT, "Expected 0, got " << kaa.count(affect_GGGG_bad) << " in " << __PRETTY_FUNCTION__);
TAP_TEST_EQUAL(kaa.count(affect_AAAC_bad), 0, TEST_AA_COUNT, "Expected 0, got " << kaa.count(affect_AAAC_bad) << " in " << __PRETTY_FUNCTION__);
TAP_TEST_EQUAL(kaa.count(affect_CCCC_bad), 0, TEST_AA_COUNT, "Expected 0, got " << kaa.count(affect_CCCC_bad) << " in " << __PRETTY_FUNCTION__);
TAP_TEST_EQUAL(kaa.count(affect_GGGG_bad), 0, TEST_AA_COUNT, "Expected 0, got " << kaa.count(affect_GGGG_bad) << " in " << __PRETTY_FUNCTION__);
delete index;
}
......@@ -240,7 +240,7 @@ void testGetMaximum() {
vector<KmerAffect> affectations(a, a+sizeof(a)/sizeof(KmerAffect));
KmerAffectAnalyser kaa(*index, "", affectations);
TAP_TEST(kaa.getSequence() == "", TEST_AA_GET_SEQUENCE, "");
TAP_TEST_EQUAL(kaa.getSequence(), "", TEST_AA_GET_SEQUENCE, "");
affect_infos results = kaa.getMaximum(AFFECT_J_BWD, AFFECT_V_BWD, 2., 0);
TAP_TEST(! results.max_found, TEST_AA_GET_MAXIMUM_MAX_FOUND,
......@@ -353,7 +353,7 @@ void testBugAffectAnalyser() {
index.insert(seqJ, "J");
index.finish_building();
TAP_TEST(data.size() == 2, TEST_FASTA_SIZE,
TAP_TEST_EQUAL(data.size(), 2, TEST_FASTA_SIZE,
"Should have 2 sequences (one seq and its revcomp), "
<< data.size() << " instead");
......
......@@ -61,8 +61,8 @@ void testRCInsertAcAutomaton() {
pointer_state<KmerAffect> *state = aho.goto_state("ACCGT");
TAP_TEST(state->informations.size() == 1, TEST_AC_GET, "");
TAP_TEST(state->informations.front() == AFFECT_AMBIGUOUS, TEST_AC_GET, "");
TAP_TEST_EQUAL(state->informations.size(), 1, TEST_AC_GET, "");
TAP_TEST_EQUAL(state->informations.front(), AFFECT_AMBIGUOUS, TEST_AC_GET, "");
TAP_TEST(state->is_final, TEST_AC_FINAL, "");
TAP_TEST(! aho.goto_state("CAAT")->is_final, TEST_AC_FINAL, "");
......
......@@ -8,16 +8,16 @@ void testAffect() {
Jplus.c |= 1 << 7;
TAP_TEST(affect_strand(Vminus) == -1, TEST_AFFECT_STRAND, "");
TAP_TEST(affect_strand(Vplus) == 1, TEST_AFFECT_STRAND, "");
TAP_TEST_EQUAL(affect_strand(Vminus), -1, TEST_AFFECT_STRAND, "");
TAP_TEST_EQUAL(affect_strand(Vplus), 1, TEST_AFFECT_STRAND, "");
TAP_TEST(affect_length(Vminus) == 1, TEST_AFFECT_LENGTH, "");
TAP_TEST(affect_length(Vplus) == 2, TEST_AFFECT_LENGTH, "");
TAP_TEST(affect_length(Jplus) == 3, TEST_AFFECT_LENGTH, "");
TAP_TEST_EQUAL(affect_length(Vminus), 1, TEST_AFFECT_LENGTH, "");
TAP_TEST_EQUAL(affect_length(Vplus), 2, TEST_AFFECT_LENGTH, "");
TAP_TEST_EQUAL(affect_length(Jplus), 3, TEST_AFFECT_LENGTH, "");
TAP_TEST(affect_char(Vminus) == 'V', TEST_AFFECT_CHAR, "");
TAP_TEST(affect_char(Vplus) == 'V', TEST_AFFECT_CHAR, "");
TAP_TEST(affect_char(Jplus) == 'J', TEST_AFFECT_CHAR, "");
TAP_TEST_EQUAL(affect_char(Vminus), 'V', TEST_AFFECT_CHAR, "");
TAP_TEST_EQUAL(affect_char(Vplus), 'V', TEST_AFFECT_CHAR, "");
TAP_TEST_EQUAL(affect_char(Jplus), 'J', TEST_AFFECT_CHAR, "");
TAP_TEST(! (Vminus == Vplus), TEST_AFFECT_COMPARISON, "");
TAP_TEST(Vminus != Vplus, TEST_AFFECT_COMPARISON, "");
......@@ -54,11 +54,11 @@ void testAffect() {
affect_t ambiguous2 = {AFFECT_AMBIGUOUS_CHAR, 2};
TAP_TEST(ambiguous == ambiguous2, TEST_AFFECT_COMPARISON, "");
TAP_TEST(toString(Vminus) == "-V", TEST_AFFECT_TO_STRING, toString(Vminus));
TAP_TEST(toString(Vplus) == "+V", TEST_AFFECT_TO_STRING, toString(Vplus));
TAP_TEST(toString(Jplus) == "+J", TEST_AFFECT_TO_STRING, toString(Jplus));
TAP_TEST(toString(AFFECT_UNKNOWN.affect) == " " AFFECT_UNKNOWN_SYMBOL, TEST_AFFECT_TO_STRING, "");
TAP_TEST(toString(AFFECT_AMBIGUOUS.affect) == " " AFFECT_AMBIGUOUS_SYMBOL, TEST_AFFECT_TO_STRING, "");
TAP_TEST_EQUAL(toString(Vminus), "-V", TEST_AFFECT_TO_STRING, toString(Vminus));
TAP_TEST_EQUAL(toString(Vplus), "+V", TEST_AFFECT_TO_STRING, toString(Vplus));
TAP_TEST_EQUAL(toString(Jplus), "+J", TEST_AFFECT_TO_STRING, toString(Jplus));
TAP_TEST_EQUAL(toString(AFFECT_UNKNOWN.affect), " " AFFECT_UNKNOWN_SYMBOL, TEST_AFFECT_TO_STRING, "");
TAP_TEST_EQUAL(toString(AFFECT_AMBIGUOUS.affect), " " AFFECT_AMBIGUOUS_SYMBOL, TEST_AFFECT_TO_STRING, "");
ostringstream oss;
oss << Vminus;
......@@ -103,24 +103,24 @@ void testKmerAffectClass() {
KmerAffect unknown;
TAP_TEST(unknown == AFFECT_UNKNOWN, TEST_KMERAFFECT_CONSTRUCTOR, "");
TAP_TEST(unknown.isUnknown(), TEST_KMERAFFECT_UNKNOWN, "");
TAP_TEST(unknown.getStrand() == 0, TEST_KMERAFFECT_STRAND, "");
TAP_TEST(unknown.getLabel() == AFFECT_UNKNOWN_SYMBOL, TEST_KMERAFFECT_LABEL, "");
TAP_TEST_EQUAL(unknown.getStrand(), 0, TEST_KMERAFFECT_STRAND, "");
TAP_TEST_EQUAL(unknown.getLabel(), AFFECT_UNKNOWN_SYMBOL, TEST_KMERAFFECT_LABEL, "");
unknown += KAVm;
TAP_TEST(unknown.affect == KAVm, TEST_KMERAFFECT_ADD, "");
unknown += KAJp;
TAP_TEST(unknown == AFFECT_AMBIGUOUS, TEST_KMERAFFECT_ADD, "");
TAP_TEST(unknown.isAmbiguous(), TEST_KMERAFFECT_AMBIGUOUS, "");
TAP_TEST(unknown.getLabel() == AFFECT_AMBIGUOUS_SYMBOL, TEST_KMERAFFECT_LABEL, "");
TAP_TEST(unknown.getStrand() == 0, TEST_KMERAFFECT_STRAND, "");
TAP_TEST(unknown.getLength() == 4, TEST_KMERAFFECT_AMBIGUOUS, "");
TAP_TEST_EQUAL(unknown.getLabel(), AFFECT_AMBIGUOUS_SYMBOL, TEST_KMERAFFECT_LABEL, "");
TAP_TEST_EQUAL(unknown.getStrand(), 0, TEST_KMERAFFECT_STRAND, "");
TAP_TEST_EQUAL(unknown.getLength(), 4, TEST_KMERAFFECT_AMBIGUOUS, "");
TAP_TEST(KAVp.getStrand() == 1, TEST_KMERAFFECT_STRAND, "");
TAP_TEST(KAVm.getStrand() == -1, TEST_KMERAFFECT_STRAND, "");
TAP_TEST(KAJp.getStrand() == 1, TEST_KMERAFFECT_STRAND, "");
TAP_TEST_EQUAL(KAVp.getStrand(), 1, TEST_KMERAFFECT_STRAND, "");
TAP_TEST_EQUAL(KAVm.getStrand(), -1, TEST_KMERAFFECT_STRAND, "");
TAP_TEST_EQUAL(KAJp.getStrand(), 1, TEST_KMERAFFECT_STRAND, "");
TAP_TEST(KAVp.getLabel() == "V", TEST_KMERAFFECT_LABEL, "");
TAP_TEST(KAVm.getLabel() == "V", TEST_KMERAFFECT_LABEL, "");
TAP_TEST(KAJp.getLabel() == "J", TEST_KMERAFFECT_LABEL, "");
TAP_TEST_EQUAL(KAVp.getLabel(), "V", TEST_KMERAFFECT_LABEL, "");
TAP_TEST_EQUAL(KAVm.getLabel(), "V", TEST_KMERAFFECT_LABEL, "");
TAP_TEST_EQUAL(KAJp.getLabel(), "J", TEST_KMERAFFECT_LABEL, "");
ostringstream ossKA, ossA;
ossKA << KAVp;
......
......@@ -7,17 +7,17 @@ void testBinReadStorage() {
reads.init(3, 10, scorer);
reads.setMaxNbReadsStored(3);
TAP_TEST(reads.scoreToBin(0) == 0, TEST_BRS_SCORE_TO_BIN, "");
TAP_TEST(reads.scoreToBin(2) == 0, TEST_BRS_SCORE_TO_BIN, "");
TAP_TEST(reads.scoreToBin(10) == 2, TEST_BRS_SCORE_TO_BIN, "");
TAP_TEST(reads.scoreToBin(11) == 3, TEST_BRS_SCORE_TO_BIN, "");
TAP_TEST(reads.scoreToBin(5) == 1, TEST_BRS_SCORE_TO_BIN, "");
TAP_TEST_EQUAL(reads.scoreToBin(0), 0, TEST_BRS_SCORE_TO_BIN, "");
TAP_TEST_EQUAL(reads.scoreToBin(2), 0, TEST_BRS_SCORE_TO_BIN, "");
TAP_TEST_EQUAL(reads.scoreToBin(10), 2, TEST_BRS_SCORE_TO_BIN, "");
TAP_TEST_EQUAL(reads.scoreToBin(11), 3, TEST_BRS_SCORE_TO_BIN, "");
TAP_TEST_EQUAL(reads.scoreToBin(5), 1, TEST_BRS_SCORE_TO_BIN, "");
Sequence seq1 = {"label", "l", "GAGAG", "", NULL, 0};
reads.add(seq1);
TAP_TEST_EQUAL(reads.smallest_bin_not_empty, 1, TEST_BRS_SBNE, "");
TAP_TEST(reads.getNbInserted() == 1, TEST_BRS_GET_NB_INSERTED, "");
TAP_TEST(reads.getNbStored() == 1, TEST_BRS_GET_NB_STORED, "");
TAP_TEST_EQUAL(reads.getNbInserted(), 1, TEST_BRS_GET_NB_INSERTED, "");
TAP_TEST_EQUAL(reads.getNbStored(), 1, TEST_BRS_GET_NB_STORED, "");
TAP_TEST(reads.getScoreBySeq(seq1) == 5
&& reads.getScoreByScore(5.) == 5
&& reads.getScore(1) == 5, TEST_BRS_GET_SCORE, "");
......@@ -25,20 +25,20 @@ void testBinReadStorage() {
Sequence seq2 = {"label2", "l2", "GA", "", NULL, 0};
reads.add(seq2);
TAP_TEST_EQUAL(reads.smallest_bin_not_empty, 0, TEST_BRS_SBNE, "");
TAP_TEST(reads.getNbInserted() == 2, TEST_BRS_GET_NB_INSERTED, "");
TAP_TEST(reads.getNbStored() == 2, TEST_BRS_GET_NB_STORED, "");
TAP_TEST_EQUAL(reads.getNbInserted(), 2, TEST_BRS_GET_NB_INSERTED, "");
TAP_TEST_EQUAL(reads.getNbStored(), 2, TEST_BRS_GET_NB_STORED, "");
TAP_TEST(reads.getScoreBySeq(seq2) == 2
&& reads.getScoreByScore(2.) == 2
&& reads.getScore(0) == 2, TEST_BRS_GET_SCORE, "");
TAP_TEST(reads.getScore() == 7, TEST_BRS_GET_SCORE, "");
TAP_TEST(reads.getAverageScore() == 3.5, TEST_BRS_GET_AVG_SCORE, "");
TAP_TEST_EQUAL(reads.getScore(), 7, TEST_BRS_GET_SCORE, "");
TAP_TEST_EQUAL(reads.getAverageScore(), 3.5, TEST_BRS_GET_AVG_SCORE, "");
Sequence seq3 = {"label3", "l3", "GGAGACAGTA", "", NULL, 0};
reads.add(seq3);
TAP_TEST_EQUAL(reads.smallest_bin_not_empty, 0, TEST_BRS_SBNE, "");
TAP_TEST(reads.getNbInserted() == 3, TEST_BRS_GET_NB_INSERTED, "");
TAP_TEST(reads.getNbStored() == 3, TEST_BRS_GET_NB_STORED, "");
TAP_TEST_EQUAL(reads.getNbInserted(), 3, TEST_BRS_GET_NB_INSERTED, "");
TAP_TEST_EQUAL(reads.getNbStored(), 3, TEST_BRS_GET_NB_STORED, "");
TAP_TEST(reads.getScoreBySeq(seq3) == 10
&& reads.getScoreByScore(10.) == 10
&& reads.getScore(2) == 10, TEST_BRS_GET_SCORE, "");
......@@ -46,44 +46,44 @@ void testBinReadStorage() {
Sequence seq4 = {"label4", "l4", "AGAGACAGTA", "", NULL, 0};
reads.add(seq4);
TAP_TEST_EQUAL(reads.smallest_bin_not_empty, 1, TEST_BRS_SBNE, "");
TAP_TEST(reads.getNbInserted() == 4, TEST_BRS_GET_NB_INSERTED, "");
TAP_TEST(reads.getNbStored() == 3, TEST_BRS_GET_NB_STORED, "");
TAP_TEST(reads.bins[0].size() == 0, TEST_BRS_ADD, "");
TAP_TEST(reads.bins[1].size() == 1, TEST_BRS_ADD, "");
TAP_TEST(reads.bins[2].size() == 2, TEST_BRS_ADD, "");
TAP_TEST(reads.bins[3].size() == 0, TEST_BRS_ADD, "");
TAP_TEST_EQUAL(reads.getNbInserted(), 4, TEST_BRS_GET_NB_INSERTED, "");
TAP_TEST_EQUAL(reads.getNbStored(), 3, TEST_BRS_GET_NB_STORED, "");
TAP_TEST_EQUAL(reads.bins[0].size(), 0, TEST_BRS_ADD, "");
TAP_TEST_EQUAL(reads.bins[1].size(), 1, TEST_BRS_ADD, "");
TAP_TEST_EQUAL(reads.bins[2].size(), 2, TEST_BRS_ADD, "");
TAP_TEST_EQUAL(reads.bins[3].size(), 0, TEST_BRS_ADD, "");
TAP_TEST(reads.getScoreBySeq(seq4) == 20
&& reads.getScoreByScore(10.) == 20
&& reads.getScore(2) == 20, TEST_BRS_GET_SCORE, "");
TAP_TEST(reads.getAverageScoreBySeq(seq4) == 10, TEST_BRS_GET_AVG_SCORE, "");
TAP_TEST_EQUAL(reads.getAverageScoreBySeq(seq4), 10, TEST_BRS_GET_AVG_SCORE, "");
Sequence seq5 = {"label5", "l5", "AATAAGAGTGAGACAGTA", "", NULL, 0};
reads.add(seq5);
TAP_TEST_EQUAL(reads.smallest_bin_not_empty, 2, TEST_BRS_SBNE, "");
TAP_TEST(reads.getNbInserted() == 5, TEST_BRS_GET_NB_INSERTED, "");
TAP_TEST(reads.getNbStored() == 3, TEST_BRS_GET_NB_STORED, "");
TAP_TEST(reads.bins[0].size() == 0, TEST_BRS_ADD, "");
TAP_TEST(reads.bins[1].size() == 0, TEST_BRS_ADD, "");
TAP_TEST(reads.bins[2].size() == 2, TEST_BRS_ADD, "");
TAP_TEST(reads.bins[3].size() == 1, TEST_BRS_ADD, "");
TAP_TEST_EQUAL(reads.getNbInserted(), 5, TEST_BRS_GET_NB_INSERTED, "");
TAP_TEST_EQUAL(reads.getNbStored(), 3, TEST_BRS_GET_NB_STORED, "");
TAP_TEST_EQUAL(reads.bins[0].size(), 0, TEST_BRS_ADD, "");
TAP_TEST_EQUAL(reads.bins[1].size(), 0, TEST_BRS_ADD, "");
TAP_TEST_EQUAL(reads.bins[2].size(), 2, TEST_BRS_ADD, "");
TAP_TEST_EQUAL(reads.bins[3].size(), 1, TEST_BRS_ADD, "");
TAP_TEST(reads.getScoreBySeq(seq5) == seq5.sequence.length()
&& reads.getScoreByScore(18.) == seq5.sequence.length()
&& reads.getScore(3) == seq5.sequence.length(), TEST_BRS_GET_SCORE, "");
TAP_TEST(reads.getAverageScore() == 9, TEST_BRS_GET_AVG_SCORE, "");
TAP_TEST_EQUAL(reads.getAverageScore(), 9, TEST_BRS_GET_AVG_SCORE, "");
reads.add(seq2);
TAP_TEST_EQUAL(reads.smallest_bin_not_empty, 2, TEST_BRS_SBNE, "");
TAP_TEST(reads.getNbInserted() == 6, TEST_BRS_GET_NB_INSERTED, "");
TAP_TEST(reads.getNbStored() == 3, TEST_BRS_GET_NB_STORED, "");
TAP_TEST(reads.getScoreBySeq(seq2) == 4, TEST_BRS_GET_SCORE, "");
TAP_TEST_EQUAL(reads.getNbInserted(), 6, TEST_BRS_GET_NB_INSERTED, "");
TAP_TEST_EQUAL(reads.getNbStored(), 3, TEST_BRS_GET_NB_STORED, "");
TAP_TEST_EQUAL(reads.getScoreBySeq(seq2), 4, TEST_BRS_GET_SCORE, "");
TAP_TEST((int) (reads.getAverageScore()*10) == 78, TEST_BRS_GET_AVG_SCORE, reads.getAverageScore());
TAP_TEST(reads.getNbScores() == 6, TEST_BRS_GET_NB_SCORES, "");
TAP_TEST(reads.getNbScores(0) == 2, TEST_BRS_GET_NB_SCORES, "");
TAP_TEST(reads.getNbScores(1) == 1, TEST_BRS_GET_NB_SCORES, "");
TAP_TEST(reads.getNbScores(2) == 2, TEST_BRS_GET_NB_SCORES, "");
TAP_TEST(reads.getNbScores(3) == 1, TEST_BRS_GET_NB_SCORES, "");
TAP_TEST_EQUAL(reads.getNbScores(), 6, TEST_BRS_GET_NB_SCORES, "");
TAP_TEST_EQUAL(reads.getNbScores(0), 2, TEST_BRS_GET_NB_SCORES, "");
TAP_TEST_EQUAL(reads.getNbScores(1), 1, TEST_BRS_GET_NB_SCORES, "");
TAP_TEST_EQUAL(reads.getNbScores(2), 2, TEST_BRS_GET_NB_SCORES, "");
TAP_TEST_EQUAL(reads.getNbScores(3), 1, TEST_BRS_GET_NB_SCORES, "");
list<Sequence> sequences = reads.getReads();
list<Sequence>::iterator it = sequences.begin();
......@@ -92,17 +92,17 @@ void testBinReadStorage() {
TAP_TEST_EQUAL(it->sequence, "AGAGACAGTA", TEST_BRS_GET_READS, "");
it++;
TAP_TEST_EQUAL(it->sequence, "AATAAGAGTGAGACAGTA", TEST_BRS_GET_READS, "");
TAP_TEST(sequences.size() == 3, TEST_BRS_GET_READS, "");
TAP_TEST_EQUAL(sequences.size(), 3, TEST_BRS_GET_READS, "");
sequences = reads.getBestReads(1);
TAP_TEST(sequences.begin()->sequence == "AATAAGAGTGAGACAGTA", TEST_BRS_GET_BEST_READS, "");
sequences = reads.getBestReads(3);
TAP_TEST(sequences.size() == 3, TEST_BRS_GET_BEST_READS, "");
TAP_TEST_EQUAL(sequences.size(), 3, TEST_BRS_GET_BEST_READS, "");
sequences = reads.getBestReads(3, 15);
TAP_TEST(sequences.size() == 1, TEST_BRS_GET_BEST_READS, "");
TAP_TEST_EQUAL(sequences.size(), 1, TEST_BRS_GET_BEST_READS, "");
TAP_TEST(sequences.begin()->sequence == "AATAAGAGTGAGACAGTA", TEST_BRS_GET_BEST_READS, "");
delete scorer;
......
......@@ -17,19 +17,19 @@ void testRepresentative() {
Sequence representative = krc.getRepresentative();
// Seq3 is the longest it should be taken when performing 0 extra iteration
TAP_TEST(representative.label.find("seq3-[37,73]") == 0, TEST_KMER_REPRESENTATIVE,
TAP_TEST_EQUAL(representative.label.find("seq3-[37,73]"), 0, TEST_KMER_REPRESENTATIVE,
"If we take the first representative we should have seq3, and not at the beginning (" << representative.label << " instead)");
krc.setStabilityLimit(1);
krc.compute();
representative = krc.getRepresentative();
TAP_TEST(representative.label.find("seq3-[37,73]") == 0, TEST_KMER_REPRESENTATIVE,
TAP_TEST_EQUAL(representative.label.find("seq3-[37,73]"), 0, TEST_KMER_REPRESENTATIVE,
"When allowing one step before stability, we should still have seq3 (" << representative.label << " instead)");
krc.setStabilityLimit(2);
krc.compute();
representative = krc.getRepresentative();
TAP_TEST(representative.label.find("seq1-[0,41]") == 0, TEST_KMER_REPRESENTATIVE,
TAP_TEST_EQUAL(representative.label.find("seq1-[0,41]"), 0, TEST_KMER_REPRESENTATIVE,
"When allowing two steps before stability, we should reach seq1 (" << representative.label << " instead)");
krc.setRevcomp(true);
......@@ -37,7 +37,7 @@ void testRepresentative() {
krc.compute();
representative = krc.getRepresentative();
string quality = krc.getQuality();
TAP_TEST(representative.label.find("seq2-[33,52]") == 0, TEST_KMER_REPRESENTATIVE_REQUIRED_SEQ,
TAP_TEST_EQUAL(representative.label.find("seq2-[33,52]"), 0, TEST_KMER_REPRESENTATIVE_REQUIRED_SEQ,
"When requiring sequence ATCGCGCCCT, we should have seq2 (" << representative.label << " instead)");
TAP_TEST(representative.sequence.length() == quality.length() ,TEST_KMER_REPRESENTATIVE_QUALITY,
......
......@@ -23,7 +23,7 @@ void testLongest() {
TEST_SAMPLER_LENGTH, "");
char id = '1';
TAP_TEST(l1.size() == 6, TEST_SAMPLER_LONGEST, "");
TAP_TEST_EQUAL(l1.size(), 6, TEST_SAMPLER_LONGEST, "");
for (list<Sequence>::const_iterator it = l1.begin(); it != l1.end(); it++) {
TAP_TEST(it->label[3] == id, TEST_SAMPLER_LONGEST, "");
id++;
......@@ -39,10 +39,10 @@ void testLongest() {
&& distrib[5] == 1 && distrib[6] == 1 && distrib[7] == 1 && distrib[8] == 1
&& distrib[9] == 2, TEST_SAMPLER_LENGTH, "");
TAP_TEST(l1.size() == 2, TEST_SAMPLER_LONGEST, "");
TAP_TEST_EQUAL(l1.size(), 2, TEST_SAMPLER_LONGEST, "");
TAP_TEST(l1.front().sequence.size() == 9, TEST_SAMPLER_LONGEST, "");
Sequence next = *(++l1.begin());
TAP_TEST(next.sequence.size() == 10, TEST_SAMPLER_LONGEST, "label = " << next.label);
TAP_TEST_EQUAL(next.sequence.size(), 10, TEST_SAMPLER_LONGEST, "label = " << next.label);
}
// Generate 10 sequences, and launch 10 times getRandom(1).
......
......@@ -5,15 +5,15 @@ void testScore() {
ReadLengthScore rls;
Sequence seq1 = {"seq", "seq", "", "", NULL, 0};
TAP_TEST(rls.getScore(seq1) == 0., TEST_LENGTH_SCORE,
TAP_TEST_EQUAL(rls.getScore(seq1), 0., TEST_LENGTH_SCORE,
"score should be 0, is " << rls.getScore(seq1));
Sequence seq2 = {"seq", "seq", "ATCGTTTACGTC", "", NULL, 0};
TAP_TEST(rls.getScore(seq2) == 12., TEST_LENGTH_SCORE,
TAP_TEST_EQUAL(rls.getScore(seq2), 12., TEST_LENGTH_SCORE,
"score should be 12, is " << rls.getScore(seq2));
Sequence seq3 = {"seq", "seq", "A", "", NULL, 0};
TAP_TEST(rls.getScore(seq3) == 1., TEST_LENGTH_SCORE,
TAP_TEST_EQUAL(rls.getScore(seq3), 1., TEST_LENGTH_SCORE,
"score should be 1, is " << rls.getScore(seq3));
......@@ -37,7 +37,7 @@ void testScore() {
// Quality does not exist anymore → the score is the length
seq4.quality = "";
TAP_TEST(rqs.getScore(seq4) == 120, TEST_QUALITY_SCORE,
TAP_TEST_EQUAL(rqs.getScore(seq4), 120, TEST_QUALITY_SCORE,
"score should be 120 not " << rqs.getScore(seq4));
}
......@@ -35,7 +35,7 @@ void testOverlap()
TAP_TEST_EQUAL(box_C->del_left, 1, TEST_FINE_SEGMENT_OVERLAP, "number of trim nucleotides : " << box_C);
TAP_TEST_EQUAL(box_A->end, 6, TEST_FINE_SEGMENT_OVERLAP, "end position of left region : " << box_A);
TAP_TEST(box_A->getLength() == 7, TEST_FINE_SEGMENT_OVERLAP, "length of left region : " << box_A->getLength());
TAP_TEST_EQUAL(box_A->getLength(), 7, TEST_FINE_SEGMENT_OVERLAP, "length of left region : " << box_A->getLength());
TAP_TEST_EQUAL(box_C->start, 7, TEST_FINE_SEGMENT_OVERLAP, "start position of right region : " << box_C);
delete box_A;
......@@ -152,80 +152,80 @@ void testSegmentationCause(IndexTypes index) {
if (data.read(i).label == "seq-seg+") {
TAP_TEST(ks.isSegmented(), TEST_KMER_IS_SEGMENTED, "seq is " << data.label(i));
TAP_TEST(ks.getSegmentationStatus() == SEG_PLUS, TEST_KMER_SEGMENTATION_CAUSE, ks.getInfoLineWithAffects());
TAP_TEST_EQUAL(ks.getSegmentationStatus(), SEG_PLUS, TEST_KMER_SEGMENTATION_CAUSE, ks.getInfoLineWithAffects());
TAP_TEST(ks.getJunction(30) == "GCCACCTGGGACAGGGAATTATTATAAGAA"
|| ks.getJunction(30) == "TGCCACCTGGGACAGGGAATTATTATAAGA",
TEST_KMER_JUNCTION, ks.getInfoLineWithAffects());
TAP_TEST(ks.getLeft() == 17, TEST_KMER_LEFT, "left = " << ks.getLeft());
TAP_TEST(ks.getRight() == 18, TEST_KMER_RIGHT, "right = " << ks.getRight());
TAP_TEST_EQUAL(ks.getLeft(), 17, TEST_KMER_LEFT, "left = " << ks.getLeft());
TAP_TEST_EQUAL(ks.getRight(), 18, TEST_KMER_RIGHT, "right = " << ks.getRight());
ks.setSegmentationStatus(NOT_PROCESSED);
TAP_TEST(! ks.isSegmented(), TEST_SET_SEGMENTATION_CAUSE, ks.getInfoLineWithAffects());
TAP_TEST(ks.getSegmentationStatus() == NOT_PROCESSED, TEST_SET_SEGMENTATION_CAUSE, ks.getInfoLineWithAffects());
TAP_TEST_EQUAL(ks.getSegmentationStatus(), NOT_PROCESSED, TEST_SET_SEGMENTATION_CAUSE, ks.getInfoLineWithAffects());
ks.setSegmentationStatus(SEG_PLUS);
TAP_TEST(ks.isSegmented(), TEST_SET_SEGMENTATION_CAUSE, ks.getInfoLineWithAffects());
TAP_TEST(ks.getSegmentationStatus(), TEST_SET_SEGMENTATION_CAUSE, ks.getInfoLineWithAffects());
nb_checked++;
} else if (data.read(i).label == "seq-seg-") {
TAP_TEST(ks.isSegmented(), TEST_KMER_IS_SEGMENTED, ks.getInfoLineWithAffects());
TAP_TEST(ks.getSegmentationStatus() == SEG_MINUS, TEST_KMER_SEGMENTATION_CAUSE, ks.getInfoLineWithAffects());
TAP_TEST_EQUAL(ks.getSegmentationStatus(), SEG_MINUS, TEST_KMER_SEGMENTATION_CAUSE, ks.getInfoLineWithAffects());
TAP_TEST(ks.getJunction(30) == "GCCACCTGGGACAGGGAATTATTATAAGAA"
|| ks.getJunction(30) == "TGCCACCTGGGACAGGGAATTATTATAAGA",
TEST_KMER_JUNCTION, ks.getInfoLineWithAffects());
TAP_TEST(ks.getLeft() == 17, TEST_KMER_LEFT, "left = " << ks.getLeft());
TAP_TEST(ks.getRight() == 18, TEST_KMER_RIGHT, "right = " << ks.getRight());
TAP_TEST_EQUAL(ks.getLeft(), 17, TEST_KMER_LEFT, "left = " << ks.getLeft());
TAP_TEST_EQUAL(ks.getRight(), 18, TEST_KMER_RIGHT, "right = " << ks.getRight());
nb_checked++;
} else if (data.read(i).label == "seq-short") {
TAP_TEST(! ks.isSegmented(), TEST_KMER_IS_SEGMENTED, ks.getInfoLineWithAffects());