Total Complexity | 4 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | class NearestSearchTest extends TestCase |
||
12 | { |
||
13 | public function testConstruction(): void |
||
18 | } |
||
19 | |||
20 | /** |
||
21 | * @dataProvider nearestProvider |
||
22 | */ |
||
23 | public function testFindNearest(array $point, array $nearest, float $distance): void |
||
24 | { |
||
25 | $nearestSearch = new NearestSearch($this->prepareKdTree()); |
||
26 | |||
27 | $point = $nearestSearch->nearest(new Point(...$point)); |
||
28 | $this->assertEquals($nearest, $point->getAxises()); |
||
29 | $this->assertEquals($distance, $nearestSearch->getNearestDistance()); |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * @return \Generator |
||
34 | */ |
||
35 | public function nearestProvider(): \Generator |
||
47 | ]; |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * @return KDTreeInterface |
||
52 | */ |
||
53 | private function prepareKdTree(): KDTreeInterface |
||
63 |