33 #include <gtest/gtest.h> 44 ASSERT_TRUE(a.
x_ == 1.0);
45 ASSERT_TRUE(a.
y_ == 2.0);
46 ASSERT_TRUE(a.
z_ == 3.0);
47 ASSERT_TRUE(b.
x_ == 1.0);
48 ASSERT_TRUE(b.
y_ == 2.0);
49 ASSERT_TRUE(b.
z_ == 3.0);
60 for (uint32_t i = 1; i < (1 << 3); i++)
62 const float xp = (i & (1 << 0)) ? 0.1 : 0.0;
63 const float yp = (i & (1 << 1)) ? 0.1 : 0.0;
64 const float zp = (i & (1 << 2)) ? 0.1 : 0.0;
65 ASSERT_TRUE(
mcl_3dl::Vec3(1.0 + xp, 2.0 + yp, 3.0 + zp) != a);
66 ASSERT_FALSE(
mcl_3dl::Vec3(1.0 + xp, 2.0 + yp, 3.0 + zp) == a);
76 ASSERT_TRUE(a + adding == a_plus);
78 ASSERT_TRUE(a - adding == a_minus);
89 ASSERT_TRUE(a / 2.0 == a * 0.5);
90 ASSERT_TRUE(a * 0.5 == a_mul);
91 ASSERT_TRUE(a / 2.0 == a_div);
107 ASSERT_LT(fabs(a.
norm() - 3.741657), 1e-6);
108 ASSERT_LT(fabs(b.
norm() - 8.774964), 1e-6);
116 const int num_samples = 8;
129 for (
int i = 0; i < num_samples; ++i)
131 for (
int j = 0; j < num_samples; ++j)
137 ASSERT_LT((a - b).
dot(a - b) - a.
dot(a) - b.
dot(b) + 2.0 * a.
dot(b), 1e-6);
146 int main(
int argc,
char** argv)
148 testing::InitGoogleTest(&argc, argv);
150 return RUN_ALL_TESTS();
float dot(const Vec3 &q) const
Vec3 times(const Vec3 &q) const
doubleAcc dot(const VectorAcc &lhs, const VectorAcc &rhs)
Vec3 cross(const Vec3 &q) const
int main(int argc, char **argv)