mirror of
https://github.com/bdelespierre/php-kmeans.git
synced 2025-01-17 20:48:42 +01:00
fixing arrow function (not available in 7.3)
This commit is contained in:
parent
cdd6636b7b
commit
5108b2ca4f
@ -35,7 +35,9 @@ class ClusterTest extends TestCase
|
|||||||
[
|
[
|
||||||
'centroid' => $points[0]->toArray(),
|
'centroid' => $points[0]->toArray(),
|
||||||
'points' => array_map(
|
'points' => array_map(
|
||||||
fn($p) => $p->toArray(),
|
function ($p) {
|
||||||
|
return $p->toArray();
|
||||||
|
},
|
||||||
$points
|
$points
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -41,7 +41,9 @@ class SpaceTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
['points' => array_map(fn($p) => $p->toArray(), $points)],
|
['points' => array_map(function ($p) {
|
||||||
|
return $p->toArray();
|
||||||
|
}, $points)],
|
||||||
$space->toArray()
|
$space->toArray()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -119,10 +121,14 @@ class SpaceTest extends TestCase
|
|||||||
$min = new Point($space, [0]);
|
$min = new Point($space, [0]);
|
||||||
$max = new Point($space, [10]);
|
$max = new Point($space, [10]);
|
||||||
|
|
||||||
Space::setRng(fn($min, $max) => $min);
|
Space::setRng(function ($min, $max) {
|
||||||
|
return $min;
|
||||||
|
});
|
||||||
$this->assertEquals($min, $space->getRandomPoint($min, $max));
|
$this->assertEquals($min, $space->getRandomPoint($min, $max));
|
||||||
|
|
||||||
Space::setRng(fn($min, $max) => $max);
|
Space::setRng(function ($min, $max) {
|
||||||
|
return $max;
|
||||||
|
});
|
||||||
$this->assertEquals($max, $space->getRandomPoint($min, $max));
|
$this->assertEquals($max, $space->getRandomPoint($min, $max));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user