|
@@ -3,12 +3,13 @@
|
|
|
* Company: Lynar Studios
|
|
|
* E-Mail: webmaster@lynarstudios.com
|
|
|
* Created: 2022-08-05
|
|
|
- * Changed: 2022-08-05
|
|
|
+ * Changed: 2022-08-07
|
|
|
*
|
|
|
* */
|
|
|
|
|
|
#include <gtest/gtest.h>
|
|
|
#include <ls-math/ls_math_vector.hpp>
|
|
|
+#include <cmath>
|
|
|
|
|
|
using namespace ls::math::vector;
|
|
|
using namespace ls::math::core::type;
|
|
@@ -59,6 +60,23 @@ namespace
|
|
|
ASSERT_FLOAT_EQ(6.0f, c.getY());
|
|
|
}
|
|
|
|
|
|
+ TEST_F(Vector2Test, operator_divisor)
|
|
|
+ {
|
|
|
+ Vector2 c = Vector2(150.0f, -25.0f);
|
|
|
+ Vector2 n = c / 152.4f;
|
|
|
+
|
|
|
+ // round by two decimals
|
|
|
+
|
|
|
+ double powValue = pow(10.0f, (double)2);
|
|
|
+ double roundedX = round(n.getX() * powValue) / powValue;
|
|
|
+ double roundedY = round(n.getY() * powValue) / powValue;
|
|
|
+
|
|
|
+ // evaluate result
|
|
|
+
|
|
|
+ ASSERT_FLOAT_EQ(0.98f, roundedX);
|
|
|
+ ASSERT_FLOAT_EQ(-0.16f, roundedY);
|
|
|
+ }
|
|
|
+
|
|
|
TEST_F(Vector2Test, operator_equals)
|
|
|
{
|
|
|
ASSERT_TRUE(Vector2(3, 4) == Vector2(3, 4));
|