ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilCtrlStructureCidGeneratorTest Class Reference

Class ilCtrlStructureCidGeneratorTest. More...

+ Inheritance diagram for ilCtrlStructureCidGeneratorTest:
+ Collaboration diagram for ilCtrlStructureCidGeneratorTest:

Public Member Functions

 testCidGeneratorIncrements ()
 
 testCidGeneratorPositiveContinuousIncrements ()
 
 testCidGeneratorNegativeContinuousIncrements ()
 
 testCidGeneratorContinuousIncrementsFromMaxIntegerValue ()
 
 testCidGeneratorIndexByCidValue ()
 
 testCidGeneratorCidByIndexValue ()
 

Detailed Description

Member Function Documentation

◆ testCidGeneratorCidByIndexValue()

ilCtrlStructureCidGeneratorTest::testCidGeneratorCidByIndexValue ( )

Definition at line 84 of file ilCtrlStructureCidGeneratorTest.php.

84  : void
85  {
86  $generator = new ilCtrlStructureCidGenerator();
87 
88  $this->assertEquals('255r', $generator->getCidByIndex(99999));
89  $this->assertEquals('-255r', $generator->getCidByIndex(-99999));
90  $this->assertEquals('0', $generator->getCidByIndex(0));
91  $this->assertEquals('0', $generator->getCidByIndex(-0));
92  $this->assertEquals('1', $generator->getCidByIndex(1));
93  $this->assertEquals('-1', $generator->getCidByIndex(-1));
94  }
Class ilCtrlStructureCidGenerator.

◆ testCidGeneratorContinuousIncrementsFromMaxIntegerValue()

ilCtrlStructureCidGeneratorTest::testCidGeneratorContinuousIncrementsFromMaxIntegerValue ( )

Definition at line 63 of file ilCtrlStructureCidGeneratorTest.php.

63  : void
64  {
65  $generator = new ilCtrlStructureCidGenerator(9223372036854775807);
66 
67  $this->expectException(TypeError::class);
68  $this->expectExceptionMessage('Cannot increment property ilCtrlStructureCidGenerator::$index of type int past its maximal value');
69  $cid = $generator->getCid();
70  }
Class ilCtrlStructureCidGenerator.

◆ testCidGeneratorIncrements()

ilCtrlStructureCidGeneratorTest::testCidGeneratorIncrements ( )

Definition at line 30 of file ilCtrlStructureCidGeneratorTest.php.

30  : void
31  {
32  $generator = new ilCtrlStructureCidGenerator();
33  $first_cid = $generator->getCid();
34  $next_cid = $generator->getCid();
35 
36  $this->assertEquals('0', $first_cid);
37  $this->assertNotEquals('0', $next_cid);
38  $this->assertEquals('1', $next_cid);
39  }
Class ilCtrlStructureCidGenerator.

◆ testCidGeneratorIndexByCidValue()

ilCtrlStructureCidGeneratorTest::testCidGeneratorIndexByCidValue ( )

Definition at line 72 of file ilCtrlStructureCidGeneratorTest.php.

72  : void
73  {
74  $generator = new ilCtrlStructureCidGenerator();
75 
76  $this->assertEquals(99999, $generator->getIndexByCid('255r'));
77  $this->assertEquals(-99999, $generator->getIndexByCid('-255r'));
78  $this->assertEquals(0, $generator->getIndexByCid('0'));
79  $this->assertEquals(0, $generator->getIndexByCid('-0'));
80  $this->assertEquals(1, $generator->getIndexByCid('1'));
81  $this->assertEquals(-1, $generator->getIndexByCid('-1'));
82  }
Class ilCtrlStructureCidGenerator.

◆ testCidGeneratorNegativeContinuousIncrements()

ilCtrlStructureCidGeneratorTest::testCidGeneratorNegativeContinuousIncrements ( )

Definition at line 52 of file ilCtrlStructureCidGeneratorTest.php.

52  : void
53  {
54  $generator = new ilCtrlStructureCidGenerator(-100);
55  $first_cid = $generator->getCid();
56  $next_cid = $generator->getCid();
57 
58  $this->assertEquals('-2s', $first_cid);
59  $this->assertNotEquals('-2s', $next_cid);
60  $this->assertEquals('-2r', $next_cid);
61  }
Class ilCtrlStructureCidGenerator.

◆ testCidGeneratorPositiveContinuousIncrements()

ilCtrlStructureCidGeneratorTest::testCidGeneratorPositiveContinuousIncrements ( )

Definition at line 41 of file ilCtrlStructureCidGeneratorTest.php.

41  : void
42  {
43  $generator = new ilCtrlStructureCidGenerator(100);
44  $first_cid = $generator->getCid();
45  $next_cid = $generator->getCid();
46 
47  $this->assertEquals('2s', $first_cid);
48  $this->assertNotEquals('2s', $next_cid);
49  $this->assertEquals('2t', $next_cid);
50  }
Class ilCtrlStructureCidGenerator.

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