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