Commit 62c605ba authored by Mathieu Giraud's avatar Mathieu Giraud

tests: CountKmerAffectAnalyser::max12() / max()

parent 31ebe495
......@@ -154,6 +154,41 @@ void testAffectAnalyser2() {
delete index;
}
template<template <class> class T>
void testAffectAnalyserMaxes() {
const int k = 4;
const bool revcomp = false;
T<KmerAffect> *index = createIndex<T<KmerAffect> >(k, revcomp);
string sequence = "ACCCCAGGGGGA";
CountKmerAffectAnalyser ckaa(*index, sequence);
KmerAffect cAffect = KmerAffect("C", 1);
KmerAffect gAffect = KmerAffect("G", 1);
set<KmerAffect> forbidden;
forbidden.insert(KmerAffect::getAmbiguous());
forbidden.insert(KmerAffect::getUnknown());
TAP_TEST(ckaa.max(forbidden) == gAffect, TEST_COUNT_AA_MAX, "max is " << ckaa.max(forbidden));
TAP_TEST(ckaa.max12(forbidden).first == gAffect, TEST_COUNT_AA_MAX12, "max1 is " << ckaa.max12(forbidden).first);
TAP_TEST(ckaa.max12(forbidden).second == cAffect, TEST_COUNT_AA_MAX12, "max2 is " << ckaa.max12(forbidden).second);
forbidden.insert(gAffect);
TAP_TEST(ckaa.max(forbidden) == cAffect, TEST_COUNT_AA_MAX, "max is " << ckaa.max(forbidden));
TAP_TEST(ckaa.max12(forbidden).first == cAffect, TEST_COUNT_AA_MAX12, "max1 is " << ckaa.max12(forbidden).first);
TAP_TEST(ckaa.max12(forbidden).second == KmerAffect::getUnknown(), TEST_COUNT_AA_MAX12, "max2 is " << ckaa.max12(forbidden).second);
forbidden.insert(cAffect);
TAP_TEST(ckaa.max(forbidden) == KmerAffect::getUnknown(), TEST_COUNT_AA_MAX, "max is " << ckaa.max(forbidden));
TAP_TEST(ckaa.max12(forbidden).first == KmerAffect::getUnknown(), TEST_COUNT_AA_MAX12, "max1 is " << ckaa.max12(forbidden).first);
TAP_TEST(ckaa.max12(forbidden).second == KmerAffect::getUnknown(), TEST_COUNT_AA_MAX12, "max2 is " << ckaa.max12(forbidden).second);
delete index;
}
template<template <class> class T>
void testGetMaximum() {
const int k = 4;
......@@ -330,6 +365,7 @@ void testAffectAnalyser() {
testAffectAnalyser1<ArrayKmerStore>();
testAffectAnalyser2<ArrayKmerStore>();
testAffectAnalyserMaxes<ArrayKmerStore>();
testBugAffectAnalyser<ArrayKmerStore>();
testGetMaximum<ArrayKmerStore>();
}
......@@ -74,6 +74,7 @@ enum {
TEST_COUNT_AA_FIRST_MAX,
TEST_COUNT_AA_LAST_MAX,
TEST_COUNT_AA_MAX,
TEST_COUNT_AA_MAX12,
/* Cluster */
TEST_CLUSTER,
......@@ -193,6 +194,7 @@ inline void declare_tests() {
RECORD_TAP_TEST(TEST_COUNT_AA_FIRST_MAX, "CountKmerAffectAnalyser::firstMax");
RECORD_TAP_TEST(TEST_COUNT_AA_LAST_MAX, "CountKmerAffectAnalyser::lastMax");
RECORD_TAP_TEST(TEST_COUNT_AA_MAX, "CountKmerAffectAnalyser::max");
RECORD_TAP_TEST(TEST_COUNT_AA_MAX12, "CountKmerAffectAnalyser::max12");
RECORD_TAP_TEST(TEST_CLUSTER, "Test automatic clusterisation");
......
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