diff --git a/src/unit_test_math_utils.cpp b/src/unit_test_math_utils.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..a549c4137a4edbfc07c963ae772740139ae27c64
--- /dev/null
+++ b/src/unit_test_math_utils.cpp
@@ -0,0 +1,85 @@
+/*
+ * unit_test_math_utils.cpp
+ *
+ * Created on: 7 mai 2021
+ * Author: vlegrand
+ */
+#include <iostream>
+#include <cassert>
+#include <cmath>
+#include "math_utils.h"
+
+using namespace std;
+
+void test_getCollisionProba() {
+ float p=getCollisionProba(2,5000000000,UINT_MAX,2);
+ assert(round(p*10000)==127);
+ p=getCollisionProba(2,5000000000,UINT_MAX,1);
+ assert(p=0.1128);
+ p =getCollisionProba(1,2,UINT_MAX,3);
+ //cout<<p<<endl;
+ assert(p==0.0);
+ p =getCollisionProba(1,1000000000,UINT_MAX,1);
+ assert(floor(p*1000+0.5)==23);
+ p =getCollisionProba(5,1000000000,UINT_MAX,1);
+ assert(floor(p*1000+0.5)==0);
+ p =getCollisionProba(5,50000000000,UINT_MAX,1);
+ assert(floor(p*1000+0.5)==975);
+}
+
+void test_gammln() {
+ float a;
+ a=gammln(1);
+ assert(exp(a)==1);
+ a=gammln(2);
+ assert(exp(a)==1);
+ a=gammln(3);
+ assert(exp(a)==2);
+ a=gammln(4);
+ assert(exp(a)==6);
+ a=gammln(5);
+ assert(exp(a)==24);
+ a=gammln(6);
+ float tmp=exp(a);
+ float tmp2=tmp*10000;
+ float tmp3=round(tmp2)/10000;
+ //printf("%s \n",tmp3);
+ assert(tmp3==120);
+ /* unsigned long n=5000;
+ unsigned long m=n+1;
+ a=gammln(m);
+ float b=gammln(n);
+ double truc=exp(a-b);
+ assert(truc==n);
+ */
+}
+
+void test_pmf() {
+ unsigned long nb_k_mers=5000000000;
+ float p=pmf(0,nb_k_mers,UINT_MAX);
+ assert(round(p*10000)==3122);
+ p=pmf(1,nb_k_mers,UINT_MAX);
+ assert(round(p*10000)==3634);
+ p=pmf(2,nb_k_mers,UINT_MAX);
+ assert(round(p*10000)==2115);
+}
+
+void test_ccdf() {
+ unsigned long nb_k_mers=5000000000;
+ double res=ccdf(2,nb_k_mers,UINT_MAX);
+ assert(round(res*10000)==1128);
+}
+
+
+int main(int argc, char **argv) {
+ cout<<"testing the gammln function"<<endl;
+ test_gammln();
+ cout<<"testing the pmf function"<<endl;
+ test_pmf();
+ cout<<"testing the ccdf function"<<endl;
+ test_ccdf();
+ cout<<"testing computation of collision probability."<<endl;
+ test_getCollisionProba();
+}
+
+