aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cli/timing_tests.cpp38
1 files changed, 21 insertions, 17 deletions
diff --git a/src/cli/timing_tests.cpp b/src/cli/timing_tests.cpp
index 3ea82c746..9600f2a5e 100644
--- a/src/cli/timing_tests.cpp
+++ b/src/cli/timing_tests.cpp
@@ -365,23 +365,7 @@ class Timing_Test_Command : public Command
filename = test_data_dir + "/" + test_type + ".vec";
}
- std::vector<std::string> lines;
-
- {
- std::ifstream infile(filename);
- if(infile.good() == false)
- {
- throw CLI_Error("Error reading test data from '" + filename + "'");
- }
- std::string line;
- while(std::getline(infile, line))
- {
- if(line.size() > 0 && line.at(0) != '#')
- {
- lines.push_back(line);
- }
- }
- }
+ std::vector<std::string> lines = read_testdata(filename);
std::vector<std::vector<ticks>> results = test->execute_evaluation(lines, warmup_runs, measurement_runs);
@@ -398,6 +382,26 @@ class Timing_Test_Command : public Command
output() << oss.str();
}
private:
+
+ std::vector<std::string> read_testdata(const std::string& filename)
+ {
+ std::vector<std::string> lines;
+ std::ifstream infile(filename);
+ if(infile.good() == false)
+ {
+ throw CLI_Error("Error reading test data from '" + filename + "'");
+ }
+ std::string line;
+ while(std::getline(infile, line))
+ {
+ if(line.size() > 0 && line.at(0) != '#')
+ {
+ lines.push_back(line);
+ }
+ }
+ return lines;
+ }
+
std::unique_ptr<Timing_Test> lookup_timing_test(const std::string& test_type);
std::string help_text() const override