3 declare(strict_types=1);
22 require_once(
'./libs/composer/vendor/autoload.php');
31 protected Data\Factory
$f;
33 protected function setUp(): void
35 $this->f =
new Data\Factory();
40 $c_dimension = $this->f->dimension()->cardinal();
41 $dimensions = [
"A dimension" => $c_dimension,
"Another dimension" => $c_dimension];
48 $c_dimension = $this->f->dimension()->cardinal();
49 $r_dimension = $this->f->dimension()->range($c_dimension);
51 "First dimension" => $c_dimension,
52 "Second dimension" => $c_dimension,
53 "Third dimension" => $r_dimension
63 $dataset = $this->f->dataset($dimensions);
64 $this->assertEquals($dimensions, $dataset->getDimensions());
66 $this->assertFalse(
"This should not happen.");
73 $dimension =
"Dimension";
74 $dataset = $this->f->dataset([
"A dimension" => $dimension]);
75 $this->assertFalse(
"This should not happen.");
77 $this->assertTrue(
true);
84 $dimension = $this->f->dimension()->cardinal();
85 $dataset = $this->f->dataset([1 => $dimension]);
86 $this->assertFalse(
"This should not happen.");
88 $this->assertTrue(
true);
95 $points = [
"A dimension" => 1,
"Another dimension" => 2];
96 $dataset = $dataset->withPoint(
100 $this->assertEquals([
"Item" => $points], $dataset->getPoints());
107 $points = [
"A dimension" => 1,
"Second dimension" => 2];
108 $dataset = $dataset->withPoint(
112 $this->assertFalse(
"This should not happen.");
113 }
catch (\ArgumentCountError
$e) {
114 $this->assertTrue(
true);
121 $info = [
"A dimension" =>
"An information",
"Another dimension" => null];
122 $dataset = $dataset->withAlternativeInformation(
126 $this->assertEquals([
"Item" => $info], $dataset->getAlternativeInformation());
133 $info = [
"A dimension" =>
"An information",
"Second dimension" => null];
134 $dataset = $dataset->withAlternativeInformation(
138 $this->assertFalse(
"This should not happen.");
139 }
catch (\ArgumentCountError
$e) {
140 $this->assertTrue(
true);
148 $info = [
"A dimension" =>
"An information",
"Another dimension" => 1];
149 $dataset = $dataset->withAlternativeInformation(
153 $this->assertFalse(
"This should not happen.");
155 $this->assertTrue(
true);
162 $points = [
"A dimension" => 1,
"Another dimension" => 2];
163 $info = [
"A dimension" =>
"An information",
"Another dimension" => null];
164 $dataset = $dataset->withPoint(
168 $dataset = $dataset->withAlternativeInformation(
173 $this->assertEquals(
false, $dataset->isEmpty());
175 $dataset = $dataset->withResetDataset();
177 $this->assertEquals(
true, $dataset->isEmpty());
178 $this->assertEquals([], $dataset->getPoints());
179 $this->assertEquals([], $dataset->getAlternativeInformation());
185 $points1 = [
"First dimension" => 0,
"Second dimension" => 0.5,
"Third dimension" => [0, 1]];
186 $points2 = [
"First dimension" => -3,
"Second dimension" => 5,
"Third dimension" => [-4, -1.5]];
187 $points3 = [
"First dimension" => -2,
"Second dimension" => 5,
"Third dimension" => [-3, -1.5]];
188 $dataset = $dataset->withPoint(
192 $dataset = $dataset->withPoint(
196 $dataset = $dataset->withPoint(
200 $this->assertEquals(-2, $dataset->getMinValueForDimension(
"First dimension"));
201 $this->assertEquals(0.5, $dataset->getMinValueForDimension(
"Second dimension"));
202 $this->assertEquals(-3, $dataset->getMinValueForDimension(
"Third dimension"));
208 $points1 = [
"First dimension" => 0,
"Second dimension" => -0.5,
"Third dimension" => [0, 1]];
209 $points2 = [
"First dimension" => -3,
"Second dimension" => -5,
"Third dimension" => [-4, 1.5]];
210 $dataset = $dataset->withPoint(
214 $dataset = $dataset->withPoint(
218 $this->assertEquals(0, $dataset->getMaxValueForDimension(
"First dimension"));
219 $this->assertEquals(-0.5, $dataset->getMaxValueForDimension(
"Second dimension"));
220 $this->assertEquals(1.5, $dataset->getMaxValueForDimension(
"Third dimension"));
testInvalidDimensionKey()
testwithInvalidAlternativeInformationCount()
testwithInvalidAlternativeInformationValue()
testwithInvalidPointsCount()
testwithAlternativeInformation()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...