/** * Test that when sampled values increase, the run errors out as expected. * * @expectedException \DrupalReleaseDate\MonteCarlo\IncreasingException * * Since all iterations will fail, the first run after the threshold is met * will cause the run to fail. * * @expectedExceptionMessage Run aborted after iteration 11 * * @covers \DrupalReleaseDate\MonteCarlo * @uses \DrupalReleaseDate\EstimateDistribution * @uses \DrupalReleaseDate\MonteCarlo\IncreasingException<extended> * @uses \DrupalReleaseDate\NumberGenerator\Cyclic<extended> * @uses \DrupalReleaseDate\Sampling\Sample * @uses \DrupalReleaseDate\Sampling\SampleSet * @uses \DrupalReleaseDate\Sampling\SampleSetRandomSampleSelector */ function testIncreasingAverageRun() { $sampleset = new SampleSet(); $sampleset->insert(new Sample(10, 10)); $sampleset->insert(new Sample(20, 11)); $sampleset->insert(new Sample(30, 12)); $sampleset->insert(new Sample(40, 13)); $randomGenerator = new CyclicGenerator(1, $sampleset->length() - 1); $sampleSelector = new SampleSetRandomSampleSelector($sampleset, $randomGenerator); $montecarlo = new MonteCarlo($sampleSelector); $average = $montecarlo->runAverage(100); }