equal
deleted
inserted
replaced
53 virtual ~RngUniformTestCase (); |
53 virtual ~RngUniformTestCase (); |
54 |
54 |
55 double ChiSquaredTest (UniformVariable &u); |
55 double ChiSquaredTest (UniformVariable &u); |
56 |
56 |
57 private: |
57 private: |
58 virtual bool DoRun (void); |
58 virtual void DoRun (void); |
59 }; |
59 }; |
60 |
60 |
61 RngUniformTestCase::RngUniformTestCase () |
61 RngUniformTestCase::RngUniformTestCase () |
62 : TestCase ("Uniform Random Number Generator") |
62 : TestCase ("Uniform Random Number Generator") |
63 { |
63 { |
100 } |
100 } |
101 |
101 |
102 return chiSquared; |
102 return chiSquared; |
103 } |
103 } |
104 |
104 |
105 bool |
105 void |
106 RngUniformTestCase::DoRun (void) |
106 RngUniformTestCase::DoRun (void) |
107 { |
107 { |
108 SeedManager::SetSeed (time (0)); |
108 SeedManager::SetSeed (time (0)); |
109 |
109 |
110 double sum = 0.; |
110 double sum = 0.; |
118 } |
118 } |
119 |
119 |
120 sum /= (double)N_RUNS; |
120 sum /= (double)N_RUNS; |
121 |
121 |
122 NS_TEST_ASSERT_MSG_LT (sum, maxStatistic, "Chi-squared statistic out of range"); |
122 NS_TEST_ASSERT_MSG_LT (sum, maxStatistic, "Chi-squared statistic out of range"); |
123 return false; |
|
124 } |
123 } |
125 |
124 |
126 // =========================================================================== |
125 // =========================================================================== |
127 // Test case for normal distribution random number generator |
126 // Test case for normal distribution random number generator |
128 // =========================================================================== |
127 // =========================================================================== |
137 virtual ~RngNormalTestCase (); |
136 virtual ~RngNormalTestCase (); |
138 |
137 |
139 double ChiSquaredTest (NormalVariable &n); |
138 double ChiSquaredTest (NormalVariable &n); |
140 |
139 |
141 private: |
140 private: |
142 virtual bool DoRun (void); |
141 virtual void DoRun (void); |
143 }; |
142 }; |
144 |
143 |
145 RngNormalTestCase::RngNormalTestCase () |
144 RngNormalTestCase::RngNormalTestCase () |
146 : TestCase ("Normal Random Number Generator") |
145 : TestCase ("Normal Random Number Generator") |
147 { |
146 { |
198 } |
197 } |
199 |
198 |
200 return chiSquared; |
199 return chiSquared; |
201 } |
200 } |
202 |
201 |
203 bool |
202 void |
204 RngNormalTestCase::DoRun (void) |
203 RngNormalTestCase::DoRun (void) |
205 { |
204 { |
206 SeedManager::SetSeed (time (0)); |
205 SeedManager::SetSeed (time (0)); |
207 |
206 |
208 double sum = 0.; |
207 double sum = 0.; |
216 } |
215 } |
217 |
216 |
218 sum /= (double)N_RUNS; |
217 sum /= (double)N_RUNS; |
219 |
218 |
220 NS_TEST_ASSERT_MSG_LT (sum, maxStatistic, "Chi-squared statistic out of range"); |
219 NS_TEST_ASSERT_MSG_LT (sum, maxStatistic, "Chi-squared statistic out of range"); |
221 return false; |
|
222 } |
220 } |
223 |
221 |
224 // =========================================================================== |
222 // =========================================================================== |
225 // Test case for exponential distribution random number generator |
223 // Test case for exponential distribution random number generator |
226 // =========================================================================== |
224 // =========================================================================== |
235 virtual ~RngExponentialTestCase (); |
233 virtual ~RngExponentialTestCase (); |
236 |
234 |
237 double ChiSquaredTest (ExponentialVariable &n); |
235 double ChiSquaredTest (ExponentialVariable &n); |
238 |
236 |
239 private: |
237 private: |
240 virtual bool DoRun (void); |
238 virtual void DoRun (void); |
241 }; |
239 }; |
242 |
240 |
243 RngExponentialTestCase::RngExponentialTestCase () |
241 RngExponentialTestCase::RngExponentialTestCase () |
244 : TestCase ("Exponential Random Number Generator") |
242 : TestCase ("Exponential Random Number Generator") |
245 { |
243 { |
295 } |
293 } |
296 |
294 |
297 return chiSquared; |
295 return chiSquared; |
298 } |
296 } |
299 |
297 |
300 bool |
298 void |
301 RngExponentialTestCase::DoRun (void) |
299 RngExponentialTestCase::DoRun (void) |
302 { |
300 { |
303 SeedManager::SetSeed (time (0)); |
301 SeedManager::SetSeed (time (0)); |
304 |
302 |
305 double sum = 0.; |
303 double sum = 0.; |
313 } |
311 } |
314 |
312 |
315 sum /= (double)N_RUNS; |
313 sum /= (double)N_RUNS; |
316 |
314 |
317 NS_TEST_ASSERT_MSG_LT (sum, maxStatistic, "Chi-squared statistic out of range"); |
315 NS_TEST_ASSERT_MSG_LT (sum, maxStatistic, "Chi-squared statistic out of range"); |
318 return false; |
|
319 } |
316 } |
320 |
317 |
321 // =========================================================================== |
318 // =========================================================================== |
322 // Test case for pareto distribution random number generator |
319 // Test case for pareto distribution random number generator |
323 // =========================================================================== |
320 // =========================================================================== |
332 virtual ~RngParetoTestCase (); |
329 virtual ~RngParetoTestCase (); |
333 |
330 |
334 double ChiSquaredTest (ParetoVariable &p); |
331 double ChiSquaredTest (ParetoVariable &p); |
335 |
332 |
336 private: |
333 private: |
337 virtual bool DoRun (void); |
334 virtual void DoRun (void); |
338 }; |
335 }; |
339 |
336 |
340 RngParetoTestCase::RngParetoTestCase () |
337 RngParetoTestCase::RngParetoTestCase () |
341 : TestCase ("Pareto Random Number Generator") |
338 : TestCase ("Pareto Random Number Generator") |
342 { |
339 { |
393 } |
390 } |
394 |
391 |
395 return chiSquared; |
392 return chiSquared; |
396 } |
393 } |
397 |
394 |
398 bool |
395 void |
399 RngParetoTestCase::DoRun (void) |
396 RngParetoTestCase::DoRun (void) |
400 { |
397 { |
401 SeedManager::SetSeed (time (0)); |
398 SeedManager::SetSeed (time (0)); |
402 |
399 |
403 double sum = 0.; |
400 double sum = 0.; |
411 } |
408 } |
412 |
409 |
413 sum /= (double)N_RUNS; |
410 sum /= (double)N_RUNS; |
414 |
411 |
415 NS_TEST_ASSERT_MSG_LT (sum, maxStatistic, "Chi-squared statistic out of range"); |
412 NS_TEST_ASSERT_MSG_LT (sum, maxStatistic, "Chi-squared statistic out of range"); |
416 return false; |
|
417 } |
413 } |
418 |
414 |
419 class RngTestSuite : public TestSuite |
415 class RngTestSuite : public TestSuite |
420 { |
416 { |
421 public: |
417 public: |