Codeception / Verify

BDD Assertions for PHPUnit and Codeception
MIT License
146 stars 25 forks source link

Allow comparing floats with delta. #29

Closed ddinchev closed 7 years ago

ddinchev commented 7 years ago

Right now, if you want to compare floats, you still have to use PHPUnit's assertEquals. With this back-compatible change, you could have more consistent tests.

The following statements are equivalent:

verify("Quantity is correct up to the thousandth.", $quantity)->equals(100.25, 0.001)
$this->assertEquals(100.25, $quantity, "Quantity is correct up to the thousandth", 0.001)
ddinchev commented 7 years ago

Added tests and split equals() / notEquals() in own test methods.

sergeyklay commented 7 years ago

Thanks

ddinchev commented 7 years ago

@sergeyklay thanks for the swift accept! Could you bump the release version of Verify so that composer could automatically update?

ddinchev commented 7 years ago

@sergeyklay I'm sorry to ask again - but could you bump the version to 0.3.3 or 0.4.0 (given that there are not back-compatibility breaking changes but there is a new feature). So the latest changes are installable as a stable release in composer? If there is a reason to not bump the version that is not obvious to me - could you please share?

sergeyklay commented 7 years ago

I'll do asap

sergeyklay commented 7 years ago

https://github.com/Codeception/Verify/releases/tag/0.3.3