-
Notifications
You must be signed in to change notification settings - Fork 0
/
CoinGroupTest.php
50 lines (42 loc) · 1.12 KB
/
CoinGroupTest.php
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
43
44
45
46
47
48
49
50
<?php
/**
* Created by IntelliJ IDEA.
* User: kfuntov
* Date: 26.12.12
* Time: 16:10
* To change this template use File | Settings | File Templates.
*/
require 'CoinGroup.php';
class CoinGroupTest extends PHPUnit_Framework_TestCase{
/**
* @var CoinGroup
*/
protected $cg;
public function setUp()
{
$this->cg=new CoinGroup(array(
new Coin(Coin::NORMAL),
new Coin(Coin::HEAVIER)
));
}
public function testConstruct()
{
$this->assertEquals(new Coin(Coin::HEAVIER), $this->cg->get(1));
}
public function testGetSize()
{
$this->assertEquals(2,$this->cg->getSize());
}
public function testNormalGroup()
{
$cg=CoinGroup::normal(3);
$this->assertEquals(3,$cg->getSize());
$this->assertEquals(new Coin(Coin::NORMAL),$cg->get(0));
$this->assertEquals(new Coin(Coin::NORMAL),$cg->get(1));
$this->assertEquals(new Coin(Coin::NORMAL),$cg->get(2));
}
public function testGetWeight()
{
$this->assertEquals(Coin::NORMAL+Coin::HEAVIER, $this->cg->getWeight());
}
}