vector reciprocal

This commit is contained in:
BlackMATov
2020-11-27 03:46:16 +07:00
parent a8f242acd6
commit 20257bd412
5 changed files with 44 additions and 38 deletions

View File

@@ -51,17 +51,20 @@ TEST_CASE("vmath/fun") {
}
SECTION("Common Functions") {
REQUIRE(abs(1) == 1);
REQUIRE(abs(-1) == 1);
REQUIRE(abs(1.f) == approx(1.f));
REQUIRE(abs(-1.f) == approx(1.f));
STATIC_REQUIRE(vmath_hpp::abs(1) == 1);
STATIC_REQUIRE(vmath_hpp::abs(-1) == 1);
STATIC_REQUIRE(vmath_hpp::abs(1.f) == approx(1.f));
STATIC_REQUIRE(vmath_hpp::abs(-1.f) == approx(1.f));
REQUIRE(sign(2) == 1);
REQUIRE(sign(-2) == -1);
REQUIRE(sign(0) == 0);
REQUIRE(sign(2.f) == approx(1.f));
REQUIRE(sign(-2.f) == approx(-1.f));
REQUIRE(sign(0.f) == approx(0.f));
STATIC_REQUIRE(sign(2) == 1);
STATIC_REQUIRE(sign(-2) == -1);
STATIC_REQUIRE(sign(0) == 0);
STATIC_REQUIRE(sign(2.f) == approx(1.f));
STATIC_REQUIRE(sign(-2.f) == approx(-1.f));
STATIC_REQUIRE(sign(0.f) == approx(0.f));
STATIC_REQUIRE(reciprocal(2.f) == approx(0.5f));
STATIC_REQUIRE(reciprocal(4.f) == approx(0.25f));
REQUIRE(floor(1.7f) == approx(1.f));
REQUIRE(trunc(1.7f) == approx(1.f));