Passed
Branch master (947605)
by smiley
03:06
created

PolynomialTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 2
Bugs 0 Features 2
Metric Value
wmc 3
c 2
b 0
f 2
lcom 1
cbo 2
dl 0
loc 25
rs 10

3 Methods

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