aboutsummaryrefslogtreecommitdiffstats
path: root/src/cli/timing_tests.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-10-02 23:58:11 -0400
committerJack Lloyd <[email protected]>2017-10-02 23:58:11 -0400
commit3e5b8d6afb44b378b7180ff7779809b646760eda (patch)
tree834eedd6c9f886b028715b03ce89f495d7f15d2e /src/cli/timing_tests.cpp
parent8c700bcf093b82a29e93f79932e4f1542818186a (diff)
Move block to its own function
Diffstat (limited to 'src/cli/timing_tests.cpp')
-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