master
AndrosovDS 12 часов назад
Родитель 626f53e9ea
Сommit 80405024dd

@ -13,7 +13,7 @@
1745823848 c:\users\diman3000\desktop\cs-lab34\text.h
<vector>
1745824478 source:c:\users\diman3000\desktop\cs-lab34\main.cpp
1745824901 source:c:\users\diman3000\desktop\cs-lab34\main.cpp
<iostream>
<vector>
"histogram.h"
@ -27,3 +27,55 @@
"svg.h"
<iostream>
1745825391 source:c:\users\diman3000\desktop\cs-lab34\unittest.cpp
"doctest.h"
"histogram_internal.h"
1745825250 c:\users\diman3000\desktop\cs-lab34\doctest.h
<signal.h>
<ciso646>
<cstddef>
<ostream>
<istream>
<type_traits>
"doctest_fwd.h"
<ctime>
<cmath>
<climits>
<math.h>
<new>
<cstdio>
<cstdlib>
<cstring>
<limits>
<utility>
<fstream>
<sstream>
<iostream>
<algorithm>
<iomanip>
<vector>
<atomic>
<mutex>
<set>
<map>
<unordered_set>
<exception>
<stdexcept>
<csignal>
<cfloat>
<cctype>
<cstdint>
<string>
<sys/types.h>
<unistd.h>
<sys/sysctl.h>
<AfxWin.h>
<windows.h>
<io.h>
<sys/time.h>
<unistd.h>
1745825157 c:\users\diman3000\desktop\cs-lab34\histogram_internal.h
<vector>

Разница между файлами не показана из-за своего большого размера Загрузить разницу

@ -0,0 +1,4 @@
#pragma once
#include <vector>
void find_minmax(const std::vector<double>& numbers, double& min, double& max);

@ -0,0 +1,43 @@
#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("all numbers are same") {
double min = 0;
double max = 0;
find_minmax({5, 5, 5, 5}, min, max);
CHECK(min == 5);
CHECK(max == 5);
}
TEST_CASE("with negative numbers") {
double min = 0;
double max = 0;
find_minmax({-3, -7, -1}, min, max);
CHECK(min == -7);
CHECK(max == -1);
}
TEST_CASE("single number") {
double min = 0;
double max = 0;
find_minmax({42}, min, max);
CHECK(min == 42);
CHECK(max == 42);
}
TEST_CASE("empty vector") {
double min = 0;
double max = 0;
find_minmax({}, min, max);
CHECK(min == 0);
CHECK(max == 0);
}
Загрузка…
Отмена
Сохранить