mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-27 09:01:46 +00:00
Add test for m_vec3_angle
This commit is contained in:
parent
85c0c78ac6
commit
5c68233004
|
@ -27,6 +27,7 @@ set(tests
|
|||
tests_vector
|
||||
tests_worker
|
||||
tests_pose
|
||||
tests_vec3_angle
|
||||
)
|
||||
if(XRT_HAVE_D3D11)
|
||||
list(APPEND tests tests_aux_d3d_d3d11 tests_comp_client_d3d11)
|
||||
|
@ -68,6 +69,7 @@ target_link_libraries(tests_rational PRIVATE aux_math)
|
|||
target_link_libraries(tests_pose PRIVATE aux_math)
|
||||
target_link_libraries(tests_quat_change_of_basis PRIVATE aux_math)
|
||||
target_link_libraries(tests_quat_swing_twist PRIVATE aux_math)
|
||||
target_link_libraries(tests_vec3_angle PRIVATE aux_math)
|
||||
|
||||
target_include_directories(tests_quat_change_of_basis SYSTEM PRIVATE ${EIGEN3_INCLUDE_DIR})
|
||||
target_include_directories(tests_quat_swing_twist SYSTEM PRIVATE ${EIGEN3_INCLUDE_DIR})
|
||||
|
|
20
tests/tests_vec3_angle.cpp
Normal file
20
tests/tests_vec3_angle.cpp
Normal file
|
@ -0,0 +1,20 @@
|
|||
// Copyright 2022, Collabora, Inc.
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
/*!
|
||||
* @file
|
||||
* @brief Test for m_vec3_angle.
|
||||
* @author Moses Turner <moses@collabora.com>
|
||||
*/
|
||||
#include "xrt/xrt_defines.h"
|
||||
#include <math/m_vec3.h>
|
||||
|
||||
|
||||
#include "catch/catch.hpp"
|
||||
|
||||
TEST_CASE("Vec3Angle")
|
||||
{
|
||||
float sqrt2_2 = sqrtf(2) / 2;
|
||||
CHECK(m_vec3_angle({1, 0, 0}, {-1, 0, 0}) == Approx(M_PI));
|
||||
CHECK(m_vec3_angle({1, 0, 0}, {0, 1, 0}) == Approx(M_PI / 2));
|
||||
CHECK(m_vec3_angle({1, 0, 0}, {sqrt2_2, sqrt2_2, 0}) == Approx(M_PI / 4));
|
||||
}
|
Loading…
Reference in a new issue