Skip to content

Commit

Permalink
Fix GaugeTest::testStorageIsUpdatedByGaugeModifications test failure …
Browse files Browse the repository at this point in the history
…caused by float precision
  • Loading branch information
LeSuisse committed Oct 13, 2022
1 parent 7d50304 commit 18f7446
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/unit/GaugeTest.php
Expand Up @@ -36,15 +36,15 @@ public function addToGauge(MetricName $name, float $value, string $help, MetricL

$gauge = new Gauge($storage, MetricName::fromName('name'), 'help');
$gauge->inc();
self::assertEquals($storage->value, 1);
self::assertEquals(1, $storage->value);
$gauge->incBy(2.2);
self::assertEquals($storage->value, 3.2);
self::assertEqualsWithDelta(3.2, $storage->value, 0.00001);
$gauge->dec();
self::assertEquals($storage->value, 2.2);
self::assertEqualsWithDelta(2.2, $storage->value, 0.00001);
$gauge->decBy(2.1);
self::assertEquals($storage->value, 0.1);
self::assertEqualsWithDelta(0.1, $storage->value, 0.00001);
$gauge->set(-10);
self::assertEquals($storage->value, -10);
self::assertEqualsWithDelta(-10, $storage->value, 0.00001);
}

public function testIncrementIsRejectedWhenLabelValuesAreNotDefinedCorrectly(): void
Expand Down

0 comments on commit 18f7446

Please sign in to comment.