You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 17:36:07 +00:00
Add is_finite method for checking built-in types
This commit is contained in:
@@ -334,6 +334,40 @@ TEST_CASE("[Basis] Set axis angle") {
|
||||
bugNan.get_axis_angle(axis, angle);
|
||||
CHECK(!Math::is_nan(angle));
|
||||
}
|
||||
|
||||
TEST_CASE("[Basis] Finite number checks") {
|
||||
const Vector3 x(0, 1, 2);
|
||||
const Vector3 infinite(NAN, NAN, NAN);
|
||||
|
||||
CHECK_MESSAGE(
|
||||
Basis(x, x, x).is_finite(),
|
||||
"Basis with all components finite should be finite");
|
||||
|
||||
CHECK_FALSE_MESSAGE(
|
||||
Basis(infinite, x, x).is_finite(),
|
||||
"Basis with one component infinite should not be finite.");
|
||||
CHECK_FALSE_MESSAGE(
|
||||
Basis(x, infinite, x).is_finite(),
|
||||
"Basis with one component infinite should not be finite.");
|
||||
CHECK_FALSE_MESSAGE(
|
||||
Basis(x, x, infinite).is_finite(),
|
||||
"Basis with one component infinite should not be finite.");
|
||||
|
||||
CHECK_FALSE_MESSAGE(
|
||||
Basis(infinite, infinite, x).is_finite(),
|
||||
"Basis with two components infinite should not be finite.");
|
||||
CHECK_FALSE_MESSAGE(
|
||||
Basis(infinite, x, infinite).is_finite(),
|
||||
"Basis with two components infinite should not be finite.");
|
||||
CHECK_FALSE_MESSAGE(
|
||||
Basis(x, infinite, infinite).is_finite(),
|
||||
"Basis with two components infinite should not be finite.");
|
||||
|
||||
CHECK_FALSE_MESSAGE(
|
||||
Basis(infinite, infinite, infinite).is_finite(),
|
||||
"Basis with three components infinite should not be finite.");
|
||||
}
|
||||
|
||||
} // namespace TestBasis
|
||||
|
||||
#endif // TEST_BASIS_H
|
||||
|
||||
Reference in New Issue
Block a user