Skip to content

Commit

Permalink
fixup! MicrotimeRepresentationTest: Memory is more accurate since 7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jnvsor committed Nov 11, 2023
1 parent 5909e17 commit faf6ac7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/Zval/Representation/MicrotimeRepresentationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ public function testConstruct()
{
$r = new MicrotimeRepresentation(123, 456, 7, 8, 100);

$mem = \memory_get_usage();
$mem_peak = \memory_get_peak_usage();

$this->assertSame(123, $r->seconds);
$this->assertSame(456, $r->microseconds);
$this->assertSame(7, $r->group);
Expand All @@ -55,8 +58,8 @@ public function testConstruct()
$this->assertSame(20.0, $r->avg);

// Memory usage isn't going to be identical after making the representation
$this->assertLessThan(1024, \abs(\memory_get_usage() - $r->mem));
$this->assertSame(\memory_get_peak_usage(), $r->mem_peak);
$this->assertLessThan(1024, \abs($mem - $r->mem));
$this->assertSame($mem_peak, $r->mem_peak);
}

/**
Expand Down

0 comments on commit faf6ac7

Please sign in to comment.