node = new Ball(self::CENTER, self::RADIUS, $subsets); } /** * @test */ public function build() : void { $this->assertInstanceOf(Ball::class, $this->node); $this->assertInstanceOf(Hypersphere::class, $this->node); $this->assertInstanceOf(Node::class, $this->node); } /** * @test */ public function split() : void { $dataset = Labeled::quick(self::SAMPLES, self::LABELS); $node = Ball::split($dataset, new Euclidean()); $this->assertEquals(self::CENTER, $node->center()); $this->assertEquals(self::RADIUS, $node->radius()); } /** * @test */ public function center() : void { $this->assertSame(self::CENTER, $this->node->center()); } /** * @test */ public function radius() : void { $this->assertSame(self::RADIUS, $this->node->radius()); } /** * @test */ public function subsets() : void { $expected = [ Labeled::quick([self::SAMPLES[0]], [self::LABELS[0]]), Labeled::quick([self::SAMPLES[1]], [self::LABELS[1]]), ]; $this->assertEquals($expected, $this->node->subsets()); } /** * @test */ public function cleanup() : void { $subsets = $this->node->subsets(); $this->assertIsArray($subsets); $this->assertCount(2, $subsets); $this->node->cleanup(); $this->expectException(RuntimeException::class); $this->node->subsets(); } }