diff options
author | Brecht Van Lommel <brecht@blender.org> | 2020-08-07 17:43:42 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2020-08-10 19:14:00 +0300 |
commit | 53d203dea8230da4e80f3cc61468a4e24ff6759c (patch) | |
tree | 3f1b7498fb1a3108e60a4355bec0e4eef76110e4 /source/blender/blenlib/tests/BLI_math_geom_test.cc | |
parent | af77bf1f0f94cb07d5bf681d1f771d4106873780 (diff) |
Tests: move remaining gtests into their own module folders
And make them part of the blender_test runner. The one exception is blenlib
performance tests, which we don't want to run by default. They remain in their
own executable.
Differential Revision: https://developer.blender.org/D8498
Diffstat (limited to 'source/blender/blenlib/tests/BLI_math_geom_test.cc')
-rw-r--r-- | source/blender/blenlib/tests/BLI_math_geom_test.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/blenlib/tests/BLI_math_geom_test.cc b/source/blender/blenlib/tests/BLI_math_geom_test.cc new file mode 100644 index 00000000000..44154d49128 --- /dev/null +++ b/source/blender/blenlib/tests/BLI_math_geom_test.cc @@ -0,0 +1,19 @@ +/* Apache License, Version 2.0 */ + +#include "testing/testing.h" + +#include "BLI_math.h" + +TEST(math_geom, 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(math_geom, 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); +} |