PolynomialTest.php 877 B

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