From 9a4b65ee9a8ba9cffae649d9c4a18703a72f902f Mon Sep 17 00:00:00 2001 From: "Yaroslav (PivovarovYV)" Date: Sun, 23 Apr 2023 22:12:26 +0300 Subject: [PATCH] =?UTF-8?q?code:=20=D1=82=D0=B5=D1=81=D1=82=D0=B8=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- histogram.cpp | 2 +- histogram_internal.h | 6 +++++ project3.layout | 25 +++++++++++++++++ unitest.cbp | 36 +++++++++++++++++++++++++ unitest.cpp | 16 +++++++++++ unitest.depend | 64 ++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 148 insertions(+), 1 deletion(-) create mode 100644 histogram_internal.h create mode 100644 project3.layout create mode 100644 unitest.cbp create mode 100644 unitest.cpp create mode 100644 unitest.depend 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" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +