From b9f19bc1e42b2b0acf69aa1eaf794c76299911af Mon Sep 17 00:00:00 2001 From: DmitriyevDM Date: Fri, 25 Apr 2025 01:42:50 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=D0=B5=20=D0=BC=D0=BE=D0=B4=D1=83=D0=BB=D1=8C=D0=BD?= =?UTF-8?q?=D1=8B=D0=B5=20=D1=82=D0=B5=D1=81=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- unittest.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/unittest.cpp b/unittest.cpp index a9ba7e5..bf37c5e 100644 --- a/unittest.cpp +++ b/unittest.cpp @@ -10,3 +10,35 @@ TEST_CASE("distinct positive numbers") { CHECK(min == 1); CHECK(max == 2); } + + +TEST_CASE("distinct negative numbers"){ + double min = 0; + double max = 0; + find_minmax({-1, -2}, min, max); + CHECK(min == -2); + CHECK(max == -1); +} +TEST_CASE("vector of the same elements"){ + double min = 0; + double max = 0; + find_minmax({3,3,3}, min, max); + CHECK(min == 3); + CHECK(max == 3); +} + +TEST_CASE("single element vector") { + double min = 0; + double max = 0; + find_minmax({7}, min, max); + CHECK(min == 7); + CHECK(max == 7); +} + +TEST_CASE("empty vector") { + double min = 0; + double max = 0; + find_minmax({}, min, max); + CHECK(min == 0); + CHECK(max == 0); +}