PolynomialTest.php 890 B

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