Skip to content

Commit

Permalink
use assertion with Delta on PHPUnit float values
Browse files Browse the repository at this point in the history
  • Loading branch information
WengerK committed Jul 12, 2023
1 parent 7473e61 commit f16ad14
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- update changelog following 'keep a changelog' format
- run code-styles Github Actions on PHP 8.1
- update symfony checker to use new symfonycorp/security-checker-action
- use assertion with Delta on PHPUnit float values

### Added
- add run of tests on Github Actions
Expand Down
6 changes: 2 additions & 4 deletions tests/SwisstopoConverterWGSToMN03Tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ public function testFromMN03ToWGS(): void
{
$swiss_converter = new SwisstopoConverter();
$coordinates = $swiss_converter->fromMN03ToWGS(554680, 145807);
$this->assertSame([
'lat' => 46.462057617639346,
'long' => 6.848673659076181,
], $coordinates);
$this->assertEqualsWithDelta(46.462057617639, $coordinates['lat'], 0.0001);
$this->assertEqualsWithDelta(6.8486736590762, $coordinates['long'], 0.0001);
}

/**
Expand Down
6 changes: 2 additions & 4 deletions tests/SwisstopoConverterWGSToMN95Tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ public function testFromMN95ToWGS(): void
{
$swiss_converter = new SwisstopoConverter();
$coordinates = $swiss_converter->fromMN95ToWGS(2555047, 1145923);
$this->assertSame([
'lat' => 46.46312579498212,
'long' => 6.8534397262208095,
], $coordinates);
$this->assertEqualsWithDelta(46.463125794982, $coordinates['lat'], 0.0001);
$this->assertEqualsWithDelta(6.8534397262208, $coordinates['long'], 0.0001);
}

/**
Expand Down

0 comments on commit f16ad14

Please sign in to comment.