diff --git a/project/histogram.cpp b/project/histogram.cpp index 8432327..99ff361 100644 --- a/project/histogram.cpp +++ b/project/histogram.cpp @@ -4,11 +4,11 @@ using namespace std; -void find_minmax(vector numbers, double& min, double& max) +bool find_minmax(vector numbers, double& min, double& max) { if (numbers.empty()) { - min = max = 0; + return true; } else { @@ -26,7 +26,7 @@ void find_minmax(vector numbers, double& min, double& max) } } } - return; + return false; } vector make_histogram (vector numbers, size_t bin_count) diff --git a/project/histogram_internal.h b/project/histogram_internal.h index 3b5a81b..d28f5fc 100644 --- a/project/histogram_internal.h +++ b/project/histogram_internal.h @@ -2,6 +2,6 @@ #define HISTOGRAM_INTERNAL_H_INCLUDED #include -void find_minmax(std::vector numbers, double& min, double& max); +bool find_minmax(std::vector numbers, double& min, double& max); #endif // HISTOGRAM_INTERNAL_H_INCLUDED diff --git a/unittest.cpp b/unittest.cpp index 09b46e0..8ad6e52 100644 --- a/unittest.cpp +++ b/unittest.cpp @@ -32,12 +32,11 @@ TEST_CASE("vector with same elements") { } TEST_CASE("void vector") { - double min = 0; - double max = 0; + double min = 3; + double max = 2; std::vector numbers {}; - find_minmax( numbers, min, max); - CHECK(min == 0); - CHECK(max == 0); + bool check = find_minmax(numbers, min, max); + CHECK(check == true); }