mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-29 02:30:35 +08:00
helper: consider matrices with the same NANs and INFINITYs equal
to simplify bulk checks when these values are expected
This commit is contained in:
committed by
Julian Kent
parent
bbaa93880b
commit
c34e8dc98f
+2
-9
@@ -28,16 +28,9 @@ int main()
|
||||
TEST(isEqual(B, B_check));
|
||||
Matrix3f C = B_check.edivide(C_check);
|
||||
|
||||
float off_diagonal_nan[9] = {2, NAN, NAN, NAN, 2, NAN, NAN, NAN, 2};
|
||||
// off diagonal are NANs because division by 0
|
||||
for (size_t i = 0; i < 3; i++) {
|
||||
for (size_t j = 0; j < 3; j++) {
|
||||
if (i == j) {
|
||||
TEST(isEqualF(C(i,j), 2.f));
|
||||
} else {
|
||||
TEST(isnan(C(i,j)));
|
||||
}
|
||||
}
|
||||
}
|
||||
TEST(C == Matrix3f(off_diagonal_nan));
|
||||
|
||||
// Test non-square matrix
|
||||
float data_43[12] = {1,3,2,
|
||||
|
||||
Reference in New Issue
Block a user