added new class

This commit is contained in:
2024-11-30 13:54:06 +03:00
parent a33ee638b9
commit 1fe5e6e276
10 changed files with 280 additions and 47 deletions

View File

@@ -16,6 +16,7 @@ add_executable(unit-tests
general/UnitTestVector4.cpp
general/UnitTestLineTrace.cpp
general/UnitTestAngles.cpp
general/UnitTestViewAngles.cpp
engines/UnitTestOpenGL.cpp
engines/UnitTestUnityEngine.cpp

View File

@@ -3,7 +3,7 @@
//
#include <gtest/gtest.h>
#include <omath/Angles.hpp>
#include <omath/Angle.hpp>
TEST(UnitTestAngles, RadiansToDeg)
{
@@ -35,4 +35,16 @@ TEST(UnitTestAngles, VerticalToHorizontal)
const auto horizontalFov = omath::angles::VerticalFovToHorizontal(vFov, aspectRation);
EXPECT_NEAR(horizontalFov, 89.99f, 0.01f);
}
TEST(UnitTestAngles, WrapAngle)
{
const float wrapped = omath::angles::WrapAngle(361.f, 0.f, 360.f);
EXPECT_NEAR(wrapped, 1.f, 0.01f);
}
TEST(UnitTestAngles, WrapAngleNegativeRange)
{
const float wrapped = omath::angles::WrapAngle(-90.f, 0.f, 360.f);
EXPECT_NEAR(wrapped, 270.f, 0.01f);
}

View File

@@ -0,0 +1,4 @@
//
// Created by Orange on 11/30/2024.
//
#include <omath/ViewAngles.hpp>