code: добавлены новые тесты
Этот коммит содержится в:
@@ -31,6 +31,10 @@
|
|||||||
<Compiler>
|
<Compiler>
|
||||||
<Add option="-Wall" />
|
<Add option="-Wall" />
|
||||||
</Compiler>
|
</Compiler>
|
||||||
|
<Unit filename="doctest.h" />
|
||||||
|
<Unit filename="histogram.cpp" />
|
||||||
|
<Unit filename="histogram_internal.h" />
|
||||||
|
<Unit filename="unittest.cpp" />
|
||||||
<Extensions>
|
<Extensions>
|
||||||
<lib_finder disable_auto="1" />
|
<lib_finder disable_auto="1" />
|
||||||
</Extensions>
|
</Extensions>
|
||||||
|
|||||||
16
unittest.cpp
16
unittest.cpp
@@ -10,3 +10,19 @@ TEST_CASE("distinct positive numbers") {
|
|||||||
CHECK(min == 1);
|
CHECK(min == 1);
|
||||||
CHECK(max == 1);
|
CHECK(max == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("distinct negative numbers") {
|
||||||
|
double min = 0;
|
||||||
|
double max = 0;
|
||||||
|
find_minmax({-1,-100,-30,-40}, min, max);
|
||||||
|
CHECK(min == -100);
|
||||||
|
CHECK(max == -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("vector of indentical elements") {
|
||||||
|
double min = 0;
|
||||||
|
double max = 0;
|
||||||
|
find_minmax({5,5,5,5}, min, max);
|
||||||
|
CHECK(min == 5);
|
||||||
|
CHECK(max == 5);
|
||||||
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user