From c37b1fed8879206d90c0bdfcca1adb93136ed62e Mon Sep 17 00:00:00 2001 From: EfremovSI Date: Sat, 20 Apr 2024 20:59:54 +0300 Subject: [PATCH] =?UTF-8?q?doc:=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BC=D0=BE=D0=B4=D1=83=D0=BB=D1=8C?= =?UTF-8?q?=D0=BD=D1=8B=D1=85=20=D1=82=D0=B5=D1=81=D1=82=D0=BE=D0=B2=20?= =?UTF-8?q?=D0=BA=20=D0=B8=D0=BD=D0=B4=D0=B8=D0=B2=D0=B8=D0=B4=D1=83=D0=B0?= =?UTF-8?q?=D0=BB=D1=8C=D0=BD=D0=BE=D0=B9=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hist_proc_internal.h | 7 +++++++ unittest4var-2.cpp | 12 ++++++++++++ unittest4var.cpp | 12 ++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 hist_proc_internal.h create mode 100644 unittest4var-2.cpp create mode 100644 unittest4var.cpp diff --git a/hist_proc_internal.h b/hist_proc_internal.h new file mode 100644 index 0000000..b029a28 --- /dev/null +++ b/hist_proc_internal.h @@ -0,0 +1,7 @@ +#ifndef HIST_PROC_INTERNAL_H_INCLUDED +#define HIST_PROC_INTERNAL_H_INCLUDED + +std::vector +make_histogram_proc(const std::vector numbers, size_t bin_count, std::vector bins); + +#endif // HIST_PROC_INTERNAL_H_INCLUDED diff --git a/unittest4var-2.cpp b/unittest4var-2.cpp new file mode 100644 index 0000000..5b2bcf3 --- /dev/null +++ b/unittest4var-2.cpp @@ -0,0 +1,12 @@ +#define DOCTEST_CONFIG_NO_MULTITHREADING +#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN +#include "doctest.h" +#include "hist_proc_internal.h" + +TEST_CASE("distinct positive numbers") { + std::vector procent(3); + procent = make_histogram_proc({1}, 3, {1, 0, 0}); + CHECK(procent[0] == 100); + CHECK(procent[1] == 0); + CHECK(procent[2] == 0); +} diff --git a/unittest4var.cpp b/unittest4var.cpp new file mode 100644 index 0000000..17a2b23 --- /dev/null +++ b/unittest4var.cpp @@ -0,0 +1,12 @@ +#define DOCTEST_CONFIG_NO_MULTITHREADING +#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN +#include "doctest.h" +#include "hist_proc_internal.h" + +TEST_CASE("distinct positive numbers") { + std::vector procent(4); + procent = make_histogram_proc({1, 2, 3}, 3, {1, 1, 1}); + CHECK(procent[0] == 33); + CHECK(procent[1] == 33); + CHECK(procent[2] == 34); +}