mirror of
https://github.com/jorenchik/mdemory.git
synced 2026-03-22 00:26:21 +00:00
improved the non-functional test files and finished the test source
files
This commit is contained in:
100022
src/test/testFiles/100000_long_lines.mdem
Normal file
100022
src/test/testFiles/100000_long_lines.mdem
Normal file
File diff suppressed because it is too large
Load Diff
100022
src/test/testFiles/100000_short_lines.mdem
Normal file
100022
src/test/testFiles/100000_short_lines.mdem
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -31,13 +31,12 @@ double timePerformance(time_point start, time_point end, int numIterations) {
|
|||||||
<< averageTime
|
<< averageTime
|
||||||
<< " sekundes iterācijā\n";
|
<< " sekundes iterācijā\n";
|
||||||
auto averagePerSecond = (100000 / averageTime);
|
auto averagePerSecond = (100000 / averageTime);
|
||||||
std::cout << "Jautājumi sekundē(" << numIterations << " iterācijas): "
|
std::cout << "Rindas sekundē (" << numIterations << " iterācijas): "
|
||||||
<< averagePerSecond << std::endl;
|
<< averagePerSecond << std::endl;
|
||||||
return averagePerSecond;
|
return averagePerSecond;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST(PerformanceTest, Measure100000SimpleQuestions) {
|
void testInputPerformance(std::string filePath, int comparisonNum) {
|
||||||
const std::string filePath = testFileDirectory + "/100000_simple_questions.mdem";
|
|
||||||
const std::string contents = readFileContents(filePath);
|
const std::string contents = readFileContents(filePath);
|
||||||
const int numIterations = 15;
|
const int numIterations = 15;
|
||||||
|
|
||||||
@@ -47,11 +46,11 @@ TEST(PerformanceTest, Measure100000SimpleQuestions) {
|
|||||||
}
|
}
|
||||||
auto end = std::chrono::high_resolution_clock::now();
|
auto end = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
ASSERT_GE(timePerformance(start, end, numIterations), 24999);
|
std::cout << "Sagaidāms rindu skaits sekundē: " << comparisonNum << std::endl;
|
||||||
|
ASSERT_GE(timePerformance(start, end, numIterations), comparisonNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(PerformanceTest, MeasureOutput100000SimpleQuestions) {
|
void testOutputPerformance(std::string filePath, int comparisonNum) {
|
||||||
const std::string filePath = testFileDirectory + "/100000_simple_questions.mdem";
|
|
||||||
const std::string contents = readFileContents(filePath);
|
const std::string contents = readFileContents(filePath);
|
||||||
const int numIterations = 15;
|
const int numIterations = 15;
|
||||||
|
|
||||||
@@ -62,7 +61,23 @@ TEST(PerformanceTest, MeasureOutput100000SimpleQuestions) {
|
|||||||
}
|
}
|
||||||
auto end = std::chrono::high_resolution_clock::now();
|
auto end = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
ASSERT_GE(timePerformance(start, end, numIterations), 100000);
|
std::cout << "Sagaidāms rindu skaits sekundē: " << comparisonNum << std::endl;
|
||||||
|
ASSERT_GE(timePerformance(start, end, numIterations), comparisonNum);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(PerformanceTest, MeasureInput100000ShortLines) {
|
||||||
|
const std::string filePath = testFileDirectory + "/100000_short_lines.mdem";
|
||||||
|
testInputPerformance(filePath, 50000);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(PerformanceTest, MeasureInput100000LongLines) {
|
||||||
|
const std::string filePath = testFileDirectory + "/100000_long_lines.mdem";
|
||||||
|
testInputPerformance(filePath, 25000);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(PerformanceTest, MeasureOutput100000ShortLines) {
|
||||||
|
const std::string filePath = testFileDirectory + "/100000_long_lines.mdem";
|
||||||
|
testOutputPerformance(filePath, 50000);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
|||||||
Reference in New Issue
Block a user