Skip to content

Commit

Permalink
units test for angular jerk
Browse files Browse the repository at this point in the history
  • Loading branch information
ctr-ozrien committed Aug 28, 2023
1 parent ec7cc88 commit 45ef74a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions wpimath/src/test/native/cpp/UnitsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@

using namespace units::acceleration;
using namespace units::angle;
using namespace units::angular_jerk;
using namespace units::angular_acceleration;
using namespace units::angular_velocity;
using namespace units::area;
Expand Down Expand Up @@ -2003,6 +2004,23 @@ TEST_F(UnitConversion, angular_velocity) {
EXPECT_NEAR(1.537e-16, test, 5.0e-20);
}

TEST_F(UnitConversion, angular_jerk) {
double test;
bool same;

same =
std::is_same_v<radians_per_second_cubed,
unit<std::ratio<1>, category::angular_jerk_unit>>;
EXPECT_TRUE(same);
same = traits::is_convertible_unit_v<deg_per_s_cu, radians_per_second_cubed>;
EXPECT_TRUE(same);

test = convert<degrees_per_second_cubed, radians_per_second_cubed>(1.0);
EXPECT_NEAR(0.0174533, test, 5.0e-8);
test = convert<turns_per_second_cubed, radians_per_second_cubed>(1.0);
EXPECT_NEAR(6.283185307, test, 5.0e-6);
}

TEST_F(UnitConversion, acceleration) {
double test;

Expand Down

0 comments on commit 45ef74a

Please sign in to comment.