diff --git a/project/pr3.cbp b/project/pr3.cbp
index 6b69c68..4542632 100644
--- a/project/pr3.cbp
+++ b/project/pr3.cbp
@@ -37,6 +37,8 @@
+
+
diff --git a/project/svg.cpp b/project/svg.cpp
index b58b16f..7166ed2 100644
--- a/project/svg.cpp
+++ b/project/svg.cpp
@@ -6,6 +6,12 @@
#include "svg.h"
using namespace std;
+size_t emptiness_width (size_t a, size_t b)
+{
+ size_t c = a - b;
+ return c;
+}
+
void
svg_begin(double width, double height)
{
@@ -36,7 +42,6 @@ svg_rect(double x, double y, double width, double height, string stroke = "black
}
-
void
show_histogram_svg(const vector& bins)
{
@@ -67,11 +72,10 @@ show_histogram_svg(const vector& bins)
for (size_t bin : bins)
{
double bin_width = (MAX_WIDTH)*(bin/max_count);
- svg_rect(MAX_WIDTH-bin_width, top, bin_width, BIN_HEIGHT, BLACK, RED);
+ svg_rect(emptiness_width(MAX_WIDTH, bin_width), top, bin_width, BIN_HEIGHT, BLACK, RED);
svg_text(TEXT_LEFT+MAX_WIDTH, top + TEXT_BASELINE, to_string(bin));
top += BIN_HEIGHT;
}
svg_end();
}
-
diff --git a/unittest.cpp b/unittest.cpp
index 907123c..69ba8f3 100644
--- a/unittest.cpp
+++ b/unittest.cpp
@@ -1,9 +1,11 @@
#define DOCTEST_CONFIG_NO_MULTITHREADING
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
+#include
#include "doctest.h"
#include "project/histogram_internal.h"
+#include "project/svg.h"
-TEST_CASE("distinct positive numbers 1")
+/* TEST_CASE("distinct positive numbers 1")
{
double min = 0;
double max = 0;
@@ -39,3 +41,16 @@ TEST_CASE("vector with same elements") {
CHECK(min == 2);
CHECK(max == 2);
}
+
+*/
+
+TEST_CASE("distinct positive numbers 1")
+{
+ double min = 0;
+ double max = 0;
+ find_minmax({1, 2}, min, max);
+ CHECK(min == 1);
+ CHECK(max == 2);
+}
+
+