From 67f5d2a9622ca738d4c100ef0a50bd097437e0c5 Mon Sep 17 00:00:00 2001 From: Danila Date: Mon, 22 May 2023 15:13:54 +0300 Subject: [PATCH] =?UTF-8?q?code:=20=D1=82=D0=B5=D0=BF=D0=B5=D1=80=D1=8C=20?= =?UTF-8?q?=D1=82=D0=BE=D1=87=D0=BD=D0=BE=20=D0=BD=D0=BE=D1=80=D0=BC=20?= =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82=20=D0=B4=D0=BB=D1=8F=20=D0=BF=D1=83?= =?UTF-8?q?=D1=81=D1=82=D0=BE=D0=B3=D0=BE=20=D0=B2=D0=B5=D0=BA=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project/histogram.cpp | 6 +++--- project/histogram_internal.h | 2 +- unittest.cpp | 9 ++++----- 3 files changed, 8 insertions(+), 9 deletions(-) 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); }