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:
authorHans Goudey <h.goudey@me.com>2022-02-17 21:36:41 +0300
committerHans Goudey <h.goudey@me.com>2022-02-17 21:36:41 +0300
commit48432c1c92824a0da4bb73b1ca7b45290a4b3aaf (patch)
tree8485d15a5f7d8b4941b34940bb3d9c02e3dac129 /source/blender/blenlib/tests
parentb6fe1b0c658f5068154f9e4a726de789f5ebb68a (diff)
Fix: Debug build error with vector type division
The idea is to keep `is_any_zero` in the `blender::math` namespace, so instead of trying to be clever, just move it there and expand the function where it was used in the class.
Diffstat (limited to 'source/blender/blenlib/tests')
-rw-r--r--source/blender/blenlib/tests/BLI_math_vec_types_test.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/source/blender/blenlib/tests/BLI_math_vec_types_test.cc b/source/blender/blenlib/tests/BLI_math_vec_types_test.cc
index 07eb6b29a20..7590d77525b 100644
--- a/source/blender/blenlib/tests/BLI_math_vec_types_test.cc
+++ b/source/blender/blenlib/tests/BLI_math_vec_types_test.cc
@@ -146,4 +146,29 @@ TEST(math_vec_types, VectorTypeConversion)
EXPECT_EQ(d[1], -1.0);
}
+TEST(math_vec_types, Divide)
+{
+ float2 a(1.0f, 2.0f);
+ float2 b(0.5f, 2.0f);
+ float2 result = a / b;
+ EXPECT_FLOAT_EQ(result.x, 2.0f);
+ EXPECT_FLOAT_EQ(result.y, 1.0f);
+}
+
+TEST(math_vec_types, DivideFloatByVector)
+{
+ float a = 2.0f;
+ float2 b(0.5f, 2.0f);
+ float2 result = a / b;
+ EXPECT_FLOAT_EQ(result.x, 4.0f);
+ EXPECT_FLOAT_EQ(result.y, 1.0f);
+}
+
+TEST(math_vec_types, DivideFloatByVectorSmall)
+{
+ float2 result = 2.0f / float2(2.0f);
+ EXPECT_FLOAT_EQ(result.x, 1.0f);
+ EXPECT_FLOAT_EQ(result.y, 1.0f);
+}
+
} // namespace blender::tests