PolynomialTest.php 978 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 PHPUnit\Framework\TestCase;
  16. /**
  17. * Polynomial coverage test
  18. */
  19. final class PolynomialTest extends TestCase{
  20. protected Polynomial $polynomial;
  21. protected function setUp():void{
  22. $this->polynomial = new Polynomial;
  23. }
  24. public function testGexp():void{
  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():void{
  30. $this->expectException(QRCodeException::class);
  31. $this->expectExceptionMessage('log(0)');
  32. $this->polynomial->glog(0);
  33. }
  34. }