Unittest для индивидуального задания вариант 4
Этот коммит содержится в:
3
unittest/histogram_internal.h
Обычный файл
3
unittest/histogram_internal.h
Обычный файл
@@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
#include <vector>
|
||||
void find_minmax(const std::vector<double>& numbers, double& min, double& max);
|
||||
2
unittest/svg_internal.h
Обычный файл
2
unittest/svg_internal.h
Обычный файл
@@ -0,0 +1,2 @@
|
||||
#pragma once
|
||||
int GetProc(int number_cnt, int bin);
|
||||
@@ -4,7 +4,8 @@
|
||||
#define DOCTEST_CONFIG_NO_MULTITHREADING
|
||||
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
|
||||
#include "doctest.h"
|
||||
#include "../sem2_lab1/histogram_internal.h"
|
||||
#include "histogram_internal.h"
|
||||
#include "svg_internal.h"
|
||||
|
||||
TEST_CASE("distinct positive numbers") {
|
||||
double min = 0;
|
||||
@@ -44,6 +45,35 @@ TEST_CASE("equal items") {
|
||||
CHECK(max == -6);
|
||||
|
||||
}
|
||||
|
||||
TEST_CASE("Test SVG normal") {
|
||||
int numb_cnt = 100;
|
||||
int bin = 44;
|
||||
int Proc = GetProc(numb_cnt, bin);
|
||||
CHECK(Proc == 44);
|
||||
}
|
||||
|
||||
TEST_CASE("Test SVG zero") {
|
||||
int numb_cnt = 0;
|
||||
int bin = 33;
|
||||
int Proc = GetProc(numb_cnt, bin);
|
||||
CHECK(Proc == 0);
|
||||
}
|
||||
|
||||
TEST_CASE("Test SVG less zero 1") {
|
||||
int numb_cnt = -23;
|
||||
int bin = 55;
|
||||
int Proc = GetProc(numb_cnt, bin);
|
||||
CHECK(Proc == 0);
|
||||
}
|
||||
|
||||
TEST_CASE("Test SVG less zero 2") {
|
||||
int numb_cnt = 100;
|
||||
int bin = -23;
|
||||
int Proc = GetProc(numb_cnt, bin);
|
||||
CHECK(Proc == 0);
|
||||
}
|
||||
|
||||
// Запуск программы: CTRL+F5 или меню "Отладка" > "Запуск без отладки"
|
||||
// Отладка программы: F5 или меню "Отладка" > "Запустить отладку"
|
||||
|
||||
|
||||
@@ -128,11 +128,13 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\sem2_lab1\histogram.cpp" />
|
||||
<ClCompile Include="..\sem2_lab1\svg.cpp" />
|
||||
<ClCompile Include="unittest.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\sem2_lab1\histogram_internal.h" />
|
||||
<ClInclude Include="doctest.h" />
|
||||
<ClInclude Include="histogram_internal.h" />
|
||||
<ClInclude Include="svg_internal.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
||||
@@ -21,12 +21,18 @@
|
||||
<ClCompile Include="..\sem2_lab1\histogram.cpp">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\sem2_lab1\svg.cpp">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\sem2_lab1\histogram_internal.h">
|
||||
<ClInclude Include="doctest.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="doctest.h">
|
||||
<ClInclude Include="svg_internal.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="histogram_internal.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
|
||||
Ссылка в новой задаче
Block a user