LimitsTest.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace MathPHP\Tests\Probability\Distribution\Multivariate;
  3. use MathPHP\Probability\Distribution\Multivariate;
  4. class LimitsTest extends \PHPUnit\Framework\TestCase
  5. {
  6. /**
  7. * Limits should look like:
  8. * (a,b)
  9. * [a,b)
  10. * (a,b]
  11. * [a,b]
  12. */
  13. private function limitTest(array $limits)
  14. {
  15. foreach ($limits as $parameter => $limit) {
  16. $this->assertRegExp('/^ ([[(]) (.+) , (.+?) ([])]) $/x', $limit);
  17. }
  18. }
  19. /**
  20. * @test Limits constant is correct format
  21. */
  22. public function testDirichletParameterLimits()
  23. {
  24. $this->limitTest(Multivariate\Dirichlet::PARAMETER_LIMITS);
  25. }
  26. /**
  27. * @test Limits constant is correct format
  28. */
  29. public function testDirichletSupportLimits()
  30. {
  31. $this->limitTest(Multivariate\Dirichlet::SUPPORT_LIMITS);
  32. }
  33. /**
  34. * @test Limits constant is correct format
  35. */
  36. public function testHypergeometricParameterLimits()
  37. {
  38. $this->limitTest(Multivariate\Hypergeometric::PARAMETER_LIMITS);
  39. }
  40. }