Skip to content

Commit

Permalink
fix(nfa): Fix error message to use the expected parameter name
Browse files Browse the repository at this point in the history
  • Loading branch information
Adda0 committed Nov 21, 2024
1 parent 4482b91 commit 5ca1e6e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/nfa/complement.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Nfa mata::nfa::complement(const Nfa& aut, const mata::utils::OrdVector<mata::Sym
decltype(algorithms::complement_classical)* algo = algorithms::complement_classical;
if (!haskey(params, "algorithm")) {
throw std::runtime_error(std::to_string(__func__) +
" requires setting the \"algo\" key in the \"params\" argument; "
" requires setting the \"algorithm\" key in the \"params\" argument; "
"received: " + std::to_string(params));
}

Expand All @@ -43,7 +43,7 @@ Nfa mata::nfa::complement(const Nfa& aut, const mata::utils::OrdVector<mata::Sym
else if ("brzozowski" == str_algo) { algo = algorithms::complement_brzozowski; }
else {
throw std::runtime_error(std::to_string(__func__) +
" received an unknown value of the \"algo\" key: " + str_algo);
" received an unknown value of the \"algorithm\" key: " + str_algo);
}

return algo(aut, symbols);
Expand Down
4 changes: 2 additions & 2 deletions src/nfa/inclusion.cc
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ namespace {
AlgoType set_algorithm(const std::string &function_name, const ParameterMap &params) {
if (!haskey(params, "algorithm")) {
throw std::runtime_error(function_name +
" requires setting the \"algo\" key in the \"params\" argument; "
" requires setting the \"algorithm\" key in the \"params\" argument; "
"received: " + std::to_string(params));
}

Expand All @@ -269,7 +269,7 @@ namespace {
algo = algorithms::is_included_antichains;
} else {
throw std::runtime_error(std::to_string(__func__) +
" received an unknown value of the \"algo\" key: " + str_algo);
" received an unknown value of the \"algorithm\" key: " + str_algo);
}

return algo;
Expand Down
4 changes: 2 additions & 2 deletions src/nfa/operations.cc
Original file line number Diff line number Diff line change
Expand Up @@ -936,15 +936,15 @@ Nfa mata::nfa::minimize(
decltype(algorithms::minimize_brzozowski)* algo = algorithms::minimize_brzozowski;
if (!haskey(params, "algorithm")) {
throw std::runtime_error(std::to_string(__func__) +
" requires setting the \"algo\" key in the \"params\" argument; "
" requires setting the \"algorithm\" key in the \"params\" argument; "
"received: " + std::to_string(params));
}

const std::string& str_algo = params.at("algorithm");
if ("brzozowski" == str_algo) { /* default */ }
else {
throw std::runtime_error(std::to_string(__func__) +
" received an unknown value of the \"algo\" key: " + str_algo);
" received an unknown value of the \"algorithm\" key: " + str_algo);
}

return algo(aut);
Expand Down
4 changes: 2 additions & 2 deletions src/nfa/universal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ bool mata::nfa::Nfa::is_universal(const Alphabet& alphabet, Run* cex, const Para
decltype(algorithms::is_universal_naive)* algo = algorithms::is_universal_naive;
if (!haskey(params, "algorithm")) {
throw std::runtime_error(std::to_string(__func__) +
" requires setting the \"algo\" key in the \"params\" argument; "
" requires setting the \"algorithm\" key in the \"params\" argument; "
"received: " + std::to_string(params));
}

Expand All @@ -146,7 +146,7 @@ bool mata::nfa::Nfa::is_universal(const Alphabet& alphabet, Run* cex, const Para
algo = algorithms::is_universal_antichains;
} else {
throw std::runtime_error(std::to_string(__func__) +
" received an unknown value of the \"algo\" key: " + str_algo);
" received an unknown value of the \"algorithm\" key: " + str_algo);
}
return algo(*this, alphabet, cex);
} // is_universal()
Expand Down
8 changes: 4 additions & 4 deletions tests/nfa/nfa.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1874,7 +1874,7 @@ TEST_CASE("mata::nfa::is_universal()")
OnTheFlyAlphabet alph{};

CHECK_THROWS_WITH(aut.is_universal(alph, params),
Catch::Matchers::ContainsSubstring("requires setting the \"algo\" key"));
Catch::Matchers::ContainsSubstring("requires setting the \"algorithm\" key"));
}

SECTION("wrong parameters 2")
Expand Down Expand Up @@ -2209,7 +2209,7 @@ q10 67 q5
OnTheFlyAlphabet alph{};

CHECK_THROWS_WITH(is_included(smaller, bigger, &alph, params),
Catch::Matchers::ContainsSubstring("requires setting the \"algo\" key"));
Catch::Matchers::ContainsSubstring("requires setting the \"algorithm\" key"));
CHECK_NOTHROW(is_included(smaller, bigger, &alph));
}

Expand Down Expand Up @@ -2371,9 +2371,9 @@ TEST_CASE("mata::nfa::are_equivalent")
OnTheFlyAlphabet alph{};

CHECK_THROWS_WITH(are_equivalent(smaller, bigger, &alph, params),
Catch::Matchers::ContainsSubstring("requires setting the \"algo\" key"));
Catch::Matchers::ContainsSubstring("requires setting the \"algorithm\" key"));
CHECK_THROWS_WITH(are_equivalent(smaller, bigger, params),
Catch::Matchers::ContainsSubstring("requires setting the \"algo\" key"));
Catch::Matchers::ContainsSubstring("requires setting the \"algorithm\" key"));
CHECK_NOTHROW(are_equivalent(smaller, bigger));
}

Expand Down

0 comments on commit 5ca1e6e

Please sign in to comment.