Changeset 3007
- Timestamp:
- Jan 14, 2005, 2:55:15 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/dataManip/tst_psRandom.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/dataManip/tst_psRandom.c
r2995 r3007 52 52 testStatus = false; 53 53 } 54 54 if (myRNG->type != PS_RANDOM_TAUS) { 55 psError(PS_ERR_UNKNOWN,true,"Did not have the expected type"); 56 testStatus = false; 57 } 58 psFree(myRNG); 59 60 // Valid type allocation with seed equal to zero 61 myRNG = psRandomAlloc(PS_RANDOM_TAUS, 0); 62 if (myRNG == NULL) { 63 printf("ERROR: Could not allocate psRandom structure\n"); 64 testStatus = false; 65 } 55 66 if (myRNG->type != PS_RANDOM_TAUS) { 56 67 psError(PS_ERR_UNKNOWN,true,"Did not have the expected type"); … … 130 141 psFree(rans); 131 142 psFree(stats); 143 144 psLogMsg(__func__,PS_LOG_INFO,"NULL psRandom variable, should generate error message"); 145 if(psRandomUniform(NULL) != 0) { 146 psError(PS_ERR_UNKNOWN,true,"Did not return zero for null psRandom"); 147 testStatus = false; 148 } 149 132 150 psMemCheckCorruption(1); 133 151 memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false); … … 184 202 psFree(rans); 185 203 psFree(stats); 204 205 psLogMsg(__func__,PS_LOG_INFO,"NULL psRandom variable, should generate error message"); 206 if(psRandomGaussian(NULL) != 0) { 207 psError(PS_ERR_UNKNOWN,true,"Did not return zero for null psRandom"); 208 testStatus = false; 209 } 210 186 211 psMemCheckCorruption(1); 187 212 memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false); … … 239 264 psFree(rans); 240 265 psFree(stats); 266 267 psLogMsg(__func__,PS_LOG_INFO,"NULL psRandom variable, should generate error message"); 268 if(psRandomPoisson(NULL, POISSON_MEAN) != 0) { 269 psError(PS_ERR_UNKNOWN,true,"Did not return zero for null psRandom"); 270 testStatus = false; 271 } 272 241 273 psMemCheckCorruption(1); 242 274 memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false); … … 294 326 psFree(rans01); 295 327 psFree(rans02); 328 329 psRandom *myRNG1 = NULL; 330 myRNG1 = psRandomAlloc(PS_RANDOM_TAUS, SEED); 331 psRandomReset(myRNG1,0); 332 psFree(myRNG1); 333 334 psLogMsg(__func__,PS_LOG_INFO,"Reset a NULL psRandom variable, should generate an error message"); 335 psRandomReset(NULL,SEED); 336 296 337 psMemCheckCorruption(1); 297 338 memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
Note:
See TracChangeset
for help on using the changeset viewer.
