ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilBitmaskTest Class Reference

Tests for utility class ilBitmask. More...

+ Inheritance diagram for ilBitmaskTest:
+ Collaboration diagram for ilBitmaskTest:

Public Member Functions

 setUp ()
 tearDown ()
 test_Constructor ()
 test_getSetButterflyPattern ()
 test_getSetallTrue ()
 test_getSetallFalse ()
 test_getSetInvertButterflyPattern ()
 test_setIllegalSetting ()
 ilException
 test_getIllegalSetting ()
 ilException
 test_getBitmask ()

Detailed Description

Tests for utility class ilBitmask.

Author
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

/

Definition at line 12 of file class.ilBitmaskTest.php.

Member Function Documentation

ilBitmaskTest::setUp ( )

Definition at line 15 of file class.ilBitmaskTest.php.

{
chdir('../../../');
require_once './Services/Utilities/classes/class.ilBitmask.php';
}
ilBitmaskTest::tearDown ( )

Definition at line 21 of file class.ilBitmaskTest.php.

{
}
ilBitmaskTest::test_Constructor ( )

Definition at line 26 of file class.ilBitmaskTest.php.

{
// Arrange
$definition = array('1bit','2bit','4bit','8bit','16bit','32bit','64bit','128bit');
$bitmask = 0;
$settings = new ilBitmask($definition, $bitmask);
// Act
// Assert
// No exception - good
}
ilBitmaskTest::test_getBitmask ( )

Definition at line 189 of file class.ilBitmaskTest.php.

{
// Arrange
$definition = array('1bit','2bit','4bit','8bit','16bit','32bit','64bit','128bit');
$bitmask = 0;
$settings = new ilBitmask($definition, $bitmask);
// Act
$settings->set('1bit', true);
$settings->set('2bit', false);
$settings->set('4bit', true);
$settings->set('8bit', false);
$settings->set('16bit', true);
$settings->set('32bit', false);
$settings->set('64bit', true);
$settings->set('128bit', false);
$expected = 85;
// Assert
$this->assertEquals( $expected, $settings->getBitmask() );
}
ilBitmaskTest::test_getIllegalSetting ( )

ilException

Definition at line 178 of file class.ilBitmaskTest.php.

{
// Arrange
$definition = array('1bit','2bit','4bit','8bit','16bit','32bit','64bit','128bit');
$bitmask = 0;
$settings = new ilBitmask($definition, $bitmask);
// Act
$settings->get('Günther');
}
ilBitmaskTest::test_getSetallFalse ( )

Definition at line 95 of file class.ilBitmaskTest.php.

{
// Arrange
$definition = array('1bit','2bit','4bit','8bit','16bit','32bit','64bit','128bit');
$bitmask = 0;
$settings = new ilBitmask($definition, $bitmask);
// Act
$settings->set('1bit', false);
$settings->set('2bit', false);
$settings->set('4bit', false);
$settings->set('8bit', false);
$settings->set('16bit', false);
$settings->set('32bit', false);
$settings->set('64bit', false);
$settings->set('128bit', false);
// Assert
$this->assertFalse($settings->get('1bit'));
$this->assertFalse($settings->get('2bit'));
$this->assertFalse($settings->get('4bit'));
$this->assertFalse($settings->get('8bit'));
$this->assertFalse($settings->get('16bit'));
$this->assertFalse($settings->get('32bit'));
$this->assertFalse($settings->get('64bit'));
$this->assertFalse($settings->get('128bit'));
}
ilBitmaskTest::test_getSetallTrue ( )

Definition at line 67 of file class.ilBitmaskTest.php.

{
// Arrange
$definition = array('1bit','2bit','4bit','8bit','16bit','32bit','64bit','128bit');
$bitmask = 0;
$settings = new ilBitmask($definition, $bitmask);
// Act
$settings->set('1bit', true);
$settings->set('2bit', true);
$settings->set('4bit', true);
$settings->set('8bit', true);
$settings->set('16bit', true);
$settings->set('32bit', true);
$settings->set('64bit', true);
$settings->set('128bit', true);
// Assert
$this->assertTrue($settings->get('1bit'));
$this->assertTrue($settings->get('2bit'));
$this->assertTrue($settings->get('4bit'));
$this->assertTrue($settings->get('8bit'));
$this->assertTrue($settings->get('16bit'));
$this->assertTrue($settings->get('32bit'));
$this->assertTrue($settings->get('64bit'));
$this->assertTrue($settings->get('128bit'));
}
ilBitmaskTest::test_getSetButterflyPattern ( )

Definition at line 39 of file class.ilBitmaskTest.php.

{
// Arrange
$definition = array('1bit','2bit','4bit','8bit','16bit','32bit','64bit','128bit');
$bitmask = 0;
$settings = new ilBitmask($definition, $bitmask);
// Act
$settings->set('1bit', true);
$settings->set('2bit', false);
$settings->set('4bit', true);
$settings->set('8bit', false);
$settings->set('16bit', true);
$settings->set('32bit', false);
$settings->set('64bit', true);
$settings->set('128bit', false);
// Assert
$this->assertTrue($settings->get('1bit'));
$this->assertFalse($settings->get('2bit'));
$this->assertTrue($settings->get('4bit'));
$this->assertFalse($settings->get('8bit'));
$this->assertTrue($settings->get('16bit'));
$this->assertFalse($settings->get('32bit'));
$this->assertTrue($settings->get('64bit'));
$this->assertFalse($settings->get('128bit'));
}
ilBitmaskTest::test_getSetInvertButterflyPattern ( )

Definition at line 123 of file class.ilBitmaskTest.php.

{
// Arrange
$definition = array('1bit','2bit','4bit','8bit','16bit','32bit','64bit','128bit');
$bitmask = 0;
$settings = new ilBitmask($definition, $bitmask);
// Act - Set Butterfly Pattern
$settings->set('1bit', false);
$settings->set('2bit', true);
$settings->set('4bit', false);
$settings->set('8bit', true);
$settings->set('16bit', false);
$settings->set('32bit', true);
$settings->set('64bit', false);
$settings->set('128bit', true);
// Act - Invert Butterfly Pattern
$settings->set('1bit', true);
$settings->set('2bit', false);
$settings->set('4bit', true);
$settings->set('8bit', false);
$settings->set('16bit', true);
$settings->set('32bit', false);
$settings->set('64bit', true);
$settings->set('128bit', false);
// Assert
$this->assertTrue($settings->get('1bit'));
$this->assertFalse($settings->get('2bit'));
$this->assertTrue($settings->get('4bit'));
$this->assertFalse($settings->get('8bit'));
$this->assertTrue($settings->get('16bit'));
$this->assertFalse($settings->get('32bit'));
$this->assertTrue($settings->get('64bit'));
$this->assertFalse($settings->get('128bit'));
}
ilBitmaskTest::test_setIllegalSetting ( )

ilException

Definition at line 164 of file class.ilBitmaskTest.php.

{
// Arrange
$definition = array('1bit','2bit','4bit','8bit','16bit','32bit','64bit','128bit');
$bitmask = 0;
$settings = new ilBitmask($definition, $bitmask);
// Act
$settings->set('Günther', true);
}

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