Skip to content

Commit 2950234

Browse files
committed
fix kWayStateCoverageEqOracle.py for non strongly connected autoamta
1 parent 9e9edcd commit 2950234

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

aalpy/oracles/kWayStateCoverageEqOracle.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class KWayStateCoverageEqOracle(Oracle):
1010
random walk at the end.
1111
"""
1212

13-
def __init__(self, alphabet: list, sul: SUL, k=2, random_walk_len=20, method='combinations'):
13+
def __init__(self, alphabet: list, sul: SUL, k=2, random_walk_len=20, method='permutations'):
1414
"""
1515
1616
Args:
@@ -61,10 +61,23 @@ def find_cex(self, hypothesis):
6161

6262
index = 0
6363
path = comb[0].prefix
64+
65+
# in case of non-strongly connected automata test case might not be possible as a path between 2 states
66+
# might not exist
67+
possible_test_case = True
6468
while index < len(comb) - 1:
65-
path += hypothesis.get_shortest_path(comb[index], comb[index + 1])
69+
path_between_states = hypothesis.get_shortest_path(comb[index], comb[index + 1])
6670
index += 1
6771

72+
if not path_between_states:
73+
possible_test_case = False
74+
break
75+
76+
path += path_between_states
77+
78+
if possible_test_case is None:
79+
continue
80+
6881
path += tuple(choices(self.alphabet, k=self.random_walk_len))
6982

7083
self.reset_hyp_and_sul(hypothesis)

0 commit comments

Comments
 (0)