diff options
author | Keuin <[email protected]> | 2022-04-12 13:03:05 +0800 |
---|---|---|
committer | Keuin <[email protected]> | 2022-04-12 13:03:05 +0800 |
commit | 60a3e2aedda225591f10a360575250b201aadd53 (patch) | |
tree | 09cfb81976dc8b2d8e4f050ac3745ee72686aa6f /test.cpp | |
parent | afad858dada4d2735d5408a4eca064fb605e4578 (diff) |
Add vec3::mod2.
Diffstat (limited to 'test.cpp')
-rw-r--r-- | test.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -67,4 +67,11 @@ TEST(Vec, Norm) { TEST(Vec, UnitVec) { vec3d a{1, 2, 2}, b{1.0 / 3, 2.0 / 3, 2.0 / 3}; ASSERT_EQ(a.unit_vec(), b); +} + +TEST(Vec, Mod2) { + vec3i a{1, 2, 3}; + vec3d b{2.5, 3, 1.2}; + ASSERT_EQ(a.mod2(), 14); + ASSERT_LE(abs(b.mod2() - (2.5 * 2.5 + 3 * 3 + 1.2 * 1.2)), 1e-10); }
\ No newline at end of file |