Skip to content

Commit 328a781

Browse files
authored
[wpimath] Port Rotation2d Java tests to C++ (wpilibsuite#7318)
1 parent ebf83e4 commit 328a781

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

wpimath/src/test/native/cpp/geometry/Rotation2dTest.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,19 @@ TEST(Rotation2dTest, Minus) {
4949
EXPECT_DOUBLE_EQ(40.0, (rot1 - rot2).Degrees().value());
5050
}
5151

52+
TEST(Rotation2dTest, UnaryMinus) {
53+
const auto rot = Rotation2d{20_deg};
54+
55+
EXPECT_DOUBLE_EQ(-20.0, (-rot).Degrees().value());
56+
}
57+
58+
TEST(Rotation2dTest, Multiply) {
59+
const auto rot = Rotation2d{10_deg};
60+
61+
EXPECT_DOUBLE_EQ(30.0, (rot * 3.0).Degrees().value());
62+
EXPECT_DOUBLE_EQ(410.0, (rot * 41.0).Degrees().value());
63+
}
64+
5265
TEST(Rotation2dTest, Equality) {
5366
auto rot1 = Rotation2d{43_deg};
5467
auto rot2 = Rotation2d{43_deg};

0 commit comments

Comments
 (0)