Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenlib/tests/BLI_math_vector_test.cc')
-rw-r--r--source/blender/blenlib/tests/BLI_math_vector_test.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/blenlib/tests/BLI_math_vector_test.cc b/source/blender/blenlib/tests/BLI_math_vector_test.cc
index 8c310645d6d..282be5f1963 100644
--- a/source/blender/blenlib/tests/BLI_math_vector_test.cc
+++ b/source/blender/blenlib/tests/BLI_math_vector_test.cc
@@ -85,4 +85,24 @@ TEST(math_vector, Clamp)
EXPECT_EQ(result_2.z, -50);
}
+TEST(math_vector, InterpolateInt)
+{
+ const int3 a(0, -100, 50);
+ const int3 b(0, 100, 100);
+ const int3 result = math::interpolate(a, b, 0.75);
+ EXPECT_EQ(result.x, 0);
+ EXPECT_EQ(result.y, 50);
+ EXPECT_EQ(result.z, 87);
+}
+
+TEST(math_vector, InterpolateFloat)
+{
+ const float3 a(40.0f, -100.0f, 50.0f);
+ const float3 b(20.0f, 100.0f, 100.0f);
+ const float3 result = math::interpolate(a, b, 0.5);
+ EXPECT_FLOAT_EQ(result.x, 30.0f);
+ EXPECT_FLOAT_EQ(result.y, 0.0f);
+ EXPECT_FLOAT_EQ(result.z, 75.0f);
+}
+
} // namespace blender::tests