Skip to content
Snippets Groups Projects
Commit d9c2e782 authored by Veronique Legrand's avatar Veronique Legrand
Browse files

fixed bug in test

parent 6204928b
No related branches found
No related tags found
No related merge requests found
Pipeline #141526 failed with stage
in 18 minutes and 41 seconds
...@@ -33,9 +33,8 @@ void test_getCollisionProba() { ...@@ -33,9 +33,8 @@ void test_getCollisionProba() {
float p=getCollisionProba(2,5000000000,UINT_MAX,2); float p=getCollisionProba(2,5000000000,UINT_MAX,2);
assert(round(p*10000)==127); assert(round(p*10000)==127);
p=getCollisionProba(2,5000000000,UINT_MAX,1); p=getCollisionProba(2,5000000000,UINT_MAX,1);
assert(p=0.1128); assert(round(p*10000)==1128);
p =getCollisionProba(1,2,UINT_MAX,3); p =getCollisionProba(1,2,UINT_MAX,3);
//cout<<p<<endl;
assert(p==0.0); assert(p==0.0);
p =getCollisionProba(1,1000000000,UINT_MAX,1); p =getCollisionProba(1,1000000000,UINT_MAX,1);
assert(floor(p*1000+0.5)==23); assert(floor(p*1000+0.5)==23);
...@@ -46,30 +45,27 @@ void test_getCollisionProba() { ...@@ -46,30 +45,27 @@ void test_getCollisionProba() {
} }
void test_gammln() { void test_gammln() {
float a; float a,tmp;
a=gammln(1); a=gammln(1);
assert(exp(a)==1); tmp=exp(a);
assert((round(tmp*10000))/10000==1);
a=gammln(2); a=gammln(2);
assert(exp(a)==1); tmp=exp(a);
assert((round(tmp*10000))/10000==1);
a=gammln(3); a=gammln(3);
assert(exp(a)==2); tmp=exp(a);
assert((round(tmp*10000))/10000==2);
a=gammln(4); a=gammln(4);
assert(exp(a)==6); tmp=exp(a);
assert((round(tmp*10000))/10000==6);
a=gammln(5); a=gammln(5);
assert(exp(a)==24); tmp=exp(a);
assert((round(tmp*10000))/10000==24);
a=gammln(6); a=gammln(6);
float tmp=exp(a); tmp=exp(a);
float tmp2=tmp*10000; float tmp2=tmp*10000;
float tmp3=round(tmp2)/10000; float tmp3=round(tmp2)/10000;
//printf("%s \n",tmp3);
assert(tmp3==120); 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() { void test_pmf() {
......
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