From 88fae957e5d4bdfa5b02ea073988e806eacd29c2 Mon Sep 17 00:00:00 2001 From: TabolinIA Date: Tue, 21 May 2024 21:57:04 +0300 Subject: [PATCH] =?UTF-8?q?code:=20=D0=B1=D0=B0=D0=B7=D0=BE=D0=B2=D1=8B?= =?UTF-8?q?=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 | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/unittest.cpp b/unittest.cpp index a9ba7e5..46b14bd 100644 --- a/unittest.cpp +++ b/unittest.cpp @@ -10,3 +10,36 @@ TEST_CASE("distinct positive numbers") { CHECK(min == 1); CHECK(max == 2); } + +TEST_CASE("empty vector") { + double min = 0; + double max = 0; + find_minmax({0, 0}, min, max); + CHECK(min == 0); + CHECK(max == 0); +} + +TEST_CASE("same numbers") { + double min = 0; + double max = 0; + find_minmax({5, 5}, min, max); + CHECK(min == 5); + CHECK(max == 5); +} + +TEST_CASE("negative numbers") { + double min = 0; + double max = 0; + find_minmax({-1, -2}, min, max); + CHECK(min == -2); + CHECK(max == -1); +} + +TEST_CASE("one number") { + double min = 0; + double max = 0; + find_minmax({1}, min, max); + CHECK(min == 1); + CHECK(max == 1); +}; +