From d2590482f69b98dc6200e02ec194ea14f81730a5 Mon Sep 17 00:00:00 2001 From: Kore Nordmann Date: Wed, 31 Jan 2007 10:19:05 +0000 Subject: - Renamed rotation methods - Added tests for vector rotation --- tests/vector_test.php | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'tests') diff --git a/tests/vector_test.php b/tests/vector_test.php index 73ecd02..9dd6a6b 100644 --- a/tests/vector_test.php +++ b/tests/vector_test.php @@ -106,6 +106,40 @@ class ezcGraphVectorTest extends ezcTestCase ); } + public function testVectorRotateClockwise() + { + $vector = new ezcGraphVector( 1, 2 ); + $result = $vector->rotateClockwise(); + + $this->assertEquals( + $result, + new ezcGraphVector( -2, 1 ) + ); + + $this->assertEquals( + $result, + $vector, + 'Result should be the vector itself' + ); + } + + public function testVectorRotateCounterClockwise() + { + $vector = new ezcGraphVector( 1, 2 ); + $result = $vector->rotateCounterClockwise(); + + $this->assertEquals( + $result, + new ezcGraphVector( 2, -1 ) + ); + + $this->assertEquals( + $result, + $vector, + 'Result should be the vector itself' + ); + } + public function testVectorMultiplyCoordinate() { $vector = new ezcGraphVector( 1, 2 ); -- cgit v1.1