/** * Checks whether the two vectors are of the same dimension. * * @api * @param self $b The vector to check against. * @return bool True if the vectors are of the same dimension, false otherwise. */ public function isSameDimension(self $b) { return $this->dimension() === $b->dimension(); }
/** * Verify that the dimension of the vector is correct. * * @test * @uses \Nubs\Vectorix\Vector::__construct * @uses \Nubs\Vectorix\Vector::components * @covers ::dimension */ public function dimensionIsCorrect() { $vector = new Vector([1, 0, 0]); $this->assertSame(3, $vector->dimension()); }