From f3ccb9237ed42f6572f42782747ebfcabc4fd5ce Mon Sep 17 00:00:00 2001 From: KlimenchenkoIA Date: Sun, 25 May 2025 19:18:08 +0300 Subject: [PATCH] =?UTF-8?q?=20=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0=D0=B5=D0=BC?= =?UTF-8?q?=20=D1=84=D0=B0=D0=B9=D0=BB=20=D0=B4=D0=BB=D1=8F=20=D1=82=D0=B5?= =?UTF-8?q?=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 | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/unittest.cpp b/unittest.cpp index a9ba7e5..10c5e28 100644 --- a/unittest.cpp +++ b/unittest.cpp @@ -1,12 +1,25 @@ -#define DOCTEST_CONFIG_NO_MULTITHREADING #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN #include "doctest.h" #include "histogram_internal.h" -TEST_CASE("distinct positive numbers") { - double min = 0; - double max = 0; - find_minmax({1, 2}, min, max); - CHECK(min == 1); - CHECK(max == 2); +TEST_CASE("Test find_minmax") { + double min, max; + + SUBCASE("Empty vector") { + find_minmax({}, min, max); + CHECK(min == 0); + CHECK(max == 0); + } + + SUBCASE("Single element") { + find_minmax({5}, min, max); + CHECK(min == 5); + CHECK(max == 5); + } + + SUBCASE("Positive numbers") { + find_minmax({1, 2, 3}, min, max); + CHECK(min == 1); + CHECK(max == 3); + } }