PolynomialTest.php 988 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. /**
  18. * @var \chillerlan\QRCode\Helpers\Polynomial
  19. */
  20. protected $polynomial;
  21. protected function setUp():void{
  22. $this->polynomial = new Polynomial;
  23. }
  24. public function testGexp(){
  25. $this->assertSame(142, $this->polynomial->gexp(-1));
  26. $this->assertSame(133, $this->polynomial->gexp(128));
  27. $this->assertSame(2, $this->polynomial->gexp(256));
  28. }
  29. public function testGlogException(){
  30. $this->expectException(QRCodeException::class);
  31. $this->expectExceptionMessage('log(0)');
  32. $this->polynomial->glog(0);
  33. }
  34. }