1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?php
- namespace MathPHP\Tests\NumericalAnalysis\NumericalIntegration;
- use MathPHP\NumericalAnalysis\NumericalIntegration\NumericalIntegration;
- use MathPHP\Exception;
- class NumericalIntegrationTest extends \PHPUnit\Framework\TestCase
- {
-
- public function testIncorrectInput()
- {
-
- $x = 10;
- $incorrectFunction = $x ** 2 + 2 * $x + 1;
-
- $this->expectException(Exception\BadDataException::class);
-
- NumericalIntegration::getPoints($incorrectFunction, [0,4,5]);
- }
-
- public function testNotCoordinatesException()
- {
-
- $points = [[0,0], [1,2,3], [2,2]];
-
- $this->expectException(Exception\BadDataException::class);
-
- NumericalIntegration::validate($points);
- }
-
- public function testNotEnoughArraysException()
- {
-
- $points = [[0,0]];
-
- $this->expectException(Exception\BadDataException::class);
-
- NumericalIntegration::validate($points);
- }
-
- public function testNotAFunctionException()
- {
-
- $points = [[0,0], [0,5], [1,1]];
-
- $this->expectException(Exception\BadDataException::class);
-
- NumericalIntegration::validate($points);
- }
- }
|