/** * It should show statistics when an iteration is completed (and there * were no rejections). */ public function testIterationEndStats() { foreach ($this->variant as $iteration) { foreach (TestUtil::createResults(10, 10) as $result) { $iteration->setResult($result); } } $this->variant->computeStats(); $this->logger->variantEnd($this->variant); $this->assertContains('RSD/r: 0.00%', $this->output->fetch()); }
/** * It should show the histogram and statistics when an iteration is * completed (and there were no rejections). */ public function testIterationEnd() { foreach ($this->variant as $iteration) { foreach (TestUtil::createResults(10, 10) as $result) { $iteration->setResult($result); } } $this->variant->computeStats(); $this->logger->variantEnd($this->variant); $display = $this->output->fetch(); $this->assertContains('1 (σ = 0.000ms ) -2σ [ █ ] +2σ [μ Mo]/r: 0.010 0.010 μRSD/r: 0.00%', $display); }
/** * It should return the revolution time. */ public function testGetRevTime() { $iteration = new Iteration(1, $this->variant->reveal(), TestUtil::createResults(100)); $this->variant->getRevolutions()->willReturn(100); $this->assertEquals(1, $iteration->getResult(TimeResult::class)->getRevTime(100)); }
/** * It should return times and memories. */ public function testGetMetricValues() { $variant = new Variant($this->subject->reveal(), $this->parameterSet->reveal(), 1, 0); $variant->createIteration(TestUtil::createResults(4, 100)); $variant->createIteration(TestUtil::createResults(8, 200)); $times = $variant->getMetricValuesByRev(TimeResult::class, 'net'); $memories = $variant->getMetricValues(MemoryResult::class, 'peak'); $this->assertEquals([4, 8], $times); $this->assertEquals([100, 200], $memories); }