From a15d6100df3d051b277571ed26e21a4e4eebe412 Mon Sep 17 00:00:00 2001 From: IshutinaYI Date: Sun, 23 Apr 2023 05:30:18 +0300 Subject: [PATCH] =?UTF-8?q?test:=20=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=B4=D0=BF=D1=80=D0=BE=D0=B5=D0=BA=D1=82=20unitte?= =?UTF-8?q?st,=20=D0=B2=D1=8B=D0=BF=D0=BE=D0=BB=D0=BD=D0=B5=D0=BD=D0=BE=20?= =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- unittest.cbp | 38 ++++++++++++++++++++++++++++++++++++++ unittest.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 unittest.cbp create mode 100644 unittest.cpp diff --git a/unittest.cbp b/unittest.cbp new file mode 100644 index 0000000..7f9621b --- /dev/null +++ b/unittest.cbp @@ -0,0 +1,38 @@ + + + + + + diff --git a/unittest.cpp b/unittest.cpp new file mode 100644 index 0000000..e950fcf --- /dev/null +++ b/unittest.cpp @@ -0,0 +1,42 @@ +#define DOCTEST_CONFIG_NO_MULTITHREADING +#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN +#include "doctest.h" +#include "histogram_internal.h" +#include "histogram.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("null vector") { + double min = 0; + double max = 0; + find_minmax({}, min, max); + CHECK(min == 0); + CHECK(max == 0); +} + +TEST_CASE("negative elements vector") { + double min = 0; + double max = 0; + find_minmax({-1,-3,-5}, min, max); + CHECK(min == -5); + CHECK(max == -1); +} + + +TEST_CASE("identical elements vector") { + double min = 0; + double max = 0; + find_minmax({8, 8, 8}, min, max); + CHECK(min == 8); + CHECK(max == 8); +} +/*TEST_CASE("null vector") { + size_t bin_count = 0; + vector bins (bin_count); +}*/