программа до пункта 6 (тестирование)

master
LedovskojMM 2 лет назад
Родитель 146ed97f3f
Сommit d0a42c4314

@ -2,9 +2,10 @@
#include <vector>
#include <cmath>
#include "histogam.h"
#include "histogam_internal.h"
using namespace std;
static find_minmax(vector<double> numbers, double& min, double& max) {
void find_minmax(vector<double> numbers, double& min, double& max) {
min = numbers[0];
for (auto i = 0; i < numbers.size(); i++) {
if (numbers[i] < min) {

@ -2,7 +2,6 @@
#define HISTOGAM_H_INCLUDED
#include <vector>
std::vector<size_t>
make_histogram(const std::vector<double>& numbers, size_t bin_count);

@ -0,0 +1,7 @@
#ifndef HISTOGAM_INTERNAL_H_INCLUDED
#define HISTOGAM_INTERNAL_H_INCLUDED
#include <vector>
void find_minmax(std::vector<double> numbers, double& min, double& max);
#endif // HISTOGAM_INTERNAL_H_INCLUDED

@ -3,16 +3,17 @@
<iostream>
<vector>
1682272330 source:c:\users\admin\onedrive\Ðàáî÷èé ñòîë\lab1\main.cpp
1682273505 source:c:\users\admin\onedrive\Ðàáî÷èé ñòîë\lab1\main.cpp
<iostream>
<vector>
<cmath>
"histogam.h"
"text.h"
1682271932 c:\users\admin\onedrive\Ðàáî÷èé ñòîë\lab1\histogam.h
1682273839 c:\users\admin\onedrive\Ðàáî÷èé ñòîë\lab1\histogam.h
<vector>
1682272812 source:c:\users\admin\onedrive\Ðàáî÷èé ñòîë\lab1\histogam.cpp
1682273664 source:c:\users\admin\onedrive\Ðàáî÷èé ñòîë\lab1\histogam.cpp
<iostream>
<vector>
<cmath>

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="unittest" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug">
<Option output="bin/Debug/unittest" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Debug/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-g" />
</Compiler>
</Target>
<Target title="Release">
<Option output="bin/Release/unittest" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Release/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-O2" />
</Compiler>
<Linker>
<Add option="-s" />
</Linker>
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
</Compiler>
<Extensions>
<lib_finder disable_auto="1" />
</Extensions>
</Project>
</CodeBlocks_project_file>

@ -0,0 +1,17 @@
#define DOCTEST_CONFIG_NO_MULTITHREADING
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include "doctest.h"
#include "histogam_internal.h"
#include <vector>
TEST_CASE("distinct positive numbers") {
double min = 0;
double max = 0;
std::vector<double>f{1,2};
CHECK(f.size() != 0);
CHECK(f.size() != 1);
find_minmax(f, min, max);
CHECK(min == 1);
CHECK(max == 2);
CHECK(min != max);
}

@ -0,0 +1,64 @@
# depslib dependency file v1.0
1682273864 source:c:\users\admin\onedrive\Ðàáî÷èé ñòîë\lab1\histogam.cpp
<iostream>
<vector>
<cmath>
"histogam.h"
"histogam_internal.h"
1682273839 c:\users\admin\onedrive\Ðàáî÷èé ñòîë\lab1\histogam.h
<vector>
1682273796 c:\users\admin\onedrive\Ðàáî÷èé ñòîë\lab1\histogam_internal.h
<vector>
1682276727 source:c:\users\admin\onedrive\Ðàáî÷èé ñòîë\lab1\unittest.cpp
"doctest.h"
"histogam_internal.h"
<vector>
1682274769 c:\users\admin\onedrive\Ðàáî÷èé ñòîë\lab1\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>
Загрузка…
Отмена
Сохранить