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:
authorSergey Sharybin <sergey.vfx@gmail.com>2014-06-18 16:49:17 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-06-18 20:09:16 +0400
commit306cbb82ecf0d7c1ba4fb0a1240175b1976bd25b (patch)
treee9eac65bf57126ac233f22fe88cc00df137ec4e5 /tests/gtests/blenlib/BLI_math_geom_test.cc
parent47ec0394ca3d03e07c07a67e8f8d1625aedd39dd (diff)
GTest unit testing framework
Currently covers only small set of functionality.
Diffstat (limited to 'tests/gtests/blenlib/BLI_math_geom_test.cc')
-rw-r--r--tests/gtests/blenlib/BLI_math_geom_test.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/gtests/blenlib/BLI_math_geom_test.cc b/tests/gtests/blenlib/BLI_math_geom_test.cc
new file mode 100644
index 00000000000..36784f50dd1
--- /dev/null
+++ b/tests/gtests/blenlib/BLI_math_geom_test.cc
@@ -0,0 +1,21 @@
+#include "testing/testing.h"
+
+#include "BLI_math.h"
+
+TEST(mathutils, DistToLine2DSimple)
+{
+ float p[2] = {5.0f, 1.0f},
+ a[2] = {0.0f, 0.0f},
+ b[2] = {2.0f, 0.0f};
+ float distance = dist_to_line_v2(p, a, b);
+ EXPECT_NEAR(1.0f, distance, 1e-6);
+}
+
+TEST(mathutils, DistToLineSegment2DSimple)
+{
+ float p[2] = {3.0f, 1.0f},
+ a[2] = {0.0f, 0.0f},
+ b[2] = {2.0f, 0.0f};
+ float distance = dist_to_line_segment_v2(p, a, b);
+ EXPECT_NEAR(sqrtf(2.0f), distance, 1e-6);
+}