From 52e6758f279d7114cc3a11452e0446b7cb2b867a Mon Sep 17 00:00:00 2001
From: ChirkaAR <ChirkaAR@mpei.ru>
Date: Sun, 27 Apr 2025 01:09:18 +0300
Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=83=D0=BD=D0=BA=D1=82=204:=20=D0=9C?=
 =?UTF-8?q?=D0=BE=D0=B4=D1=83=D0=BB=D1=8C=D0=BD=D1=8B=D0=B5=20=D1=82=D0=B5?=
 =?UTF-8?q?=D1=81=D1=82=D1=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 histogram.cpp        |  2 +-
 histogram_internal.h |  9 +++++++++
 unittest.cpp         | 29 +++++++++++++++++++++++++++++
 3 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/histogram.cpp b/histogram.cpp
index 9deefeb..0b5f9d1 100644
--- a/histogram.cpp
+++ b/histogram.cpp
@@ -3,7 +3,7 @@
 #include <vector>
 using namespace std;
 
-static void find_minmax(const vector<double>& numbers, double& minN, double& maxN)
+void find_minmax(const vector<double>& numbers, double& minN, double& maxN)
 {
     minN = numbers[0];
     maxN = numbers[0];
diff --git a/histogram_internal.h b/histogram_internal.h
index e69de29..54abeff 100644
--- a/histogram_internal.h
+++ b/histogram_internal.h
@@ -0,0 +1,9 @@
+#ifndef HISTOGRAM_INTERNAL_H_INCLUDED
+#define HISTOGRAM_INTERNAL_H_INCLUDED
+
+#include <vector>
+
+std::vector<size_t>
+find_minmax( const std::vector<double>& numbers, double& minN, double& maxN);
+
+#endif // HISTOGRAM_INTERNAL_H_INCLUDED
diff --git a/unittest.cpp b/unittest.cpp
index e69de29..f0883f5 100644
--- a/unittest.cpp
+++ b/unittest.cpp
@@ -0,0 +1,29 @@
+#define DOCTEST_CONFIG_NO_MULTITHREADING
+#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
+#include "doctest.h"
+#include "histogram_internal.h"
+/*
+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("distinct negative numbers")
+{
+    double min = 0;
+    double max = 0;
+    find_minmax({-1, -2}, min, max);
+    CHECK(min == -2);
+    CHECK(max == -1);
+}
+TEST_CASE("vector 1 element")
+{
+    double min = 0;
+    double max = 0;
+    find_minmax({1}, min, max);
+    CHECK(min == 1);
+    CHECK(max == 1);
+}