Skip to content
Snippets Groups Projects
Commit 2e794830 authored by totten's avatar totten
Browse files

CommunityMessagesTest - Relax probability test

parent d1b65097
No related branches found
No related tags found
No related merge requests found
......@@ -299,7 +299,7 @@ class CRM_Core_CommunityMessagesTest extends CiviUnitTestCase {
$this->assertEquals('<h1>Two</h1>', $doc1['messages'][1]['markup']);
// randomly pick many times
$trials = 40;
$trials = 80;
$freq = array(); // array($message => $count)
for ($i = 0; $i < $trials; $i++) {
$message = $communityMessages->pick();
......@@ -307,8 +307,8 @@ class CRM_Core_CommunityMessagesTest extends CiviUnitTestCase {
}
// assert the probabilities
$this->assertApproxEquals(0.5, $freq['<h1>One</h1>'] / $trials, 0.2);
$this->assertApproxEquals(0.5, $freq['<h1>Two</h1>'] / $trials, 0.2);
$this->assertApproxEquals(0.5, $freq['<h1>One</h1>'] / $trials, 0.3);
$this->assertApproxEquals(0.5, $freq['<h1>Two</h1>'] / $trials, 0.3);
$this->assertEquals($trials, $freq['<h1>One</h1>'] + $freq['<h1>Two</h1>']);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment