summaryrefslogtreecommitdiff
path: root/vendor/chillerlan/php-qrcode/tests/Helpers/PolynomialTest.php
blob: b0f3f4aa7988b6120b94377ebe924e0199e85f6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/**
 * Class PolynomialTest
 *
 * @filesource   PolynomialTest.php
 * @created      09.02.2016
 * @package      chillerlan\QRCodeTest\Helpers
 * @author       Smiley <[email protected]>
 * @copyright    2015 Smiley
 * @license      MIT
 */

namespace chillerlan\QRCodeTest\Helpers;

use chillerlan\QRCode\Helpers\Polynomial;
use chillerlan\QRCode\QRCodeException;
use PHPUnit\Framework\TestCase;

/**
 * Polynomial coverage test
 */
final class PolynomialTest extends TestCase{

	protected Polynomial $polynomial;

	protected function setUp():void{
		$this->polynomial = new Polynomial;
	}

	public function testGexp():void{
		$this::assertSame(142, $this->polynomial->gexp(-1));
		$this::assertSame(133, $this->polynomial->gexp(128));
		$this::assertSame(2,   $this->polynomial->gexp(256));
	}

	public function testGlogException():void{
		$this->expectException(QRCodeException::class);
		$this->expectExceptionMessage('log(0)');

		$this->polynomial->glog(0);
	}
}