|
|
@@ -132,18 +132,18 @@ TEST(Vector, DivisionWorksAcrossTypes) {
|
|
|
TEST(Vector, Length) {
|
|
|
// EXPECT_THAT(iota3i().lengthSquared(), 14);
|
|
|
EXPECT_THAT(iota3i().magnitude(),
|
|
|
- ::testing::DoubleNear(std::sqrt(14), 0.00001));
|
|
|
+ ::testing::DoubleNear(std::sqrt(14), std::numeric_limits<double>::epsilon()));
|
|
|
}
|
|
|
|
|
|
TEST(Vector, Distance) {
|
|
|
// EXPECT_THAT((iota3i().distanceSquared(vec3i{3, 1, -1})), 21);
|
|
|
EXPECT_THAT((iota3i() - vec3i({3, 1, -1})).magnitude(),
|
|
|
- ::testing::DoubleNear(std::sqrt(21), 0.00001));
|
|
|
+ ::testing::DoubleNear(std::sqrt(21), std::numeric_limits<double>::epsilon()));
|
|
|
}
|
|
|
|
|
|
TEST(Vector, Projection) {
|
|
|
EXPECT_THAT(iota3i().projection(vec3i({3, 1, -1})).magnitude(),
|
|
|
- ::testing::DoubleNear(std::sqrt(4.0/11.0), 0.00001));
|
|
|
+ ::testing::DoubleNear(std::sqrt(4.0/11.0), std::numeric_limits<double>::epsilon()));
|
|
|
}
|
|
|
|
|
|
TEST(Vector, DotProductIsSumOfElementProducts) {
|
|
|
@@ -153,9 +153,9 @@ TEST(Vector, DotProductIsSumOfElementProducts) {
|
|
|
TEST(Vector, UnitFunctionCreatesNewVectorOverMagnitude) {
|
|
|
double sq = std::sqrt(14);
|
|
|
auto unit = iota3i().unit();
|
|
|
- EXPECT_THAT(unit[0], ::testing::DoubleNear(1/sq, 0.00001));
|
|
|
- EXPECT_THAT(unit[1], ::testing::DoubleNear(2/sq, 0.00001));
|
|
|
- EXPECT_THAT(unit[2], ::testing::DoubleNear(3/sq, 0.00001));
|
|
|
+ EXPECT_THAT(unit[0], ::testing::DoubleNear(1/sq, std::numeric_limits<double>::epsilon()));
|
|
|
+ EXPECT_THAT(unit[1], ::testing::DoubleNear(2/sq, std::numeric_limits<double>::epsilon()));
|
|
|
+ EXPECT_THAT(unit[2], ::testing::DoubleNear(3/sq, std::numeric_limits<double>::epsilon()));
|
|
|
}
|
|
|
|
|
|
TEST(Vector, CanCastEntireVectorThroughConstructor) {
|