acc: improve diagnostics for algorithms that use too many colors
* spot/twa/acc.hh (acc_cond::mark_t): Diagnose mark_t with set numbers that are too larges. * tests/python/except.py: Adjust. * tests/core/acc.cc: Remove most of asserts, as those can be disabled, and adjust expected exception.
This commit is contained in:
parent
f31864488b
commit
0e681ed060
3 changed files with 21 additions and 7 deletions
|
|
@ -102,7 +102,10 @@ namespace spot
|
|||
: mark_t(_value_t::zero())
|
||||
{
|
||||
for (iterator i = begin; i != end; ++i)
|
||||
set(*i);
|
||||
if (SPOT_LIKELY(*i < SPOT_MAX_ACCSETS))
|
||||
set(*i);
|
||||
else
|
||||
report_too_many_sets();
|
||||
}
|
||||
|
||||
/// Create a mark_t from a list of set numbers.
|
||||
|
|
|
|||
|
|
@ -53,6 +53,17 @@ static void print(const std::vector<std::vector<int>>& res)
|
|||
}
|
||||
}
|
||||
|
||||
static void expect(const std::exception& e, const char* prefix)
|
||||
{
|
||||
if (std::strncmp(e.what(), "Too many acceptance sets used.",
|
||||
strlen(prefix)))
|
||||
{
|
||||
std::cerr << "exception: " << e.what() << '\n';
|
||||
std::cerr << "expected: " << prefix << '\n';
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
spot::acc_cond ac(4);
|
||||
|
|
@ -189,7 +200,7 @@ int main()
|
|||
}
|
||||
catch (const std::runtime_error& e)
|
||||
{
|
||||
assert(!std::strncmp(e.what(), "Too many acceptance sets used.", 30));
|
||||
expect(e, "Too many acceptance sets used.");
|
||||
}
|
||||
|
||||
#if SPOT_DEBUG
|
||||
|
|
@ -204,7 +215,7 @@ int main()
|
|||
}
|
||||
catch (const std::runtime_error& e)
|
||||
{
|
||||
assert(!std::strncmp(e.what(), "Too many acceptance sets used.", 30));
|
||||
expect(e, "Too many acceptance sets used.");
|
||||
}
|
||||
|
||||
try
|
||||
|
|
@ -214,17 +225,17 @@ int main()
|
|||
}
|
||||
catch (const std::runtime_error& e)
|
||||
{
|
||||
assert(!std::strncmp(e.what(), "Too many acceptance sets used.", 30));
|
||||
expect(e, "Too many acceptance sets used.");
|
||||
}
|
||||
#endif
|
||||
try
|
||||
{
|
||||
spot::acc_cond::mark_t m{spot::acc_cond::mark_t::max_accsets()};
|
||||
}
|
||||
catch (const std::runtime_error& e)
|
||||
{
|
||||
assert(!std::strcmp(e.what(), "bit index is out of bounds"));
|
||||
expect(e, "Too many acceptance sets used.");
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ else:
|
|||
try:
|
||||
m = spot.mark_t([0, n, 1])
|
||||
except RuntimeError as e:
|
||||
assert "bit index is out of bounds" in str(e)
|
||||
assert "Too many acceptance sets used. The limit is" in str(e)
|
||||
else:
|
||||
report_missing_exception()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue