mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-04 17:20:34 +08:00
Make wrap() work with integer types (#145)
* Make wrap() work with integers
This commit is contained in:
committed by
GitHub
parent
25c0455348
commit
cd8ad1584c
@@ -21,6 +21,13 @@ int main()
|
||||
TEST(fabs(wrap(360. - FLT_EPSILON, 0., 360.) - (360. - FLT_EPSILON)) < FLT_EPSILON);
|
||||
TEST(fabs(wrap(360. + FLT_EPSILON, 0., 360.) - FLT_EPSILON) < FLT_EPSILON);
|
||||
|
||||
// integer wraps
|
||||
TEST(wrap(-10, 0, 10) == 0);
|
||||
TEST(wrap(-4, 0, 10) == 6);
|
||||
TEST(wrap(0, 0, 10) == 0)
|
||||
TEST(wrap(4, 0, 10) == 4);
|
||||
TEST(wrap(10, 0, 10) == 0);
|
||||
|
||||
// wrap pi
|
||||
TEST(fabs(wrap_pi(0.)) < FLT_EPSILON);
|
||||
TEST(fabs(wrap_pi(4.) - (4. - M_TWOPI)) < FLT_EPSILON);
|
||||
|
||||
Reference in New Issue
Block a user