test: библиотека для unit-тестирования

ShchegolikhYR 2 месяцев назад
Родитель d21b2f37d6
Сommit 795b706d73

Двоичные данные
.DS_Store поставляемый

Двоичный файл не отображается.

@ -32,6 +32,7 @@
52E197562D5F35A1004F8E3E /* Gistogramma */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Gistogramma; sourceTree = BUILT_PRODUCTS_DIR; }; 52E197562D5F35A1004F8E3E /* Gistogramma */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Gistogramma; sourceTree = BUILT_PRODUCTS_DIR; };
52FD91E32DC3AA580037B82C /* text.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = text.hpp; sourceTree = "<group>"; }; 52FD91E32DC3AA580037B82C /* text.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = text.hpp; sourceTree = "<group>"; };
52FD91E42DC3AA580037B82C /* text.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = text.cpp; sourceTree = "<group>"; }; 52FD91E42DC3AA580037B82C /* text.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = text.cpp; sourceTree = "<group>"; };
52FD91E62DC3AD020037B82C /* histogram_internal.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = histogram_internal.hpp; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
@ -52,6 +53,7 @@
52FD91E42DC3AA580037B82C /* text.cpp */, 52FD91E42DC3AA580037B82C /* text.cpp */,
52D010C32DC397980091060B /* histogram.hpp */, 52D010C32DC397980091060B /* histogram.hpp */,
52D010C42DC397980091060B /* histogram.cpp */, 52D010C42DC397980091060B /* histogram.cpp */,
52FD91E62DC3AD020037B82C /* histogram_internal.hpp */,
523FBF7D2DA909BA0044A741 /* main.cpp */, 523FBF7D2DA909BA0044A741 /* main.cpp */,
52E197572D5F35A1004F8E3E /* Products */, 52E197572D5F35A1004F8E3E /* Products */,
); );

Двоичный файл не отображается.

@ -110,8 +110,8 @@
filePath = "main.cpp" filePath = "main.cpp"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "86" startingLineNumber = "34"
endingLineNumber = "86" endingLineNumber = "34"
landmarkName = "main()" landmarkName = "main()"
landmarkType = "9"> landmarkType = "9">
</BreakpointContent> </BreakpointContent>

Разница между файлами не показана из-за своего большого размера Загрузить разницу

@ -3,7 +3,7 @@
using namespace std; using namespace std;
static void find_minmax(const vector<double>& numbers, double& minimum, double& maximum) { void find_minmax(const vector<double>& numbers, double& minimum, double& maximum) {
minimum = numbers[0]; minimum = numbers[0];
maximum = numbers[0]; maximum = numbers[0];
for (auto i : numbers) { for (auto i : numbers) {

@ -0,0 +1,7 @@
#ifndef histogram_internal_h
#define histogram_internal_h
#include <vector>
void find_minmax(const std::vector<double>& numbers, double& minimum, double& maximum);
#endif /* histogram_internal_h */

@ -29,58 +29,6 @@ Input input_data() {
return in; return in;
} }
//void find_minmax(const vector<double>& numbers, double& minimum, double& maximum) {
// minimum = numbers[0];
// for (int i : numbers) {
// if (i < minimum) minimum = i;
// }
// maximum = numbers[0];
// for (int i : numbers) {
// if (i > maximum) maximum = i;
// }
//}
//vector<size_t> make_histogram(const vector<double>& numbers, size_t& bin_count) {
// vector <size_t> baskets;
// baskets.resize(bin_count);
//
// double basket_max;
// double basket_min;
// double basket_size;
//
// find_minmax(numbers, basket_min, basket_max);
// basket_size = (basket_max - basket_min) / bin_count;
// for (int i = 0; i < bin_count; i++) {
// for (int j = 0; j < numbers.size(); j++) {
// if ((numbers[j] >= (basket_min + i * basket_size) and numbers[j] < (basket_min + (i + 1) * basket_size)) or (i == bin_count - 1 and numbers[j] == basket_max)) {
// baskets[i]++;
// }
// }
// }
// return baskets;
//}
//void show_histogram_text(const vector<size_t>& baskets) {
// const size_t screen_width = 80;
// const size_t max_asterisk = screen_width - 3 - 1;
// cout.precision(4);
// size_t baskets_max_count;
//
// baskets_max_count = baskets[0];
// for (size_t i : baskets) {
// if (i > baskets_max_count) baskets_max_count = i;
// }
// for (int i = 0; i < baskets.size(); i++) {
// size_t height = baskets[i];
// if (baskets_max_count > max_asterisk) {
// height = max_asterisk * (static_cast<double>(baskets[i]) / baskets_max_count);
// }
// cout << baskets[i] << "|";
// for (int j = 0; j < height; j++) cout << "*";
// cout << endl;
// }
//}
int main () { int main () {
auto in = input_data(); auto in = input_data();
auto bins = make_histogram(in.numbers, in.bin_count); auto bins = make_histogram(in.numbers, in.bin_count);

@ -0,0 +1,70 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 77;
objects = {
/* Begin PBXGroup section */
52FD91EE2DC3AEC90037B82C = {
isa = PBXGroup;
children = (
);
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXProject section */
52FD91EF2DC3AEC90037B82C /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = 1;
LastUpgradeCheck = 1620;
};
buildConfigurationList = 52FD91F22DC3AEC90037B82C /* Build configuration list for PBXProject "unittest" */;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 52FD91EE2DC3AEC90037B82C;
minimizedProjectReferenceProxies = 1;
preferredProjectObjectVersion = 77;
projectDirPath = "";
projectRoot = "";
targets = (
);
};
/* End PBXProject section */
/* Begin XCBuildConfiguration section */
52FD91F32DC3AEC90037B82C /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
};
name = Debug;
};
52FD91F42DC3AEC90037B82C /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
52FD91F22DC3AEC90037B82C /* Build configuration list for PBXProject "unittest" */ = {
isa = XCConfigurationList;
buildConfigurations = (
52FD91F32DC3AEC90037B82C /* Debug */,
52FD91F42DC3AEC90037B82C /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 52FD91EF2DC3AEC90037B82C /* Project object */;
}

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>

Двоичный файл не отображается.
Загрузка…
Отмена
Сохранить