Exemplo n.º 1
0
def afw_nonuniversality_check(afw: dict) -> bool:
    """ Checks if the language read by the input AFW is different
    from Σ∗, returning True/False.

    The afw is translated into a nfa and then its nonuniversality
    is checked.

    :param dict afw: input AFW.
    :return: *(bool)*, True if input afw is nonuniversal, False
             otherwise.
    """
    nfa = afw_to_nfa_conversion(afw)
    return NFA.nfa_nonuniversality_check(nfa)
Exemplo n.º 2
0
 def test_nfa_nonuniversality_check_side_effects(self):
     """ Tests that the function doesn't make any side effect
     on the input"""
     before = copy.deepcopy(self.nfa_nonuniversality_test_01)
     NFA.nfa_nonuniversality_check(self.nfa_nonuniversality_test_01)
     self.assertDictEqual(before, self.nfa_nonuniversality_test_01)
Exemplo n.º 3
0
 def test_nfa_nonuniversality_check_wrong_input(self):
     """ Tests the nonemptines of an input different from a
     dict object. [EXPECTED FAILURE] """
     self.assertFalse(NFA.nfa_nonuniversality_check(0))
Exemplo n.º 4
0
 def test_nfa_nonuniversality_check_wrong_dict(self):
     """ Tests the nonuniversality of an input dict different
     from a dict representing a nfa. [EXPECTED FAILURE] """
     self.assertFalse(NFA.nfa_nonuniversality_check({}))
Exemplo n.º 5
0
 def test_nfa_nonuniversality_check_empty(self):
     """ Tests the nonuniversality of an empty nfa """
     self.assertFalse(
         NFA.nfa_nonuniversality_check(self.nfa_nonuniversality_test_empty))
Exemplo n.º 6
0
 def test_nfa_nonuniversality_check_false(self):
     """ Tests a correct nfa nonuniversality check, where the
     nfa is universal """
     self.assertFalse(
         NFA.nfa_nonuniversality_check(self.nfa_nonuniversality_test_02))
Exemplo n.º 7
0
 def test_nfa_nonuniversality_check(self):
     """ Tests a correct nfa nonuniversality check """
     self.assertTrue(
         NFA.nfa_nonuniversality_check(self.nfa_nonuniversality_test_01))