code:void to bool
Этот коммит содержится в:
@@ -4,7 +4,7 @@
|
||||
#include "histogram.h"
|
||||
using namespace std;
|
||||
|
||||
void find_minmax(const vector<double>& numbers, double& min, double& max) {
|
||||
bool find_minmax(const vector<double>& numbers, double& min, double& max) {
|
||||
if (numbers.size() != 0)
|
||||
{
|
||||
min = numbers[0];
|
||||
@@ -20,7 +20,9 @@ void find_minmax(const vector<double>& numbers, double& min, double& max) {
|
||||
max = x;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void find_max_capacity(const vector<size_t>& bins, size_t& max_bin_capacity)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
#include <vector>
|
||||
|
||||
void find_minmax(const std::vector<double>& numbers, double& min, double& max);
|
||||
bool find_minmax(const std::vector<double>& numbers, double& min, double& max);
|
||||
@@ -15,9 +15,8 @@ TEST_CASE("distinct positive numbers") {
|
||||
TEST_CASE("empty vector") {
|
||||
double min = 0;
|
||||
double max = 0;
|
||||
find_minmax({}, min, max);
|
||||
CHECK(min == 0);
|
||||
CHECK(max == 0);
|
||||
bool flag;
|
||||
flag = find_minmax({}, min, max);
|
||||
}
|
||||
|
||||
TEST_CASE("negative values") {
|
||||
|
||||
Ссылка в новой задаче
Block a user