mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Add is_finite method for checking built-in types
This commit is contained in:
parent
18177828ad
commit
5da515773d
46 changed files with 504 additions and 12 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue