code: сделал тесты для функции вар5

main
Danila 2 лет назад
Родитель e431557ac6
Сommit 7e6b2fe398

@ -0,0 +1,10 @@
#ifndef TEXT_H_INCLUDED
#define TEXT_H_INCLUDED
size_t emptiness_width (size_t a, size_t b)
{
size_t c = a - b;
return c;
}
#endif // TEXT_H_INCLUDED

@ -33,6 +33,7 @@
<Add option="-fexceptions" /> <Add option="-fexceptions" />
</Compiler> </Compiler>
<Unit filename=".gitignore" /> <Unit filename=".gitignore" />
<Unit filename="emptiness_width.h" />
<Unit filename="histogram.cpp" /> <Unit filename="histogram.cpp" />
<Unit filename="histogram.h" /> <Unit filename="histogram.h" />
<Unit filename="histogram_internal.h" /> <Unit filename="histogram_internal.h" />

@ -4,6 +4,7 @@
#include "doctest.h" #include "doctest.h"
#include "project/histogram_internal.h" #include "project/histogram_internal.h"
#include "project/svg.h" #include "project/svg.h"
#include "project/emptiness_width.h"
/* TEST_CASE("distinct positive numbers 1") /* TEST_CASE("distinct positive numbers 1")
{ {
@ -44,13 +45,22 @@ TEST_CASE("vector with same elements") {
*/ */
TEST_CASE("distinct positive numbers 1") TEST_CASE("test1 var 5")
{ {
double min = 0; size_t a = 100;
double max = 0; size_t b = 200;
find_minmax({1, 2}, min, max); size_t c = emptiness_width (b,a);
CHECK(min == 1); CHECK(c == b-a);
CHECK(max == 2);
} }
TEST_CASE("test2 var 5")
{
size_t a = 100;
size_t b = 200;
size_t c = emptiness_width (a,b);
CHECK(c != b-a);
}

Загрузка…
Отмена
Сохранить