| 1 | // SPDX-License-Identifier: GPL-3.0-or-latercxx . . $ `<file>/tests/src/test_mathutils.cpp`/ |
| 2 | // Copyright 2019 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #include <catch2/catch_all.hpp> |
| 5 | |
| 6 | #include "common/mathutils.h"cxx . . $ `<file>/src/common/mathutils.h`/ |
| 7 | #include <units.h> |
| 8 | |
| 9 | namespace Testscxx . . $ Tests/::Utilscxx . . $ Tests/Utils/::Mathcxx . . $ Tests/Utils/Math/ { |
| 10 | |
| 11 | TEST_CASEcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:144:11`!("MathUtils tests", "[Utils][Math]") |
| 12 | { |
| 13 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("linearNorm") |
| 14 | { |
| 15 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<int> valuescxx . . $ std/vector#vector(9619226211e5a241).{1, 50, 100}; |
| 16 | stdcxx . . $ std/::paircxx . . $ std/pair#<int, int> oldRangecxx . . $ std/pair#pair(62e1774a2dc03c82).(1, 100); |
| 17 | stdcxx . . $ std/::paircxx . . $ std/pair#<int, int> newRangecxx . . $ std/pair#pair(62e1774a2dc03c82).(1, 50); |
| 18 | |
| 19 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<int> normValuescxx . . $ std/vector#vector(9619226211e5a241).{1, 25, 50}; |
| 20 | ::Utilscxx . . $ Utils/::Mathcxx . . $ Utils/Math/::linearNormcxx . . $ Utils/Math/linearNorm(985260a9f02479ec).(values, oldRange, newRange); |
| 21 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(values == normValues); |
| 22 | } |
| 23 | |
| 24 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("lerpX") |
| 25 | { |
| 26 | auto p1 = stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(0, 0); |
| 27 | auto p2 = stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(10, 10); |
| 28 | |
| 29 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(::Utils::Math::lerpX(5, p1, p2) == 5); |
| 30 | } |
| 31 | |
| 32 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("lerpY") |
| 33 | { |
| 34 | auto p1 = stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(0, 0); |
| 35 | auto p2 = stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(10, 10); |
| 36 | |
| 37 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(::Utils::Math::lerpY(5, p1, p2) == 5); |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | } // namespace Tests::Utils::Math |