From eef8e448375927b3b958a94c9385a59aaa8875ca Mon Sep 17 00:00:00 2001 From: Stephane Del Pino <stephane.delpino44@gmail.com> Date: Tue, 3 Jul 2018 19:20:47 +0200 Subject: [PATCH] Added cross product test --- tests/test_TinyVector.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/test_TinyVector.cpp b/tests/test_TinyVector.cpp index 8f10f0127..5fe7f6165 100644 --- a/tests/test_TinyVector.cpp +++ b/tests/test_TinyVector.cpp @@ -67,9 +67,17 @@ TEST_CASE("TinyVector", "[algebra]") { REQUIRE(l2Norm(TinyVector<2,double>(3,4)) == Approx(5).epsilon(1E-14)); + SECTION("checking for cross product") { + const TinyVector<3,int> a(1,-2,4); + const TinyVector<3,int> b(3, 1,6); + REQUIRE(crossProduct(a, b) == TinyVector<3,int>(-16,6,7)); + } + #ifndef NDEBUG - REQUIRE_THROWS_AS(x[4]=0, AssertError); - const TinyVector<3,int>& const_x = x; - REQUIRE_THROWS_AS(const_x[-1], AssertError); + SECTION("checking for bounds validation") { + REQUIRE_THROWS_AS(x[4]=0, AssertError); + const TinyVector<3,int>& const_x = x; + REQUIRE_THROWS_AS(const_x[-1], AssertError); + } #endif // NDEBUG } -- GitLab