Родитель
325d6f8fc4
Сommit
b086795769
После Ширина: | Высота: | Размер: 455 B |
@ -0,0 +1,33 @@
|
|||||||
|
# depslib dependency file v1.0
|
||||||
|
1750444036 source:c:\users\taa41\desktop\ïðîãà\lab1\main.cpp
|
||||||
|
<iostream>
|
||||||
|
"histogram.h"
|
||||||
|
"svg.h"
|
||||||
|
<fstream>
|
||||||
|
|
||||||
|
1749173822 c:\users\taa41\desktop\ïðîãà\lab1\histogram.h
|
||||||
|
<vector>
|
||||||
|
|
||||||
|
1750443911 source:c:\users\taa41\desktop\ïðîãà\lab1\svg.cpp
|
||||||
|
"svg.h"
|
||||||
|
<algorithm>
|
||||||
|
<string>
|
||||||
|
<iostream>
|
||||||
|
|
||||||
|
1750442384 c:\users\taa41\desktop\ïðîãà\lab1\svg.h
|
||||||
|
<vector>
|
||||||
|
<string>
|
||||||
|
<iostream>
|
||||||
|
<fstream>
|
||||||
|
|
||||||
|
1750443947 source:c:\users\taa41\desktop\ïðîãà\lab1\histogram.cpp
|
||||||
|
<iostream>
|
||||||
|
"histogram.h"
|
||||||
|
"histogram_internal.h"
|
||||||
|
<algorithm>
|
||||||
|
<cmath>
|
||||||
|
<vector>
|
||||||
|
|
||||||
|
1749200462 c:\users\taa41\desktop\ïðîãà\lab1\histogram_internal.h
|
||||||
|
<vector>
|
||||||
|
|
@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||||
|
<CodeBlocks_layout_file>
|
||||||
|
<FileVersion major="1" minor="0" />
|
||||||
|
<ActiveTarget name="Debug" />
|
||||||
|
<File name="histogram.cpp" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
|
<Cursor>
|
||||||
|
<Cursor1 position="289" topLine="0" />
|
||||||
|
</Cursor>
|
||||||
|
</File>
|
||||||
|
<File name="main.cpp" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
|
<Cursor>
|
||||||
|
<Cursor1 position="142" topLine="0" />
|
||||||
|
</Cursor>
|
||||||
|
</File>
|
||||||
|
<File name="svg.cpp" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="-2" zoom_2="0">
|
||||||
|
<Cursor>
|
||||||
|
<Cursor1 position="1151" topLine="0" />
|
||||||
|
</Cursor>
|
||||||
|
</File>
|
||||||
|
<File name="svg.h" open="1" top="1" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
|
<Cursor>
|
||||||
|
<Cursor1 position="671" topLine="0" />
|
||||||
|
</Cursor>
|
||||||
|
</File>
|
||||||
|
<File name="histogram.h" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
|
<Cursor>
|
||||||
|
<Cursor1 position="168" topLine="0" />
|
||||||
|
</Cursor>
|
||||||
|
</File>
|
||||||
|
</CodeBlocks_layout_file>
|
@ -1,9 +1,24 @@
|
|||||||
#include "histogram.h"
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include "histogram.h"
|
||||||
|
#include "svg.h"
|
||||||
|
#include <fstream>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
auto in = input_data();
|
Input data = input_data();
|
||||||
auto bins = make_histogram(in.numbers, in.bin_count);
|
|
||||||
show_histogram_text(bins);
|
|
||||||
|
size_t block_width = svg::input_block_width();
|
||||||
|
|
||||||
|
auto bins = make_histogram(data.numbers, data.bin_count);
|
||||||
|
|
||||||
|
|
||||||
|
show_histogram_text(bins, block_width);
|
||||||
|
|
||||||
|
ofstream svg_file("histogram.svg");
|
||||||
|
svg::show_histogram_svg(svg_file, bins, block_width);
|
||||||
|
svg_file.close();
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,52 @@
|
|||||||
|
#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") {
|
||||||
|
double min = 0;
|
||||||
|
double max = 0;
|
||||||
|
int sz = find_minmax({}, min, max);
|
||||||
|
|
||||||
|
CHECK(sz == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("single element vector") {
|
||||||
|
double min = 0;
|
||||||
|
double max = 0;
|
||||||
|
find_minmax({5}, min, max);
|
||||||
|
CHECK(min == 5);
|
||||||
|
CHECK(max == 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("negative numbers") {
|
||||||
|
double min = 0;
|
||||||
|
double max = 0;
|
||||||
|
find_minmax({-3, -1, -5}, min, max);
|
||||||
|
CHECK(min == -5);
|
||||||
|
CHECK(max == -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("identical elements") {
|
||||||
|
double min = 0;
|
||||||
|
double max = 0;
|
||||||
|
find_minmax({7, 7, 7}, min, max);
|
||||||
|
CHECK(min == 7);
|
||||||
|
CHECK(max == 7);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("mixed positive and negative numbers") {
|
||||||
|
double min = 0;
|
||||||
|
double max = 0;
|
||||||
|
find_minmax({-2, 3, 0, -5, 4}, min, max);
|
||||||
|
CHECK(min == -5);
|
||||||
|
CHECK(max == 4);
|
||||||
|
}
|
@ -0,0 +1,63 @@
|
|||||||
|
# depslib dependency file v1.0
|
||||||
|
1749200479 source:c:\users\taa41\desktop\ïðîãà\lab1\histogram.cpp
|
||||||
|
<iostream>
|
||||||
|
"histogram.h"
|
||||||
|
"histogram_internal.h"
|
||||||
|
<algorithm>
|
||||||
|
<cmath>
|
||||||
|
|
||||||
|
1749173822 c:\users\taa41\desktop\ïðîãà\lab1\histogram.h
|
||||||
|
<vector>
|
||||||
|
|
||||||
|
1749200462 c:\users\taa41\desktop\ïðîãà\lab1\histogram_internal.h
|
||||||
|
<vector>
|
||||||
|
|
||||||
|
1749200396 source:c:\users\taa41\desktop\ïðîãà\lab1\unittest.cpp
|
||||||
|
"doctest.h"
|
||||||
|
"histogram_internal.h"
|
||||||
|
|
||||||
|
1749168294 c:\users\taa41\desktop\ïðîãà\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>
|
||||||
|
|
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||||
|
<CodeBlocks_layout_file>
|
||||||
|
<FileVersion major="1" minor="0" />
|
||||||
|
<ActiveTarget name="Debug" />
|
||||||
|
<File name="histogram_internal.h" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
|
<Cursor>
|
||||||
|
<Cursor1 position="171" topLine="0" />
|
||||||
|
</Cursor>
|
||||||
|
</File>
|
||||||
|
<File name="histogram.cpp" open="1" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
|
<Cursor>
|
||||||
|
<Cursor1 position="0" topLine="0" />
|
||||||
|
</Cursor>
|
||||||
|
</File>
|
||||||
|
<File name="unittest.cpp" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
|
<Cursor>
|
||||||
|
<Cursor1 position="225" topLine="0" />
|
||||||
|
</Cursor>
|
||||||
|
</File>
|
||||||
|
</CodeBlocks_layout_file>
|
Загрузка…
Ссылка в новой задаче