PolynomialTest.php 961 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\QRCodeTest\QRTestAbstract;
  15. class PolynomialTest extends QRTestAbstract{
  16. /**
  17. * @var \chillerlan\QRCode\Helpers\Polynomial
  18. */
  19. protected $polynomial;
  20. protected function setUp(){
  21. $this->polynomial = new Polynomial;
  22. }
  23. public function testGexp(){
  24. $this->assertEquals(142, $this->polynomial->gexp(-1));
  25. $this->assertEquals(133, $this->polynomial->gexp(128));
  26. $this->assertEquals(2, $this->polynomial->gexp(256));
  27. }
  28. /**
  29. * @expectedException \chillerlan\QRCode\QRCodeException
  30. * @expectedExceptionMessage log(0)
  31. */
  32. public function testGlogException(){
  33. $this->polynomial->glog(0);
  34. }
  35. }