diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b6c12e7013b044676b26ab686252612db3817470..c36e9a2d570b0a385e679904a61dd3b260c25cd8 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -5,6 +5,7 @@ set(EXECUTABLE_OUTPUT_PATH ${PASTIS_BINARY_DIR}) add_executable (unit_tests test_main.cpp test_Array.cpp + test_ArrayUtils.cpp test_ItemType.cpp test_PastisAssert.cpp test_RevisionInfo.cpp diff --git a/tests/test_ArrayUtils.cpp b/tests/test_ArrayUtils.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9861db42a725f5983e55db3d4caca3b9be6c6a17 --- /dev/null +++ b/tests/test_ArrayUtils.cpp @@ -0,0 +1,26 @@ +#include <catch.hpp> + +#include <PastisAssert.hpp> +#include <Array.hpp> +#include <ArrayUtils.hpp> + +// Instantiate to ensure full coverage is performed +template class Array<int>; + +TEST_CASE("ArrayUtils", "[utils]") { + + Array<int> a(10); + a[0] =13; + a[1] = 1; + a[2] = 8; + a[3] =-3; + a[4] =23; + a[5] =-1; + a[6] =13; + a[7] = 0; + a[8] =12; + a[9] = 9; + + REQUIRE((ReduceMin(a) == -3)); + REQUIRE((ReduceMax(a) == 23)); +}