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); +}; +