ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
DatasetTest Class Reference
+ Inheritance diagram for DatasetTest:
+ Collaboration diagram for DatasetTest:

Public Member Functions

 testDimensions ()
 
 testInvalidDimension ()
 
 testInvalidDimensionKey ()
 
 testwithPoint ()
 
 testwithInvalidPointsCount ()
 
 testwithAlternativeInformation ()
 
 testwithInvalidAlternativeInformationCount ()
 
 testwithInvalidAlternativeInformationValue ()
 
 testwithResetDataset ()
 
 testMinValue ()
 
 testMaxValue ()
 

Protected Member Functions

 setUp ()
 
 getSimpleDimensions ()
 
 getExtendedDimensions ()
 

Detailed Description

Definition at line 29 of file DatasetTest.php.

Member Function Documentation

◆ getExtendedDimensions()

DatasetTest::getExtendedDimensions ( )
protected

Definition at line 44 of file DatasetTest.php.

Referenced by testMaxValue(), and testMinValue().

44  : array
45  {
46  $c_dimension = $this->f->dimension()->cardinal();
47  $r_dimension = $this->f->dimension()->range($c_dimension);
48  $dimensions = [
49  "First dimension" => $c_dimension,
50  "Second dimension" => $c_dimension,
51  "Third dimension" => $r_dimension
52  ];
53 
54  return $dimensions;
55  }
+ Here is the caller graph for this function:

◆ getSimpleDimensions()

DatasetTest::getSimpleDimensions ( )
protected

Definition at line 36 of file DatasetTest.php.

Referenced by testDimensions(), testwithAlternativeInformation(), testwithInvalidAlternativeInformationCount(), testwithInvalidAlternativeInformationValue(), testwithInvalidPointsCount(), testwithPoint(), and testwithResetDataset().

36  : array
37  {
38  $c_dimension = $this->f->dimension()->cardinal();
39  $dimensions = ["A dimension" => $c_dimension, "Another dimension" => $c_dimension];
40 
41  return $dimensions;
42  }
+ Here is the caller graph for this function:

◆ setUp()

DatasetTest::setUp ( )
protected

Definition at line 31 of file DatasetTest.php.

31  : void
32  {
33  $this->f = new Data\Factory();
34  }

◆ testDimensions()

DatasetTest::testDimensions ( )

Definition at line 57 of file DatasetTest.php.

References Vendor\Package\$e, and getSimpleDimensions().

57  : void
58  {
59  try {
60  $dimensions = $this->getSimpleDimensions();
61  $dataset = $this->f->dataset($dimensions);
62  $this->assertEquals($dimensions, $dataset->getDimensions());
63  } catch (\InvalidArgumentException $e) {
64  $this->assertFalse("This should not happen.");
65  }
66  }
getSimpleDimensions()
Definition: DatasetTest.php:36
+ Here is the call graph for this function:

◆ testInvalidDimension()

DatasetTest::testInvalidDimension ( )

Definition at line 68 of file DatasetTest.php.

References Vendor\Package\$e.

68  : void
69  {
70  try {
71  $dimension = "Dimension";
72  $dataset = $this->f->dataset(["A dimension" => $dimension]);
73  $this->assertFalse("This should not happen.");
74  } catch (\InvalidArgumentException $e) {
75  $this->assertTrue(true);
76  }
77  }

◆ testInvalidDimensionKey()

DatasetTest::testInvalidDimensionKey ( )

Definition at line 79 of file DatasetTest.php.

References Vendor\Package\$e.

79  : void
80  {
81  try {
82  $dimension = $this->f->dimension()->cardinal();
83  $dataset = $this->f->dataset([1 => $dimension]);
84  $this->assertFalse("This should not happen.");
85  } catch (\InvalidArgumentException $e) {
86  $this->assertTrue(true);
87  }
88  }

◆ testMaxValue()

DatasetTest::testMaxValue ( )

Definition at line 203 of file DatasetTest.php.

References getExtendedDimensions().

203  : void
204  {
205  $dataset = $this->f->dataset($this->getExtendedDimensions());
206  $points1 = ["First dimension" => 0, "Second dimension" => -0.5, "Third dimension" => [0, 1]];
207  $points2 = ["First dimension" => -3, "Second dimension" => -5, "Third dimension" => [-4, 1.5]];
208  $dataset = $dataset->withPoint(
209  "Item 1",
210  $points1
211  );
212  $dataset = $dataset->withPoint(
213  "Item 2",
214  $points2
215  );
216  $this->assertEquals(0, $dataset->getMaxValueForDimension("First dimension"));
217  $this->assertEquals(-0.5, $dataset->getMaxValueForDimension("Second dimension"));
218  $this->assertEquals(1.5, $dataset->getMaxValueForDimension("Third dimension"));
219  }
getExtendedDimensions()
Definition: DatasetTest.php:44
+ Here is the call graph for this function:

◆ testMinValue()

DatasetTest::testMinValue ( )

Definition at line 180 of file DatasetTest.php.

References getExtendedDimensions().

180  : void
181  {
182  $dataset = $this->f->dataset($this->getExtendedDimensions());
183  $points1 = ["First dimension" => 0, "Second dimension" => 0.5, "Third dimension" => [0, 1]];
184  $points2 = ["First dimension" => -3, "Second dimension" => 5, "Third dimension" => [-4, -1.5]];
185  $points3 = ["First dimension" => -2, "Second dimension" => 5, "Third dimension" => [-3, -1.5]];
186  $dataset = $dataset->withPoint(
187  "Item 1",
188  $points1
189  );
190  $dataset = $dataset->withPoint(
191  "Item 2",
192  $points2
193  );
194  $dataset = $dataset->withPoint(
195  "Item 2",
196  $points3
197  );
198  $this->assertEquals(-2, $dataset->getMinValueForDimension("First dimension"));
199  $this->assertEquals(0.5, $dataset->getMinValueForDimension("Second dimension"));
200  $this->assertEquals(-3, $dataset->getMinValueForDimension("Third dimension"));
201  }
getExtendedDimensions()
Definition: DatasetTest.php:44
+ Here is the call graph for this function:

◆ testwithAlternativeInformation()

DatasetTest::testwithAlternativeInformation ( )

Definition at line 116 of file DatasetTest.php.

References getSimpleDimensions().

116  : void
117  {
118  $dataset = $this->f->dataset($this->getSimpleDimensions());
119  $info = ["A dimension" => "An information", "Another dimension" => null];
120  $dataset = $dataset->withAlternativeInformation(
121  "Item",
122  $info
123  );
124  $this->assertEquals(["Item" => $info], $dataset->getAlternativeInformation());
125  }
getSimpleDimensions()
Definition: DatasetTest.php:36
+ Here is the call graph for this function:

◆ testwithInvalidAlternativeInformationCount()

DatasetTest::testwithInvalidAlternativeInformationCount ( )

Definition at line 127 of file DatasetTest.php.

References Vendor\Package\$e, and getSimpleDimensions().

127  : void
128  {
129  try {
130  $dataset = $this->f->dataset($this->getSimpleDimensions());
131  $info = ["A dimension" => "An information", "Second dimension" => null];
132  $dataset = $dataset->withAlternativeInformation(
133  "Item",
134  $info
135  );
136  $this->assertFalse("This should not happen.");
137  } catch (\ArgumentCountError $e) {
138  $this->assertTrue(true);
139  }
140  }
getSimpleDimensions()
Definition: DatasetTest.php:36
+ Here is the call graph for this function:

◆ testwithInvalidAlternativeInformationValue()

DatasetTest::testwithInvalidAlternativeInformationValue ( )

Definition at line 142 of file DatasetTest.php.

References Vendor\Package\$e, and getSimpleDimensions().

142  : void
143  {
144  try {
145  $dataset = $this->f->dataset($this->getSimpleDimensions());
146  $info = ["A dimension" => "An information", "Another dimension" => 1];
147  $dataset = $dataset->withAlternativeInformation(
148  "Item",
149  $info
150  );
151  $this->assertFalse("This should not happen.");
152  } catch (\InvalidArgumentException $e) {
153  $this->assertTrue(true);
154  }
155  }
getSimpleDimensions()
Definition: DatasetTest.php:36
+ Here is the call graph for this function:

◆ testwithInvalidPointsCount()

DatasetTest::testwithInvalidPointsCount ( )

Definition at line 101 of file DatasetTest.php.

References Vendor\Package\$e, and getSimpleDimensions().

101  : void
102  {
103  try {
104  $dataset = $this->f->dataset($this->getSimpleDimensions());
105  $points = ["A dimension" => 1, "Second dimension" => 2];
106  $dataset = $dataset->withPoint(
107  "Item",
108  $points
109  );
110  $this->assertFalse("This should not happen.");
111  } catch (\ArgumentCountError $e) {
112  $this->assertTrue(true);
113  }
114  }
getSimpleDimensions()
Definition: DatasetTest.php:36
+ Here is the call graph for this function:

◆ testwithPoint()

DatasetTest::testwithPoint ( )

Definition at line 90 of file DatasetTest.php.

References getSimpleDimensions().

90  : void
91  {
92  $dataset = $this->f->dataset($this->getSimpleDimensions());
93  $points = ["A dimension" => 1, "Another dimension" => 2];
94  $dataset = $dataset->withPoint(
95  "Item",
96  $points
97  );
98  $this->assertEquals(["Item" => $points], $dataset->getPoints());
99  }
getSimpleDimensions()
Definition: DatasetTest.php:36
+ Here is the call graph for this function:

◆ testwithResetDataset()

DatasetTest::testwithResetDataset ( )

Definition at line 157 of file DatasetTest.php.

References getSimpleDimensions().

157  : void
158  {
159  $dataset = $this->f->dataset($this->getSimpleDimensions());
160  $points = ["A dimension" => 1, "Another dimension" => 2];
161  $info = ["A dimension" => "An information", "Another dimension" => null];
162  $dataset = $dataset->withPoint(
163  "Item",
164  $points
165  );
166  $dataset = $dataset->withAlternativeInformation(
167  "Item",
168  $info
169  );
170 
171  $this->assertEquals(false, $dataset->isEmpty());
172 
173  $dataset = $dataset->withResetDataset();
174 
175  $this->assertEquals(true, $dataset->isEmpty());
176  $this->assertEquals([], $dataset->getPoints());
177  $this->assertEquals([], $dataset->getAlternativeInformation());
178  }
getSimpleDimensions()
Definition: DatasetTest.php:36
+ Here is the call graph for this function:

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