From b6a5509409d44ca18b9a3f3c09b4ca9fc5d752e7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 6 Jul 2020 13:18:06 +1000 Subject: [PATCH] AP_Math: added test for vector2f rotate --- libraries/AP_Math/tests/test_vector2.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libraries/AP_Math/tests/test_vector2.cpp b/libraries/AP_Math/tests/test_vector2.cpp index 44ae19a16b..17055d16e8 100644 --- a/libraries/AP_Math/tests/test_vector2.cpp +++ b/libraries/AP_Math/tests/test_vector2.cpp @@ -52,6 +52,12 @@ TEST(Vector2Test, reflect) Vector2f reflected3 = Vector2f(3, 3); reflected3.reflect(Vector2f(1, -1)); EXPECT_EQ(reflected3, Vector2f(-3, -3)); + + // rotation + Vector2f base = Vector2f(2, 1); + base.rotate(radians(90)); + EXPECT_FLOAT_EQ(base.x, -1); + EXPECT_FLOAT_EQ(base.y, 2); } TEST(Vector2Test, closest_point)