32 #include <gtest/gtest.h> 45 for (
size_t i = 0; i < 3; ++i)
47 ASSERT_EQ(v[i], val[i]);
48 ASSERT_EQ(vc[i], val[i]);
61 for (
size_t i = 0; i < 3; ++i)
63 ASSERT_EQ(v[i], val[i]);
64 ASSERT_EQ(vc[i], val[i]);
68 TEST(CyclicVec, OperatorsFloat)
71 Vec3 v1(1.0
f, 2.0
f, 3.0
f);
72 Vec3 v12(1.0
f, 2.0
f, 3.0
f);
73 Vec3 v2(4.0
f, 5.0
f, 6.0
f);
79 ASSERT_EQ(v1 + v2, Vec3(5.0
f, 7.0
f, 9.0
f));
80 ASSERT_EQ(v1 - v2, Vec3(-3.0
f, -3.0
f, -3.0
f));
81 ASSERT_EQ(v1 * v2, Vec3(4.0
f, 10.0
f, 18.0
f));
84 TEST(CyclicVec, OperatorsInt)
95 ASSERT_EQ(v1 + v2, Vec3(5, 7, 9));
96 ASSERT_EQ(v1 - v2, Vec3(-3, -3, -3));
97 ASSERT_EQ(v1 * v2, Vec3(4, 10, 18));
105 ASSERT_EQ(v.sqlen(), 25);
106 ASSERT_EQ(v.len(), 5.0);
107 ASSERT_EQ(v.norm(), sqrtf(50));
113 Vec3 v(3.0
f, 4.0
f, 5.0
f);
115 ASSERT_EQ(v.sqlen(), 25.0);
116 ASSERT_EQ(v.len(), 5.0);
117 ASSERT_EQ(v.norm(), sqrtf(50.0));
136 int main(
int argc,
char** argv)
138 testing::InitGoogleTest(&argc, argv);
140 return RUN_ALL_TESTS();
int main(int argc, char **argv)
TEST(CyclicVec, InitFloat)