diff --git a/NEWS b/NEWS index e97201bc0..6b03d9811 100644 --- a/NEWS +++ b/NEWS @@ -78,7 +78,9 @@ New in spot 2.6.3.dev (not yet released) Bugs fixed: - The pair of acc_cond::mark_t returned by - acc_code::used_inf_fin_sets() was not usable in Python. + acc_code::used_inf_fin_sets(), and the pair (bool, + vector_rs_pairs) by acc_cond::is_rabin_like() and + acc_cond::is_streett_like() were not usable in Python. New in spot 2.6.3 (2018-10-17) diff --git a/python/spot/impl.i b/python/spot/impl.i index 05c08f77f..44a4d008b 100644 --- a/python/spot/impl.i +++ b/python/spot/impl.i @@ -475,7 +475,9 @@ namespace std { %feature("flatnested") spot::acc_cond::acc_code; %feature("flatnested") spot::acc_cond::rs_pair; %apply bool* OUTPUT {bool& max, bool& odd}; -%template(vector_rs_pair) std::vector; +namespace std { + %template(vector_rs_pair) vector; +} %apply std::vector &OUTPUT {std::vector& pairs} %include %template(pair_bool_mark) std::pair; diff --git a/tests/python/setacc.py b/tests/python/setacc.py index e3bb62111..48a7e66e9 100644 --- a/tests/python/setacc.py +++ b/tests/python/setacc.py @@ -36,3 +36,22 @@ assert fin == [0] (inf, fin) = spot.acc_code("(Fin(0)|Inf(1))&Fin(2)&Inf(0)").used_inf_fin_sets() assert inf == [0,1] assert fin == [0,2] + +# is_rabin_like() returns (bool, [(inf, fin), ...]) +(b, v) = spot.acc_cond("(Fin(0)&Inf(1))|(Fin(2)&Inf(0))").is_rabin_like() +assert b == True +assert len(v) == 2 +assert v[0].fin == [0] +assert v[0].inf == [1] +assert v[1].fin == [2] +assert v[1].inf == [0] +(b, v) = spot.acc_cond("(Fin(0)|Inf(1))&(Fin(2)|Inf(0))").is_rabin_like() +assert b == False +assert len(v) == 0 +(b, v) = spot.acc_cond("(Fin(0)|Inf(1))&(Fin(2)|Inf(0))").is_streett_like() +assert b == True +assert len(v) == 2 +assert v[0].fin == [0] +assert v[0].inf == [1] +assert v[1].fin == [2] +assert v[1].inf == [0]