From c220cad8350aa7d043241b4f2a6761ecfcf82a65 Mon Sep 17 00:00:00 2001 From: Leonetienne Date: Fri, 11 Feb 2022 11:13:56 +0100 Subject: [PATCH] Translated tests for math/abs --- Test/CMakeLists.txt | 2 ++ Test/Math__Abs.cpp | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 Test/Math__Abs.cpp diff --git a/Test/CMakeLists.txt b/Test/CMakeLists.txt index 63acf97..b01345c 100644 --- a/Test/CMakeLists.txt +++ b/Test/CMakeLists.txt @@ -10,6 +10,8 @@ add_executable(Tests Catch2.h main.cpp Math__Mod.cpp + Math__Oscillate.cpp + Math__Abs.cpp ) target_link_libraries(Tests Eule) diff --git a/Test/Math__Abs.cpp b/Test/Math__Abs.cpp new file mode 100644 index 0000000..ae9788d --- /dev/null +++ b/Test/Math__Abs.cpp @@ -0,0 +1,31 @@ +#include "Catch2.h" +#include + +using namespace Eule; + +/** Equivalence classes: +* -- value > 0 +* -- value < 0 +* -- value == 0 +*/ + +// Checks with a positive input +TEST_CASE("Positive_Value", "[Math][Abs]") +{ + REQUIRE(Math::Abs(45.0) == 45.0); + return; +} + +// Checks with a negative input +TEST_CASE("Negative_Value", "[Math][Abs]") +{ + REQUIRE(Math::Abs(-45.0) == 45); + return; +} + +// Checks with a zero input +TEST_CASE("Zero_Value", "[Math][Abs]") +{ + REQUIRE(Math::Abs(0.0) == 0.0); + return; +}