def get_non_crashing_cover_set(fsm: MealyMachine): scs = get_state_cover_set(fsm) non_crashing = set() for seq in scs: fsm.reset() output = fsm.process_input(seq) if (output is not None) and ("error" not in output): non_crashing.add(seq) return non_crashing
def get_dset_outputs(fsm, dset): states = fsm.get_states() outputs = {} for state in states: mm = MealyMachine(state) out = [] for dseq in dset: out.append(mm.process_input(dseq)) mm.reset() outputs[state] = tuple(out.copy()) return outputs
def get_dset_outputs(fsm, dset): states = fsm.get_states() outputs = {} for state in states: if isinstance(fsm, MealyMachine): mm = MealyMachine(state) elif isinstance(fsm, DFA): mm = DFA(state, fsm.accepting_states) out = [] for dseq in dset: out.append(mm.process_input(dseq)) mm.reset() outputs[state] = tuple(out.copy()) return outputs