From 43d426aaae535aa3338289b6d9d465c557d45b78 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Mon, 2 Jul 2018 18:36:56 +0200 Subject: [PATCH] complement: improve code coverage * spot/twaalgos/complement.cc: removed unused code * tests/python/except.py: test for exception raised --- spot/twaalgos/complement.cc | 18 ++---------------- tests/python/except.py | 7 +++++++ 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/spot/twaalgos/complement.cc b/spot/twaalgos/complement.cc index d90fe90ec..c61b422c7 100644 --- a/spot/twaalgos/complement.cc +++ b/spot/twaalgos/complement.cc @@ -310,22 +310,8 @@ namespace spot } } else - { - auto it = succs.begin(); - while (it != succs.end()) - { - // remove state if it should stay in s or c - if ((*it)[t.dst] == ncsb_s - || (*it)[t.dst] == ncsb_c) - { - std::iter_swap(it, succs.end() - 1); - succs.pop_back(); - continue; - } - (*it)[t.dst] = ncsb_n; - ++it; - } - } + for (auto& succ: succs) + succ[t.dst] = ncsb_n; } } diff --git a/tests/python/except.py b/tests/python/except.py index fa637334f..0d4819d10 100644 --- a/tests/python/except.py +++ b/tests/python/except.py @@ -152,3 +152,10 @@ except RuntimeError as e: assert "bit index is out of bounds" in str(e) else: report_missing_exception() + +try: + spot.complement_semidet(spot.translate('Gb R a', 'ba')) +except RuntimeError as e: + assert "requires a semi-deterministic input" in str(e) +else: + report_missing_exception()