Google testing works now

This commit is contained in:
Thorben Höhne
2025-02-19 21:11:42 +01:00
parent 53dac3537e
commit 61189bdc73
14 changed files with 176 additions and 50 deletions

View File

@@ -175,8 +175,8 @@ namespace Phanes::Core::Math::Detail
static constexpr bool map(const Phanes::Core::Math::TVector2<T, S>& v1, const Phanes::Core::Math::TVector2<T, S>& v2)
{
return (Phanes::Core::Math::Abs(v1.x - v2.x) < P_FLT_INAC &&
Phanes::Core::Math::Abs(v1.y - v2.y) < P_FLT_INAC);
return (Phanes::Core::Math::Abs(v1.x - v2.x) <= P_FLT_INAC &&
Phanes::Core::Math::Abs(v1.y - v2.y) <= P_FLT_INAC);
}
};

View File

@@ -707,7 +707,7 @@ namespace Phanes::Core::Math {
*/
template<RealType T, bool S>
TVector3<T, S>& ClampToCubeV(TVector3<T, S> v1, T cubeRadius);
TVector3<T, S>& ClampToCubeV(TVector3<T, S>& v1, T cubeRadius);
/**
* Rotates vector around axis

View File

@@ -292,7 +292,7 @@ namespace Phanes::Core::Math
}
template<RealType T, bool S>
TVector3<T, S>& ClampToCubeV(TVector3<T, S> v1, T cubeRadius)
TVector3<T, S>& ClampToCubeV(TVector3<T, S>& v1, T cubeRadius)
{
Detail::compute_vec3_clamp<T, S>::map(v1, v1, cubeRadius);
return v1;

View File

@@ -0,0 +1,21 @@
#include <iostream>
#include "Core/Math/Include.h"
namespace PMath = Phanes::Core::Math;
int main()
{
PMath::Matrix4 m0 = PMath::Matrix4(1.0f, 5.0f, 3.0f, 4.0f,
2.0f, 6.0f, 4.0f, 1.0f,
2.0f, -3.0f, 5.0f, 3.0f,
8.0f, -4.0f, 6.0f, -2.0f);
PMath::Matrix4 m2;
std::cout << std::to_string(PMath::InverseV<float, false>(m0)) << std::endl;
std::cout << PMath::ToString(m0) << std::endl;
return 0;
}

View File

@@ -0,0 +1,2 @@
#include "pch.h"

View File

@@ -0,0 +1,7 @@
//
// pch.h
//
#pragma once
#include "googletest/googletest/include/gtest/gtest.h"

View File

@@ -0,0 +1,39 @@
project "gtest"
language "C++"
kind "StaticLib"
third_party_boilerplate()
includedirs {
PhanesThirdParty .. "/googletest/googletest/include",
PhanesThirdParty .. "/googletest/googletest/include/gtest",
PhanesThirdParty .. "/googletest/googletest"
}
files {
PhanesThirdParty .. "/googletest/googletest/src/**.cc",
PhanesThirdParty .. "/googletest/googletest/include/gtest/**.h"
}
project "MathTestFPU"
kind "ConsoleApp"
boilerplate()
files {
PhanesRuntime .. "/Core/Tests/Math/MathTestFPU/test.cpp"
}
buildoptions {"-Wno-unused-variable", "-w", "-fpermissive"}
pchheader (PhanesRuntime .. "/Core/Tests/Math/MathTestFPU/pch.h")
pchsource (PhanesRuntime .. "/Core/Tests/Math/MathTestFPU/pch.cpp")
links { "gtest" }
dependson { "gtest" }
includedirs {
PhanesRuntime .. "/Core/Tests/Math/MathTestFPU",
PhanesThirdParty .. "/googletest/googletest/include",
PhanesThirdParty,
PhanesRuntime
}

File diff suppressed because it is too large Load Diff