code: добавление ещё 4 модульных тестов в unittest.cpp
Этот коммит содержится в:
32
unittest.cpp
32
unittest.cpp
@@ -10,3 +10,35 @@ TEST_CASE("distinct positive numbers") {
|
||||
CHECK(min == 1);
|
||||
CHECK(max == 2);
|
||||
}
|
||||
|
||||
TEST_CASE("empty array") {
|
||||
double min = 0;
|
||||
double max = 0;
|
||||
find_minmax({}, min, max);
|
||||
CHECK(min == 0);
|
||||
CHECK(max == 0);
|
||||
}
|
||||
|
||||
TEST_CASE("array with a single element") {
|
||||
double min = 0;
|
||||
double max = 0;
|
||||
find_minmax({1}, min, max);
|
||||
CHECK(min == 1);
|
||||
CHECK(max == 1);
|
||||
}
|
||||
|
||||
TEST_CASE("array of negative elements") {
|
||||
double min = 0;
|
||||
double max = 0;
|
||||
find_minmax({-1, -2}, min, max);
|
||||
CHECK(min == -2);
|
||||
CHECK(max == -1);
|
||||
}
|
||||
|
||||
TEST_CASE("array of identical elements") {
|
||||
double min = 0;
|
||||
double max = 0;
|
||||
find_minmax({1, 1}, min, max);
|
||||
CHECK(min == 1);
|
||||
CHECK(max == 1);
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user