diff --git a/spot/gen/automata.cc b/spot/gen/automata.cc index ed2fdde9e..39e83f507 100644 --- a/spot/gen/automata.cc +++ b/spot/gen/automata.cc @@ -29,6 +29,8 @@ namespace spot twa_graph_ptr ks_cobuchi(unsigned n) { + if (n == 0) + throw std::runtime_error("ks_cobuchi() expects a positive argument"); // the alphabet has four letters: // i, s (for sigma), p (for pi), h (for hash) // we encode this four letters alphabet thanks to two AP a and b @@ -86,4 +88,3 @@ namespace spot } } } - diff --git a/spot/gen/automata.hh b/spot/gen/automata.hh index 8570e61fd..b4d5a0057 100644 --- a/spot/gen/automata.hh +++ b/spot/gen/automata.hh @@ -41,8 +41,9 @@ namespace spot /// year={2015}, /// organization={Springer} /// } + /// + /// \pre n>0 SPOT_API twa_graph_ptr ks_cobuchi(unsigned n); } } - diff --git a/tests/core/genaut.test b/tests/core/genaut.test index 2660e942f..b6c08e714 100644 --- a/tests/core/genaut.test +++ b/tests/core/genaut.test @@ -36,3 +36,6 @@ cat >expected <err && exit 1 +grep positive err