mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-02 05:04:08 +08:00
Fixed coverage issues.
This commit is contained in:
parent
a90484362f
commit
f1968f51d6
@ -6,8 +6,9 @@
|
||||
|
||||
namespace matrix
|
||||
{
|
||||
|
||||
template<typename Type>
|
||||
float wrap_pi(Type x)
|
||||
Type wrap_pi(Type x)
|
||||
{
|
||||
if (!isfinite(x)) {
|
||||
return x;
|
||||
@ -27,4 +28,4 @@ float wrap_pi(Type x)
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
@ -13,6 +13,7 @@ set(tests
|
||||
filter
|
||||
integration
|
||||
squareMatrix
|
||||
helper
|
||||
)
|
||||
|
||||
add_custom_target(test_build)
|
||||
|
||||
18
test/helper.cpp
Normal file
18
test/helper.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <matrix/helper_functions.hpp>
|
||||
|
||||
using namespace matrix;
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
assert(fabs(wrap_pi(4.0) - (4.0 - 2*M_PI)) < 1e-5);
|
||||
assert(fabs(wrap_pi(-4.0) - (-4.0 + 2*M_PI)) < 1e-5);
|
||||
assert(fabs(wrap_pi(3.0) - (3.0)) < 1e-3);
|
||||
wrap_pi(NAN);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* vim: set et fenc=utf-8 ff=unix sts=0 sw=4 ts=4 : */
|
||||
Loading…
x
Reference in New Issue
Block a user