ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
RangeTest Class Reference
+ Inheritance diagram for RangeTest:
+ Collaboration diagram for RangeTest:

Public Member Functions

 testFactory ()
 
 testValues (Range $range)
 testFactory More...
 
 testEndCalculation (Range $range)
 testFactory More...
 
 testWithLength (Range $range)
 testFactory More...
 
 testWithStart (Range $range)
 testWithLength More...
 
 testUnpack (Range $range)
 testWithStart More...
 
 testNegativeStart (Range $range)
 testFactory More...
 
 testNegativeLength (Range $range)
 testFactory More...
 
 testConstructionWrongStart ()
 
 testConstructionWrongLength ()
 
 testCroppedTo ($start, $length, $max, $has_changed)
 cropCases More...
 

Static Public Member Functions

static cropCases ()
 

Detailed Description

Member Function Documentation

◆ cropCases()

static RangeTest::cropCases ( )
static

Definition at line 138 of file RangeTest.php.

138  : array
139  {
140  return [
141  [0, 100, 1000, false],
142  [0, 1000, 100, true],
143  [50, 100, 75, true],
144  [50, 100, 200, false],
145  [100, 100, 50, true]
146  ];
147  }

◆ testConstructionWrongLength()

RangeTest::testConstructionWrongLength ( )

Definition at line 114 of file RangeTest.php.

References Vendor\Package\$f, and ILIAS\UI\Implementation\Component\Table\$range.

114  : void
115  {
116  $this->expectException(InvalidArgumentException::class);
117  $f = new ILIAS\Data\Factory();
118  $range = $f->range(1, -2);
119  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ testConstructionWrongStart()

RangeTest::testConstructionWrongStart ( )

Definition at line 107 of file RangeTest.php.

References Vendor\Package\$f, and ILIAS\UI\Implementation\Component\Table\$range.

107  : void
108  {
109  $this->expectException(InvalidArgumentException::class);
110  $f = new ILIAS\Data\Factory();
111  $range = $f->range(-1, 2);
112  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ testCroppedTo()

RangeTest::testCroppedTo (   $start,
  $length,
  $max,
  $has_changed 
)

cropCases

Definition at line 124 of file RangeTest.php.

References Vendor\Package\$f, ILIAS\UI\Implementation\Component\Table\$range, and ILIAS\Data\Range\croppedTo().

124  : void
125  {
126  $f = new ILIAS\Data\Factory();
127  $range = $f->range($start, $length);
128  $cropped = $range->croppedTo($max);
129 
130  if (!$has_changed) {
131  $this->assertEquals($range, $cropped);
132  } else {
133  $this->assertEquals(min($max, $start), $cropped->getStart());
134  $this->assertEquals($max, $cropped->getEnd());
135  }
136  }
croppedTo(int $max)
This will create a range that is guaranteed to not exceed $max.
Definition: Range.php:98
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ testEndCalculation()

RangeTest::testEndCalculation ( Range  $range)

testFactory

Definition at line 49 of file RangeTest.php.

References ILIAS\Data\Range\getEnd().

49  : void
50  {
51  $this->assertEquals(3, $range->getEnd());
52  }
+ Here is the call graph for this function:

◆ testFactory()

RangeTest::testFactory ( )

Definition at line 29 of file RangeTest.php.

References Vendor\Package\$f, and ILIAS\UI\Implementation\Component\Table\$range.

29  : Range
30  {
31  $f = new ILIAS\Data\Factory();
32  $range = $f->range(1, 2);
33  $this->assertInstanceOf(Range::class, $range);
34  return $range;
35  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
A simple class to express a naive range of whole positive numbers.
Definition: Range.php:28

◆ testNegativeLength()

RangeTest::testNegativeLength ( Range  $range)

testFactory

Definition at line 101 of file RangeTest.php.

References ILIAS\Data\Range\withLength().

101  : void
102  {
103  $this->expectException(InvalidArgumentException::class);
104  $range = $range->withLength(-1);
105  }
withLength(int $length)
Definition: Range.php:87
+ Here is the call graph for this function:

◆ testNegativeStart()

RangeTest::testNegativeStart ( Range  $range)

testFactory

Definition at line 92 of file RangeTest.php.

References ILIAS\Data\Range\withStart().

92  : void
93  {
94  $this->expectException(InvalidArgumentException::class);
95  $range = $range->withStart(-5);
96  }
withStart(int $start)
Definition: Range.php:79
+ Here is the call graph for this function:

◆ testUnpack()

RangeTest::testUnpack ( Range  $range)

testWithStart

Definition at line 81 of file RangeTest.php.

References ILIAS\Data\Range\unpack().

81  : void
82  {
83  $this->assertEquals(
84  [3,3],
85  $range->unpack()
86  );
87  }
+ Here is the call graph for this function:

◆ testValues()

RangeTest::testValues ( Range  $range)

testFactory

Definition at line 40 of file RangeTest.php.

References ILIAS\Data\Range\getLength(), and ILIAS\Data\Range\getStart().

40  : void
41  {
42  $this->assertEquals(1, $range->getStart());
43  $this->assertEquals(2, $range->getLength());
44  }
+ Here is the call graph for this function:

◆ testWithLength()

RangeTest::testWithLength ( Range  $range)

testFactory

Definition at line 57 of file RangeTest.php.

References ILIAS\UI\Implementation\Component\Table\$range, ILIAS\Data\Range\getEnd(), ILIAS\Data\Range\getLength(), ILIAS\Data\Range\getStart(), and ILIAS\Data\Range\withLength().

57  : Range
58  {
59  $range = $range->withLength(3);
60  $this->assertEquals(1, $range->getStart());
61  $this->assertEquals(3, $range->getLength());
62  $this->assertEquals(4, $range->getEnd());
63  return $range;
64  }
withLength(int $length)
Definition: Range.php:87
A simple class to express a naive range of whole positive numbers.
Definition: Range.php:28
+ Here is the call graph for this function:

◆ testWithStart()

RangeTest::testWithStart ( Range  $range)

testWithLength

Definition at line 69 of file RangeTest.php.

References ILIAS\UI\Implementation\Component\Table\$range, ILIAS\Data\Range\getEnd(), ILIAS\Data\Range\getLength(), ILIAS\Data\Range\getStart(), and ILIAS\Data\Range\withStart().

69  : Range
70  {
71  $range = $range->withStart(3);
72  $this->assertEquals(3, $range->getStart());
73  $this->assertEquals(3, $range->getLength());
74  $this->assertEquals(6, $range->getEnd());
75  return $range;
76  }
withStart(int $start)
Definition: Range.php:79
A simple class to express a naive range of whole positive numbers.
Definition: Range.php:28
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: