diff --git a/histogam.cpp b/histogam.cpp index e3fc6aa..25ee82b 100644 --- a/histogam.cpp +++ b/histogam.cpp @@ -2,9 +2,10 @@ #include #include #include "histogam.h" +#include "histogam_internal.h" using namespace std; -static find_minmax(vector numbers, double& min, double& max) { +void find_minmax(vector numbers, double& min, double& max) { min = numbers[0]; for (auto i = 0; i < numbers.size(); i++) { if (numbers[i] < min) { diff --git a/histogam.h b/histogam.h index 994a9c4..af2d8ad 100644 --- a/histogam.h +++ b/histogam.h @@ -2,7 +2,6 @@ #define HISTOGAM_H_INCLUDED #include - std::vector make_histogram(const std::vector& numbers, size_t bin_count); diff --git a/histogam_internal.h b/histogam_internal.h new file mode 100644 index 0000000..58eecb6 --- /dev/null +++ b/histogam_internal.h @@ -0,0 +1,7 @@ +#ifndef HISTOGAM_INTERNAL_H_INCLUDED +#define HISTOGAM_INTERNAL_H_INCLUDED + +#include +void find_minmax(std::vector numbers, double& min, double& max); + +#endif // HISTOGAM_INTERNAL_H_INCLUDED diff --git a/lab1.depend b/lab1.depend index fdaeffe..5f3bc1d 100644 --- a/lab1.depend +++ b/lab1.depend @@ -3,16 +3,17 @@ -1682272330 source:c:\users\admin\onedrive\Рабочий стол\lab1\main.cpp +1682273505 source:c:\users\admin\onedrive\Рабочий стол\lab1\main.cpp "histogam.h" + "text.h" -1682271932 c:\users\admin\onedrive\Рабочий стол\lab1\histogam.h +1682273839 c:\users\admin\onedrive\Рабочий стол\lab1\histogam.h -1682272812 source:c:\users\admin\onedrive\Рабочий стол\lab1\histogam.cpp +1682273664 source:c:\users\admin\onedrive\Рабочий стол\lab1\histogam.cpp diff --git a/unittest.cbp b/unittest.cbp new file mode 100644 index 0000000..7f9621b --- /dev/null +++ b/unittest.cbp @@ -0,0 +1,38 @@ + + + + + + diff --git a/unittest.cpp b/unittest.cpp new file mode 100644 index 0000000..87d0670 --- /dev/null +++ b/unittest.cpp @@ -0,0 +1,17 @@ +#define DOCTEST_CONFIG_NO_MULTITHREADING +#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN +#include "doctest.h" +#include "histogam_internal.h" +#include + +TEST_CASE("distinct positive numbers") { + double min = 0; + double max = 0; + std::vectorf{1,2}; + CHECK(f.size() != 0); + CHECK(f.size() != 1); + find_minmax(f, min, max); + CHECK(min == 1); + CHECK(max == 2); + CHECK(min != max); +} diff --git a/unittest.depend b/unittest.depend new file mode 100644 index 0000000..5760bab --- /dev/null +++ b/unittest.depend @@ -0,0 +1,64 @@ +# depslib dependency file v1.0 +1682273864 source:c:\users\admin\onedrive\Рабочий стол\lab1\histogam.cpp + + + + "histogam.h" + "histogam_internal.h" + +1682273839 c:\users\admin\onedrive\Рабочий стол\lab1\histogam.h + + +1682273796 c:\users\admin\onedrive\Рабочий стол\lab1\histogam_internal.h + + +1682276727 source:c:\users\admin\onedrive\Рабочий стол\lab1\unittest.cpp + "doctest.h" + "histogam_internal.h" + + +1682274769 c:\users\admin\onedrive\Рабочий стол\lab1\doctest.h + + + + + + + "doctest_fwd.h" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +