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

algo/tests/: Add tests for core/math.cpp

parent 8d259859
#include <core/math.hpp>
void testComputeNbKmers() {
// When all k-mers match, probability of error is 0, thus we return the same
// number of occurrences as in input
TAP_TEST_EQUAL(compute_nb_kmers_limit(10, 100, 109, 99), 100, TEST_MATH_LIMIT_KMERS,"");
TAP_TEST_EQUAL(compute_nb_kmers_limit(10, 100, 109, 90), 100, TEST_MATH_LIMIT_KMERS,"");
TAP_TEST_EQUAL(compute_nb_kmers_limit(10, 100, 109, 95), 100, TEST_MATH_LIMIT_KMERS,"");
TAP_TEST_EQUAL(compute_nb_kmers_limit(10, 100, 109, 999), 100, TEST_MATH_LIMIT_KMERS,"");
TAP_TEST_EQUAL(compute_nb_kmers_limit(10, 10, 109, 999), 0, TEST_MATH_LIMIT_KMERS,"");
TAP_TEST_EQUAL(compute_nb_kmers_limit(10, 1, 109, 999), 0, TEST_MATH_LIMIT_KMERS,"");
TAP_TEST_EQUAL(compute_nb_kmers_limit(10, 20, 109, 999), 7, TEST_MATH_LIMIT_KMERS,"");
}
void testMath() {
testComputeNbKmers();
}
......@@ -16,6 +16,7 @@
#include "testWindowsStorage.cpp"
#include "testReadStorage.cpp"
#include "testAutomaton.cpp"
#include "testMath.cpp"
int main(void) {
TAP_START(NB_TESTS);
......@@ -36,6 +37,7 @@ int main(void) {
testWindowStorage();
testReadStorage();
testAutomaton();
testMath();
TAP_END_TEST_EXIT
}
......@@ -178,6 +178,9 @@ enum {
TEST_BRS_GET_NB_SCORES,
TEST_BRS_GET_BEST_READS,
/* Math */
TEST_MATH_LIMIT_KMERS,
/* Bugs */
TEST_BUG_SEGMENTATION,
TEST_SEGMENT_POSITION,
......@@ -350,6 +353,7 @@ inline void declare_tests() {
RECORD_TAP_TEST(TEST_KMER_REPRESENTATIVE, "Test KmerRepresentativeComputer computations");
RECORD_TAP_TEST(TEST_KMER_REPRESENTATIVE_REQUIRED_SEQ, "Test KmerRepresentativeComputer computations with a required sequence");
RECORD_TAP_TEST(TEST_KMER_REPRESENTATIVE_REVCOMP, "Test KmerRepresentativeComputer computations on a dataset and its revcomp");
RECORD_TAP_TEST(TEST_MATH_LIMIT_KMERS, "Test computation on limit of number of k-mers");
RECORD_TAP_TEST(TEST_KMER_REPRESENTATIVE_QUALITY, "Test KmerRepresentativeComputer quality computations");
RECORD_TAP_TEST(TEST_BUG_SEGMENTATION, "Test segmentation bug");
RECORD_TAP_TEST(TEST_SEGMENT_POSITION, "Test V,D,J position");
......
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