| @@ 388-407 (lines=20) @@ | ||
| 385 | /* |
|
| 386 | * Test add commutative. |
|
| 387 | */ |
|
| 388 | public function testAddCommutative() |
|
| 389 | { |
|
| 390 | $this |
|
| 391 | ->given( |
|
| 392 | $a = $this->fromNative($this->randomNativeNumber())->toInteger(), |
|
| 393 | $b = $this->fromNative($this->randomNativeNumber())->toReal(), |
|
| 394 | $c = $this->fromNative($this->randomNativeNumber())->toDecimal() |
|
| 395 | ) |
|
| 396 | ->then |
|
| 397 | ->boolean( |
|
| 398 | $a->add($b)->equals($b->add($a)) |
|
| 399 | )->isTrue() |
|
| 400 | ->boolean( |
|
| 401 | $a->add($c)->equals($c->add($a)) |
|
| 402 | )->isTrue() |
|
| 403 | ->boolean( |
|
| 404 | $b->add($c)->equals($c->add($b)) |
|
| 405 | )->isTrue() |
|
| 406 | ; |
|
| 407 | } |
|
| 408 | ||
| 409 | /* |
|
| 410 | * Test add associative. |
|
| @@ 569-588 (lines=20) @@ | ||
| 566 | /* |
|
| 567 | * Test mult commutative. |
|
| 568 | */ |
|
| 569 | public function testMultCommutative() |
|
| 570 | { |
|
| 571 | $this |
|
| 572 | ->given( |
|
| 573 | $a = $this->fromNative($this->randomNativeNumber())->toInteger(), |
|
| 574 | $b = $this->fromNative($this->randomNativeNumber())->toReal(), |
|
| 575 | $c = $this->fromNative($this->randomNativeNumber())->toDecimal() |
|
| 576 | ) |
|
| 577 | ->then |
|
| 578 | ->boolean( |
|
| 579 | $a->mult($b)->equals($b->mult($a)) |
|
| 580 | )->isTrue() |
|
| 581 | ->boolean( |
|
| 582 | $a->mult($c)->equals($c->mult($a)) |
|
| 583 | )->isTrue() |
|
| 584 | ->boolean( |
|
| 585 | $b->mult($c)->equals($c->mult($b)) |
|
| 586 | )->isTrue() |
|
| 587 | ; |
|
| 588 | } |
|
| 589 | ||
| 590 | /* |
|
| 591 | * Test mult associative. |
|