Skip to content

Commit

Permalink
🔀 Merge branch 'ladislas/bugfix/math-utils-divide-zero' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
ladislas committed Sep 22, 2022
2 parents daa9517 + 3541487 commit a2ea7e7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
3 changes: 2 additions & 1 deletion libs/Utils/include/MathUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
namespace leka::utils::math {

template <typename OutputType, typename IntputType>
auto map(IntputType x, IntputType in_min, IntputType in_max, OutputType out_min, OutputType out_max) -> OutputType
constexpr auto map(IntputType x, IntputType in_min, IntputType in_max, OutputType out_min, OutputType out_max)
-> OutputType
{
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
Expand Down
7 changes: 0 additions & 7 deletions libs/Utils/tests/MathUtils_test_random8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,3 @@ TEST(MathUtilsTest, RandomBetween0And255)
EXPECT_GE(random, 0);
EXPECT_LE(random, 255);
}

TEST(MathUtilsTest, RandomBetweenOutsideOfRange)
{
auto random = random8(300, 500);
EXPECT_GE(random, 0);
EXPECT_LE(random, 255);
}

0 comments on commit a2ea7e7

Please sign in to comment.