DarkflameServer/tests/dCommonTests/TestNiPoint3.cpp
jadebenn a0d51e21ca
refactor: allow usage of NiPoint3 and NiQuaternion in constexpr context (#1414)
* allow usage of NiPoint3 and NiQuaternion in constexpr context

* removed .cpp files entirely

* moving circular dependency circumvention stuff to an .inl file

* real world usage!!!!!

* reverting weird branch cross-pollination

* removing more weird branch cross-pollination

* remove comment

* added inverse header guard to inl file

* Update NiPoint3.inl

* trying different constructor syntax

* reorganize into .inl files for readability

* uncomment include

* moved non-constexpr definitions to cpp file

* moved static definitions back to inl files

* testing fix

* moved constants into seperate namespace

* Undo change in build-and-test.yml

* nodiscard
2024-01-29 01:53:12 -06:00

24 lines
540 B
C++

#include <gtest/gtest.h>
#include "NiPoint3.h"
/**
* @brief Basic test for NiPoint3 functionality
*
*/
TEST(dCommonTests, NiPoint3Test) {
// Check that Unitize works
ASSERT_EQ(NiPoint3(3, 0, 0).Unitize(), NiPoint3Constant::UNIT_X);
// Check what unitize does to a vector of length 0
ASSERT_EQ(NiPoint3Constant::ZERO.Unitize(), NiPoint3Constant::ZERO);
}
TEST(dCommonTests, NiPoint3OperatorTest) {
NiPoint3 a(1, 2, 3);
NiPoint3 b(4, 5, 6);
a += b;
EXPECT_FLOAT_EQ(a.x, 5);
EXPECT_FLOAT_EQ(a.y, 7);
EXPECT_FLOAT_EQ(a.z, 9);
}