diff --git a/tests/test_TinyVector.cpp b/tests/test_TinyVector.cpp index 5e29a8e5da409030bdb478fb278ec64f63b02d20..feb4fe26c52bfd3f1b9f9650d5a72cd04ff0de97 100644 --- a/tests/test_TinyVector.cpp +++ b/tests/test_TinyVector.cpp @@ -5,4 +5,42 @@ TEST_CASE("TinyVector", "[algebra]") { TinyVector<3,int> v(1,2,3); REQUIRE(((v[0] == 1) and (v[1] == 2) and (v[2] == 3))); + REQUIRE(v.dimension() == 3); + + const TinyVector<3,int> z = zero; + REQUIRE(((z[0] == 0) and (z[1] == 0) and (z[2] == 0))); + + v = TinyVector<3,int>(3,2,4); + TinyVector<3,int> w(1,2,6); + REQUIRE((v,w)==31); + + w = 2*v; + REQUIRE(((w[0] == 2*v[0]) and (w[1]==2*v[1]) and (w[2]==2*v[2]))); + + TinyVector<3,int> x = v; + REQUIRE(x==v); + + x = TinyVector<3,int> (6,4,8); + REQUIRE(x==w); + REQUIRE(x!=v); + + x=v; + REQUIRE(x==v); + + x+=w; + REQUIRE(x==3*v); + + x=v+w; + REQUIRE(x==3*v); + + x-=w; + REQUIRE(x==v); + + x=w-v; + REQUIRE(x==v); + + TinyVector<3,int> z1; z1 = zero; + REQUIRE(((z1[0] == 0) and (z1[1] == 0) and (z1[2] == 0))); + + REQUIRE( Catch::Detail::stringify(x) == "(3,2,4)"); }