From c8f4ebca9638f0ed628bf441c4823236d1d5ee69 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 26 May 2024 16:16:14 +0300 Subject: [PATCH] =?UTF-8?q?unittest=20=D0=B4=D0=BB=D1=8F=20=D1=81=D0=BE?= =?UTF-8?q?=D0=B1=D1=81=D1=82=D0=B2=D0=B5=D0=BD=D0=BD=D0=BE=D0=B3=D0=BE=20?= =?UTF-8?q?=D0=B2=D0=B0=D1=80=D0=B8=D0=B0=D0=BD=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- histogram_internal.h | 1 + svg.cpp | 1 - unittest.cpp | 13 +++++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/histogram_internal.h b/histogram_internal.h index 7473744..2cc39b9 100644 --- a/histogram_internal.h +++ b/histogram_internal.h @@ -1,4 +1,5 @@ #ifndef HISTOGRAM_INTERNAL_H_INCLUDED #define HISTOGRAM_INTERNAL_H_INCLUDED void find_minmax(const std::vector& numbers, double& min, double& max); +std::string check_color(const std::string& color); #endif // HISTOGRAM_INTERNAL_H_INCLUDED diff --git a/svg.cpp b/svg.cpp index 84ddc82..1ec5992 100644 --- a/svg.cpp +++ b/svg.cpp @@ -2,7 +2,6 @@ #include #include "svg.h" - void svg_begin(double width, double height) { std::cout << "\n"; diff --git a/unittest.cpp b/unittest.cpp index 2b818d9..9c59d84 100644 --- a/unittest.cpp +++ b/unittest.cpp @@ -3,6 +3,7 @@ #include "doctest.h" #include "histogram_internal.h" + TEST_CASE("distinct positive numbers") { double min = 0; double max = 0; @@ -42,3 +43,15 @@ TEST_CASE("equal elements") { CHECK(min == 4); CHECK(max == 4); } + +TEST_CASE("correct input 1") { + CHECK(check_color("red") == "red"); +} + +TEST_CASE("uncorrect input 2") { + CHECK(check_color("light red") == "black"); +} + +TEST_CASE("uncorrect input 2") { + CHECK(check_color("FF0000") == "black"); +}