sandbox
Loading...
Searching...
No Matches
angle_tests.hpp
1// SPDX-License-Identifier: MIT
2#ifndef LIBSBX_MATH_TESTS_ANGLE_TESTS_HPP_
3#define LIBSBX_MATH_TESTS_ANGLE_TESTS_HPP_
4
5#include <gtest/gtest.h>
6
8
9TEST(libsbx_math_angle, degree) {
10 using namespace sbx::math::literals;
11
12 auto degree = 90_deg;
13
14 EXPECT_FLOAT_EQ(degree.value(), 90.0f);
15}
16
17TEST(libsbx_math_angle, radian) {
18 using namespace sbx::math::literals;
19
20 auto radian = 0.25_rad;
21
22 EXPECT_FLOAT_EQ(radian.value(), 0.25f);
23}
24
25TEST(libsbx_math_angle, degree_to_radian) {
26 using namespace sbx::math::literals;
27
28 auto degree = 90_deg;
30
31 EXPECT_FLOAT_EQ(radian.value(), std::numbers::pi_v<float> / 2.0f);
32}
33
34TEST(libsbx_math_angle, radian_to_degree) {
35 using namespace sbx::math::literals;
36
37 auto radian = 1.57079632679_rad;
39
40 EXPECT_FLOAT_EQ(degree.value(), 90.0f);
41}
42
43#endif // LIBSBX_MATH_TESTS_ANGLE_TESTS_HPP_
Angle types and utilities.
constexpr auto to_degrees(const basic_radian< Type > &radian) noexcept -> basic_degree< Type >
Converts radians to degrees.
Definition: angle.ipp:412
constexpr auto to_radians(const basic_degree< Type > &degree) noexcept -> basic_radian< Type >
Converts degrees to radians.
Definition: angle.ipp:417
Strongly-typed degree value wrapper.
Definition: angle.hpp:45
constexpr auto value() const noexcept -> value_type
Returns the stored degree value.
Definition: angle.ipp:64
Strongly-typed radian value wrapper.
Definition: angle.hpp:354
constexpr auto value() const noexcept -> value_type
Returns the stored radian value.
Definition: angle.ipp:190
User-defined literals for degree and radian values.
Definition: angle.hpp:1003