Passed
Push — main ( 40d4d0...b1f2dd )
by N.
05:04
created

tipsraderTest::testCreateObject()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 31
Code Lines 22

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 22
nc 2
nop 0
dl 0
loc 31
rs 9.568
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * tipsraderTest.
5
 * @author Niklas Dougherty
6
 */
7
8
declare(strict_types=1);
9
10
namespace Tips\Tests\Funktioner;
11
12
use PHPUnit\Framework\TestCase;
13
use Tips\Klasser\Preludium;
14
15
/**
16
 * tipsraderTest.
17
 */
18
class tipsraderTest extends TestCase
19
{
20
	/**
21
	 * Construct object with argument and verify that the object has the expected properties.
22
	 */
23
	public function testCreateObject(): void
24
	{
25
		new Preludium();
26
27
		$tipsrader = [
28
			'11X1111112211',
29
			'11X1111112212',
30
			'11X1111112221',
31
			'11X1111112222',
32
			'11XX111112212',
33
			'11XX111112221',
34
			'1121111111222',
35
			'1121111112121',
36
			'1121111112211',
37
			'1121111211111',
38
			'1121111211211'
39
		];
40
41
		$tipsrader_012 = array_map('symboler_till_siffror', $tipsrader);
42
		$this->assertEquals(array_map('siffror_till_symboler', $tipsrader_012), $tipsrader);
43
44
		$tipsrader_bas36 = bas3till36($tipsrader_012);
45
		$this->assertEquals(bas36till3($tipsrader_bas36), $tipsrader_012);
46
47
		$this->assertEquals(kommatisera('0011000002202'), '1,1,X,X,1,1,1,1,1,2,2,1,2');
48
49
		$rätt_rad = '1X21X11112X11';
50
		$rättvektor = [9, 8, 8, 7, 7, 7, 7, 9, 10, 8, 8];
51
52
		foreach ($tipsrader as $i => $rad) {
53
			$this->assertEquals(antal_rätt($rad, $rätt_rad), $rättvektor[$i]);
54
		}
55
	}
56
}
57