1<?
php declare(strict_types=1);
4use PHPUnit\Framework\TestCase;
14 $range =
$f->range(1, 2);
15 $this->assertInstanceOf(Range::class, $range);
24 $this->assertEquals(1, $range->
getStart());
25 $this->assertEquals(2, $range->
getLength());
33 $this->assertEquals(3, $range->
getEnd());
42 $this->assertEquals(1, $range->
getStart());
43 $this->assertEquals(3, $range->
getLength());
44 $this->assertEquals(4, $range->
getEnd());
54 $this->assertEquals(3, $range->
getStart());
55 $this->assertEquals(3, $range->
getLength());
56 $this->assertEquals(6, $range->
getEnd());
76 $this->expectException(InvalidArgumentException::class);
85 $this->expectException(InvalidArgumentException::class);
94 $this->expectException(InvalidArgumentException::class);
100 $this->expectException(InvalidArgumentException::class);
102 $range =
$f->range(-1, 2);
107 $this->expectException(InvalidArgumentException::class);
109 $range =
$f->range(1, -2);
114 $this->expectException(InvalidArgumentException::class);
116 $range =
$f->range(1, 0);
An exception for terminatinating execution or to throw for unit testing.
A simple class to express a naive range of whole positive numbers.
testConstructionWrongLength()
testUnpack(Range $range)
@depends testWithStart
testConstructionWrongStart()
testConstructionNullLength()
testWithLength(Range $range)
@depends testFactory
testNullLength(Range $range)
@depends testFactory
testNegativeLength(Range $range)
@depends testFactory
testWithStart(Range $range)
@depends testWithLength
testNegativeStart(Range $range)
@depends testFactory
testEndCalculation(Range $range)
@depends testFactory
testValues(Range $range)
@depends testFactory