forked from the-crucible/phpunit-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path21Equals2.php
More file actions
26 lines (23 loc) · 725 Bytes
/
21Equals2.php
File metadata and controls
26 lines (23 loc) · 725 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
/**
* More specialized comparisons are used for specific argument types
* for $expected and $actual, see below.
* assertEquals(float $expected, float $actual[, string $message = '', float $delta = 0])
* Reports an error identified by $message if the two floats $expected and
* $actual are not within $delta of each other.
* Please read "What Every Computer Scientist Should Know About Floating-Point Arithmetic"
* to understand why $delta is neccessary.
*
*/
class FloatEqualsTest extends PHPUnit_Framework_TestCase
{
public function testSuccess()
{
$this->assertEquals(1.0, 1.1, '', 0.2);
}
public function testFailure()
{
$this->assertEquals(1.0, 1.1);
}
}
?>