From 4a8e7e85ce0bc840f7970685883bb265c09e2543 Mon Sep 17 00:00:00 2001 From: Saikari Date: Sun, 21 Dec 2025 22:22:18 +0300 Subject: [PATCH] try --- .github/workflows/cmake-multi-platform.yml | 8 ++++++++ include/omath/linear_algebra/vector3.hpp | 4 ++-- tests/general/unit_test_vector3.cpp | 6 ++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 0c2aadf..95c34f2 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -506,6 +506,14 @@ jobs: cmake-build/build/${{ matrix.preset }}/**/*.log ${{ env.VCPKG_ROOT }}/buildtrees/**/*.log + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Run WASM Unit Tests + run: node out/Release/unit_tests.js + ############################################################################## # 8) Windows MSYS2 MinGW – GCC / Ninja ############################################################################## diff --git a/include/omath/linear_algebra/vector3.hpp b/include/omath/linear_algebra/vector3.hpp index 1aaec5a..ab481f2 100644 --- a/include/omath/linear_algebra/vector3.hpp +++ b/include/omath/linear_algebra/vector3.hpp @@ -233,10 +233,10 @@ namespace omath return Angle::from_radians(std::acos(dot(other) / bottom)); } - [[nodiscard]] bool is_perpendicular(const Vector3& other) const noexcept + [[nodiscard]] bool is_perpendicular(const Vector3& other, Type epsilon = static_cast(0.0001)) const noexcept { if (const auto angle = angle_between(other)) - return angle->as_degrees() == static_cast(90); + return std::abs(angle->as_degrees() - static_cast(90)) <= epsilon; return false; } diff --git a/tests/general/unit_test_vector3.cpp b/tests/general/unit_test_vector3.cpp index f5cc9fb..2be59df 100644 --- a/tests/general/unit_test_vector3.cpp +++ b/tests/general/unit_test_vector3.cpp @@ -390,8 +390,10 @@ TEST_F(UnitTestVector3, AsTuple) // Test AsTuple method TEST_F(UnitTestVector3, AngleBeatween) { - EXPECT_EQ(Vector3(0.0f, 0.0f, 1.0f).angle_between({1, 0 ,0}).value().as_degrees(), 90.0f); - EXPECT_EQ(Vector3(0.0f, 0.0f, 1.0f).angle_between({0.0f, 0.0f, 1.0f}).value().as_degrees(), 0.0f); + EXPECT_NEAR(Vector3(0.0f, 0.0f, 1.0f).angle_between({1, 0, 0}).value().as_degrees(), + 90.0f, 0.001f); + EXPECT_NEAR(Vector3(0.0f, 0.0f, 1.0f).angle_between({0.0f, 0.0f, 1.0f}).value().as_degrees(), + 0.0f, 0.001f); EXPECT_FALSE(Vector3(0.0f, 0.0f, 0.0f).angle_between({0.0f, 0.0f, 1.0f}).has_value()); }