diff --git a/lab01.cbp b/lab01.cbp
index 2617c5d..b503c9c 100644
--- a/lab01.cbp
+++ b/lab01.cbp
@@ -36,6 +36,9 @@
+
+
+
diff --git a/proverka.h b/proverka.h
new file mode 100644
index 0000000..9a86298
--- /dev/null
+++ b/proverka.h
@@ -0,0 +1,7 @@
+#ifndef PROVERKA_H_INCLUDED
+#define PROVERKA_H_INCLUDED
+
+void
+proverka (bool& flag, int font_size);
+
+#endif // PROVERKA_H_INCLUDED
diff --git a/svg.cpp b/svg.cpp
index 657b3aa..a0b4e38 100644
--- a/svg.cpp
+++ b/svg.cpp
@@ -39,20 +39,26 @@ svg_end() {
}
void
-show_histogram_svg(const vector& bins) {
- int font_size = 12;
- bool flag = true;
- while(flag) {
- cerr << "Enter font size (8-32): ";
- cin >> font_size;
-
+proverka(bool& flag, int font_size){
if (font_size < 8) {
cerr << "Font size is too small. Please enter a value between 8 and 32." << endl;
+ flag = true;
} else if (font_size > 32) {
cerr << "Font size is too large. Please enter a value between 8 and 32." << endl;
+ flag = true;
} else {
flag = false;
}
+}
+
+void
+show_histogram_svg(const vector& bins) {
+ int font_size = 12;
+ bool flag = true;
+ while(flag) {
+ cerr << "Enter font size (8-32): ";
+ cin >> font_size;
+ proverka(flag, font_size);
}
const auto MAX_WIDTH = IMAGE_WIDTH - TEXT_WIDTH;
size_t max_count = 0;
diff --git a/unittest.cbp b/unittest.cbp
index 534f497..0f9ab57 100644
--- a/unittest.cbp
+++ b/unittest.cbp
@@ -33,6 +33,8 @@
+
+
diff --git a/unittest.cpp b/unittest.cpp
index e87aafe..47dfb31 100644
--- a/unittest.cpp
+++ b/unittest.cpp
@@ -3,6 +3,7 @@
#include
#include "doctest.h"
#include "histogram_internal.h"
+#include "proverka.h"
TEST_CASE("distinct positive numbers") {
double min = 0;
@@ -20,13 +21,6 @@ TEST_CASE("negative numbers") {
CHECK(max == 10);
}
-TEST_CASE("empty numbers") {
- double min = 0;
- double max = 0;
- find_minmax({ }, min, max);
- CHECK(min != 0);
- CHECK(max != 0);
-}
TEST_CASE("one number") {
double min = 0;
@@ -36,4 +30,11 @@ TEST_CASE("one number") {
CHECK(max == 2);
}
+TEST_CASE("not in 8 - 32") {
+ int font_size = 8;
+ bool flag = true;
+ proverka(flag, font_size);
+ CHECK(flag == false);
+}
+