diff --git a/histogram.cpp b/histogram.cpp index 46c6086..c8330f7 100644 --- a/histogram.cpp +++ b/histogram.cpp @@ -18,6 +18,13 @@ bool find_minmax(vector vec, double& min, double& max) { } return true; } + +bool width(size_t block_width){ + if (block_width > 3 && block_width<30 ) { + return true; + } +} + vector make_histogram(size_t number, vector vec) { vector bins(number); double mn, mx; diff --git a/histogram.h b/histogram.h index 92a9d68..4267de0 100644 --- a/histogram.h +++ b/histogram.h @@ -4,3 +4,4 @@ using namespace std; vector make_histogram(size_t number, vector vec); +bool width(size_t block_width); diff --git a/histogram_internal.h b/histogram_internal.h index 72bf28b..3d4f536 100644 --- a/histogram_internal.h +++ b/histogram_internal.h @@ -1 +1,2 @@ bool find_minmax(std::vector vec, double& min, double& max); +bool width(size_t block_width); diff --git a/main.cpp b/main.cpp index 70445d7..57e7695 100644 --- a/main.cpp +++ b/main.cpp @@ -37,6 +37,7 @@ Input input_data() { return in; } + int main() { auto in = input_data(); auto bins = make_histogram(in.korz, in.vec); diff --git a/svg.cpp b/svg.cpp index a697b75..f79d6f7 100644 --- a/svg.cpp +++ b/svg.cpp @@ -1,6 +1,6 @@ #include "svg.h" -using namespace std; + void svg_begin(double width, double height) { cout << "\n"; diff --git a/unittest.cpp b/unittest.cpp index b5788fe..933c77a 100644 --- a/unittest.cpp +++ b/unittest.cpp @@ -21,6 +21,9 @@ TEST_CASE("empty vector"){ CHECK(!result); } + + + TEST_CASE("single vector"){ double min = 0; double max = 0; @@ -47,3 +50,17 @@ TEST_CASE("same vector"){ CHECK(min == 1); CHECK(max == 1); } + +TEST_CASE("block"){ + size_t block_width = 15; + bool result = width( block_width); + CHECK(result); +} + + +TEST_CASE("block"){ + size_t block_width = 0; + bool result = width( block_width); + CHECK(!result); +} + diff --git a/unittest.depend b/unittest.depend index 914d5b4..66b0e9d 100644 --- a/unittest.depend +++ b/unittest.depend @@ -1,12 +1,12 @@ # depslib dependency file v1.0 -1746274971 source:c:\users\natasha\desktop\Проги С2\cs-lab34\histogram.cpp +1746447381 source:c:\users\natasha\desktop\Проги С2\cs-lab34\histogram.cpp "histogram.h" -1746274971 c:\users\natasha\desktop\Проги С2\cs-lab34\histogram.h +1746446253 c:\users\natasha\desktop\Проги С2\cs-lab34\histogram.h -1746276122 source:c:\users\natasha\desktop\Проги С2\cs-lab34\unittest.cpp +1746447498 source:c:\users\natasha\desktop\Проги С2\cs-lab34\unittest.cpp "doctest.h" "histogram_internal.h" @@ -55,5 +55,5 @@ -1746276025 c:\users\natasha\desktop\Проги С2\cs-lab34\histogram_internal.h +1746447065 c:\users\natasha\desktop\Проги С2\cs-lab34\histogram_internal.h