From ecac05dfbf73d54b356faff7d057fe8e23f7917f Mon Sep 17 00:00:00 2001 From: KapitonovMikA Date: Mon, 20 May 2024 04:03:36 +0300 Subject: [PATCH] =?UTF-8?q?code:=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 | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/unittest.cpp b/unittest.cpp index 0acaa65..3508c15 100644 --- a/unittest.cpp +++ b/unittest.cpp @@ -14,9 +14,7 @@ TEST_CASE("distinct positive numbers") { TEST_CASE("empty vector"){ double min = 0; double max = 0; - find_minmax({ 0, 0 }, min, max); - CHECK(min == 0); - CHECK(max == 0); + CHECK(!find_minmax({}, min, max)); } TEST_CASE("same elements"){ @@ -24,5 +22,20 @@ TEST_CASE("same elements"){ double max = 0; find_minmax({ 1, 1 }, min, max); CHECK(min == max); - CHECK(max == min); +} + +TEST_CASE("only one number"){ + double min = 0; + double max = 0; + find_minmax({1}, min, max); + CHECK(min == 1); + CHECK(max == 1); +} + +TEST_CASE("distinct negative numbers") { + double min = 0; + double max = 0; + find_minmax({-1, -2}, min, max); + CHECK(min == -2); + CHECK(max == -1); }