diff --git a/LR3/.gitignore b/LR3/.gitignore
index b6aa39b..6184e5c 100644
--- a/LR3/.gitignore
+++ b/LR3/.gitignore
@@ -2,3 +2,5 @@
/obj
/LR3.depend
/LR3.layout
+/curl/
+/unittest.layout
diff --git a/LR3/LR3.cbp b/LR3/LR3.cbp
index ccf7e89..a005009 100644
--- a/LR3/LR3.cbp
+++ b/LR3/LR3.cbp
@@ -37,7 +37,10 @@
+
+
+
diff --git a/LR3/histogram.cpp b/LR3/histogram.cpp
index b627dc7..3c86d4a 100644
--- a/LR3/histogram.cpp
+++ b/LR3/histogram.cpp
@@ -1,4 +1,5 @@
#include "histogram.h"
+#include "histogram_internal.h"
#include
diff --git a/LR3/histogram_internal.h b/LR3/histogram_internal.h
new file mode 100644
index 0000000..737dbd1
--- /dev/null
+++ b/LR3/histogram_internal.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#include
+
+
+using namespace std;
+
+void
+find_minmax(vector numbers, double& min, double& max);
diff --git a/LR3/main.cpp b/LR3/main.cpp
index 289053a..7c31418 100644
--- a/LR3/main.cpp
+++ b/LR3/main.cpp
@@ -2,6 +2,7 @@
#include
#include "histogram.h"
#include "text.h"
+#include "svg.h"
using namespace std;
@@ -30,5 +31,5 @@ int main()
{
auto in = input_data();
auto bins = make_histogram(in.numbers, in.bin_count);
- show_histogram_text(bins);
+ show_histogram_svg(bins);
}
diff --git a/LR3/svg.cpp b/LR3/svg.cpp
new file mode 100644
index 0000000..0326c53
--- /dev/null
+++ b/LR3/svg.cpp
@@ -0,0 +1,56 @@
+#include "svg.h"
+#include
+using namespace std;
+
+void
+svg_begin(double width, double height) {
+ cout << "\n";
+ cout << "\n";
+}
+
+void svg_text(double left, double baseline, string text) {
+ cout << "" << text << "";
+}
+
+
+void svg_rect(double x, double y, double width, double height, string stroke = "black", string fill = "black")
+{
+ cout << "";
+}
+
+void show_histogram_svg(const vector& bins) {
+ const auto IMAGE_WIDTH = 400;
+ const auto IMAGE_HEIGHT = 300;
+ const auto TEXT_LEFT = 20;
+ const auto TEXT_BASELINE = 20;
+ const auto TEXT_WIDTH = 50;
+ const auto BIN_HEIGHT = 30;
+ const auto BLOCK_WIDTH = 10;
+
+ svg_begin(400, 300);
+ double top = 0;
+
+ for (size_t bin : bins) {
+ const double bin_width = BLOCK_WIDTH * bin;
+ if(bin_width> IMAGE_WIDTH) {
+ const double bin_width= IMAGE_WIDTH - TEXT_WIDTH;
+ }
+ svg_text(TEXT_LEFT, top + TEXT_BASELINE, to_string(bin));
+ svg_rect(TEXT_WIDTH, top, bin_width, BIN_HEIGHT, "blue", "green");
+ top += BIN_HEIGHT;
+ }
+
+ //svg_text(20, 20, to_string(bins[0]));
+ //svg_rect(50, 0, bins[0] * 10, 30);
+ svg_end();
+}
diff --git a/LR3/svg.h b/LR3/svg.h
new file mode 100644
index 0000000..9a80948
--- /dev/null
+++ b/LR3/svg.h
@@ -0,0 +1,9 @@
+#ifndef SVG_H_INCLUDED
+#define SVG_H_INCLUDED
+#include
+#include
+
+void show_histogram_svg(const std::vector &bins);
+
+
+#endif // SVG_H_INCLUDED
diff --git a/LR3/unittest.cbp b/LR3/unittest.cbp
new file mode 100644
index 0000000..534f497
--- /dev/null
+++ b/LR3/unittest.cbp
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/LR3/unittest.cpp b/LR3/unittest.cpp
new file mode 100644
index 0000000..7b62f70
--- /dev/null
+++ b/LR3/unittest.cpp
@@ -0,0 +1,29 @@
+#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;
+ find_minmax({1, 2}, min, max);
+ CHECK(min == 1);
+ CHECK(max == 2);
+}
+
+TEST_CASE("массив из одного числа") {
+ double min = 0;
+ double max = 0;
+ find_minmax({1}, min, max);
+ CHECK(min == 1);
+ CHECK(max == 1);
+}
+
+TEST_CASE("отрицательные числа") {
+ double min = 0;
+ double max = 0;
+ find_minmax({-1, -2}, min, max);
+ CHECK(min == -2);
+ CHECK(max == -1);
+}
diff --git a/LR3/unittest.depend b/LR3/unittest.depend
new file mode 100644
index 0000000..5dac4f7
--- /dev/null
+++ b/LR3/unittest.depend
@@ -0,0 +1,12 @@
+# depslib dependency file v1.0
+1748202161 source:c:\users\daemo\onedrive\Рабочий стол\lab03\lr3\histogram.cpp
+ "histogram.h"
+ "histogram_internal.h"
+
+
+1748199863 c:\users\daemo\onedrive\Рабочий стол\lab03\lr3\histogram.h
+
+
+1748202619 c:\users\daemo\onedrive\Рабочий стол\lab03\lr3\histogram_internal.h
+
+