Files
pest/tests/Features/Expect/toEqualWithDelta.php
2022-09-19 09:03:27 +02:00

16 lines
428 B
PHP

<?php
use PHPUnit\Framework\ExpectationFailedException;
test('pass', function () {
expect(1.0)->toEqualWithDelta(1.3, .4);
});
test('failures with custom message', function () {
expect(1.0)->toEqualWithDelta(1.5, .1, 'oh no!');
})->throws(ExpectationFailedException::class, 'oh no!');
test('not failures', function () {
expect(1.0)->not->toEqualWithDelta(1.6, .7);
})->throws(ExpectationFailedException::class);