ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
DataSizeTest Class Reference

Testing the DataSize object. More...

+ Inheritance diagram for DataSizeTest:
+ Collaboration diagram for DataSizeTest:

Public Member Functions

 test_normal ($a, $b, $expected)
 tDataProvider More...
 
 test_division_by_zero ()
 
 tDataProvider ()
 

Detailed Description

Member Function Documentation

◆ tDataProvider()

DataSizeTest::tDataProvider ( )

Definition at line 36 of file DataSizeTest.php.

References array.

37  {
38  return array(array(122, 1000, "0.122 KB"),
39  array(-122, 1000, "-0.122 KB"),
40  array(122, 1000000, "0.000122 MB"),
41  array(-122, 1000000, "-0.000122 MB"),
42  array(122, 1000000000, "1.22E-7 GB"),
43  array(-122, 1000000000, "-1.22E-7 GB"),
44  array(122, 1000000000000, "1.22E-10 TB"),
45  array(-122, 1000000000000, "-1.22E-10 TB"),
46  array(122, 1000000000000000, "1.22E-13 PB"),
47  array(-122, 1000000000000000, "-1.22E-13 PB"),
48  array(122, 1000000000000000000, "1.22E-16 EB"),
49  array(-122, 1000000000000000000, "-1.22E-16 EB"),
50 
51  // This tests will fail because the second param of DataSize
52  // needs an integer and this numbers are to big.
53  // array(122, 1000000000000000000000, "1.22E-19 ZB"),
54  // array(-122, 1000000000000000000000, "-1.22E-19 ZB"),
55  // array(122, 1000000000000000000000000, "1.22E-19 YB"),
56  // array(-122, 1000000000000000000000000, "-1.22E-19 YB")
57 
58  array(122, 1024, "0.119140625 KiB"),
59  array(-122, 1024, "-0.119140625 KiB"),
60  array(122, 1048576, "0.00011634826660156 MiB"),
61  array(-122, 1048576, "-0.00011634826660156 MiB"),
62  array(122, 1073741824, "1.1362135410309E-7 GiB"),
63  array(-122, 1073741824, "-1.1362135410309E-7 GiB"),
64  array(122, 1099511627776, "1.109583536163E-10 TiB"),
65  array(-122, 1099511627776, "-1.109583536163E-10 TiB"),
66  array(122, 1125899906842624, "1.0835776720342E-13 PiB"),
67  array(-122, 1125899906842624, "-1.0835776720342E-13 PiB"),
68  array(122, 1152921504606846976, "1.0581813203459E-16 EiB"),
69  array(-122, 1152921504606846976, "-1.0581813203459E-16 EiB")
70  );
71  }
Create styles array
The data for the language used.

◆ test_division_by_zero()

DataSizeTest::test_division_by_zero ( )

Definition at line 26 of file DataSizeTest.php.

27  {
28  try {
29  $ds = new DataSize(4533, 0);
30  $this->assertFalse("This should not happen");
31  } catch (\Exception $e) {
32  $this->assertTrue(true);
33  }
34  }
Class DataSize.
Definition: DataSize.php:15

◆ test_normal()

DataSizeTest::test_normal (   $a,
  $b,
  $expected 
)

tDataProvider

Definition at line 18 of file DataSizeTest.php.

19  {
20  $ds = new DataSize($a, $b);
21  $this->assertEquals($a/$b, $ds->getSize());
22  $this->assertEquals($b, $ds->getUnit());
23  $this->assertEquals($expected, $ds->__toString());
24  }
Class DataSize.
Definition: DataSize.php:15

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