|
@@ 157-184 (lines=28) @@
|
| 154 |
|
/* |
| 155 |
|
* Test add. |
| 156 |
|
*/ |
| 157 |
|
public function testAdd() |
| 158 |
|
{ |
| 159 |
|
parent::testAdd(); |
| 160 |
|
|
| 161 |
|
$this |
| 162 |
|
->given( |
| 163 |
|
$positiveInfinite = $this->fromNative($this->positiveInfiniteNativeNumber()), |
| 164 |
|
$negativeInfinite = $this->fromNative($this->negativeInfiniteNativeNumber()), |
| 165 |
|
$number = $this->fromNative($this->randomNativeNumber()) |
| 166 |
|
) |
| 167 |
|
->then |
| 168 |
|
->boolean($number->add($positiveInfinite)->equals($positiveInfinite)) |
| 169 |
|
->isTrue() |
| 170 |
|
->boolean($positiveInfinite->add($number)->equals($positiveInfinite)) |
| 171 |
|
->isTrue() |
| 172 |
|
->boolean($number->add($negativeInfinite)->equals($negativeInfinite)) |
| 173 |
|
->isTrue() |
| 174 |
|
->boolean($negativeInfinite->add($number)->equals($negativeInfinite)) |
| 175 |
|
->isTrue() |
| 176 |
|
->boolean($positiveInfinite->add($positiveInfinite)->equals($positiveInfinite)) |
| 177 |
|
->isTrue() |
| 178 |
|
->boolean($negativeInfinite->add($negativeInfinite)->equals($negativeInfinite)) |
| 179 |
|
->isTrue() |
| 180 |
|
->exception(function () use ($positiveInfinite, $negativeInfinite) { |
| 181 |
|
$positiveInfinite->add($negativeInfinite); |
| 182 |
|
})->isInstanceOf(\Exception::class) |
| 183 |
|
; |
| 184 |
|
} |
| 185 |
|
|
| 186 |
|
/* |
| 187 |
|
* Test sub. |
|
@@ 189-216 (lines=28) @@
|
| 186 |
|
/* |
| 187 |
|
* Test sub. |
| 188 |
|
*/ |
| 189 |
|
public function testSub() |
| 190 |
|
{ |
| 191 |
|
parent::testSub(); |
| 192 |
|
|
| 193 |
|
$this |
| 194 |
|
->given( |
| 195 |
|
$positiveInfinite = $this->fromNative($this->positiveInfiniteNativeNumber()), |
| 196 |
|
$negativeInfinite = $this->fromNative($this->negativeInfiniteNativeNumber()), |
| 197 |
|
$number = $this->fromNative($this->randomNativeNumber()) |
| 198 |
|
) |
| 199 |
|
->then |
| 200 |
|
->boolean($number->sub($positiveInfinite)->equals($negativeInfinite)) |
| 201 |
|
->isTrue() |
| 202 |
|
->boolean($positiveInfinite->sub($number)->equals($positiveInfinite)) |
| 203 |
|
->isTrue() |
| 204 |
|
->boolean($number->sub($negativeInfinite)->equals($positiveInfinite)) |
| 205 |
|
->isTrue() |
| 206 |
|
->boolean($negativeInfinite->sub($number)->equals($negativeInfinite)) |
| 207 |
|
->isTrue() |
| 208 |
|
->boolean($positiveInfinite->sub($negativeInfinite)->equals($positiveInfinite)) |
| 209 |
|
->isTrue() |
| 210 |
|
->boolean($negativeInfinite->sub($positiveInfinite)->equals($negativeInfinite)) |
| 211 |
|
->isTrue() |
| 212 |
|
->exception(function () use ($positiveInfinite) { |
| 213 |
|
$positiveInfinite->sub($positiveInfinite); |
| 214 |
|
})->isInstanceOf(\Exception::class) |
| 215 |
|
; |
| 216 |
|
} |
| 217 |
|
|
| 218 |
|
/* |
| 219 |
|
* Test mult. |