PolynomialTest.php 942 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * Class PolynomialTest
  4. *
  5. * @filesource PolynomialTest.php
  6. * @created 09.02.2016
  7. * @package chillerlan\QRCodeTest\Helpers
  8. * @author Smiley <smiley@chillerlan.net>
  9. * @copyright 2015 Smiley
  10. * @license MIT
  11. */
  12. namespace chillerlan\QRCodeTest\Helpers;
  13. use chillerlan\QRCode\Helpers\Polynomial;
  14. use chillerlan\QRCode\QRCodeException;
  15. use chillerlan\QRCodeTest\QRTestAbstract;
  16. class PolynomialTest extends QRTestAbstract{
  17. protected Polynomial $polynomial;
  18. protected function setUp():void{
  19. $this->polynomial = new Polynomial;
  20. }
  21. public function testGexp(){
  22. $this->assertSame(142, $this->polynomial->gexp(-1));
  23. $this->assertSame(133, $this->polynomial->gexp(128));
  24. $this->assertSame(2, $this->polynomial->gexp(256));
  25. }
  26. public function testGlogException(){
  27. $this->expectException(QRCodeException::class);
  28. $this->expectExceptionMessage('log(0)');
  29. $this->polynomial->glog(0);
  30. }
  31. }