From 9f7fba658694d17c3d1c85b05b399836bdad4591 Mon Sep 17 00:00:00 2001 From: SavinSA Date: Sun, 21 Apr 2024 21:44:42 +0300 Subject: [PATCH] =?UTF-8?q?test:=20=D0=BD=D0=B5=D1=81=D0=BA=D0=BE=D0=BB?= =?UTF-8?q?=D1=8C=D0=BA=D0=BE=20=D1=82=D0=B5=D1=81=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- unittest.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/unittest.cpp b/unittest.cpp index 09e3f7a..f91aa73 100644 --- a/unittest.cpp +++ b/unittest.cpp @@ -10,3 +10,33 @@ TEST_CASE("distinct positive numbers") { CHECK(min == 1); CHECK(max == 2); } +TEST_CASE("empty vector") { + double min = 0; + double max = 0; + find_minmax({NULL}, min, max); + CHECK(min == 0); + CHECK(max == 0); +} +TEST_CASE("one element") { + double min = 0; + double max = 0; + find_minmax({1}, min, max); + CHECK(min == 1); + CHECK(max == 1); +} + +TEST_CASE("negative elements") { + double min = 0; + double max = 0; + find_minmax({-1, -2}, min, max); + CHECK(min == -2); + CHECK(max == -1); +} +TEST_CASE("same elements") { + double min = 0; + double max = 0; + find_minmax({1,1,1}, min, max); + CHECK(min == 1); + CHECK(max == 1); +} +