}
else if (opType == "/test-reset") {
auto it = j.find("type");
- if (it != j.end() && it->is_string()) {
+ std::string type = (it != j.end() && it->is_string()) ? *it : "soft";
- auto itI = j.find("id");
- int id = (itI != j.end() && itI->is_number_integer()) ? itI->get<int>() : -2; // default is: apply to all the tests
+ auto itI = j.find("id");
+ int id = (itI != j.end() && itI->is_number_integer()) ? itI->get<int>() : -1; // default is: apply to all the tests
- if ((*it == "soft") || (*it == "hard")) {
- result = eop.test__reset(response, (*it == "soft"), id);
- }
- else
- response += "invalid 'type' string field (allowed: soft|hard)";
+ if ((type == "soft") || (type == "hard")) {
+ result = eop.test__reset(response, (type == "soft"), id);
}
else
- response += "missing 'type' string field";
+ response += "invalid 'type' string field (allowed: [soft]|hard)";
}
else if (opType == "/test-repeats") {
auto it = j.find("amount");
}
else if (opType == "/test-junit") {
auto it = j.find("targetFile");
- if (it != j.end() && it->is_string())
- result = eop.test__junit(response, *it);
- else
- response += "missing 'targetFile' string field";
+ std::string targetFile = (it != j.end() && it->is_string()) ? *it : "/tmp/junit.xml";
+ result = eop.test__junit(response, targetFile);
}
else if (opType == "/test-summary-counts") {
result = eop.test__summary_counts(response);
else
response += "invalid 'action' string field (allowed: enable|disable)";
}
- else if ((opType == "/test-report-hex")||(opType == "/test-dump_stdout")) {
+ else if ((opType == "/test-report-hex")||(opType == "/test-dump-stdout")) {
auto itA = j.find("action");
std::string action = (itA != j.end() && itA->is_string()) ? *itA : "enable"; // default is: enable