Skip to content

Commit

Permalink
Merge pull request #27 from joelbeedle/26-bug-queue-specification-in-…
Browse files Browse the repository at this point in the history
…headless-mode-issue-with-user-input

Add file extension check when specifying a queue in headless mode - Fixes Issue #26
  • Loading branch information
joelbeedle authored Jul 31, 2024
2 parents 2a42337 + c0e9935 commit 1b8a339
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/core/test_queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,14 @@ bool TestQueue::save(const std::string& filename) {
}

bool TestQueue::load(const std::string& filename) {
std::ifstream file(filename + ".json");
std::string full_filename = filename;

// Check if the filename already ends with ".json"
if (filename.size() < 5 || filename.substr(filename.size() - 5) != ".json") {
full_filename += ".json";
}

std::ifstream file(full_filename);
if (file.is_open()) {
nlohmann::json j;
file >> j;
Expand All @@ -82,6 +89,7 @@ bool TestQueue::load(const std::string& filename) {
}
return false;
}

void TestQueue::addPermutedTests(
const TestConfig& base, const std::vector<std::vector<float>>& permutations,
const std::vector<std::string>& parameter_names) {
Expand Down

0 comments on commit 1b8a339

Please sign in to comment.