assertEquals(4, $v->kysiX()); $this->assertEquals(3, $v->kysiY()); try{ $v2=new Vektor(); $this->fail("Vektor loodi ilma andmeteta"); } catch(Exception $ex){ } } public function testLiitmine(){ $v1=new Vektor(3, 5); $v2=new Vektor(1, 0); $v3=$v1->liida($v2); $this->assertEquals(4, $v3->kysiX()); $this->assertEquals(5, $v3->kysiY()); $this->assertEquals(3, $v1->kysiX()); $this->assertEquals(5, $v1->kysiY()); $this->assertEquals(1, $v2->kysiX()); $this->assertEquals(0, $v2->kysiY()); } public function testLiitmine2(){ $v1=new Vektor(3, 5); $v2=new Vektor(0, 1); $v3=$v1->liida($v2); $this->assertEquals(3, $v3->kysiX()); $this->assertEquals(6, $v3->kysiY()); $this->assertEquals(3, $v1->kysiX()); $this->assertEquals(5, $v1->kysiY()); $this->assertEquals(0, $v2->kysiX()); $this->assertEquals(1, $v2->kysiY()); } public function testVastandVektor(){ $v=new Vektor(3, 5); $vastand=$v->vastandVektor(); $this->assertEquals(-3, $vastand->kysiX()); } public function testVastandVektor2(){ $v=new Vektor(4, 6); $vastand=$v->vastandVektor(); $this->assertEquals(-4, $vastand->kysiX()); } } ?>