4 #include "urand/urand.h" 5 #include <CUnit/CUnit.h> 6 #include <CUnit/Basic.h> 7 #include <CUnit/Console.h> 9 #define max(a,b) (a > b ? a : b) 14 # define CX_ASSERT_DOUBLE_EQUAL(val,exp,tol) \ 15 { printf("value, expect = % 9.5f,% 9.5f\n",val,exp); \ 16 CU_ASSERT_DOUBLE_EQUAL(val,exp,tol); } 17 # define CX_ASSERT_EQUAL(val, exp); \ 18 { printf("value, expect = % ld,% ld\n",(long) val,(long) exp); \ 19 CU_ASSERT_EQUAL(val,exp); } 21 # define CX_ASSERT_DOUBLE_EQUAL(val,exp,tol) \ 22 CU_ASSERT_DOUBLE_EQUAL(val,exp,tol); 23 # define CX_ASSERT_EQUAL(val, exp); \ 24 CU_ASSERT_EQUAL(val,exp); 27 int init_suite(
void) {
return 0; }
28 int clean_suite(
void) {
return 0; }
31 void test_LR_errors(
void) {
32 FILE *oldstderr = stderr, *newstderr;
33 char strbuf[200], *ptr;
38 0x00,
"LRerr_OK : LibRan - No Error\n",
39 0x01,
"LRerr_Unspecified : LibRan - Unspecified Error\n",
40 0x03,
"LRerr_BadDataType : LibRan - Bad Data Type given\n",
41 0x05,
"LRerr_BadLRType : LibRan - Bad Random Variate Type given\n",
42 0x09,
"LRerr_NoAuxiliaryObject : LibRan - Required Auxiliary Object not found\n",
43 0x0B,
"LRerr_NoAuxNormalizeDone : LibRan - Auxiliary Object requires normalization\n",
44 0x0D,
"LRerr_BadAuxSetup : LibRan - Auxiliary Object incorrectly set-up\n",
45 0x11,
"LRerr_BinGeneric : LibRan - Binning Object Unspecified Error\n",
46 0x13,
"LRerr_TooManyValues : LibRan - Too Many Values given\n",
47 0x15,
"LRerr_InvalidInputValue : LibRan - Invalid Input Value Error\n",
48 0x17,
"LRerr_InvalidRange : LibRan - Invalid Range Value Error\n",
49 0x19,
"LRerr_UnmetPreconditions : LibRan - Preconditions Not Performed\n",
50 0x1B,
"LRerr_SuspiciousValues : LibRan - Suspicious Value - Normalization Error?\n",
51 0x1D,
"LRerr_AllocFail : LibRan - Memory Allocation Error\n"};
54 newstderr = stderr = tmpfile();
56 for (
int i = 0; i <
sizeof(es)/
sizeof(es[0]); i++) {
58 (void) fseek(stderr,0,SEEK_SET);
60 (void) fseek(stderr,0,SEEK_SET);
61 ptr = fgets(strbuf,
sizeof(strbuf), stderr);
66 CU_ASSERT_STRING_EQUAL(ptr, es[i].msg);
67 (void) sscanf(es[i].msg,
"%s : ",strbuf);
68 CU_ASSERT_STRING_EQUAL(
LRstrerrno(es[i].err), strbuf);
80 #define STRINGIFY(arg) #arg 81 #define STRVAL(arg) STRINGIFY(arg) 82 void test_LR_version(
void) {
83 CU_ASSERT_STRING_EQUAL(LRversion(
"vers"), STRVAL(
LR_VERSION));
84 CU_ASSERT_STRING_EQUAL(LRversion(
"version"), STRVAL(
LR_VERSION));
85 CU_ASSERT_STRING_EQUAL(LRversion(
"major"), STRVAL(LR_VER_MAJOR));
86 CU_ASSERT_STRING_EQUAL(LRversion(
"MAJOR"), STRVAL(LR_VER_MAJOR));
87 CU_ASSERT_STRING_EQUAL(LRversion(
"minor"), STRVAL(LR_VER_MINOR));
88 CU_ASSERT_STRING_EQUAL(LRversion(
"mInOr"), STRVAL(LR_VER_MINOR));
89 CU_ASSERT_STRING_EQUAL(LRversion(
"patch"), STRVAL(LR_VER_PATCH));
90 CU_ASSERT_STRING_EQUAL(LRversion(
"PaTcH"), STRVAL(LR_VER_PATCH));
91 CU_ASSERT_STRING_EQUAL(LRversion(
"date"), STRVAL(
LR_DATE));
92 CU_ASSERT_STRING_EQUAL(LRversion(
"Date"), STRVAL(
LR_DATE));
94 CU_ASSERT_STRING_EQUAL(
96 STRVAL(LR_VER_MAJOR)
"." 97 STRVAL(LR_VER_MINOR)
"." 98 STRVAL(LR_VER_PATCH));
99 CU_ASSERT_STRING_EQUAL(LRversion(
"foobar"),
"");
102 #define testLRnew(tt) void test_new_##tt(void) { \ 103 LR_obj *o = LR_new(gausbm, LR_##tt); \ 104 CU_ASSERT_PTR_NOT_NULL(o); \ 105 CU_ASSERT_EQUAL(o->d, LR_##tt); \ 106 CU_ASSERT_PTR_EQUAL(o->ui, LR_irand); \ 107 CU_ASSERT_PTR_EQUAL(o->ul, LR_lrand); \ 108 CU_ASSERT_PTR_EQUAL(o->uf, LR_frand); \ 109 CU_ASSERT_PTR_EQUAL(o->ud, LR_drand); \ 110 CU_ASSERT_EQUAL(sizeof (*o), sizeof (LR_obj)); \ 112 CU_ASSERT_PTR_NULL(o); \ 121 #define testLRset(tt, ptt, att) void test_set_##tt(void) { \ 122 LR_obj *o = LR_new(gausbm, LR_##tt); \ 123 CU_ASSERT_EQUAL(LR_set(o, 'a', -1##ptt),0); \ 124 CU_ASSERT_EQUAL(LR_set(o, 'b', 3##ptt),0); \ 125 CU_ASSERT_EQUAL(LR_set(o, 'm', 2##ptt),0); \ 126 CU_ASSERT_EQUAL(LR_set(o, 's', 1##ptt),0); \ 127 CU_ASSERT_EQUAL(LR_set(o, 'x', 5##ptt),0); \ 128 CU_ASSERT_EQUAL(LR_set(o, 'k', 7),0); \ 129 CU_ASSERT_EQUAL(LR_set(o, 'n', 11),0); \ 130 CU_ASSERT_NOT_EQUAL(LR_set(o, 'z', 9##ptt),0); \ 131 CU_ASSERT_EQUAL(o->a.att, -1##ptt); \ 132 CU_ASSERT_EQUAL(o->b.att, 3##ptt); \ 133 CU_ASSERT_EQUAL(o->m.att, 2##ptt); \ 134 CU_ASSERT_EQUAL(o->s.att, 1##ptt); \ 135 CU_ASSERT_EQUAL(o->x.att, 5##ptt); \ 136 CU_ASSERT_EQUAL(o->k, 7); \ 137 CU_ASSERT_EQUAL(o->n, 11); \ 144 testLRset(
double,.,d)
147 #define testLRsetall(tt, ptt, att) void test_set_all_##tt(void) { \ 148 LR_obj *o = LR_new(gausbm, LR_##tt); \ 150 LR_set_all(o,"abmsxknpq", \ 151 -1##ptt,3##ptt,2##ptt,1##ptt,5##ptt,7,11,4.,16.),0); \ 152 CU_ASSERT_EQUAL(o->a.att, -1##ptt); \ 153 CU_ASSERT_EQUAL(o->b.att, 3##ptt); \ 154 CU_ASSERT_EQUAL(o->m.att, 2##ptt); \ 155 CU_ASSERT_EQUAL(o->s.att, 1##ptt); \ 156 CU_ASSERT_EQUAL(o->x.att, 5##ptt); \ 157 CU_ASSERT_EQUAL(o->k, 7); \ 158 CU_ASSERT_EQUAL(o->n, 11); \ 159 CU_ASSERT_EQUAL(o->p, 4.); \ 160 CU_ASSERT_EQUAL(o->q, 16.); \ 165 testLRsetall(
float,.,f)
166 testLRsetall(
long,L,l)
167 testLRsetall(
double,.,d)
170 #define testLRsetall2(tt, ptt, att) void test_set_all2_##tt(void) { \ 171 LR_obj *o = LR_new(gausbm, LR_##tt); \ 173 LR_set_all(o,"mpnaxksqb", \ 174 2##ptt,4.,11,-1##ptt,5##ptt,7,1##ptt,16.,3##ptt),0); \ 175 CU_ASSERT_EQUAL(o->a.att, -1##ptt); \ 176 CU_ASSERT_EQUAL(o->b.att, 3##ptt); \ 177 CU_ASSERT_EQUAL(o->m.att, 2##ptt); \ 178 CU_ASSERT_EQUAL(o->s.att, 1##ptt); \ 179 CU_ASSERT_EQUAL(o->x.att, 5##ptt); \ 180 CU_ASSERT_EQUAL(o->k, 7); \ 181 CU_ASSERT_EQUAL(o->n, 11); \ 182 CU_ASSERT_EQUAL(o->p, 4.); \ 183 CU_ASSERT_EQUAL(o->q, 16.); \ 187 testLRsetall2(
int,,i)
188 testLRsetall2(
float,.,f)
189 testLRsetall2(
long,L,l)
190 testLRsetall2(
double,.,d)
193 #define testLRsetall3(tt, ptt, att) void test_set_all3_##tt(void) { \ 194 LR_obj *o = LR_new(gausbm, LR_##tt); \ 195 CU_ASSERT_NOT_EQUAL( \ 196 LR_set_all(o,"mpnaxzksqby", \ 197 2##ptt,4.,11,-1##ptt,5##ptt,33##ptt,7,1##ptt,16.,3##ptt,9##ptt),0); \ 198 CU_ASSERT_EQUAL(o->a.att, -1##ptt); \ 199 CU_ASSERT_EQUAL(o->b.att, 3##ptt); \ 200 CU_ASSERT_EQUAL(o->m.att, 2##ptt); \ 201 CU_ASSERT_EQUAL(o->s.att, 1##ptt); \ 202 CU_ASSERT_EQUAL(o->x.att, 5##ptt); \ 203 CU_ASSERT_EQUAL(o->k, 7); \ 204 CU_ASSERT_EQUAL(o->n, 11); \ 205 CU_ASSERT_EQUAL(o->p, 4.); \ 206 CU_ASSERT_EQUAL(o->q, 16.); \ 210 testLRsetall3(
int,,i)
211 testLRsetall3(
float,.,f)
212 testLRsetall3(
long,L,l)
213 testLRsetall3(
double,.,d)
216 #define testLRcheck(nn, dist, tt, ttt, setup) \ 217 void test_check_ ## dist ## _##tt ## _##nn(void) { \ 218 LR_obj *o = LR_new(dist, LR_ ##ttt); \ 223 void test_check_bad_0(
void) {
228 testLRcheck(0,
unif, d,
double,
231 CU_ASSERT_EQUAL(o->
a.
d, -1.5);
232 CU_ASSERT_EQUAL(o->
b.
d, 2.0);
234 testLRcheck(1,
unif, d,
double,
238 testLRcheck(2,
gausbm, d,
double,
241 CU_ASSERT_EQUAL(o->
m.
d, 1.5);
242 CU_ASSERT_EQUAL(o->
s.
d, 2.0);
244 testLRcheck(3,
gausbm, d,
double,
248 testLRcheck(4,
uinvcdf, d,
double,
251 testLRcheck(5,
uinvcdf, d,
double,
255 testLRcheck(6,
uinvcdf, d,
double,
259 testLRcheck(7,
uinvcdf, d,
double,
263 testLRcheck(8,
uinvcdf, d,
double,
269 testLRcheck(0,
unif, f,
float,
272 CU_ASSERT_EQUAL(o->
a.
f, -1.5);
273 CU_ASSERT_EQUAL(o->
b.
f, 2.0);
275 testLRcheck(1,
unif, f,
float,
279 testLRcheck(2,
gausbm, f,
float,
282 CU_ASSERT_EQUAL(o->
m.
f, 1.5);
283 CU_ASSERT_EQUAL(o->
s.
f, 2.0);
285 testLRcheck(3,
gausbm, f,
float,
289 testLRcheck(4,
uinvcdf, f,
float,
292 testLRcheck(5,
uinvcdf, f,
float,
296 testLRcheck(6,
uinvcdf, f,
float,
300 testLRcheck(7,
uinvcdf, f,
float,
304 testLRcheck(8,
uinvcdf, f,
float,
310 #define testLRindep(dist, nn, num, incr, setup) \
311 void test_indep_seq_##nn(
void) { \
316 for (
int i = 0; i < num; i++) { \
317 for (
int j = 0; j < incr; j++) { \
320 CU_ASSERT_DOUBLE_EQUAL(y1, y2,.0000001); \
322 LR_rm(&o1);
LR_rm(&o2); \
325 testLRindep(
unif, 1, 10, 5000,)
326 testLRindep(
unif, 2, 10, 5000,
330 testLRindep(
gausbm, 3, 10, 5000,)
331 testLRindep(gausbm, 4, 10, 5000,
335 testLRindep(
gsn2, 5, 10, 5000,)
336 testLRindep(gsn2, 6, 10, 5000,
342 #define testLRbinnew(tt) void test_bin_new_##tt(void) { \ 343 LR_bin *b = LR_bin_new(10); \ 344 CU_ASSERT_PTR_NOT_NULL(b); \ 345 CU_ASSERT_EQUAL(b->n, 10); \ 346 CU_ASSERT_EQUAL(b->nn, 1); \ 347 CU_ASSERT_EQUAL(sizeof(b), sizeof(LR_bin *)); \ 348 CU_ASSERT_EQUAL(sizeof(*b), sizeof(LR_bin)); \ 349 CU_ASSERT_EQUAL(sizeof(b->bdrs[0]), sizeof(double)); \ 350 CU_ASSERT_EQUAL(sizeof(b->bins[0]), sizeof(long)); \ 352 CU_ASSERT_PTR_NULL(b); \ 362 #define testLRbinset(nn,aa,bb,cc,dd) void test_bin_set_##nn(void) { \ 363 LR_bin *b = LR_bin_new(5); \ 364 CU_ASSERT_EQUAL(LR_bin_set(b, aa),0); \ 365 CU_ASSERT_EQUAL(LR_bin_set(b, bb),0); \ 366 CU_ASSERT_EQUAL(LR_bin_set(b, cc),0); \ 367 CU_ASSERT_EQUAL(LR_bin_set(b, dd),0); \ 368 CU_ASSERT_NOT_EQUAL(LR_bin_set(b, aa+bb),0); \ 369 CU_ASSERT_DOUBLE_EQUAL(b->bdrs[0],-1.0,.0001); \ 370 CU_ASSERT_DOUBLE_EQUAL(b->bdrs[1], 0.0,.0001); \ 371 CU_ASSERT_DOUBLE_EQUAL(b->bdrs[2], 3.3,.0001); \ 372 CU_ASSERT_DOUBLE_EQUAL(b->bdrs[3], 4.5,.0001); \ 373 CU_ASSERT_DOUBLE_EQUAL(b->bdrs[4], 0.0,.0001); \ 377 testLRbinset(1,-1.0,0.0,3.3,4.5)
378 testLRbinset(2,4.5,3.3,0.0,-1.0)
379 testLRbinset(3,-1.0,4.5,3.3,0.0)
380 testLRbinset(4,3.3,-1.0,4.5,0.0)
382 #define testLRbinadd(nn,aa) void test_bin_add_##nn(void) { \ 383 LR_bin *b = LR_bin_new(aa+2); \ 384 for (int i = 1; i < aa; i++) { \ 385 CU_ASSERT_EQUAL(LR_bin_set(b, i/(double) aa),0); \ 387 for (int i = 0; i < 10000; i++) { \ 388 CU_ASSERT_EQUAL(LR_bin_add(b, 0.0001*i),0); \ 390 for (int i = 0; i < aa; i++) { \ 391 CU_ASSERT_DOUBLE_EQUAL(b->bins[i],10000./(double) aa, 1.);\ 402 #define compCdfPdf(tt,oo,xx,xxh,tol) \ 403 CU_ASSERT_DOUBLE_EQUAL( \ 404 ((LR##tt ## _CDF(oo,xxh))-(LR##tt ## _CDF(oo,xx)))/((xxh)-(xx)),\ 405 LR##tt ## _PDF(oo,xx),tol) 417 #define testCdfPdf(nn,tt,ttt,dist,nnt,del,tol,setup) \ 418 void test_cdf_pdf_ ## tt ## _ ##dist ## _##nn(void) { \ 419 LR_obj *o = LR_new(dist, LR_##ttt); \ 422 incr = (o->b.tt - o->a.tt)/nnt; \ 423 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,o->a.tt-2*incr),0.,tol) \ 424 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,o->a.tt-2*incr),0.,tol) \ 425 for (int i = 1; i < nnt; i++) { \ 426 compCdfPdf(tt,o,o->a.tt+i*incr,o->a.tt+i*incr+del,tol) \ 428 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,o->b.tt+2*incr),1.,tol) \ 429 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,o->b.tt+2*incr),0.,tol) \ 442 #define testSymDF(nn,tt,ttt,dist,x1,x2,tol,setup) \ 443 void test_sym_ ## tt ## _ ##dist ## _##nn(void) { \ 444 LR_obj *o = LR_new(dist, LR_##ttt); \ 446 ttt c1,p1,c2,p2, one = 1; \ 447 c1 = LR##tt ## _CDF(o,x1); \ 448 p1 = LR##tt ## _PDF(o,x1); \ 449 c2 = LR##tt ## _CDF(o,x2); \ 450 p2 = LR##tt ## _PDF(o,x2); \ 451 CU_ASSERT_DOUBLE_EQUAL(p1,p2,tol) \ 452 CU_ASSERT_DOUBLE_EQUAL(c1+c2,one,tol) \ 456 #define testCdfPdf0unif(nn,tt,ttt,tol,setup) \ 457 void test_cdf_pdf_##tt ## _unif ## _##nn(void) { \ 458 LR_obj *o = LR_new(unif, LR_##ttt); \ 461 ival = (o->b.tt - o->a.tt); \ 463 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,o->a.tt-.1),0.,tol) \ 464 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,o->a.tt-.1),0.,tol) \ 465 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,o->a.tt),0.,tol) \ 466 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,o->a.tt),pval,tol) \ 467 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,o->a.tt+.25*ival),.25,tol) \ 468 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,o->a.tt+.25*ival),pval,tol) \ 469 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,o->a.tt+.5*ival),.5,tol) \ 470 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,o->a.tt+.5*ival),pval,tol) \ 471 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,o->a.tt+.75*ival),.75,tol) \ 472 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,o->a.tt+.75*ival),pval,tol) \ 473 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,o->b.tt),1.,tol) \ 474 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,o->b.tt),0.,tol) \ 475 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,o->b.tt+.1),1.,tol) \ 476 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,o->b.tt+.1),0.,tol) \ 481 #define testLRunif(nn,tt,ttt,dist,bn,setup) \ 482 void test_##dist ## _##tt ## _##nn(void) {\ 483 LR_obj *o = LR_new(dist, LR_##ttt); \ 484 LR_bin *b = LR_bin_new(bn); \ 485 double x, cdf[bn], tot = 10007.; \ 487 double incr = (o->b.tt - o->a.tt) / bn; \ 488 o->uf = tfrand; o->ud = tdrand; \ 489 for (int i = 1; i < bn; i++) { \ 490 LR_bin_set(b,o->a.tt + i*incr); \ 491 cdf[i-1] = tot*(LR##tt ## _CDF(o,o->a.tt+i*incr) \ 492 - LR##tt ## _CDF(o,o->a.tt+(i-1)*incr)); \ 494 cdf[bn-1] = tot*(LR##tt ## _CDF(o,o->b.tt) \ 495 - LR##tt ## _CDF(o,o->b.tt - incr)); \ 496 for (int i = 0; i < tot; i++) { \ 497 LR_bin_add(b,LR##tt ## _RAN(o)); \ 499 for (int i = 0; i < bn; i++) { \ 500 CU_ASSERT_DOUBLE_EQUAL(b->bins[i],cdf[i],2.); \ 515 #define testLRvar(vty,nn,tt,ttt,bn,vsc,vab,setup) \ 516 void test_##vty ## _##tt ## _##nn(void) { \ 517 LR_obj *o = LR_new(vty, LR_##ttt); \ 518 LR_bin *b = LR_bin_new(bn); \ 519 double x, cdf[bn], tol, tot = 10007.; \ 521 double incr = (o->b.tt - o->a.tt) / bn; \ 522 o->uf = tfrand; o->ud = tdrand; \ 523 for (int i = 1; i < bn; i++) { \ 524 LR_bin_set(b,o->a.tt + i*incr); \ 525 cdf[i-1] = tot*(LR##tt ## _CDF(o,o->a.tt+i*incr) \ 526 - LR##tt ## _CDF(o,o->a.tt+(i-1)*incr)); \ 528 cdf[bn-1] = tot*(LR##tt ## _CDF(o,o->b.tt) \ 529 - LR##tt ## _CDF(o,o->b.tt - incr)); \ 530 for (int i = 0; i < tot; i++) { \ 531 LR_bin_add(b,LR##tt ## _RAN(o)); \ 533 for (int i = 0; i < bn; i++) { \ 534 tol = max(cdf[i]*vsc,vab); \ 535 CU_ASSERT_DOUBLE_EQUAL(b->bins[i],cdf[i],tol); \ 552 #define testLRvarx(vty,nn,tt,ttt,bn,xtot,vsc,vab,setup) \ 553 void test_##vty ## _##tt ## _##nn(void) { \ 554 LR_obj *o = LR_new(vty, LR_##ttt); \ 555 LR_bin *b = LR_bin_new(bn); \ 556 double x, cdf[bn], tol; \ 558 double incr = (o->b.tt - o->a.tt) / bn; \ 560 for (int i = 1; i < bn; i++) { \ 561 LR_bin_set(b,o->a.tt + i*incr); \ 562 cdf[i-1] = xtot*(LR##tt ## _CDF(o,o->a.tt+i*incr) \ 563 - LR##tt ## _CDF(o,o->a.tt+(i-1)*incr)); \ 565 cdf[bn-1] = xtot*(LR##tt ## _CDF(o,o->b.tt) \ 566 - LR##tt ## _CDF(o,o->b.tt - incr)); \ 567 for (int i = 0; i < xtot; i++) { \ 568 LR_bin_add(b,LR##tt ## _RAN(o)); \ 570 for (int i = 0; i < bn; i++) { \ 571 tol = max(cdf[i]*vsc,vab); \ 572 CU_ASSERT_DOUBLE_EQUAL(b->bins[i],cdf[i],tol); \ 590 #define testLRhalf(vty,nn,tt,ttt,end,bn,xtot,vsc,vab,setup) \ 591 void test_##vty ## _##tt ## _##nn(void) { \ 592 LR_obj *o = LR_new(vty, LR_##ttt); \ 593 LR_bin *b = LR_bin_new(bn+2); \ 594 double x, cdf[bn+2], tol; \ 596 double begin = 0.0, \ 599 for (int i = 0; i < bn; i++) { \ 600 x = begin + i*incr; \ 602 cdf[i] = xtot*(LR##tt ## _CDF(o,x) \ 603 - LR##tt ## _CDF(o,x - incr)); \ 605 cdf[bn] = xtot * (1.0 - LR##tt ## _CDF(o,begin+bn*incr)); \ 606 for (int i = 0; i < xtot; i++) { \ 607 LR_bin_add(b,LR##tt ## _RAN(o)); \ 609 for (int i = 0; i <= bn; i++) { \ 610 tol = max(cdf[i]*vsc,vab); \ 611 CU_ASSERT_DOUBLE_EQUAL(1.0*b->bins[i],cdf[i],tol); \ 629 #define testLRfull(vty,nn,tt,ttt,ww,bn,xtot,vsc,vab,setup) \ 630 void test_##vty ## _##tt ## _##nn(void) { \ 631 LR_obj *o = LR_new(vty, LR_##ttt); \ 632 LR_bin *b = LR_bin_new(bn+2); \ 633 double x, cdf[bn+2], tol; \ 635 double begin = o->m.tt - ww*o->s.tt, \ 636 incr = 2.0*ww*o->s.tt / bn; \ 638 cdf[0] = xtot * LR##tt ## _CDF(o,begin); \ 639 LR_bin_set(b,begin); \ 640 for (int i = 1; i <= bn; i++) { \ 641 x = begin + i*incr; \ 643 cdf[i] = xtot*(LR##tt ## _CDF(o,x) \ 644 - LR##tt ## _CDF(o,x - incr)); \ 646 cdf[bn+1] = xtot * (1.0 - LR##tt ## _CDF(o,begin+bn*incr)); \ 647 for (int i = 0; i < xtot; i++) { \ 648 LR_bin_add(b,LR##tt ## _RAN(o)); \ 650 for (int i = 0; i <= bn+1; i++) { \ 651 tol = max(cdf[i]*vsc,vab); \ 652 CU_ASSERT_DOUBLE_EQUAL(1.0*b->bins[i],cdf[i],tol); \ 665 #define testBADdt(vty,nn,tt,ttt, btt, xx, setup) \ 666 void test_bad_##tt ## _dt_ ##nn(void) { \ 667 LR_obj *o = LR_new(vty, LR_##ttt); \ 669 CU_ASSERT(isnan(LR##btt ## _RAN(o))); \ 670 CU_ASSERT(isnan(LR##btt ## _PDF(o,xx))); \ 671 CU_ASSERT(isnan(LR##btt ## _CDF(o,xx))); \ 672 CU_ASSERT_EQUAL(LR_aux_new(o,9),LRerr_NoAuxiliaryObject); \ 673 CU_ASSERT_EQUAL(LR_aux_rm(o),LRerr_NoAuxiliaryObject); \ 674 CU_ASSERT_EQUAL(LR_aux_set(o,1.,1.),LRerr_NoAuxiliaryObject); \ 675 CU_ASSERT_EQUAL(LR_aux_norm(o),LRerr_NoAuxiliaryObject); \ 684 testCdfPdf0unif(0,d,
double,.001,)
685 testCdfPdf(1,d,
double,unif,20,.0001,.001,)
686 testCdfPdf(2,d,
double,unif,50,.0001,.001,)
687 testCdfPdf(3,d,
double,unif,90,.0001,.001,)
689 testCdfPdf0unif(4,d,
double,.001,
LR_set_all(o,"ab",-2.,2.))
690 testCdfPdf(5,d,
double,unif,33,.0001,.001,
LR_set_all(o,"ab",-1.,3.))
692 testCdfPdf0unif(0,f,
float,.001,)
693 testCdfPdf(1,f,
float,unif,20,.0001,.001,)
694 testCdfPdf(2,f,
float,unif,50,.0001,.001,)
695 testCdfPdf(3,f,
float,unif,90,.0001,.001,)
697 testCdfPdf0unif(4,f,
float,.001,
LR_set_all(o,"ab",-2.,2.))
698 testCdfPdf(5,f,
float,unif,33,.0001,.001,
LR_set_all(o,"ab",-1.,3.))
700 testLRunif(1,d,
double,unif,10,)
701 testLRunif(2,d,
double,unif,25,)
702 testLRunif(3,d,
double,unif,20,
LR_set_all(o,"ab",-2.,2.))
703 testLRunif(4,d,
double,unif,60,
LR_set_all(o,"ab",-5.,1.))
705 testLRunif(1,f,
float,unif,10,)
706 testLRunif(2,f,
float,unif,25,)
707 testLRunif(3,f,
float,unif,20,
LR_set_all(o,"ab",-2.,2.))
708 testLRunif(4,f,
float,unif,60,
LR_set_all(o,"ab",-5.,1.))
713 #define testCdfPdf0piece(nn,tt,ttt,tol,lo,hi) \ 714 void test_cdf_pdf_##tt ## _piece ## _##nn(void) { \ 715 LR_obj *o = LR_new(piece, LR_##ttt); \ 717 ttt xlo = lo, xhi = hi, xlen = (xhi - xlo), xun = xlen/8.; \ 718 LR_set_all(o,"abx", xlo, xhi, 4.0); \ 719 CU_ASSERT_EQUAL(LR_aux_set(o,xlo+2.0*xun, 1.0),0) \ 720 CU_ASSERT_EQUAL(LR_aux_set(o,xlo+2.5*xun,-1.0),LRerr_InvalidInputValue) \ 721 LR_aux_set(o, xlo + 3.0*xun, 3.0); \ 722 LR_aux_set(o, xlo + 4.0*xun, 0.0); \ 723 LR_aux_set(o, xlo + 5.0*xun, 5.0); \ 724 LR_aux_set(o, xlo + 7.0*xun, 2.0); \ 726 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,xlo- .1),0.,tol) \ 727 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,xlo- .1),0.,tol) \ 728 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,xlo+ .5*xun),.0833,tol) \ 729 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,xlo+ .5*xun),.1667/xun,tol) \ 730 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,xlo+1.5*xun),.25,tol) \ 731 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,xlo+1.5*xun),.1667/xun,tol) \ 732 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,xlo+2.5*xun),.3542,tol) \ 733 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,xlo+2.5*xun),.0417/xun,tol) \ 734 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,xlo+3.5*xun),.4375,tol) \ 735 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,xlo+3.5*xun),.125/xun,tol) \ 736 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,xlo+4.5*xun),.5,tol) \ 737 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,xlo+4.5*xun),.0,tol) \ 738 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,xlo+5.5*xun),.6042,tol) \ 739 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,xlo+5.5*xun),.2083/xun,tol) \ 740 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,xlo+6.5*xun),.8125,tol) \ 741 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,xlo+6.5*xun),.2083/xun,tol) \ 742 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,xlo+7.5*xun),.9583,tol) \ 743 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,xlo+7.5*xun),.0833/xun,tol) \ 744 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,xhi+.1),1.,tol) \ 745 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,xhi+.1),0.,tol) \ 748 testCdfPdf(0,d,
double,
piece,75,.0001,.001,
758 testCdfPdf(1,d,
double,
piece,55,.0001,.001,
768 testCdfPdf0piece(2,d,
double,.001,-2.,6.);
769 testCdfPdf0piece(3,d,
double,.001,0.,8.);
771 testCdfPdf(0,f,
float,
piece,75,.0001,.001,
781 testCdfPdf(1,f,
float,
piece,55,.0001,.001,
791 testCdfPdf0piece(2,f,
float,.001,-2.,6.);
792 testCdfPdf0piece(3,f,
float,.001,2.,12.);
794 testLRunif(1,d,
double,
piece,32,
804 testLRunif(2,d,
double,
piece,75,
814 testLRunif(3,d,
double,
piece,50,
821 testLRunif(4,d,
double,
piece,60,
828 testLRunif(1,f,
float,
piece,32,
838 testLRunif(2,f,
float,
piece,75,
848 testLRunif(3,f,
float,
piece,50,
855 testLRunif(4,f,
float,
piece,60,
864 #define testBADpiece(nn,tt,ttt,lo,hi,xx,code) \
865 void test_bad_##tt ## _piece ## _##nn(
void) { \
868 LR_set_all(o,
"abx", lo, hi, xx); \
872 testBADpiece(0,d,
double,2.,4.,1.,
877 CU_ASSERT(isnan(
LRd_PDF(o,3.)));
878 CU_ASSERT(isnan(
LRd_CDF(o,3.)));
881 testBADpiece(0,f,
float,2.,4.,1.,
886 CU_ASSERT(isnan(
LRf_PDF(o,3.)));
887 CU_ASSERT(isnan(
LRf_CDF(o,3.)));
891 #define testCdfPdf0gsn2(nn,tt,ttt,tol,setup) \
892 void test_cdf_pdf_##tt ## _gsn2 ## _##nn(
void) { \
893 LR_obj *o =
LR_new(gsn2, LR_##ttt); \
896 ival = (o->b.tt - o->a.tt); \
898 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,o->a.tt-.1),0.,tol) \
899 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,o->a.tt-.1),0.,tol) \
900 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,o->a.tt),0.,tol) \
901 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,o->a.tt),0.,tol) \
902 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,o->a.tt+.25*ival),.125,tol) \
903 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,o->a.tt+.25*ival),pval*.5,tol) \
904 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,o->a.tt+.5*ival),.5,tol) \
905 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,o->a.tt+.5*ival),pval,tol) \
906 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,o->a.tt+.75*ival),.875,tol) \
907 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,o->a.tt+.75*ival),pval*.5,tol) \
908 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,o->b.tt),1.,tol) \
909 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,o->b.tt),0.,tol) \
910 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,o->b.tt+.1),1.,tol) \
911 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,o->b.tt+.1),0.,tol) \
914 testCdfPdf0gsn2(0,d,
double,.001,)
915 testCdfPdf(1,d,
double,gsn2,20,.0001,.001,)
916 testCdfPdf(2,d,
double,gsn2,50,.0001,.001,)
917 testCdfPdf(3,d,
double,gsn2,90,.0001,.001,)
919 testCdfPdf0gsn2(4,d,
double,.001,
LR_set_all(o,"ab",-3.,1.))
920 testCdfPdf(5,d,
double,gsn2,33,.0001,.001,
LR_set_all(o,"ab",-1.,3.))
922 testSymDF(6,d,
double, gsn2, -.9, .9, .0001,);
923 testSymDF(7,d,
double, gsn2, -.6, .6, .0001,);
924 testSymDF(8,d,
double, gsn2, -.3, .3, .0001,);
926 testCdfPdf0gsn2(0,f,
float,.001,)
927 testCdfPdf(1,f,
float,gsn2,20,.0001,.003,)
928 testCdfPdf(2,f,
float,gsn2,50,.0001,.003,)
929 testCdfPdf(3,f,
float,gsn2,90,.0001,.003,)
931 testCdfPdf0gsn2(4,f,
float,.003,
LR_set_all(o,"ab",-3.,1.))
932 testCdfPdf(5,f,
float,gsn2,33,.0001,.003,
LR_set_all(o,"ab",-1.,3.))
934 testSymDF(6,f,
float, gsn2, -.9, .9, .0001,);
935 testSymDF(7,f,
float, gsn2, -.6, .6, .0001,);
936 testSymDF(8,f,
float, gsn2, -.3, .3, .0001,);
938 #define testLRgsn2(nn,tt,ttt,bn,setup) \ 939 testLRvar(gsn2,nn,tt,ttt,bn,.1,27,setup) 941 testLRgsn2(1,d,
double,10,)
942 testLRgsn2(2,d,
double,25,)
943 testLRgsn2(3,d,
double,20,
LR_set_all(o,"ab",-2.,2.))
944 testLRgsn2(4,d,
double,30,
LR_set_all(o,"ab",-5.,1.))
946 testLRgsn2(1,f,
float,10,)
947 testLRgsn2(2,f,
float,25,)
948 testLRgsn2(3,f,
float,20,
LR_set_all(o,"ab",-2.,2.))
949 testLRgsn2(4,f,
float,30,
LR_set_all(o,"ab",-5.,1.))
952 #define testCdfPdf0gsn4(nn,tt,ttt,tol,setup) \ 953 void test_cdf_pdf_##tt ## _gsn4 ## _##nn(void) { \ 954 LR_obj *o = LR_new(gsn4, LR_##ttt); \ 957 ival = (o->b.tt - o->a.tt); \ 959 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,o->a.tt-.1),0.,tol) \ 960 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,o->a.tt-.1),0.,tol) \ 961 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,o->a.tt),0.,tol) \ 962 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,o->a.tt),0.,tol) \ 963 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,o->a.tt+.25*ival),.041667,tol) \ 964 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,o->a.tt+.25*ival),pval*.16666,tol)\ 965 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,o->a.tt+.5*ival),.5,tol) \ 966 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,o->a.tt+.5*ival),pval*.66666,tol)\ 967 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,o->a.tt+.75*ival),.95833,tol) \ 968 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,o->a.tt+.75*ival),pval*.16666,tol)\ 969 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,o->b.tt),1.,tol) \ 970 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,o->b.tt),0.,tol) \ 971 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,o->b.tt+.1),1.,tol) \ 972 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,o->b.tt+.1),0.,tol) \ 975 testCdfPdf0gsn4(0,d,
double,.001,)
976 testCdfPdf(1,d,
double,
gsn4,20,.0001,.001,)
977 testCdfPdf(2,d,
double,
gsn4,50,.0001,.001,)
978 testCdfPdf(3,d,
double,
gsn4,90,.0001,.001,)
980 testCdfPdf0gsn4(4,d,
double,.0001,
LR_set_all(o,"ab",-3.,1.))
981 testCdfPdf(5,d,
double,
gsn4,33,.0001,.003,
LR_set_all(o,"ab", -1.,4.))
983 testSymDF(6,d,
double, gsn4, -1.9, 1.9, .0001,);
984 testSymDF(7,d,
double, gsn4, -1.6, 1.6, .0001,);
985 testSymDF(8,d,
double, gsn4, -1.3, 1.3, .0001,);
986 testSymDF( 9,d,
double, gsn4, -.9, .9, .0001,);
987 testSymDF(10,d,
double, gsn4, -.6, .6, .0001,);
988 testSymDF(11,d,
double, gsn4, -.3, .3, .0001,);
990 testCdfPdf0gsn4(0,f,
float,.001,)
991 testCdfPdf(1,f,
float,gsn4,20,.0001,.003,)
992 testCdfPdf(2,f,
float,gsn4,50,.0001,.003,)
993 testCdfPdf(3,f,
float,gsn4,90,.0001,.003,)
995 testCdfPdf0gsn4(4,f,
float,.001,
LR_set_all(o,"ab",-3.,1.))
996 testCdfPdf(5,f,
float,gsn4,33,.0001,.003,
LR_set_all(o,"ab", -1.,4.))
998 testSymDF(6,f,
float, gsn4, -1.9, 1.9, .0001,);
999 testSymDF(7,f,
float, gsn4, -1.6, 1.6, .0001,);
1000 testSymDF(8,f,
float, gsn4, -1.3, 1.3, .0001,);
1001 testSymDF( 9,f,
float, gsn4, -.9, .9, .0001,);
1002 testSymDF(10,f,
float, gsn4, -.6, .6, .0001,);
1003 testSymDF(11,f,
float, gsn4, -.3, .3, .0001,);
1006 #define testLRgsn4(nn,tt,ttt,bn,setup) \ 1007 testLRvarx(gsn4,nn,tt,ttt,bn,100*10007,.1,100,setup) 1009 testLRgsn4(1,d,
double,10,)
1010 testLRgsn4(2,d,
double,25,)
1011 testLRgsn4(3,d,
double,20,
LR_set_all(o,"ab",-4.,-1.))
1012 testLRgsn4(4,d,
double,30,
LR_set_all(o,"ab",0.,6.))
1014 testLRgsn4(1,f,
float,10,)
1015 testLRgsn4(2,f,
float,25,)
1016 testLRgsn4(3,f,
float,20,
LR_set_all(o,"ab",-4.,-1.))
1017 testLRgsn4(4,f,
float,30,
LR_set_all(o,"ab",0.,6.))
1020 #define testCdfPdf0gsn12(nn,tt,ttt,tol,setup) \ 1021 void test_cdf_pdf_##tt ## _gsn12 ## _##nn(void) { \ 1022 LR_obj *o = LR_new(gsn12, LR_##ttt); \ 1024 double m = o->m.tt, s = o->s.tt, iv,pv; \ 1027 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,m-6.1*s),0.,tol) \ 1028 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,m-6.1*s),0.,tol) \ 1029 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,m-6.0*s),0.,tol) \ 1030 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,m-6.0*s),0.,tol) \ 1031 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,m-3.0*s),pv*50879./13305600.,tol)\ 1032 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,m-3.0*s),397./394240.,tol) \ 1033 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,m-2.0*s),pv*1093./19800.,tol) \ 1034 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,m-2.0*s),29639./1330560.,tol) \ 1035 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,m-s),pv*1623019./6652800.,tol) \ 1036 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,m-s),12831419./79833600.,tol) \ 1037 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,m),0.5,tol) \ 1038 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,m),pv*655177./1663200.,tol) \ 1039 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,m+s),pv*1623019./6652800.,tol) \ 1040 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,m+s),67002181./79833600.,tol) \ 1041 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,m+2.0*s),pv*1093./19800.,tol) \ 1042 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,m+2.0*s),1300921./1330560.,tol) \ 1043 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,m+3.0*s),pv*50879./13305600.,tol)\ 1044 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,m+3.0*s),393843./394240.,tol) \ 1045 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,m+6.0*s),0.,tol) \ 1046 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,m+6.0*s),1.,tol) \ 1047 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,m+6.1*s),0.,tol) \ 1048 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,m+6.1*s),1.,tol) \ 1051 #define testLRgsn12(nn,tt,ttt,bn,setup) \ 1052 testLRfull(gsn12,nn,tt,ttt,4.,bn,100*10007,.1,20,setup) 1054 testCdfPdf0gsn12(0,d,
double,.001,)
1055 testCdfPdf(1,d,
double,
gsn12,20,.0001,.001,)
1056 testCdfPdf(2,d,
double,
gsn12,50,.0001,.001,)
1057 testCdfPdf(3,d,
double,
gsn12,90,.0001,.001,)
1059 testCdfPdf0gsn12(4,d,
double,.0001,
LR_set_all(o,"ms",-3.,.5))
1060 testCdfPdf(5,d,
double,
gsn12,33,.0001,.003,
LR_set_all(o,"ms", -1.,2.))
1062 testSymDF(6,d,
double, gsn12, -4.9, 4.9, .0001,);
1063 testSymDF(7,d,
double, gsn12, -3.6, 3.6, .0001,);
1064 testSymDF(8,d,
double, gsn12, -2.3, 2.3, .0001,);
1065 testSymDF(9,d,
double, gsn12, -1.9, 1.9, .0001,);
1066 testSymDF(10,d,
double, gsn12, -1.6, 1.6, .0001,);
1067 testSymDF(11,d,
double, gsn12, -1.3, 1.3, .0001,);
1068 testSymDF(12,d,
double, gsn12, -.9, .9, .0001,);
1069 testSymDF(13,d,
double, gsn12, -.6, .6, .0001,);
1070 testSymDF(14,d,
double, gsn12, -.3, .3, .0001,);
1072 testLRgsn12(1,d,
double,10,)
1073 testLRgsn12(2,d,
double,25,)
1074 testLRgsn12(3,d,
double,20,
LR_set_all(o,"ms",-2.,2.))
1075 testLRgsn12(4,d,
double,30,
LR_set_all(o,"ms",1.,.5))
1077 testCdfPdf0gsn12(0,f,
float,.002,)
1078 testCdfPdf(1,f,
float,gsn12,20,.0001,.002,)
1079 testCdfPdf(2,f,
float,gsn12,50,.0001,.002,)
1080 testCdfPdf(3,f,
float,gsn12,90,.0001,.002,)
1082 testCdfPdf0gsn12(4,f,
float,.0001,
LR_set_all(o,"ms",-3.,.5))
1083 testCdfPdf(5,f,
float,gsn12,33,.0001,.003,
LR_set_all(o,"ms", -1.,2.))
1085 testSymDF(6,f,
float, gsn12, -4.9, 4.9, .0001,);
1086 testSymDF(7,f,
float, gsn12, -3.6, 3.6, .0001,);
1087 testSymDF(8,f,
float, gsn12, -2.3, 2.3, .0001,);
1088 testSymDF(9,f,
float, gsn12, -1.9, 1.9, .0001,);
1089 testSymDF(10,f,
float, gsn12, -1.6, 1.6, .0001,);
1090 testSymDF(11,f,
float, gsn12, -1.3, 1.3, .0001,);
1091 testSymDF(12,f,
float, gsn12, -.9, .9, .0001,);
1092 testSymDF(13,f,
float, gsn12, -.6, .6, .0001,);
1093 testSymDF(14,f,
float, gsn12, -.3, .3, .0001,);
1095 testLRgsn12(1,f,
float,10,)
1096 testLRgsn12(2,f,
float,25,)
1097 testLRgsn12(3,f,
float,20,
LR_set_all(o,"ms",-2.,2.))
1098 testLRgsn12(4,f,
float,30,
LR_set_all(o,"ms",1.,.5))
1102 #define testCdfPdf0lspline(nn,tt,ttt,tol,lo,hi) \ 1103 void test_cdf_pdf_##tt ## _lspline ## _##nn(void) { \ 1104 LR_obj *o = LR_new(lspline, LR_##ttt); \ 1106 ttt xlo = lo, xhi = hi, xlen = (xhi - xlo), xun = xlen/8.; \ 1107 LR_set_all(o,"ab", xlo, xhi); \ 1108 CU_ASSERT_EQUAL(LR_aux_set(o,xlo+2.0*xun, 1.0),0) \ 1109 CU_ASSERT_EQUAL(LR_aux_set(o,xlo+2.5*xun,-1.0),LRerr_InvalidInputValue) \ 1110 LR_aux_set(o, xlo + 3.0*xun, 3.0); \ 1111 LR_aux_set(o, xlo + 4.0*xun, 0.0); \ 1112 LR_aux_set(o, xlo + 5.0*xun, 5.0); \ 1113 LR_aux_set(o, xlo + 7.0*xun, 2.0); \ 1115 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,xlo- .1),0.,tol) \ 1116 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,xlo- .1),0.,tol) \ 1117 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,xlo+ .6*xun),.006,tol) \ 1118 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,xlo+ .6*xun),.020/xun,tol) \ 1119 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,xlo+1.8*xun),.054,tol) \ 1120 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,xlo+1.8*xun),.060/xun,tol) \ 1121 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,xlo+2.4*xun),.104,tol) \ 1122 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,xlo+2.4*xun),.120/xun,tol) \ 1123 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,xlo+3.6*xun),.284,tol) \ 1124 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,xlo+3.6*xun),.080/xun,tol) \ 1125 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,xlo+4.6*xun),.360,tol) \ 1126 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,xlo+4.6*xun),.200/xun,tol) \ 1127 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,xlo+5.4*xun),.592,tol) \ 1128 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,xlo+5.4*xun),.2933/xun,tol) \ 1129 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,xlo+6.6*xun),.872,tol) \ 1130 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,xlo+6.6*xun),.1733/xun,tol) \ 1131 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,xlo+7.4*xun),.976,tol) \ 1132 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,xlo+7.4*xun),.080/xun,tol) \ 1133 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,xhi+.1),1.,tol) \ 1134 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,xhi+.1),0.,tol) \ 1137 testCdfPdf(0,d,
double,
lspline,75,.0001,.001,
1147 testCdfPdf(1,d,
double,
lspline,55,.0001,.001,
1158 testCdfPdf0lspline(2,d,
double,.001,-2.,6.);
1159 testCdfPdf0lspline(3,d,
double,.001,2.,12.);
1161 testCdfPdf(0,f,
float,
lspline,75,.0001,.001,
1171 testCdfPdf(1,f,
float,
lspline,55,.0001,.001,
1182 testCdfPdf0lspline(2,f,
float,.001,-2.,6.);
1183 testCdfPdf0lspline(3,f,
float,.001,2.,12.);
1185 #define testLRlspl(nn,tt,ttt,bn,setup) \ 1186 testLRvar(lspline,nn,tt,ttt,bn,.04,2,setup) 1188 testLRlspl(1,d,
double,75,
1199 testLRlspl(2,d,
double,55,
1212 testLRlspl(3,d,
double,80,
1218 testLRlspl(4,d,
double,50,
1224 testLRlspl(1,f,
float,75,
1235 testLRlspl(2,f,
float,55,
1246 testLRlspl(3,f,
float,80,
1252 testLRlspl(4,f,
float,50,
1259 #define testBADlspline(nn,tt,ttt,lo,hi,code) \
1260 void test_bad_##tt ## _lspline ## _##nn(
void) { \
1263 LR_set_all(o,
"ab", lo, hi); \
1267 testBADlspline(0,d,
double,2.,4.,
1273 CU_ASSERT(isnan(
LRd_PDF(o,3.)));
1274 CU_ASSERT(isnan(
LRd_CDF(o,3.)));
1277 testBADlspline(0,f,
float,2.,4.,
1283 CU_ASSERT(isnan(
LRf_PDF(o,3.)));
1284 CU_ASSERT(isnan(
LRf_CDF(o,3.)));
1288 double MyCDF(
double x) {
1289 static double pi4 = NAN;
1290 double zero = 0.0, one = 1.0, two = 2.0;
1296 }
else if (x >= two) {
1299 double t = sin(pi4*x);
1304 double MyCDF2(
double x) {
1305 return MyCDF(x + 2.0);
1308 double MyCDFc(
double x) {
1311 return half + M_1_PI *atan(x - half);
1314 float MyCDFf(
float x) {
1315 static float pi4 = NAN;
1316 float zero = 0.0, one = 1.0, two = 2.0;
1322 }
else if (x >= two) {
1325 float t = sin(pi4*x);
1330 float MyCDF2f(
float x) {
1331 return MyCDF(x + 2.0);
1334 float MyCDFcf(
float x) {
1337 return half + M_1_PI *atan(x - half);
1340 #define testCdfPdf0uinvcdf(nn,tt,ttt,cdf,tol,xlo,xhi) \ 1341 void test_cdf_pdf_##tt ## _uinvcdf ## _##nn(void) { \ 1342 LR_obj *o = LR_new(uinvcdf, LR_##ttt); \ 1343 ttt xun = (xhi - xlo); \ 1344 LR_set_all(o,"ab", xlo, xhi); \ 1345 LR##tt ## _uinvcdf(o,cdf); \ 1346 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,xlo-.1),0.,tol) \ 1347 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,xlo-.1),0.,tol) \ 1348 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,xlo+.25*xun),.146447,tol) \ 1349 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,xlo+.25*xun),.555360,tol) \ 1350 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,xlo+.50*xun),.500000,tol) \ 1351 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,xlo+.50*xun),.785398,tol) \ 1352 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,xlo+.60*xun),.654509,tol) \ 1353 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,xlo+.60*xun),.746958,tol) \ 1354 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,xlo+.80*xun),.904509,tol) \ 1355 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,xlo+.80*xun),.461645,tol) \ 1356 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,xlo+.95*xun),.993844,tol) \ 1357 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,xlo+.95*xun),.122863,tol) \ 1358 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,xhi+.1),1.,tol) \ 1359 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,xhi+.1),0.,tol) \ 1362 testLRcheck(9,
uinvcdf, d,
double,
1365 testLRcheck(9,
uinvcdf, f,
float,
1369 testCdfPdf0uinvcdf(0,d,
double,MyCDF,.0001,0.,2.);
1370 testCdfPdf0uinvcdf(1,d,
double,MyCDF2,.0001,-2.,0.);
1371 testSymDF(2,d,
double,
uinvcdf, .1, 1.9,.0001,
1375 testSymDF(3,d,
double,
uinvcdf, .25, 1.75,.0001,
1379 testSymDF(4,d,
double,
uinvcdf, .5, 1.5,.0001,
1383 testSymDF(5,d,
double,
uinvcdf, .75, 1.25,.0001,
1387 testSymDF(6,d,
double,
uinvcdf, .9, 1.1,.0001,
1391 testLRvar(
uinvcdf,7,d,
double, 40, .1, 10,
1395 testLRvar(
uinvcdf,8,d,
double, 60, .1, 10,
1400 testCdfPdf0uinvcdf(0,f,
float,MyCDFf,.001,0.,2.);
1401 testCdfPdf0uinvcdf(1,f,
float,MyCDF2f,.001,-2.,0.);
1402 testSymDF(2,f,
float,
uinvcdf, .1, 1.9,.001,
1406 testSymDF(3,f,
float,
uinvcdf, .25, 1.75,.001,
1410 testSymDF(4,f,
float,
uinvcdf, .5, 1.5,.001,
1414 testSymDF(5,f,
float,
uinvcdf, .75, 1.25,.001,
1418 testSymDF(6,f,
float,
uinvcdf, .9, 1.1,.001,
1422 testLRvar(
uinvcdf,7,f,
float, 40, .1, 10,
1426 testLRvar(
uinvcdf,8,f,
float, 60, .1, 10,
1442 #define testCdfPdfHR(nn,tt,ttt,dist,end,nnt,tol,setup) \
1443 void test_cdf_pdf_##tt ## _##dist ## _##nn(
void) { \
1444 LR_obj *o =
LR_new(dist, LR_##ttt); \
1445 double incr = end/nnt, x = 0.0; \
1447 for (
int i = 0; i < nnt; i++) { \
1448 compCdfPdf(tt,o,x,x+.0001,tol) \
1460 #define testCdfPdf0nexp(dist,nn,tt,ttt,tol,mean) \ 1461 void test_cdf_pdf_##tt ## _ ## dist ## _##nn(void) { \ 1462 LR_obj *o = LR_new(dist, LR_##ttt); \ 1463 LR_set_all(o,"m", mean); \ 1465 ttt cc2 = sqrt(cc); \ 1466 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,mean*0.5),1.0-cc2,tol) \ 1467 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,mean*0.5),cc2/mean,tol) \ 1468 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,mean),1.0-cc,tol) \ 1469 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,mean),cc/mean,tol) \ 1470 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,mean*2.0),1.0-cc*cc,tol) \ 1471 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,mean*2.0),cc*cc/mean,tol) \ 1474 testCdfPdf0nexp(
nexp,0,d,
double,.0001,1.0)
1475 testCdfPdf0nexp(
nexp,1,d,
double,.0001,.3)
1476 testCdfPdf0nexp(nexp,2,d,
double,.0001,3.0)
1478 testCdfPdfHR(3,d,
double,nexp,3.,60,.0001,)
1479 testCdfPdfHR(4,d,
double,nexp,3.,60,.0005,
1482 testCdfPdfHR(5,d,
double,nexp,4.,80,.0001,
1486 testCdfPdf0nexp(nexp,0,f,
float,.001,1.0)
1487 testCdfPdf0nexp(nexp,1,f,
float,.001,.3)
1488 testCdfPdf0nexp(nexp,2,f,
float,.001,3.0)
1490 testCdfPdfHR(3,f,
float,nexp,3.,60,.001,)
1491 testCdfPdfHR(4,f,
float,nexp,3.,60,.005,
1494 testCdfPdfHR(5,f,
float,nexp,4.,80,.001,
1498 #define testLRnexp(nn,tt,ttt,end,bn,setup) \ 1499 testLRhalf(nexp,nn,tt,ttt,end,bn,50*10007,.1,100,setup) 1501 testLRnexp(1,d,
double,3.0,60, )
1502 testLRnexp(2,d,
double,2.0,60,
1505 testLRnexp(3,d,
double,4.0,80,
1509 testLRnexp(1,f,
float,3.0,60, )
1510 testLRnexp(2,f,
float,2.0,60,
1513 testLRnexp(3,f,
float,4.0,80,
1518 #define testLRerlang(nn,tt,ttt,end,bn,setup) \ 1519 testLRhalf(erlang,nn,tt,ttt,end,bn,50*10007,.1,100,setup) 1522 testCdfPdf0nexp(
erlang,0,d,
double,.0001,1.0)
1523 testCdfPdf0nexp(
erlang,1,d,
double,.0001,.3)
1524 testCdfPdf0nexp(erlang,2,d,
double,.0001,3.0)
1526 testCdfPdfHR(3,d,
double,erlang,3.,60,.0001,)
1527 testCdfPdfHR(4,d,
double,erlang,3.,60,.0005,
1530 testCdfPdfHR(5,d,
double,erlang,4.,80,.0001,
1534 testLRerlang(1,d,
double,3.0,60, )
1535 testLRerlang(2,d,
double,2.0,60,
1538 testLRerlang(3,d,
double,4.0,80,
1543 #define testCdfPdf0erlang2(nn,tt,ttt,tol,mn) \ 1544 void test_cdf_pdf_##tt ## _ ## erlang2 ## _##nn(void) { \ 1545 LR_obj *o = LR_new(erlang, LR_##ttt); \ 1546 LR_set_all(o,"mk", mn, 2); \ 1548 ttt cc2 = sqrt(cc); \ 1550 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,-.1),0.,tol) \ 1551 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,-.1),0.,tol) \ 1552 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,mn*0.5),1.0-cc2*1.5,tol) \ 1553 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,mn*0.5),.5*cc2*xm,tol) \ 1554 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,mn),1.0-cc*2.0,tol) \ 1555 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,mn),cc*xm,tol) \ 1556 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,mn*2.0),1.0-cc*cc*3.0,tol) \ 1557 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,mn*2.0),2.0*cc*cc*xm,tol) \ 1560 testCdfPdf0erlang2(0,d,
double,.0001,1.0)
1561 testCdfPdf0erlang2(1,d,
double,.0001,.3)
1562 testCdfPdf0erlang2(2,d,
double,.0001,3.0)
1563 testLRerlang(4,d,
double,3.0,60,
1566 testLRerlang(5,d,
double,2.0,60,
1569 testLRerlang(6,d,
double,4.0,80,
1574 #define testCdfPdf0erlang3(nn,tt,ttt,tol,mn) \ 1575 void test_cdf_pdf_##tt ## _ ## erlang3 ## _##nn(void) { \ 1576 LR_obj *o = LR_new(erlang, LR_##ttt); \ 1577 LR_set_all(o,"mk", mn, 3); \ 1579 ttt cc2 = sqrt(cc); \ 1581 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,-.1),0.,tol) \ 1582 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,-.1),0.,tol) \ 1583 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,mn*0.5),1.0-cc2*1.625,tol) \ 1584 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,mn*0.5),.125*cc2*xm,tol) \ 1585 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,mn),1.0-cc*2.5,tol) \ 1586 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,mn),.5*cc*xm,tol) \ 1587 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,mn*2.0),1.0-cc*cc*5.0,tol) \ 1588 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,mn*2.0),2.0*cc*cc*xm,tol) \ 1591 testCdfPdf0erlang3(0,d,
double,.0001,1.0)
1592 testCdfPdf0erlang3(1,d,
double,.0001,.3)
1593 testCdfPdf0erlang3(2,d,
double,.0001,3.0)
1594 testLRerlang(7,d,
double,3.0,60,
1597 testLRerlang(8,d,
double,2.0,60,
1600 testLRerlang(9,d,
double,4.0,80,
1605 #define testCdfPdf0erlang4(nn,tt,ttt,tol,mn) \ 1606 void test_cdf_pdf_##tt ## _ ## erlang4 ## _##nn(void) { \ 1607 LR_obj *o = LR_new(erlang, LR_##ttt); \ 1608 LR_set_all(o,"mk", mn, 4); \ 1610 ttt cc2 = sqrt(cc); \ 1612 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,-.1),0.,tol) \ 1613 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,-.1),0.,tol) \ 1614 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,mn*0.5),1.0-cc2*1.645833,tol) \ 1615 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,mn*0.5),.02083333*cc2*xm,tol) \ 1616 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,mn),1.0-cc*2.666667,tol) \ 1617 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,mn),.1666667*cc*xm,tol) \ 1618 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,mn*2.0),1.0-cc*cc*6.333333,tol) \ 1619 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,mn*2.0),1.3333333*cc*cc*xm,tol) \ 1622 testCdfPdf0erlang4(0,d,
double,.0001,1.0)
1623 testCdfPdf0erlang4(1,d,
double,.0001,.3)
1624 testCdfPdf0erlang4(2,d,
double,.0001,3.0)
1625 testLRerlang(10,d,
double,3.0,60,
1628 testLRerlang(11,d,
double,2.0,60,
1631 testLRerlang(12,d,
double,4.0,80,
1636 testCdfPdf0nexp(erlang,0,f,
float,.0001,1.0)
1637 testCdfPdf0nexp(erlang,1,f,
float,.0001,.3)
1638 testCdfPdf0nexp(erlang,2,f,
float,.0001,3.0)
1640 testCdfPdfHR(3,f,
float,erlang,3.,60,.001,)
1641 testCdfPdfHR(4,f,
float,erlang,3.,60,.005,
1644 testCdfPdfHR(5,f,
float,erlang,4.,80,.001,
1648 testLRerlang(1,f,
float,3.0,60, )
1649 testLRerlang(2,f,
float,2.0,60,
1652 testLRerlang(3,f,
float,4.0,80,
1656 testCdfPdf0erlang2(0,f,
float,.001,1.0)
1657 testCdfPdf0erlang2(1,f,
float,.001,.3)
1658 testCdfPdf0erlang2(2,f,
float,.001,3.0)
1659 testLRerlang(4,f,
float,3.0,60,
1662 testLRerlang(5,f,
float,2.0,60,
1665 testLRerlang(6,f,
float,4.0,80,
1669 testCdfPdf0erlang3(0,f,
float,.001,1.0)
1670 testCdfPdf0erlang3(1,f,
float,.001,.3)
1671 testCdfPdf0erlang3(2,f,
float,.001,3.0)
1672 testLRerlang(7,f,
float,3.0,60,
1675 testLRerlang(8,f,
float,2.0,60,
1678 testLRerlang(9,f,
float,4.0,80,
1682 testCdfPdf0erlang4(0,f,
float,.001,1.0)
1683 testCdfPdf0erlang4(1,f,
float,.001,.3)
1684 testCdfPdf0erlang4(2,f,
float,.001,3.0)
1685 testLRerlang(10,f,
float,3.0,60,
1688 testLRerlang(11,f,
float,2.0,60,
1691 testLRerlang(12,f,
float,4.0,80,
1706 #define testCdfPdfFR(nn,tt,ttt,dist,ww,nnt,tol,setup) \ 1707 void test_cdf_pdf_##tt ## _##dist ## _##nn(void) { \ 1708 LR_obj *o = LR_new(dist, LR_##ttt); \ 1711 incr = 2.*ww*o->s.tt/nnt; \ 1712 x = o->m.tt - o->s.tt*ww; \ 1713 for (int i = 0; i < nnt; i++) { \ 1714 compCdfPdf(tt,o,x,x+.0001,tol) \ 1728 #define testCdfPdf0gaus(ggg,nn,tt,ttt,tol,mean,dev) \ 1729 void test_cdf_pdf_##tt ## _##ggg ## _##nn(void) { \ 1730 LR_obj *o = LR_new(ggg, LR_##ttt); \ 1731 ttt cc = .5*M_2_SQRTPI*M_SQRT1_2/dev; \ 1732 ttt ee = exp(-0.5); \ 1733 ttt efm1 = .5*(1.0 + erf(-M_SQRT1_2)); \ 1734 ttt efp1 = .5*(1.0 + erf(M_SQRT1_2)); \ 1735 LR_set_all(o,"ms", mean, dev); \ 1736 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,mean-dev),efm1,tol) \ 1737 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,mean-dev),cc*ee,tol) \ 1738 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,mean),.5,tol) \ 1739 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,mean),cc,tol) \ 1740 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,mean+dev),efp1,tol) \ 1741 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,mean+dev),cc*ee,tol) \ 1744 testCdfPdf0gaus(gausbm,0,d,
double,.0001,0.0, 1.0)
1745 testCdfPdf0gaus(gausbm,1,d,
double,.0001,-1.0, 2.0)
1746 testCdfPdf0gaus(gausbm,2,d,
double,.0001,1.5, .5)
1748 testCdfPdf0gaus(gausbm,0,f,
float,.0001,0.0, 1.0)
1749 testCdfPdf0gaus(gausbm,1,f,
float,.0001,-1.0, 2.0)
1750 testCdfPdf0gaus(gausbm,2,f,
float,.0001,1.5, .5)
1752 testCdfPdfFR(3,d,
double,gausbm,3,60,.0001,)
1753 testCdfPdfFR(4,d,
double,gausbm,3,60,.0001,
1756 testCdfPdfFR(5,d,
double,gausbm,4,80,.0001,
1760 testSymDF(6,d,
double, gausbm, -5.5, 5.5, .0001,);
1761 testSymDF(7,d,
double, gausbm, -4.6, 4.6, .0001,);
1762 testSymDF(8,d,
double, gausbm, -3.3, 3.3, .0001,);
1763 testSymDF(9,d,
double, gausbm, -2.9, 2.9, .0001,);
1764 testSymDF(10,d,
double, gausbm,-1.4, 1.4, .0001,);
1765 testSymDF(11,d,
double, gausbm, -.7, .7, .0001,);
1767 testCdfPdfFR(3,f,
float,gausbm,3,60,.001,)
1768 testCdfPdfFR(4,f,
float,gausbm,3,60,.001,
1771 testCdfPdfFR(5,f,
float,gausbm,4,80,.001,
1774 testSymDF(6,f,
float, gausbm, -5.5, 5.5, .0001,);
1775 testSymDF(7,f,
float, gausbm, -4.6, 4.6, .0001,);
1776 testSymDF(8,f,
float, gausbm, -3.3, 3.3, .0001,);
1777 testSymDF(9,f,
float, gausbm, -2.9, 2.9, .0001,);
1778 testSymDF(10,f,
float, gausbm,-1.4, 1.4, .0001,);
1779 testSymDF(11,f,
float, gausbm, -.7, .7, .0001,);
1781 testCdfPdf0gaus(
gausmar,0,d,
double,.0001,0.0, 1.0)
1782 testCdfPdf0gaus(gausmar,0,f,
float,.001,0.0, 1.0)
1783 testCdfPdfFR(1,d,
double,gausmar,3,60,.0001,)
1784 testCdfPdfFR(1,f,
float,gausmar,3,60,.001,)
1786 #define testLRgausbm(nn,tt,ttt,ww,bn,setup) \ 1787 testLRfull(gausbm,nn,tt,ttt,ww,bn,50*10007,.1,100,setup) 1789 testLRgausbm(1,d,
double,3.0,60, )
1790 testLRgausbm(2,d,
double,3.0,60,
1793 testLRgausbm(3,d,
double,3.0,60,
1797 testLRgausbm(1,f,
float,3.0,60, )
1798 testLRgausbm(2,f,
float,3.0,60,
1801 testLRgausbm(3,f,
float,3.0,60,
1805 #define testLRgausmar(nn,tt,ttt,ww,bn,setup) \ 1806 testLRfull(gausmar,nn,tt,ttt,ww,bn,50*10007,.1,100,setup) 1808 testLRgausmar(1,d,
double,3.0,60, )
1809 testLRgausmar(2,d,
double,3.0,60,
1812 testLRgausmar(3,d,
double,3.0,60,
1816 testLRgausmar(1,f,
float,3.0,60, )
1817 testLRgausmar(2,f,
float,3.0,60,
1820 testLRgausmar(3,f,
float,3.0,60,
1834 #define testCdfPdf0cauchy(dist,nn,tt,ttt,tol,peak,wid,setup) \ 1835 void test_cdf_pdf_##tt ## _## dist ## _##nn(void) { \ 1836 LR_obj *o = LR_new(dist, LR_##ttt); \ 1838 ttt cc = M_1_PI/wid; \ 1839 LR_set_all(o,"ms", peak, wid); \ 1840 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,peak-wid),.25,tol) \ 1841 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,peak-wid),cc*.5,tol) \ 1842 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,peak),.5,tol) \ 1843 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,peak),cc,tol) \ 1844 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _CDF(o,peak+wid),.75,tol) \ 1845 CU_ASSERT_DOUBLE_EQUAL(LR##tt ## _PDF(o,peak+wid),cc*.5,tol) \ 1848 testCdfPdf0cauchy(
cauchy,0,d,
double,.0001,0.0, 1.0, )
1849 testCdfPdf0cauchy(
cauchy,1,d,
double,.0001,-1.0, 2.0, )
1850 testCdfPdf0cauchy(cauchy,2,d,
double,.0001,1.5, .5, )
1852 testCdfPdfFR(3,d,
double,cauchy,3,60,.0001,)
1853 testCdfPdfFR(4,d,
double,cauchy,3,60,.0001,
1856 testCdfPdfFR(5,d,
double,cauchy,4,80,.0001,
1860 testSymDF(6,d,
double, cauchy, -5.5, 5.5, .0001,);
1861 testSymDF(7,d,
double, cauchy, -4.6, 4.6, .0001,);
1862 testSymDF(8,d,
double, cauchy, -3.3, 3.3, .0001,);
1863 testSymDF(9,d,
double, cauchy, -2.9, 2.9, .0001,);
1864 testSymDF(10,d,
double, cauchy,-1.4, 1.4, .0001,);
1865 testSymDF(11,d,
double, cauchy, -.7, .7, .0001,);
1867 testCdfPdf0cauchy(cauchy,0,f,
float,.001,0.0, 1.0, )
1868 testCdfPdf0cauchy(cauchy,1,f,
float,.001,-1.0, 2.0, )
1869 testCdfPdf0cauchy(cauchy,2,f,
float,.001,1.5, .5, )
1871 testCdfPdfFR(3,f,
float,cauchy,3,60,.001,)
1872 testCdfPdfFR(4,f,
float,cauchy,3,60,.001,
1875 testCdfPdfFR(5,f,
float,cauchy,4,80,.001,
1879 testSymDF(6,f,
float, cauchy, -5.5, 5.5, .0001,);
1880 testSymDF(7,f,
float, cauchy, -4.6, 4.6, .0001,);
1881 testSymDF(8,f,
float, cauchy, -3.3, 3.3, .0001,);
1882 testSymDF(9,f,
float, cauchy, -2.9, 2.9, .0001,);
1883 testSymDF(10,f,
float, cauchy,-1.4, 1.4, .0001,);
1884 testSymDF(11,f,
float, cauchy, -.7, .7, .0001,);
1886 testCdfPdf0cauchy(
cauchymar,0,d,
double,.0001,0.0, 1.0, )
1887 testCdfPdf0cauchy(cauchymar,1,d,
double,.0001,-1.0, 2.0, )
1888 testCdfPdf0cauchy(cauchymar,0,f,
float,.001,0.0, 1.0, )
1889 testCdfPdf0cauchy(cauchymar,1,f,
float,.001,-1.0, 2.0, )
1891 #define testLRcauchy(nn,tt,ttt,ww,bn,setup) \ 1892 testLRfull(cauchy,nn,tt,ttt,ww,bn,50*10007,.1,100,setup) 1894 testLRcauchy(1,d,
double,3.0,60, )
1895 testLRcauchy(2,d,
double,3.0,60,
1898 testLRcauchy(3,d,
double,3.0,60,
1902 testLRcauchy(1,f,
float,3.0,60, )
1903 testLRcauchy(2,f,
float,3.0,60,
1906 testLRcauchy(3,f,
float,3.0,60,
1910 #define testLRcauchymar(nn,tt,ttt,ww,bn,setup) \ 1911 testLRfull(cauchymar,nn,tt,ttt,ww,bn,50*10007,.1,100,setup) 1913 testLRcauchymar(1,d,
double,3.0,60, )
1914 testLRcauchymar(2,d,
double,3.0,60,
1917 testLRcauchymar(3,d,
double,3.0,60,
1921 testLRcauchymar(1,f,
float,3.0,60, )
1922 testLRcauchymar(2,f,
float,3.0,60,
1925 testLRcauchymar(3,f,
float,3.0,60,
1930 testCdfPdf0cauchy(
uinvcdf, 9, d,
double,.0001,0.5, 1.0,
1934 testCdfPdfFR(10,d,
double,uinvcdf,3,60,.0001,
1939 testLRfull(uinvcdf,11,d,
double,3.0,60,50*10007,.1,100,
1944 testCdfPdf0cauchy(uinvcdf, 9, f,
float,.001,0.5, 1.0,
1948 testCdfPdfFR(10,f,
float,uinvcdf,3,60,.001,
1953 testLRfull(uinvcdf,11,f,
float,3.0,60,50*10007,.1,100,
1959 testBADdt(unif,1,d,
double, f, .5, )
1960 testBADdt(unif,2,f,
float, d, .5, )
1961 testBADdt(cauchy,3,d,
double, f, .5, )
1962 testBADdt(cauchy,4,f,
float, d, .5, )
1963 testBADdt(gausbm,5,d,
double, f, .5, )
1964 testBADdt(gausbm,6,f,
float, d, .5, )
1965 testBADdt(nexp,7,d,
double, f, .5, )
1966 testBADdt(nexp,8,f,
float, d, .5, )
1967 testBADdt(gsn12,9,d,
double, f, .5, )
1968 testBADdt(gsn12,10,f,
float, d, .5, )
1969 testBADdt(
poisson,11,i,
int, d, 2, )
1971 testBADdt(
binomial,13,i,
int, d, 2, )
1974 #define tryPdfCdf(kk,pdf,cdf) \ 1975 CU_ASSERT_DOUBLE_EQUAL(LRi_CDF(o,kk),cdf,.000001) \ 1976 CU_ASSERT_DOUBLE_EQUAL(LRi_PDF(o,kk),pdf,.000001) 1978 #define testCdfPdf0pois(nn,xp,setup) \ 1979 void test_cdf_pdf_##xp ## _poisson ## _##nn(void) { \ 1980 LR_obj *o = LR_new(poisson, LR_int); \ 1981 LR_set_all(o,"p", xp ## .); \ 1985 testCdfPdf0pois(1,1,
1986 tryPdfCdf(0,.3678794,.3678794)
1987 tryPdfCdf(1,.3678794,.7357589)
1988 tryPdfCdf(2,.1839397,.9196986)
1989 tryPdfCdf(4,.0153283,.9963402)
1990 tryPdfCdf(8,.0000091,.9999989)
1992 testCdfPdf0pois(2,2,
1993 tryPdfCdf(0,.1353353,.1353353)
1994 tryPdfCdf(1,.2706706,.4060058)
1995 tryPdfCdf(2,.2706706,.6766764)
1996 tryPdfCdf(4,.0902235,.9473470)
1997 tryPdfCdf(8,.0008593,.9997626)
1999 testCdfPdf0pois(3,4,
2000 tryPdfCdf(0,.0183156,.0183156)
2001 tryPdfCdf(1,.0732626,.0915782)
2002 tryPdfCdf(3,.1953668,.4334701)
2003 tryPdfCdf(4,.1953668,.6288369)
2004 tryPdfCdf(8,.0297702,.9786366)
2005 tryPdfCdf(12,.0006415,.9997263)
2007 testCdfPdf0pois(4,8,
2008 tryPdfCdf(0,.0003355,.0003355)
2009 tryPdfCdf(1,.0026837,.0030192)
2010 tryPdfCdf(4,.0572523,.0996324)
2011 tryPdfCdf(7,.1395865,.4529608)
2012 tryPdfCdf(8,.1395865,.5925473)
2013 tryPdfCdf(12,.0481268,.9362028)
2014 tryPdfCdf(15,.0090260,.9917690)
2028 #define testLRdisc(vty,nn,bn,xtot,vsc,vab,setup) \ 2029 void test_##vty ## _i ## _##nn(void) { \ 2030 LR_obj *o = LR_new(vty, LR_int); \ 2031 LR_bin *b = LR_bin_new(bn+1); \ 2032 double x, cdf[bn+1], tol; \ 2034 double begin = 0.5, \ 2036 for (int i = 0; i < bn; i++) { \ 2039 cdf[i] = xtot*(LRi_PDF(o,x)); \ 2041 cdf[bn] = xtot * (1.0 - LRi_CDF(o,bn-1)); \ 2042 for (int i = 0; i < xtot; i++) { \ 2043 LR_bin_add(b,LRi_RAN(o)); \ 2045 for (int i = 0; i <= bn; i++) { \ 2046 tol = max(cdf[i]*vsc,vab); \ 2047 CU_ASSERT_DOUBLE_EQUAL(1.0*b->bins[i],cdf[i],tol); \ 2049 LR_rm(&o); LR_bin_rm(&b); \ 2052 #define testLRpoisson(nn,bn,setup) \ 2053 testLRdisc(poisson,nn,bn,50*10007,.1,100,setup) 2059 testLRpoisson(5,20,
LR_set_all(o,
"p", 5.5); )
2061 testLRcheck(1, poisson, i,
int,
2065 testLRcheck(2, poisson, i,
int,
2071 #define testCdfPdf0geom(nn,xp,setup) \
2072 void test_cdf_pdf_##xp ## _geometric ## _##nn(
void) { \
2074 LR_set_all(o,
"p", . ## xp); \
2078 testCdfPdf0geom(1,25,
2079 tryPdfCdf(1,.250000,.250000)
2080 tryPdfCdf(2,.187500,.437500)
2081 tryPdfCdf(3,.140625,.578125)
2082 tryPdfCdf(4,.105469,.683594)
2083 tryPdfCdf(8,.033371,.899887)
2085 testCdfPdf0geom(2,50,
2086 tryPdfCdf(1,.500000,.500000)
2087 tryPdfCdf(2,.250000,.750000)
2088 tryPdfCdf(3,.125000,.875000)
2089 tryPdfCdf(4,.062500,.937500)
2090 tryPdfCdf(8,.003906,.996094)
2092 testCdfPdf0geom(3,75,
2093 tryPdfCdf(1,.750000,.750000)
2094 tryPdfCdf(2,.187500,.937500)
2095 tryPdfCdf(3,.046875,.984375)
2096 tryPdfCdf(4,.011719,.996094)
2097 tryPdfCdf(5,.002930,.999023)
2100 #define testLRgeom(nn,bn,setup) \ 2101 testLRdisc(geometric,nn,bn,50*10007,.1,100,setup) 2110 testLRcheck(1, geometric, i,
int,
2114 testLRcheck(2, geometric, i,
int,
2118 testLRcheck(3, geometric, i,
int,
2120 CU_ASSERT_EQUAL(
LR_check(o), LRerr_InvalidInputValue);
2124 #define testCdfPdf0binom(nn,xp,mm,setup) \ 2125 void test_cdf_pdf_##xp ## _binomial ## _##nn(void) { \ 2126 LR_obj *o = LR_new(binomial, LR_int); \ 2127 LR_set_all(o,"pn", . ## xp, mm); \ 2130 testCdfPdf0binom(1,25, 10,
2131 tryPdfCdf(0,.056314,.056314)
2132 tryPdfCdf(2,.281568,.525593)
2133 tryPdfCdf(5,.058399,.980272)
2134 tryPdfCdf(7,.003090,.999584)
2135 tryPdfCdf(8,.000386,.999970)
2137 testCdfPdf0binom(2,50, 10,
2138 tryPdfCdf(0,.000977,.000977)
2139 tryPdfCdf(2,.043945,.054688)
2140 tryPdfCdf(5,.246094,.623047)
2141 tryPdfCdf(7,.117188,.945313)
2142 tryPdfCdf(8,.043945,.989258)
2144 testCdfPdf0binom(3,80, 10,
2145 tryPdfCdf(0,.000000,.000000)
2146 tryPdfCdf(2,.000074,.000078)
2147 tryPdfCdf(5,.026424,.032793)
2148 tryPdfCdf(7,.201327,.322200)
2149 tryPdfCdf(8,.301990,.624190)
2150 tryPdfCdf(10,.107374,1.000000)
2153 #define testLRbinom(nn,bn,setup) \ 2154 testLRdisc(binomial,nn,bn,50*10007,.1,100, \ 2155 LR_set_all(o,"n", bn); \ 2165 testLRcheck(1, binomial, i,
int,
2167 CU_ASSERT_EQUAL(
LR_check(o), LRerr_OK);
2169 testLRcheck(2, binomial, i,
int,
2171 CU_ASSERT_EQUAL(
LR_check(o), LRerr_InvalidInputValue);
2173 testLRcheck(3, binomial, i,
int,
2175 CU_ASSERT_EQUAL(
LR_check(o), LRerr_InvalidInputValue);
2177 testLRcheck(4, binomial, i,
int,
2178 CU_ASSERT_EQUAL(
LR_check(o), LRerr_InvalidInputValue);
2180 testLRcheck(5, binomial, i,
int,
2182 CU_ASSERT_EQUAL(
LR_check(o), LRerr_OK);
2185 int main(
int argc,
char* argv[]) {
2186 CU_pSuite pS = NULL;
2187 CU_pSuite pSint = NULL;
2188 CU_pSuite pShalf = NULL;
2189 CU_pSuite pSfull = NULL;
2190 CU_pSuite pSdisc = NULL;
2191 CU_BasicRunMode mode = CU_BRM_VERBOSE;
2192 CU_ErrorAction error_action = CUEA_IGNORE;
2196 setvbuf(stdout, NULL, _IONBF, 0);
2198 for (i=1 ; i<argc ; i++) {
2199 if (!strcmp(
"-i", argv[i])) {
2200 error_action = CUEA_IGNORE;
2201 }
else if (!strcmp(
"-f", argv[i])) {
2202 error_action = CUEA_FAIL;
2203 }
else if (!strcmp(
"-A", argv[i])) {
2204 error_action = CUEA_ABORT;
2205 }
else if (!strcmp(
"-s", argv[i])) {
2206 mode = CU_BRM_SILENT;
2207 }
else if (!strcmp(
"-n", argv[i])) {
2208 mode = CU_BRM_NORMAL;
2209 }
else if (!strcmp(
"-I", argv[i])) {
2211 }
else if (!strcmp(
"-v", argv[i])) {
2212 mode = CU_BRM_VERBOSE;
2215 "\nUsage: %s [options]\n\n" 2216 "Options: -i ignore framework errors [default].\n" 2217 " -f fail on framework error.\n" 2218 " -A abort on framework error.\n\n" 2219 " -s silent mode - no output to screen.\n" 2220 " -n normal mode - standard output to screen.\n" 2221 " -I interactive mode - uses curses.\n" 2222 " -v verbose mode - max output to screen [default].\n\n" 2223 " -h print this message and exit.\n\n", argv[0]);
2228 if (CUE_SUCCESS != CU_initialize_registry()) {
2229 printf(
"\nTest Registry initialization failed.");
2230 return CU_get_error();
2232 pS = CU_add_suite(
"LR_test_suite", init_suite, clean_suite);
2234 printf(
"\nTest Registry Suite failure.");
2235 CU_cleanup_registry();
2236 return CU_get_error();
2238 pSint = CU_add_suite(
"LR_test_suite_interval",
2239 init_suite, clean_suite);
2240 if (pSint == NULL) {
2241 printf(
"\nTest Registry Suite Interval failure.");
2242 CU_cleanup_registry();
2243 return CU_get_error();
2245 pShalf = CU_add_suite(
"LR_test_suite_half_range",
2246 init_suite, clean_suite);
2247 if (pShalf == NULL) {
2248 printf(
"\nTest Registry Suite Half Range failure.");
2249 CU_cleanup_registry();
2250 return CU_get_error();
2252 pSfull = CU_add_suite(
"LR_test_suite_full_range",
2253 init_suite, clean_suite);
2254 if (pSfull == NULL) {
2255 printf(
"\nTest Registry Suite Full Range failure.");
2256 CU_cleanup_registry();
2257 return CU_get_error();
2259 pSdisc = CU_add_suite(
"LR_test_suite_discrete",
2260 init_suite, clean_suite);
2261 if (pSdisc == NULL) {
2262 printf(
"\nTest Registry Suite Discrete failure.");
2263 CU_cleanup_registry();
2264 return CU_get_error();
2267 if ((NULL == CU_add_test(pS,
"errors", test_LR_errors))
2268 || (NULL == CU_add_test(pS,
"version", test_LR_version))
2269 || (NULL == CU_add_test(pS,
"new - int", test_new_int))
2270 || (NULL == CU_add_test(pS,
"new - float", test_new_float))
2271 || (NULL == CU_add_test(pS,
"new - long", test_new_long))
2272 || (NULL == CU_add_test(pS,
"new - double", test_new_double))
2273 || (NULL == CU_add_test(pS,
"set - int", test_set_int))
2274 || (NULL == CU_add_test(pS,
"set - float", test_set_float))
2275 || (NULL == CU_add_test(pS,
"set - long", test_set_long))
2276 || (NULL == CU_add_test(pS,
"set - double", test_set_double))
2277 || (NULL == CU_add_test(pS,
"set_all - int", test_set_all_int))
2278 || (NULL == CU_add_test(pS,
"set_all - float", test_set_all_float))
2279 || (NULL == CU_add_test(pS,
"set_all - long", test_set_all_long))
2280 || (NULL == CU_add_test(pS,
"set_all - double",test_set_all_double))
2281 || (NULL == CU_add_test(pS,
"set_all2 - int", test_set_all2_int))
2282 || (NULL == CU_add_test(pS,
"set_all2 - float", test_set_all2_float))
2283 || (NULL == CU_add_test(pS,
"set_all2 - long", test_set_all2_long))
2284 || (NULL == CU_add_test(pS,
"set_all2 - double",test_set_all2_double))
2285 || (NULL == CU_add_test(pS,
"set_all3 - int", test_set_all3_int))
2286 || (NULL == CU_add_test(pS,
"set_all3 - float", test_set_all3_float))
2287 || (NULL == CU_add_test(pS,
"set_all3 - long", test_set_all3_long))
2288 || (NULL == CU_add_test(pS,
"set_all3 - double",test_set_all3_double))
2289 || (NULL == CU_add_test(pS,
"check - bad",test_check_bad_0))
2290 || (NULL == CU_add_test(pS,
"check - d - 0",test_check_unif_d_0))
2291 || (NULL == CU_add_test(pS,
"check - d - 1",test_check_unif_d_1))
2292 || (NULL == CU_add_test(pS,
"check - d - 2",test_check_gausbm_d_2))
2293 || (NULL == CU_add_test(pS,
"check - d - 3",test_check_gausbm_d_3))
2294 || (NULL == CU_add_test(pS,
"check - d - 4",test_check_uinvcdf_d_4))
2295 || (NULL == CU_add_test(pS,
"check - d - 5",test_check_uinvcdf_d_5))
2296 || (NULL == CU_add_test(pS,
"check - d - 6",test_check_uinvcdf_d_6))
2297 || (NULL == CU_add_test(pS,
"check - d - 7",test_check_uinvcdf_d_7))
2298 || (NULL == CU_add_test(pS,
"check - d - 8",test_check_uinvcdf_d_8))
2299 || (NULL == CU_add_test(pS,
"check - d - 9",test_check_uinvcdf_d_9))
2300 || (NULL == CU_add_test(pS,
"check - f - 0",test_check_unif_f_0))
2301 || (NULL == CU_add_test(pS,
"check - f - 1",test_check_unif_f_1))
2302 || (NULL == CU_add_test(pS,
"check - f - 2",test_check_gausbm_f_2))
2303 || (NULL == CU_add_test(pS,
"check - f - 3",test_check_gausbm_f_3))
2304 || (NULL == CU_add_test(pS,
"check - f - 4",test_check_uinvcdf_f_4))
2305 || (NULL == CU_add_test(pS,
"check - f - 5",test_check_uinvcdf_f_5))
2306 || (NULL == CU_add_test(pS,
"check - f - 6",test_check_uinvcdf_f_6))
2307 || (NULL == CU_add_test(pS,
"check - f - 7",test_check_uinvcdf_f_7))
2308 || (NULL == CU_add_test(pS,
"check - f - 8",test_check_uinvcdf_f_8))
2309 || (NULL == CU_add_test(pS,
"check - f - 9",test_check_uinvcdf_f_9))
2310 || (NULL == CU_add_test(pS,
"indep seq - 1",test_indep_seq_1))
2311 || (NULL == CU_add_test(pS,
"indep seq - 2",test_indep_seq_2))
2312 || (NULL == CU_add_test(pS,
"indep seq - 3",test_indep_seq_3))
2313 || (NULL == CU_add_test(pS,
"indep seq - 4",test_indep_seq_4))
2314 || (NULL == CU_add_test(pS,
"indep seq - 5",test_indep_seq_5))
2315 || (NULL == CU_add_test(pS,
"indep seq - 6",test_indep_seq_6))
2321 || (NULL == CU_add_test(pS,
"new_bin - double", test_bin_new_double))
2322 || (NULL == CU_add_test(pS,
"new_bin_set - 1", test_bin_set_1))
2323 || (NULL == CU_add_test(pS,
"new_bin_set - 2", test_bin_set_2))
2324 || (NULL == CU_add_test(pS,
"new_bin_set - 3", test_bin_set_3))
2325 || (NULL == CU_add_test(pS,
"new_bin_set - 4", test_bin_set_4))
2326 || (NULL == CU_add_test(pS,
"new_bin_add - 1", test_bin_add_1))
2327 || (NULL == CU_add_test(pS,
"new_bin_add - 2", test_bin_add_2))
2328 || (NULL == CU_add_test(pS,
"new_bin_add - 3", test_bin_add_3))
2329 || (NULL == CU_add_test(pS,
"new_bin_add - 4", test_bin_add_4))
2330 || (NULL == CU_add_test(pS,
"bad data type - 1", test_bad_d_dt_1))
2331 || (NULL == CU_add_test(pS,
"bad data type - 2", test_bad_f_dt_2))
2332 || (NULL == CU_add_test(pS,
"bad data type - 3", test_bad_d_dt_3))
2333 || (NULL == CU_add_test(pS,
"bad data type - 4", test_bad_f_dt_4))
2334 || (NULL == CU_add_test(pS,
"bad data type - 5", test_bad_d_dt_5))
2335 || (NULL == CU_add_test(pS,
"bad data type - 6", test_bad_f_dt_6))
2336 || (NULL == CU_add_test(pS,
"bad data type - 7", test_bad_d_dt_7))
2337 || (NULL == CU_add_test(pS,
"bad data type - 8", test_bad_f_dt_8))
2338 || (NULL == CU_add_test(pS,
"bad data type - 9", test_bad_d_dt_9))
2339 || (NULL == CU_add_test(pS,
"bad data type - 10", test_bad_f_dt_10))
2340 || (NULL == CU_add_test(pS,
"bad data type - 11", test_bad_i_dt_11))
2341 || (NULL == CU_add_test(pS,
"bad data type - 12", test_bad_i_dt_12))
2342 || (NULL == CU_add_test(pS,
"bad data type - 13", test_bad_i_dt_13))
2344 printf(
"\nTest Suite additions failure.");
2345 CU_cleanup_registry();
2346 return CU_get_error();
2348 if ((NULL == CU_add_test(pSint,
"Unif-P/CDF-d-0", test_cdf_pdf_d_unif_0))
2349 || (NULL == CU_add_test(pSint,
"Unif-P/CDF-d-1", test_cdf_pdf_d_unif_1))
2350 || (NULL == CU_add_test(pSint,
"Unif-P/CDF-d-2", test_cdf_pdf_d_unif_2))
2351 || (NULL == CU_add_test(pSint,
"Unif-P/CDF-d-3", test_cdf_pdf_d_unif_3))
2352 || (NULL == CU_add_test(pSint,
"Unif-P/CDF-d-4", test_cdf_pdf_d_unif_4))
2353 || (NULL == CU_add_test(pSint,
"Unif-P/CDF-d-5", test_cdf_pdf_d_unif_5))
2354 || (NULL == CU_add_test(pSint,
"Unif-Ran-d-1", test_unif_d_1))
2355 || (NULL == CU_add_test(pSint,
"Unif-Ran-d-2", test_unif_d_2))
2356 || (NULL == CU_add_test(pSint,
"Unif-Ran-d-3", test_unif_d_3))
2357 || (NULL == CU_add_test(pSint,
"Unif-Ran-d-4", test_unif_d_4))
2358 || (NULL == CU_add_test(pSint,
"Unif-P/CDF-f-0", test_cdf_pdf_f_unif_0))
2359 || (NULL == CU_add_test(pSint,
"Unif-P/CDF-f-1", test_cdf_pdf_f_unif_1))
2360 || (NULL == CU_add_test(pSint,
"Unif-P/CDF-f-2", test_cdf_pdf_f_unif_2))
2361 || (NULL == CU_add_test(pSint,
"Unif-P/CDF-f-3", test_cdf_pdf_f_unif_3))
2362 || (NULL == CU_add_test(pSint,
"Unif-P/CDF-f-4", test_cdf_pdf_f_unif_4))
2363 || (NULL == CU_add_test(pSint,
"Unif-P/CDF-f-5", test_cdf_pdf_f_unif_5))
2364 || (NULL == CU_add_test(pSint,
"Unif-Ran-f-1", test_unif_f_1))
2365 || (NULL == CU_add_test(pSint,
"Unif-Ran-f-2", test_unif_f_2))
2366 || (NULL == CU_add_test(pSint,
"Unif-Ran-f-3", test_unif_f_3))
2367 || (NULL == CU_add_test(pSint,
"Unif-Ran-f-4", test_unif_f_4))
2368 || (NULL == CU_add_test(pSint,
"Piece-P/CDF-d-0",test_cdf_pdf_d_piece_0))
2369 || (NULL == CU_add_test(pSint,
"Piece-P/CDF-d-1",test_cdf_pdf_d_piece_1))
2370 || (NULL == CU_add_test(pSint,
"Piece-P/CDF-d-2",test_cdf_pdf_d_piece_2))
2371 || (NULL == CU_add_test(pSint,
"Piece-P/CDF-d-3",test_cdf_pdf_d_piece_3))
2372 || (NULL == CU_add_test(pSint,
"Piece-Ran-d-1", test_piece_d_1))
2373 || (NULL == CU_add_test(pSint,
"Piece-Ran-d-2", test_piece_d_2))
2374 || (NULL == CU_add_test(pSint,
"Piece-Ran-d-3", test_piece_d_3))
2375 || (NULL == CU_add_test(pSint,
"Piece-Ran-d-4", test_piece_d_4))
2376 || (NULL == CU_add_test(pSint,
"Piece-P/CDF-f-0",test_cdf_pdf_f_piece_0))
2377 || (NULL == CU_add_test(pSint,
"Piece-P/CDF-f-1",test_cdf_pdf_f_piece_1))
2378 || (NULL == CU_add_test(pSint,
"Piece-P/CDF-f-2",test_cdf_pdf_f_piece_2))
2379 || (NULL == CU_add_test(pSint,
"Piece-P/CDF-f-3",test_cdf_pdf_f_piece_3))
2380 || (NULL == CU_add_test(pSint,
"Piece-Ran-f-1", test_piece_f_1))
2381 || (NULL == CU_add_test(pSint,
"Piece-Ran-f-2", test_piece_f_2))
2382 || (NULL == CU_add_test(pSint,
"Piece-Ran-f-3", test_piece_f_3))
2383 || (NULL == CU_add_test(pSint,
"Piece-Ran-f-4", test_piece_f_4))
2384 || (NULL == CU_add_test(pSint,
"Piece-Bad-d-0", test_bad_d_piece_0))
2385 || (NULL == CU_add_test(pSint,
"Piece-Bad-f-0", test_bad_f_piece_0))
2386 || (NULL == CU_add_test(pSint,
"Gsn2-P/CDF-d-0", test_cdf_pdf_d_gsn2_0))
2387 || (NULL == CU_add_test(pSint,
"Gsn2-P/CDF-d-1", test_cdf_pdf_d_gsn2_1))
2388 || (NULL == CU_add_test(pSint,
"Gsn2-P/CDF-d-2", test_cdf_pdf_d_gsn2_2))
2389 || (NULL == CU_add_test(pSint,
"Gsn2-P/CDF-d-3", test_cdf_pdf_d_gsn2_3))
2390 || (NULL == CU_add_test(pSint,
"Gsn2-P/CDF-d-4", test_cdf_pdf_d_gsn2_4))
2391 || (NULL == CU_add_test(pSint,
"Gsn2-P/CDF-d-5", test_cdf_pdf_d_gsn2_5))
2392 || (NULL == CU_add_test(pSint,
"Gsn2-Sym-d-6", test_sym_d_gsn2_6))
2393 || (NULL == CU_add_test(pSint,
"Gsn2-Sym-d-7", test_sym_d_gsn2_7))
2394 || (NULL == CU_add_test(pSint,
"Gsn2-Sym-d-8", test_sym_d_gsn2_8))
2395 || (NULL == CU_add_test(pSint,
"Gsn2-Ran-d-1", test_gsn2_d_1))
2396 || (NULL == CU_add_test(pSint,
"Gsn2-Ran-d-2", test_gsn2_d_2))
2397 || (NULL == CU_add_test(pSint,
"Gsn2-Ran-d-3", test_gsn2_d_3))
2398 || (NULL == CU_add_test(pSint,
"Gsn2-Ran-d-4", test_gsn2_d_4))
2399 || (NULL == CU_add_test(pSint,
"Gsn2-P/CDF-f-0", test_cdf_pdf_f_gsn2_0))
2400 || (NULL == CU_add_test(pSint,
"Gsn2-P/CDF-f-1", test_cdf_pdf_f_gsn2_1))
2401 || (NULL == CU_add_test(pSint,
"Gsn2-P/CDF-f-2", test_cdf_pdf_f_gsn2_2))
2402 || (NULL == CU_add_test(pSint,
"Gsn2-P/CDF-f-3", test_cdf_pdf_f_gsn2_3))
2403 || (NULL == CU_add_test(pSint,
"Gsn2-P/CDF-f-4", test_cdf_pdf_f_gsn2_4))
2404 || (NULL == CU_add_test(pSint,
"Gsn2-P/CDF-f-5", test_cdf_pdf_f_gsn2_5))
2405 || (NULL == CU_add_test(pSint,
"Gsn2-Sym-f-6", test_sym_f_gsn2_6))
2406 || (NULL == CU_add_test(pSint,
"Gsn2-Sym-f-7", test_sym_f_gsn2_7))
2407 || (NULL == CU_add_test(pSint,
"Gsn2-Sym-f-8", test_sym_f_gsn2_8))
2408 || (NULL == CU_add_test(pSint,
"Gsn2-Ran-f-1", test_gsn2_f_1))
2409 || (NULL == CU_add_test(pSint,
"Gsn2-Ran-f-2", test_gsn2_f_2))
2410 || (NULL == CU_add_test(pSint,
"Gsn2-Ran-f-3", test_gsn2_f_3))
2411 || (NULL == CU_add_test(pSint,
"Gsn2-Ran-f-4", test_gsn2_f_4))
2412 || (NULL == CU_add_test(pSint,
"Gsn4-P/CDF-d-0", test_cdf_pdf_d_gsn4_0))
2413 || (NULL == CU_add_test(pSint,
"Gsn4-P/CDF-d-1", test_cdf_pdf_d_gsn4_1))
2414 || (NULL == CU_add_test(pSint,
"Gsn4-P/CDF-d-2", test_cdf_pdf_d_gsn4_2))
2415 || (NULL == CU_add_test(pSint,
"Gsn4-P/CDF-d-3", test_cdf_pdf_d_gsn4_3))
2416 || (NULL == CU_add_test(pSint,
"Gsn4-P/CDF-d-4", test_cdf_pdf_d_gsn4_4))
2417 || (NULL == CU_add_test(pSint,
"Gsn4-P/CDF-d-5", test_cdf_pdf_d_gsn4_5))
2418 || (NULL == CU_add_test(pSint,
"Gsn4-Sym-d-6", test_sym_d_gsn4_6))
2419 || (NULL == CU_add_test(pSint,
"Gsn4-Sym-d-7", test_sym_d_gsn4_7))
2420 || (NULL == CU_add_test(pSint,
"Gsn4-Sym-d-8", test_sym_d_gsn4_8))
2421 || (NULL == CU_add_test(pSint,
"Gsn4-Sym-d-9", test_sym_d_gsn4_9))
2422 || (NULL == CU_add_test(pSint,
"Gsn4-Sym-d-10", test_sym_d_gsn4_10))
2423 || (NULL == CU_add_test(pSint,
"Gsn4-Sym-d-11", test_sym_d_gsn4_11))
2424 || (NULL == CU_add_test(pSint,
"Gsn4-Ran-d-1", test_gsn4_d_1))
2425 || (NULL == CU_add_test(pSint,
"Gsn4-Ran-d-2", test_gsn4_d_2))
2426 || (NULL == CU_add_test(pSint,
"Gsn4-Ran-d-3", test_gsn4_d_3))
2427 || (NULL == CU_add_test(pSint,
"Gsn4-Ran-d-4", test_gsn4_d_4))
2428 || (NULL == CU_add_test(pSint,
"Gsn4-P/CDF-f-0", test_cdf_pdf_f_gsn4_0))
2429 || (NULL == CU_add_test(pSint,
"Gsn4-P/CDF-f-1", test_cdf_pdf_f_gsn4_1))
2430 || (NULL == CU_add_test(pSint,
"Gsn4-P/CDF-f-2", test_cdf_pdf_f_gsn4_2))
2431 || (NULL == CU_add_test(pSint,
"Gsn4-P/CDF-f-3", test_cdf_pdf_f_gsn4_3))
2432 || (NULL == CU_add_test(pSint,
"Gsn4-P/CDF-f-4", test_cdf_pdf_f_gsn4_4))
2433 || (NULL == CU_add_test(pSint,
"Gsn4-P/CDF-f-5", test_cdf_pdf_f_gsn4_5))
2434 || (NULL == CU_add_test(pSint,
"Gsn4-Sym-f-6", test_sym_f_gsn4_6))
2435 || (NULL == CU_add_test(pSint,
"Gsn4-Sym-f-7", test_sym_f_gsn4_7))
2436 || (NULL == CU_add_test(pSint,
"Gsn4-Sym-f-8", test_sym_f_gsn4_8))
2437 || (NULL == CU_add_test(pSint,
"Gsn4-Sym-f-9", test_sym_f_gsn4_9))
2438 || (NULL == CU_add_test(pSint,
"Gsn4-Sym-f-10", test_sym_f_gsn4_10))
2439 || (NULL == CU_add_test(pSint,
"Gsn4-Sym-f-11", test_sym_f_gsn4_11))
2440 || (NULL == CU_add_test(pSint,
"Gsn4-Ran-f-1", test_gsn4_f_1))
2441 || (NULL == CU_add_test(pSint,
"Gsn4-Ran-f-2", test_gsn4_f_2))
2442 || (NULL == CU_add_test(pSint,
"Gsn4-Ran-f-3", test_gsn4_f_3))
2443 || (NULL == CU_add_test(pSint,
"Gsn4-Ran-f-4", test_gsn4_f_4))
2444 || (NULL == CU_add_test(pSint,
"Gsn12-P/CDF-f-0", test_cdf_pdf_f_gsn12_0))
2445 || (NULL == CU_add_test(pSint,
"Gsn12-P/CDF-f-1", test_cdf_pdf_f_gsn12_1))
2446 || (NULL == CU_add_test(pSint,
"Gsn12-P/CDF-f-2", test_cdf_pdf_f_gsn12_2))
2447 || (NULL == CU_add_test(pSint,
"Gsn12-P/CDF-f-3", test_cdf_pdf_f_gsn12_3))
2448 || (NULL == CU_add_test(pSint,
"Gsn12-P/CDF-f-4", test_cdf_pdf_f_gsn12_4))
2449 || (NULL == CU_add_test(pSint,
"Gsn12-P/CDF-f-5", test_cdf_pdf_f_gsn12_5))
2450 || (NULL == CU_add_test(pSint,
"Gsn12-Sym-f-6", test_sym_f_gsn12_6))
2451 || (NULL == CU_add_test(pSint,
"Gsn12-Sym-f-7", test_sym_f_gsn12_7))
2452 || (NULL == CU_add_test(pSint,
"Gsn12-Sym-f-8", test_sym_f_gsn12_8))
2453 || (NULL == CU_add_test(pSint,
"Gsn12-Sym-f-9", test_sym_f_gsn12_9))
2454 || (NULL == CU_add_test(pSint,
"Gsn12-Sym-f-10", test_sym_f_gsn12_10))
2455 || (NULL == CU_add_test(pSint,
"Gsn12-Sym-f-11", test_sym_f_gsn12_11))
2456 || (NULL == CU_add_test(pSint,
"Gsn12-Sym-f-12", test_sym_f_gsn12_12))
2457 || (NULL == CU_add_test(pSint,
"Gsn12-Sym-f-13", test_sym_f_gsn12_13))
2458 || (NULL == CU_add_test(pSint,
"Gsn12-Sym-f-14", test_sym_f_gsn12_14))
2459 || (NULL == CU_add_test(pSint,
"Gsn12-Ran-f-1", test_gsn12_f_1))
2460 || (NULL == CU_add_test(pSint,
"Gsn12-Ran-f-2", test_gsn12_f_2))
2461 || (NULL == CU_add_test(pSint,
"Gsn12-Ran-f-3", test_gsn12_f_3))
2462 || (NULL == CU_add_test(pSint,
"Gsn12-Ran-f-4", test_gsn12_f_4))
2463 || (NULL == CU_add_test(pSint,
"Lspline-P/CDF-d-0",test_cdf_pdf_d_lspline_0))
2464 || (NULL == CU_add_test(pSint,
"Lspline-P/CDF-d-1",test_cdf_pdf_d_lspline_1))
2465 || (NULL == CU_add_test(pSint,
"Lspline-P/CDF-d-2",test_cdf_pdf_d_lspline_2))
2466 || (NULL == CU_add_test(pSint,
"Lspline-P/CDF-d-3",test_cdf_pdf_d_lspline_3))
2467 || (NULL == CU_add_test(pSint,
"Lspline-Ran-d-1", test_lspline_d_1))
2468 || (NULL == CU_add_test(pSint,
"Lspline-Ran-d-2", test_lspline_d_2))
2469 || (NULL == CU_add_test(pSint,
"Lspline-Ran-d-3", test_lspline_d_3))
2470 || (NULL == CU_add_test(pSint,
"Lspline-Ran-d-4", test_lspline_d_4))
2471 || (NULL == CU_add_test(pSint,
"Lspline-P/CDF-f-0",test_cdf_pdf_f_lspline_0))
2472 || (NULL == CU_add_test(pSint,
"Lspline-P/CDF-f-1",test_cdf_pdf_f_lspline_1))
2473 || (NULL == CU_add_test(pSint,
"Lspline-P/CDF-f-2",test_cdf_pdf_f_lspline_2))
2474 || (NULL == CU_add_test(pSint,
"Lspline-P/CDF-f-3",test_cdf_pdf_f_lspline_3))
2475 || (NULL == CU_add_test(pSint,
"Lspline-Ran-f-1", test_lspline_f_1))
2476 || (NULL == CU_add_test(pSint,
"Lspline-Ran-f-2", test_lspline_f_2))
2477 || (NULL == CU_add_test(pSint,
"Lspline-Ran-f-3", test_lspline_f_3))
2478 || (NULL == CU_add_test(pSint,
"Lspline-Ran-f-4", test_lspline_f_4))
2479 || (NULL == CU_add_test(pSint,
"Lspline-Bad-d-0", test_bad_d_lspline_0))
2480 || (NULL == CU_add_test(pSint,
"Lspline-Bad-f-0", test_bad_f_lspline_0))
2481 || (NULL == CU_add_test(pSint,
"Uinvcdf-P/CDF-d-0",test_cdf_pdf_d_uinvcdf_0))
2482 || (NULL == CU_add_test(pSint,
"Uinvcdf-P/CDF-d-1",test_cdf_pdf_d_uinvcdf_1))
2483 || (NULL == CU_add_test(pSint,
"Uinvcdf-Sym-d-2", test_sym_d_uinvcdf_2))
2484 || (NULL == CU_add_test(pSint,
"Uinvcdf-Sym-d-3", test_sym_d_uinvcdf_3))
2485 || (NULL == CU_add_test(pSint,
"Uinvcdf-Sym-d-4", test_sym_d_uinvcdf_4))
2486 || (NULL == CU_add_test(pSint,
"Uinvcdf-Sym-d-5", test_sym_d_uinvcdf_5))
2487 || (NULL == CU_add_test(pSint,
"Uinvcdf-Sym-d-6", test_sym_d_uinvcdf_6))
2488 || (NULL == CU_add_test(pSint,
"Uinvcdf-Ran-d-7", test_uinvcdf_d_7))
2489 || (NULL == CU_add_test(pSint,
"Uinvcdf-Ran-d-8", test_uinvcdf_d_8))
2490 || (NULL == CU_add_test(pSint,
"Uinvcdf-P/CDF-f-0",test_cdf_pdf_f_uinvcdf_0))
2491 || (NULL == CU_add_test(pSint,
"Uinvcdf-P/CDF-f-1",test_cdf_pdf_f_uinvcdf_1))
2492 || (NULL == CU_add_test(pSint,
"Uinvcdf-Sym-f-2", test_sym_f_uinvcdf_2))
2493 || (NULL == CU_add_test(pSint,
"Uinvcdf-Sym-f-3", test_sym_f_uinvcdf_3))
2494 || (NULL == CU_add_test(pSint,
"Uinvcdf-Sym-f-4", test_sym_f_uinvcdf_4))
2495 || (NULL == CU_add_test(pSint,
"Uinvcdf-Sym-f-5", test_sym_f_uinvcdf_5))
2496 || (NULL == CU_add_test(pSint,
"Uinvcdf-Sym-f-6", test_sym_f_uinvcdf_6))
2497 || (NULL == CU_add_test(pSint,
"Uinvcdf-Ran-f-7", test_uinvcdf_f_7))
2498 || (NULL == CU_add_test(pSint,
"Uinvcdf-Ran-f-8", test_uinvcdf_f_8))
2500 printf(
"\nTest Suite interval additions failure.");
2501 CU_cleanup_registry();
2502 return CU_get_error();
2505 if ((NULL == CU_add_test(pShalf,
"Nexp-P/CDF-d-0", test_cdf_pdf_d_nexp_0))
2506 || (NULL == CU_add_test(pShalf,
"Nexp-P/CDF-d-1", test_cdf_pdf_d_nexp_1))
2507 || (NULL == CU_add_test(pShalf,
"Nexp-P/CDF-d-2", test_cdf_pdf_d_nexp_2))
2508 || (NULL == CU_add_test(pShalf,
"Nexp-P/CDF-d-3", test_cdf_pdf_d_nexp_3))
2509 || (NULL == CU_add_test(pShalf,
"Nexp-P/CDF-d-4", test_cdf_pdf_d_nexp_4))
2510 || (NULL == CU_add_test(pShalf,
"Nexp-P/CDF-d-5", test_cdf_pdf_d_nexp_5))
2511 || (NULL == CU_add_test(pShalf,
"Nexp-Ran-d-1", test_nexp_d_1))
2512 || (NULL == CU_add_test(pShalf,
"Nexp-Ran-d-2", test_nexp_d_2))
2513 || (NULL == CU_add_test(pShalf,
"Nexp-Ran-d-3", test_nexp_d_3))
2514 || (NULL == CU_add_test(pShalf,
"Nexp-P/CDF-f-0", test_cdf_pdf_f_nexp_0))
2515 || (NULL == CU_add_test(pShalf,
"Nexp-P/CDF-f-1", test_cdf_pdf_f_nexp_1))
2516 || (NULL == CU_add_test(pShalf,
"Nexp-P/CDF-f-2", test_cdf_pdf_f_nexp_2))
2517 || (NULL == CU_add_test(pShalf,
"Nexp-P/CDF-f-3", test_cdf_pdf_f_nexp_3))
2518 || (NULL == CU_add_test(pShalf,
"Nexp-P/CDF-f-4", test_cdf_pdf_f_nexp_4))
2519 || (NULL == CU_add_test(pShalf,
"Nexp-P/CDF-f-5", test_cdf_pdf_f_nexp_5))
2520 || (NULL == CU_add_test(pShalf,
"Nexp-Ran-f-1", test_nexp_f_1))
2521 || (NULL == CU_add_test(pShalf,
"Nexp-Ran-f-2", test_nexp_f_2))
2522 || (NULL == CU_add_test(pShalf,
"Nexp-Ran-f-3", test_nexp_f_3))
2523 || (NULL == CU_add_test(pShalf,
"Erlang/Nexp-P/CDF-d-0", test_cdf_pdf_d_erlang_0))
2524 || (NULL == CU_add_test(pShalf,
"Erlang/Nexp-P/CDF-d-1", test_cdf_pdf_d_erlang_1))
2525 || (NULL == CU_add_test(pShalf,
"Erlang/Nexp-P/CDF-d-2", test_cdf_pdf_d_erlang_2))
2526 || (NULL == CU_add_test(pShalf,
"Erlang/Nexp-P/CDF-d-3", test_cdf_pdf_d_erlang_3))
2527 || (NULL == CU_add_test(pShalf,
"Erlang/Nexp-P/CDF-d-4", test_cdf_pdf_d_erlang_4))
2528 || (NULL == CU_add_test(pShalf,
"Erlang/Nexp-P/CDF-d-5", test_cdf_pdf_d_erlang_5))
2529 || (NULL == CU_add_test(pShalf,
"Erlang/Nexp-Ran-d-1", test_erlang_d_1))
2530 || (NULL == CU_add_test(pShalf,
"Erlang/Nexp-Ran-d-2", test_erlang_d_2))
2531 || (NULL == CU_add_test(pShalf,
"Erlang/Nexp-Ran-d-3", test_erlang_d_3))
2532 || (NULL == CU_add_test(pShalf,
"Erlang2-P/CDF-d-0", test_cdf_pdf_d_erlang2_0))
2533 || (NULL == CU_add_test(pShalf,
"Erlang2-P/CDF-d-1", test_cdf_pdf_d_erlang2_1))
2534 || (NULL == CU_add_test(pShalf,
"Erlang2-P/CDF-d-2", test_cdf_pdf_d_erlang2_2))
2535 || (NULL == CU_add_test(pShalf,
"Erlang2-Ran-d-4", test_erlang_d_4))
2536 || (NULL == CU_add_test(pShalf,
"Erlang2-Ran-d-5", test_erlang_d_5))
2537 || (NULL == CU_add_test(pShalf,
"Erlang2-Ran-d-6", test_erlang_d_6))
2538 || (NULL == CU_add_test(pShalf,
"Erlang3-P/CDF-d-0", test_cdf_pdf_d_erlang3_0))
2539 || (NULL == CU_add_test(pShalf,
"Erlang3-P/CDF-d-1", test_cdf_pdf_d_erlang3_1))
2540 || (NULL == CU_add_test(pShalf,
"Erlang3-P/CDF-d-2", test_cdf_pdf_d_erlang3_2))
2541 || (NULL == CU_add_test(pShalf,
"Erlang3-Ran-d-7", test_erlang_d_7))
2542 || (NULL == CU_add_test(pShalf,
"Erlang3-Ran-d-8", test_erlang_d_8))
2543 || (NULL == CU_add_test(pShalf,
"Erlang3-Ran-d-9", test_erlang_d_9))
2544 || (NULL == CU_add_test(pShalf,
"Erlang4-P/CDF-d-0", test_cdf_pdf_d_erlang4_0))
2545 || (NULL == CU_add_test(pShalf,
"Erlang4-P/CDF-d-1", test_cdf_pdf_d_erlang4_1))
2546 || (NULL == CU_add_test(pShalf,
"Erlang4-P/CDF-d-2", test_cdf_pdf_d_erlang4_2))
2547 || (NULL == CU_add_test(pShalf,
"Erlang4-Ran-d-10", test_erlang_d_10))
2548 || (NULL == CU_add_test(pShalf,
"Erlang4-Ran-d-11", test_erlang_d_11))
2549 || (NULL == CU_add_test(pShalf,
"Erlang4-Ran-d-12", test_erlang_d_12))
2550 || (NULL == CU_add_test(pShalf,
"Erlang/Nexp-P/CDF-f-0", test_cdf_pdf_f_erlang_0))
2551 || (NULL == CU_add_test(pShalf,
"Erlang/Nexp-P/CDF-f-1", test_cdf_pdf_f_erlang_1))
2552 || (NULL == CU_add_test(pShalf,
"Erlang/Nexp-P/CDF-f-2", test_cdf_pdf_f_erlang_2))
2553 || (NULL == CU_add_test(pShalf,
"Erlang/Nexp-P/CDF-f-3", test_cdf_pdf_f_erlang_3))
2554 || (NULL == CU_add_test(pShalf,
"Erlang/Nexp-P/CDF-f-4", test_cdf_pdf_f_erlang_4))
2555 || (NULL == CU_add_test(pShalf,
"Erlang/Nexp-P/CDF-f-5", test_cdf_pdf_f_erlang_5))
2556 || (NULL == CU_add_test(pShalf,
"Erlang/Nexp-Ran-f-1", test_erlang_f_1))
2557 || (NULL == CU_add_test(pShalf,
"Erlang/Nexp-Ran-f-2", test_erlang_f_2))
2558 || (NULL == CU_add_test(pShalf,
"Erlang/Nexp-Ran-f-3", test_erlang_f_3))
2559 || (NULL == CU_add_test(pShalf,
"Erlang2-P/CDF-f-0", test_cdf_pdf_f_erlang2_0))
2560 || (NULL == CU_add_test(pShalf,
"Erlang2-P/CDF-f-1", test_cdf_pdf_f_erlang2_1))
2561 || (NULL == CU_add_test(pShalf,
"Erlang2-P/CDF-f-2", test_cdf_pdf_f_erlang2_2))
2562 || (NULL == CU_add_test(pShalf,
"Erlang2-Ran-f-4", test_erlang_f_4))
2563 || (NULL == CU_add_test(pShalf,
"Erlang2-Ran-f-5", test_erlang_f_5))
2564 || (NULL == CU_add_test(pShalf,
"Erlang2-Ran-f-6", test_erlang_f_6))
2565 || (NULL == CU_add_test(pShalf,
"Erlang3-P/CDF-f-0", test_cdf_pdf_f_erlang3_0))
2566 || (NULL == CU_add_test(pShalf,
"Erlang3-P/CDF-f-1", test_cdf_pdf_f_erlang3_1))
2567 || (NULL == CU_add_test(pShalf,
"Erlang3-P/CDF-f-2", test_cdf_pdf_f_erlang3_2))
2568 || (NULL == CU_add_test(pShalf,
"Erlang3-Ran-f-7", test_erlang_f_7))
2569 || (NULL == CU_add_test(pShalf,
"Erlang3-Ran-f-8", test_erlang_f_8))
2570 || (NULL == CU_add_test(pShalf,
"Erlang3-Ran-f-9", test_erlang_f_9))
2571 || (NULL == CU_add_test(pShalf,
"Erlang4-P/CDF-f-0", test_cdf_pdf_f_erlang4_0))
2572 || (NULL == CU_add_test(pShalf,
"Erlang4-P/CDF-f-1", test_cdf_pdf_f_erlang4_1))
2573 || (NULL == CU_add_test(pShalf,
"Erlang4-P/CDF-f-2", test_cdf_pdf_f_erlang4_2))
2574 || (NULL == CU_add_test(pShalf,
"Erlang4-Ran-f-10", test_erlang_f_10))
2575 || (NULL == CU_add_test(pShalf,
"Erlang4-Ran-f-11", test_erlang_f_11))
2576 || (NULL == CU_add_test(pShalf,
"Erlang4-Ran-f-12", test_erlang_f_12))
2578 printf(
"\nTest Suite interval additions failure.");
2579 CU_cleanup_registry();
2580 return CU_get_error();
2583 if ((NULL == CU_add_test(pSfull,
"Gausbm-P/CDF-d-0", test_cdf_pdf_d_gausbm_0))
2584 || (NULL == CU_add_test(pSfull,
"Gausbm-P/CDF-d-1", test_cdf_pdf_d_gausbm_1))
2585 || (NULL == CU_add_test(pSfull,
"Gausbm-P/CDF-d-2", test_cdf_pdf_d_gausbm_2))
2586 || (NULL == CU_add_test(pSfull,
"Gausbm-P/CDF-d-3", test_cdf_pdf_d_gausbm_3))
2587 || (NULL == CU_add_test(pSfull,
"Gausbm-P/CDF-d-4", test_cdf_pdf_d_gausbm_4))
2588 || (NULL == CU_add_test(pSfull,
"Gausbm-P/CDF-d-5", test_cdf_pdf_d_gausbm_5))
2589 || (NULL == CU_add_test(pSfull,
"Gausbm-Sym-d-6", test_sym_d_gausbm_6))
2590 || (NULL == CU_add_test(pSfull,
"Gausbm-Sym-d-7", test_sym_d_gausbm_7))
2591 || (NULL == CU_add_test(pSfull,
"Gausbm-Sym-d-8", test_sym_d_gausbm_8))
2592 || (NULL == CU_add_test(pSfull,
"Gausbm-Sym-d-9", test_sym_d_gausbm_9))
2593 || (NULL == CU_add_test(pSfull,
"Gausbm-Sym-d-10", test_sym_d_gausbm_10))
2594 || (NULL == CU_add_test(pSfull,
"Gausbm-Sym-d-11", test_sym_d_gausbm_11))
2595 || (NULL == CU_add_test(pSfull,
"Gausbm-Ran-d-1", test_gausbm_d_1))
2596 || (NULL == CU_add_test(pSfull,
"Gausbm-Ran-d-2", test_gausbm_d_2))
2597 || (NULL == CU_add_test(pSfull,
"Gausbm-Ran-d-3", test_gausbm_d_3))
2598 || (NULL == CU_add_test(pSfull,
"Gausbm-P/CDF-f-0", test_cdf_pdf_f_gausbm_0))
2599 || (NULL == CU_add_test(pSfull,
"Gausbm-P/CDF-f-1", test_cdf_pdf_f_gausbm_1))
2600 || (NULL == CU_add_test(pSfull,
"Gausbm-P/CDF-f-2", test_cdf_pdf_f_gausbm_2))
2601 || (NULL == CU_add_test(pSfull,
"Gausbm-P/CDF-f-3", test_cdf_pdf_f_gausbm_3))
2602 || (NULL == CU_add_test(pSfull,
"Gausbm-P/CDF-f-4", test_cdf_pdf_f_gausbm_4))
2603 || (NULL == CU_add_test(pSfull,
"Gausbm-P/CDF-f-5", test_cdf_pdf_f_gausbm_5))
2604 || (NULL == CU_add_test(pSfull,
"Gausbm-Sym-f-6", test_sym_f_gausbm_6))
2605 || (NULL == CU_add_test(pSfull,
"Gausbm-Sym-f-7", test_sym_f_gausbm_7))
2606 || (NULL == CU_add_test(pSfull,
"Gausbm-Sym-f-8", test_sym_f_gausbm_8))
2607 || (NULL == CU_add_test(pSfull,
"Gausbm-Sym-f-9", test_sym_f_gausbm_9))
2608 || (NULL == CU_add_test(pSfull,
"Gausbm-Sym-f-10", test_sym_f_gausbm_10))
2609 || (NULL == CU_add_test(pSfull,
"Gausbm-Sym-f-11", test_sym_f_gausbm_11))
2610 || (NULL == CU_add_test(pSfull,
"Gausbm-Ran-f-1", test_gausbm_f_1))
2611 || (NULL == CU_add_test(pSfull,
"Gausbm-Ran-f-2", test_gausbm_f_2))
2612 || (NULL == CU_add_test(pSfull,
"Gausbm-Ran-f-3", test_gausbm_f_3))
2613 || (NULL == CU_add_test(pSfull,
"Gausmar-P/CDF-d-0", test_cdf_pdf_d_gausmar_0))
2614 || (NULL == CU_add_test(pSfull,
"Gausmar-P/CDF-d-1", test_cdf_pdf_d_gausmar_1))
2615 || (NULL == CU_add_test(pSfull,
"Gausmar-Ran-d-1", test_gausmar_d_1))
2616 || (NULL == CU_add_test(pSfull,
"Gausmar-Ran-d-2", test_gausmar_d_2))
2617 || (NULL == CU_add_test(pSfull,
"Gausmar-Ran-d-3", test_gausmar_d_3))
2618 || (NULL == CU_add_test(pSfull,
"Gausmar-P/CDF-f-0", test_cdf_pdf_f_gausmar_0))
2619 || (NULL == CU_add_test(pSfull,
"Gausmar-P/CDF-f-1", test_cdf_pdf_f_gausmar_1))
2620 || (NULL == CU_add_test(pSfull,
"Gausmar-Ran-f-1", test_gausmar_f_1))
2621 || (NULL == CU_add_test(pSfull,
"Gausmar-Ran-f-2", test_gausmar_f_2))
2622 || (NULL == CU_add_test(pSfull,
"Gausmar-Ran-f-3", test_gausmar_f_3))
2623 || (NULL == CU_add_test(pSfull,
"Cauchy-P/CDF-d-0", test_cdf_pdf_d_cauchy_0))
2624 || (NULL == CU_add_test(pSfull,
"Cauchy-P/CDF-d-1", test_cdf_pdf_d_cauchy_1))
2625 || (NULL == CU_add_test(pSfull,
"Cauchy-P/CDF-d-2", test_cdf_pdf_d_cauchy_2))
2626 || (NULL == CU_add_test(pSfull,
"Cauchy-P/CDF-d-3", test_cdf_pdf_d_cauchy_3))
2627 || (NULL == CU_add_test(pSfull,
"Cauchy-P/CDF-d-4", test_cdf_pdf_d_cauchy_4))
2628 || (NULL == CU_add_test(pSfull,
"Cauchy-P/CDF-d-5", test_cdf_pdf_d_cauchy_5))
2629 || (NULL == CU_add_test(pSfull,
"Cauchy-Sym-d-6", test_sym_d_cauchy_6))
2630 || (NULL == CU_add_test(pSfull,
"Cauchy-Sym-d-7", test_sym_d_cauchy_7))
2631 || (NULL == CU_add_test(pSfull,
"Cauchy-Sym-d-8", test_sym_d_cauchy_8))
2632 || (NULL == CU_add_test(pSfull,
"Cauchy-Sym-d-9", test_sym_d_cauchy_9))
2633 || (NULL == CU_add_test(pSfull,
"Cauchy-Sym-d-10", test_sym_d_cauchy_10))
2634 || (NULL == CU_add_test(pSfull,
"Cauchy-Sym-d-11", test_sym_d_cauchy_11))
2635 || (NULL == CU_add_test(pSfull,
"Cauchy-Ran-d-1", test_cauchy_d_1))
2636 || (NULL == CU_add_test(pSfull,
"Cauchy-Ran-d-2", test_cauchy_d_2))
2637 || (NULL == CU_add_test(pSfull,
"Cauchy-Ran-d-3", test_cauchy_d_3))
2638 || (NULL == CU_add_test(pSfull,
"Cauchy-P/CDF-f-0", test_cdf_pdf_f_cauchy_0))
2639 || (NULL == CU_add_test(pSfull,
"Cauchy-P/CDF-f-1", test_cdf_pdf_f_cauchy_1))
2640 || (NULL == CU_add_test(pSfull,
"Cauchy-P/CDF-f-2", test_cdf_pdf_f_cauchy_2))
2641 || (NULL == CU_add_test(pSfull,
"Cauchy-P/CDF-f-3", test_cdf_pdf_f_cauchy_3))
2642 || (NULL == CU_add_test(pSfull,
"Cauchy-P/CDF-f-4", test_cdf_pdf_f_cauchy_4))
2643 || (NULL == CU_add_test(pSfull,
"Cauchy-P/CDF-f-5", test_cdf_pdf_f_cauchy_5))
2644 || (NULL == CU_add_test(pSfull,
"Cauchy-Sym-f-6", test_sym_f_cauchy_6))
2645 || (NULL == CU_add_test(pSfull,
"Cauchy-Sym-f-7", test_sym_f_cauchy_7))
2646 || (NULL == CU_add_test(pSfull,
"Cauchy-Sym-f-8", test_sym_f_cauchy_8))
2647 || (NULL == CU_add_test(pSfull,
"Cauchy-Sym-f-9", test_sym_f_cauchy_9))
2648 || (NULL == CU_add_test(pSfull,
"Cauchy-Sym-f-10", test_sym_f_cauchy_10))
2649 || (NULL == CU_add_test(pSfull,
"Cauchy-Sym-f-11", test_sym_f_cauchy_11))
2650 || (NULL == CU_add_test(pSfull,
"Cauchy-Ran-f-1", test_cauchy_f_1))
2651 || (NULL == CU_add_test(pSfull,
"Cauchy-Ran-f-2", test_cauchy_f_2))
2652 || (NULL == CU_add_test(pSfull,
"Cauchy-Ran-f-3", test_cauchy_f_3))
2653 || (NULL == CU_add_test(pSfull,
"Cauchymar-P/CDF-d-0", test_cdf_pdf_d_cauchymar_0))
2654 || (NULL == CU_add_test(pSfull,
"Cauchymar-P/CDF-d-1", test_cdf_pdf_d_cauchymar_1))
2655 || (NULL == CU_add_test(pSfull,
"Cauchymar-Ran-d-1", test_cauchymar_d_1))
2656 || (NULL == CU_add_test(pSfull,
"Cauchymar-Ran-d-2", test_cauchymar_d_2))
2657 || (NULL == CU_add_test(pSfull,
"Cauchymar-Ran-d-3", test_cauchymar_d_3))
2658 || (NULL == CU_add_test(pSfull,
"Cauchymar-P/CDF-f-0", test_cdf_pdf_f_cauchymar_0))
2659 || (NULL == CU_add_test(pSfull,
"Cauchymar-P/CDF-f-1", test_cdf_pdf_f_cauchymar_1))
2660 || (NULL == CU_add_test(pSfull,
"Cauchymar-Ran-f-1", test_cauchymar_f_1))
2661 || (NULL == CU_add_test(pSfull,
"Cauchymar-Ran-f-2", test_cauchymar_f_2))
2662 || (NULL == CU_add_test(pSfull,
"Cauchymar-Ran-f-3", test_cauchymar_f_3))
2663 || (NULL == CU_add_test(pSfull,
"Cauchy/Uinvcdf-P/CDF-d-9",test_cdf_pdf_d_uinvcdf_9))
2664 || (NULL == CU_add_test(pSfull,
"Cauchy/Uinvcdf-P/CDF-d-10",test_cdf_pdf_d_uinvcdf_10))
2665 || (NULL == CU_add_test(pSfull,
"Cauchy/Uinvcdf-Ran-d-11", test_uinvcdf_d_11))
2666 || (NULL == CU_add_test(pSfull,
"Cauchy/Uinvcdf-P/CDF-f-9",test_cdf_pdf_f_uinvcdf_9))
2667 || (NULL == CU_add_test(pSfull,
"Cauchy/Uinvcdf-P/CDF-f-10",test_cdf_pdf_f_uinvcdf_10))
2668 || (NULL == CU_add_test(pSfull,
"Cauchy/Uinvcdf-Ran-f-11", test_uinvcdf_f_11))
2670 printf(
"\nTest Suite full range additions failure.");
2671 CU_cleanup_registry();
2672 return CU_get_error();
2674 if ((NULL == CU_add_test(pSdisc,
"Poisson-P/CDF-1-1", test_cdf_pdf_1_poisson_1))
2675 || (NULL == CU_add_test(pSdisc,
"Poisson-P/CDF-2-2", test_cdf_pdf_2_poisson_2))
2676 || (NULL == CU_add_test(pSdisc,
"Poisson-P/CDF-4-3", test_cdf_pdf_4_poisson_3))
2677 || (NULL == CU_add_test(pSdisc,
"Poisson-P/CDF-8-4", test_cdf_pdf_8_poisson_4))
2678 || (NULL == CU_add_test(pSdisc,
"Poisson-Ran-1-1", test_poisson_i_1))
2679 || (NULL == CU_add_test(pSdisc,
"Poisson-Ran-2-2", test_poisson_i_2))
2680 || (NULL == CU_add_test(pSdisc,
"Poisson-Ran-4-3", test_poisson_i_3))
2681 || (NULL == CU_add_test(pSdisc,
"Poisson-Ran-8-4", test_poisson_i_4))
2682 || (NULL == CU_add_test(pSdisc,
"Poisson-Ran-55-5", test_poisson_i_5))
2683 || (NULL == CU_add_test(pSdisc,
"check - Poisson - 1",test_check_poisson_i_1))
2684 || (NULL == CU_add_test(pSdisc,
"check - Poisson - 2",test_check_poisson_i_2))
2685 || (NULL == CU_add_test(pSdisc,
"Geom-P/CDF-25-1", test_cdf_pdf_25_geometric_1))
2686 || (NULL == CU_add_test(pSdisc,
"Geom-P/CDF-50-2", test_cdf_pdf_50_geometric_2))
2687 || (NULL == CU_add_test(pSdisc,
"Geom-P/CDF-75-3", test_cdf_pdf_75_geometric_3))
2688 || (NULL == CU_add_test(pSdisc,
"Geometric-Ran-def-1", test_geometric_i_1))
2689 || (NULL == CU_add_test(pSdisc,
"Geometric-Ran-50-2", test_geometric_i_2))
2690 || (NULL == CU_add_test(pSdisc,
"Geometric-Ran-20-3", test_geometric_i_3))
2691 || (NULL == CU_add_test(pSdisc,
"Geometric-Ran-35-4", test_geometric_i_4))
2692 || (NULL == CU_add_test(pSdisc,
"Geometric-Ran-65-5", test_geometric_i_5))
2693 || (NULL == CU_add_test(pSdisc,
"Geometric-Ran-80-6", test_geometric_i_6))
2694 || (NULL == CU_add_test(pSdisc,
"check - Geom - 1",test_check_geometric_i_1))
2695 || (NULL == CU_add_test(pSdisc,
"check - Geom - 2",test_check_geometric_i_2))
2696 || (NULL == CU_add_test(pSdisc,
"check - Geom - 3",test_check_geometric_i_3))
2697 || (NULL == CU_add_test(pSdisc,
"Binom-P/CDF-25-1", test_cdf_pdf_25_binomial_1))
2698 || (NULL == CU_add_test(pSdisc,
"Binom-P/CDF-50-2", test_cdf_pdf_50_binomial_2))
2699 || (NULL == CU_add_test(pSdisc,
"Binom-P/CDF-75-3", test_cdf_pdf_80_binomial_3))
2700 || (NULL == CU_add_test(pSdisc,
"Binomial-Ran-def-1", test_binomial_i_1))
2701 || (NULL == CU_add_test(pSdisc,
"Binomial-Ran-50-1", test_binomial_i_2))
2702 || (NULL == CU_add_test(pSdisc,
"Binomial-Ran-20-1", test_binomial_i_3))
2703 || (NULL == CU_add_test(pSdisc,
"Binomial-Ran-35-1", test_binomial_i_4))
2704 || (NULL == CU_add_test(pSdisc,
"Binomial-Ran-65-1", test_binomial_i_5))
2705 || (NULL == CU_add_test(pSdisc,
"Binomial-Ran-80-1", test_binomial_i_6))
2706 || (NULL == CU_add_test(pSdisc,
"check - Binomial - 1",test_check_binomial_i_1))
2707 || (NULL == CU_add_test(pSdisc,
"check - Binomial - 2",test_check_binomial_i_2))
2708 || (NULL == CU_add_test(pSdisc,
"check - Binomial - 3",test_check_binomial_i_3))
2709 || (NULL == CU_add_test(pSdisc,
"check - Binomial - 4",test_check_binomial_i_4))
2710 || (NULL == CU_add_test(pSdisc,
"check - Binomial - 5",test_check_binomial_i_5))
2712 printf(
"\nTest Suite discrete additions failure.");
2713 CU_cleanup_registry();
2714 return CU_get_error();
2718 CU_basic_set_mode(mode);
2719 CU_set_error_action(error_action);
2721 CU_console_run_tests();
2723 CU_basic_run_tests();
2728 CU_cleanup_registry();
2729 return CU_get_error();
int LR_aux_norm(LR_obj *o)
LR_aux_norm(LR_obj *o) - process given intervals and normalize values.
int LR_aux_set(LR_obj *o, double x, double p)
LR_aux_set(LR_obj *o, double x, double p) - add an interval boundary for the underlying distribution...
#define LR_VERSION
LibRan Library Version (X.Y.Z)
double LRd_CDF(LR_obj *o, double x)
LRd_CDF(LR_obj *o, double x) - cumulative distribution function.
int LRd_uinvcdf(LR_obj *o, double(*cdf)(double))
LRd_uinvcdf() - set the user defined CDF for this variate distribution.
int LRf_uinvcdf(LR_obj *o, float(*cdf)(float))
LRf_uinvcdf() - set the user defined CDF for this variate distribution.
int LR_check(LR_obj *o)
LR_check(LR_obj *o) - check and fix the LR object parameters if possible.
#define LRerr_UnmetPreconditions
float LRf_RAN(LR_obj *o)
LRf_RAN(LR_obj *o) - random variate generator.
float LRf_PDF(LR_obj *o, float x)
LRf_PDF(LR_obj *o, float x) - probability distribution function.
#define LRerr_InvalidRange
LR_obj * LR_new(LR_type t, LR_data_type d)
LR_new(LR_type t, LR_data_type d) - create the LR object and preset some default parameter values...
double LRd_RAN(LR_obj *o)
LRd_RAN(LR_obj *o) - random variate generator.
double LRd_PDF(LR_obj *o, double x)
LRd_PDF(LR_obj *o, double x) - probability distribution function.
float LRf_CDF(LR_obj *o, float x)
LRf_CDF(LR_obj *o, float x) - cumulative distribution function.
#define LRerr_BadDataType
int LR_aux_new(LR_obj *o, int n)
LR_aux_new(LR_obj *o, int n) - initialize a new auxiliary object.
int LR_rm(LR_obj **o)
LR_rm(LR_obj **o) - destroy the LR object and release allocated memory.
char * LRstrerrno(int LRerrno)
LRstrerrno(int LRerrno) - return the errno code string for the given LibRan errno.
#define LR_DATE
LibRan Library date (YYYYMMDD)
void LRperror(char *str, int LRerrno)
LRperror(char *str, int LRerrno) - print out explanatory error message to stderr. ...
int LR_set_all(LR_obj *o, char *x,...)
LR_set_all(LR_obj *o, char *x, ...) - set all given LR object parameters.
The LibRan common header file.
#define LRerr_Unspecified
#define LRerr_InvalidInputValue
the fundamental LibRan random variate distribution object
void LR_lsetseed(LR_obj *, long lty)
LR_lsetseed(LR_obj *, long X) - set the seed to X.