function NumericComparator::assertEquals
Throws
Overrides ScalarComparator::assertEquals
File
-
vendor/
sebastian/ comparator/ src/ NumericComparator.php, line 33
Class
Namespace
SebastianBergmann\ComparatorCode
public function assertEquals(mixed $expected, mixed $actual, float $delta = 0.0, bool $canonicalize = false, bool $ignoreCase = false) : void {
if ($this->isInfinite($actual) && $this->isInfinite($expected)) {
return;
}
if (($this->isInfinite($actual) xor $this->isInfinite($expected)) || ($this->isNan($actual) || $this->isNan($expected)) || abs($actual - $expected) > $delta) {
$exporter = new Exporter();
throw new ComparisonFailure($expected, $actual, '', '', sprintf('Failed asserting that %s matches expected %s.', $exporter->export($actual), $exporter->export($expected)));
}
}