diff --git a/histogram.cpp b/histogram.cpp index 8c8a080..ad249d2 100644 --- a/histogram.cpp +++ b/histogram.cpp @@ -4,7 +4,7 @@ #include "histogram.h" #include "histogram_internal.h" using namespace std; -void find_minmax(const vector& numbers, double& min, double& max) { +void find_minmax(const vector numbers, double& min, double& max) { min = numbers[0]; for (auto i = 0; i < numbers.size(); i++) { if (numbers[i] < min) { diff --git a/histogram_internal.h b/histogram_internal.h new file mode 100644 index 0000000..18abf25 --- /dev/null +++ b/histogram_internal.h @@ -0,0 +1,6 @@ +#ifndef HISTOGRAM_INTERNAL_H_INCLUDED +#define HISTOGRAM_INTERNAL_H_INCLUDED +#include +void find_minmax(std::vector numbers, double& min, double& max); + +#endif // HISTOGRAM_INTERNAL_H_INCLUDED diff --git a/project3.layout b/project3.layout new file mode 100644 index 0000000..5bf559e --- /dev/null +++ b/project3.layout @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/unitest.cbp b/unitest.cbp new file mode 100644 index 0000000..b58cac2 --- /dev/null +++ b/unitest.cbp @@ -0,0 +1,36 @@ + + + + + + diff --git a/unitest.cpp b/unitest.cpp new file mode 100644 index 0000000..28c1f8d --- /dev/null +++ b/unitest.cpp @@ -0,0 +1,16 @@ +#define DOCTEST_CONFIG_NO_MULTITHREADING +#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN +#include "doctest.h" +#include "histogram_internal.h" +#include +TEST_CASE("distinct positive numbers") { + double min = 0; + double max = 0; + std::vectormas{1,2}; + CHECK(mas.size() != 0); + CHECK(mas.size() != 1); + find_minmax(mas, min, max); + CHECK(min == 1); + CHECK(max == 2); + CHECK(min != max); +} diff --git a/unitest.depend b/unitest.depend new file mode 100644 index 0000000..3246a93 --- /dev/null +++ b/unitest.depend @@ -0,0 +1,64 @@ +# depslib dependency file v1.0 +1682275493 source:c:\users\hp\desktop\lab-03\project3\histogram.cpp + + + + "histogram.h" + "histogram_internal.h" + +1682271918 c:\users\hp\desktop\lab-03\project3\histogram.h + + +1682275464 c:\users\hp\desktop\lab-03\project3\histogram_internal.h + + +1682275379 source:c:\users\hp\desktop\lab-03\project3\unitest.cpp + "doctest.h" + "histogram_internal.h" + + +1682274805 c:\users\hp\desktop\lab-03\project3\doctest.h + + + + + + + "doctest_fwd.h" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +