Родитель
f37d1cd25c
Сommit
81ff18f02d
@ -0,0 +1,25 @@
|
||||
#include "prot.h"
|
||||
int input_width(int countOfNumbers){
|
||||
const int BLOCK_WIDTH = 10;
|
||||
bool check = false;
|
||||
int width =0;
|
||||
while(check == false){
|
||||
std::cout << "Input width:"<<std::endl;
|
||||
std::cin >> width;
|
||||
if(width < 70){
|
||||
std::cout << "width less 70" << std::endl;
|
||||
}
|
||||
else if(width > 800){
|
||||
std::cout << "width more 800" << std::endl;
|
||||
}
|
||||
else if(width < countOfNumbers*BLOCK_WIDTH / 3.0){
|
||||
std::cout << "ìåíåå òðåòè êîëè÷åñòâà ÷èñåë, óìíîæåííûõ íà øèðèíó áëîêà " << std::endl;
|
||||
}
|
||||
else{
|
||||
check = true;
|
||||
}
|
||||
|
||||
}
|
||||
return width;
|
||||
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
#ifndef PROT_H_INCLUDED
|
||||
#define PROT_H_INCLUDED
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
|
||||
int input_width(int countOfNumbers);
|
||||
|
||||
#endif // PROT_H_INCLUDED
|
@ -0,0 +1,44 @@
|
||||
#define DOCTEST_CONFIG_NO_MULTITHREADING
|
||||
#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("empty vector") {
|
||||
std::vector<double> numbers{};
|
||||
double min=0, max=0;
|
||||
CHECK(!find_minmax(numbers, min, max));
|
||||
}
|
||||
TEST_CASE("1 val") {
|
||||
std::vector<double> numbers{1};
|
||||
double min=0, max=0;
|
||||
find_minmax(numbers, min, max);
|
||||
CHECK(min == 1);
|
||||
CHECK(max == 1);
|
||||
}
|
||||
TEST_CASE("- val") {
|
||||
std::vector<double> numbers{-1,-2};
|
||||
double min=0, max=0;
|
||||
find_minmax(numbers, min, max);
|
||||
CHECK(min == -2);
|
||||
CHECK(max == -1);
|
||||
}
|
||||
TEST_CASE("same val") {
|
||||
std::vector<double> numbers{2,2};
|
||||
double min=0, max=0;
|
||||
find_minmax(numbers, min, max);
|
||||
CHECK(min == 2);
|
||||
CHECK(max == 2);
|
||||
}
|
||||
TEST_CASE("check prot1") {
|
||||
check(input_width(int countOfNumbers, 10));
|
||||
|
||||
}
|
||||
|
Загрузка…
Ссылка в новой задаче