From 870229ef4977eeb10a225ce216ceb26ddb71141f Mon Sep 17 00:00:00 2001 From: Matthias Grob Date: Tue, 18 Oct 2022 17:28:57 +0200 Subject: [PATCH] FunctionsTest: add isFinite() tests with Vector3f arguments --- src/lib/mathlib/math/FunctionsTest.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/lib/mathlib/math/FunctionsTest.cpp b/src/lib/mathlib/math/FunctionsTest.cpp index a8c2315419..8788651f26 100644 --- a/src/lib/mathlib/math/FunctionsTest.cpp +++ b/src/lib/mathlib/math/FunctionsTest.cpp @@ -224,3 +224,17 @@ TEST(FunctionsTest, countSetBits) EXPECT_EQ(countSetBits(0xffffffffu), 32); EXPECT_EQ(countSetBits(754323), 9); } + +TEST(FunctionsTest, isFiniteVector3f) +{ + EXPECT_TRUE(isFinite(matrix::Vector3f())); + EXPECT_TRUE(isFinite(matrix::Vector3f(0.f, 1.f, 2.f))); + EXPECT_FALSE(isFinite(matrix::Vector3f(0.f, 0.f, INFINITY))); + EXPECT_FALSE(isFinite(matrix::Vector3f(0.f, 0.f, NAN))); + EXPECT_FALSE(isFinite(matrix::Vector3f(0.f, NAN, 0.f))); + EXPECT_FALSE(isFinite(matrix::Vector3f(0.f, NAN, NAN))); + EXPECT_FALSE(isFinite(matrix::Vector3f(NAN, 0.f, 0.f))); + EXPECT_FALSE(isFinite(matrix::Vector3f(NAN, 0.f, NAN))); + EXPECT_FALSE(isFinite(matrix::Vector3f(NAN, NAN, 0.f))); + EXPECT_FALSE(isFinite(matrix::Vector3f(NAN, NAN, NAN))); +}