Commit 849f02e3 authored by Cyprien Borée's avatar Cyprien Borée

adapt unit-tests/testReadStorage.cpp

for more informations see #3393.
parent f71b8bf0
Pipeline #35240 failed with stages
in 14 minutes and 6 seconds
......@@ -9,13 +9,13 @@ void testBinReadStorage() {
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, "");
TAP_TEST_EQUAL(reads.scoreToBin(10), 0, TEST_BRS_SCORE_TO_BIN, "");
TAP_TEST_EQUAL(reads.scoreToBin(11), 0, TEST_BRS_SCORE_TO_BIN, "");
TAP_TEST_EQUAL(reads.scoreToBin(5), 0, TEST_BRS_SCORE_TO_BIN, "");
Sequence seq1 = {"label", "l", "GAGAG", "", 0};
reads.add(seq1);
TAP_TEST_EQUAL(reads.smallest_bin_not_empty, 1, TEST_BRS_SBNE, "");
TAP_TEST_EQUAL(reads.smallest_bin_not_empty, 0, TEST_BRS_SBNE, "");
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
......@@ -27,9 +27,9 @@ void testBinReadStorage() {
TAP_TEST_EQUAL(reads.smallest_bin_not_empty, 0, TEST_BRS_SBNE, "");
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_EQUAL(reads.getScoreBySeq(seq2), 7, TEST_BRS_GET_NB_STORED, "");
TAP_TEST_EQUAL(reads.getScoreByScore(2.), 7, TEST_BRS_GET_NB_STORED, "");
TAP_TEST_EQUAL(reads.getScore(0), 7, TEST_BRS_GET_NB_STORED, "");
TAP_TEST_EQUAL(reads.getScore(), 7, TEST_BRS_GET_SCORE, "");
TAP_TEST_EQUAL(reads.getAverageScore(), 3.5, TEST_BRS_GET_AVG_SCORE, "");
......@@ -39,57 +39,57 @@ void testBinReadStorage() {
TAP_TEST_EQUAL(reads.smallest_bin_not_empty, 0, TEST_BRS_SBNE, "");
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, "");
TAP_TEST_EQUAL(reads.getScoreBySeq(seq3), 17, TEST_BRS_GET_NB_STORED, "");
TAP_TEST_EQUAL(reads.getScoreByScore(10.), 17, TEST_BRS_GET_NB_STORED, "");
TAP_TEST_EQUAL(reads.getScore(2), 17, TEST_BRS_GET_SCORE, "");
Sequence seq4 = {"label4", "l4", "AGAGACAGTA", "", 0};
reads.add(seq4);
  • Je suis ok pour les modifications ci-dessus (à part celles sur les scores où je n'ai pas vérifié).

    En revanche en dessous, cela me pose plus question. Tu es dans le cas où getNbStored() < getNbInserted() et donc on est dans le cas où tu as fait appel à reallocate. On devrait donc avoir exactement le même comportement avant ta modification et après ta modification. Je ne vois pas ce qui peut expliquer que, par exemple, on ne retrouve pas le même nombre de séquences dans les mêmes bins.

Please register or sign in to reply
TAP_TEST_EQUAL(reads.smallest_bin_not_empty, 1, TEST_BRS_SBNE, "");
TAP_TEST_EQUAL(reads.smallest_bin_not_empty, 0, TEST_BRS_SBNE, "");
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[0].size(), 1, 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[2].size(), 1, 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_EQUAL(reads.getScoreBySeq(seq4), 10, TEST_BRS_ADD, "");
TAP_TEST_EQUAL(reads.getScoreByScore(10.), 10, TEST_BRS_ADD, "");
TAP_TEST_EQUAL(reads.getScore(2), 10, TEST_BRS_GET_SCORE, "");
TAP_TEST_EQUAL(reads.getAverageScoreBySeq(seq4), 10, TEST_BRS_GET_AVG_SCORE, "");
Sequence seq5 = {"label5", "l5", "AATAAGAGTGAGACAGTA", "", 0};
reads.add(seq5);
TAP_TEST_EQUAL(reads.smallest_bin_not_empty, 2, TEST_BRS_SBNE, "");
TAP_TEST_EQUAL(reads.smallest_bin_not_empty, 1, TEST_BRS_SBNE, "");
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[1].size(), 1, TEST_BRS_ADD, "");
TAP_TEST_EQUAL(reads.bins[2].size(), 1, 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_EQUAL(reads.getAverageScore(), 9, TEST_BRS_GET_AVG_SCORE, "");
TAP_TEST_EQUAL(reads.getAverageScore(), 4.375, TEST_BRS_GET_AVG_SCORE, "");
reads.add(seq2);
TAP_TEST_EQUAL(reads.smallest_bin_not_empty, 2, TEST_BRS_SBNE, "");
TAP_TEST_EQUAL(reads.smallest_bin_not_empty, 1, TEST_BRS_SBNE, "");
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_EQUAL((int) (reads.getAverageScore()*10), 41, TEST_BRS_GET_AVG_SCORE, reads.getAverageScore());
TAP_TEST_EQUAL(reads.getNbScores(), 6, TEST_BRS_GET_NB_SCORES, "");
TAP_TEST_EQUAL(reads.getNbScores(), 9, 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(2), 1, 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();
TAP_TEST_EQUAL(it->sequence, "GGAGACAGTA", TEST_BRS_GET_READS, "");
TAP_TEST_EQUAL(it->sequence, "GAGAG", TEST_BRS_GET_READS, "");
it++;
TAP_TEST_EQUAL(it->sequence, "AGAGACAGTA", TEST_BRS_GET_READS, "");
TAP_TEST_EQUAL(it->sequence, "GGAGACAGTA", TEST_BRS_GET_READS, "");
it++;
TAP_TEST_EQUAL(it->sequence, "AATAAGAGTGAGACAGTA", TEST_BRS_GET_READS, "");
TAP_TEST_EQUAL(sequences.size(), 3, TEST_BRS_GET_READS, "");
......
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