summaryrefslogtreecommitdiff
path: root/test_vec.cpp
diff options
context:
space:
mode:
authorKeuin <[email protected]>2022-04-20 22:12:17 +0800
committerKeuin <[email protected]>2022-04-20 22:12:17 +0800
commited6a7d7e31e3fa3b23078d55e6a88917ee68c66e (patch)
treea71d7db362458e85f49f2cb9c71f9ec6ff6b639c /test_vec.cpp
parent699287623d51be688f2af0a01fedcf90d035da13 (diff)
Add vec3::parallel and its test.
Diffstat (limited to 'test_vec.cpp')
-rw-r--r--test_vec.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/test_vec.cpp b/test_vec.cpp
index 1c9390f..a81ee09 100644
--- a/test_vec.cpp
+++ b/test_vec.cpp
@@ -117,4 +117,16 @@ TEST(Vec, Refract) {
TEST(Vec, Refract_TIR) {
vec3d n{1, 0, 0}, u{-1, 0, -sqrt(3)}, v{1, 0, -sqrt(3)};
ASSERT_EQ(v.unit_vec(), n.refract<true>(u.unit_vec(), 2));
+}
+
+TEST(Vec, VecParallel) {
+ vec3d a{1, 1, 2}, b{1.1, 1.1, 2.2}, c{0,0,0}, d{1, 2, 1};
+ ASSERT_TRUE(a.parallel(b));
+ ASSERT_TRUE(b.parallel(a));
+ ASSERT_TRUE(a.parallel(c));
+ ASSERT_TRUE(c.parallel(a));
+ ASSERT_FALSE(a.parallel(d));
+ ASSERT_FALSE(d.parallel(a));
+ ASSERT_FALSE(b.parallel(d));
+ ASSERT_FALSE(d.parallel(b));
} \ No newline at end of file