summaryrefslogtreecommitdiff
path: root/test_vec.cpp
diff options
context:
space:
mode:
authorKeuin <[email protected]>2022-04-20 22:04:37 +0800
committerKeuin <[email protected]>2022-04-20 22:04:37 +0800
commit699287623d51be688f2af0a01fedcf90d035da13 (patch)
tree4c563ebfb810efb78acca0796b5b49d594e69c05 /test_vec.cpp
parentbfc5e815e6e157291ad653b9ea97bb12ca8bc835 (diff)
Bugfix: vec3::cross was implemented and tested incorrectly.
Diffstat (limited to 'test_vec.cpp')
-rw-r--r--test_vec.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/test_vec.cpp b/test_vec.cpp
index 9739160..1c9390f 100644
--- a/test_vec.cpp
+++ b/test_vec.cpp
@@ -25,15 +25,21 @@ TEST(Vec, VecMin) {
}
TEST(Vec, CrossProduct) {
- vec3i a{1, 1, 1}, b{2, 2, 2}, c{3, 4, 5}, d{6, 7, 8}, e{-3, -6, -3};
+ vec3i a{1, 1, 1}, b{2, 2, 2}, c{3, 4, 5}, d{6, 7, 8}, e{-3, 6, -3};
ASSERT_EQ(cross(a, b), vec3i{});
ASSERT_EQ(a.cross(b), vec3i{});
ASSERT_EQ(cross(c, d), e);
ASSERT_EQ(c.cross(d), e);
- vec3d f{3, 4, 5}, g{6, 7, 8}, h{-3, -6, -3};
+ vec3d f{3, 4, 5}, g{6, 7, 8}, h{-3, 6, -3};
ASSERT_EQ(cross(f, g), h);
ASSERT_EQ(f.cross(g), h);
+
+ vec3d u{2, -2, -2}, v{2.5, -5, -2.5}, w{-5, 0, -5};
+ ASSERT_EQ(cross(u, v), w);
+
+ vec3d x{1.6, 3.5, 11}, y{3, 7, 15}, z{-24.5, 9, 0.7};
+ ASSERT_EQ(cross(x, y), z);
}
TEST(Vec, DotProduct) {