def test_equal_atoms(self): test = parse_next_expression("test") test = nsnode.find_node(test.type, nsnode.car(test), nsnode.cdr(test)) same = parse_next_expression("test") same = nsnode.find_node(same.type, nsnode.car(same), nsnode.cdr(same)) other = parse_next_expression("testx") other = nsnode.find_node(other.type, nsnode.car(other), nsnode.cdr(other)) self.assertTrue(nsnode.node_equal(test, same) != 0) self.assertTrue(nsnode.node_equal(test, other) == 0)
def test_equal_expressions(self): test = parse_next_expression("test.r") test = find_hierarchy(test) nsnode.free_node(test) same = parse_next_expression("test.r") same = find_hierarchy(same) nsnode.free_node(same) other = parse_next_expression("testx.rx") other = find_hierarchy(other) nsnode.free_node(other) self.assertTrue(nsnode.node_equal(test, same) != 0) self.assertTrue(nsnode.node_equal(test, other) == 0)
def test_parsing_error(self): try: expr = parse_next_expression("a == 0") except NuSMVParsingError as err: self.assertEqual(len(err.errors), 1) self.assertEqual(str(err), "Error at line 1, token '=': syntax error")
def test_set(self): test = parse_next_expression("{a, b, c}") test = find_hierarchy(test) nsnode.free_node(test) print("UNION:", nsparser.UNION) print("ATOM:", nsparser.ATOM) self.show_types(test)
def _get_epistemic_trans(variable): """Return a new TRANS next(variable) = variable""" transexpr = "next({0}) = {0}".format(variable) return parse_next_expression(transexpr)
def test_contexted_expression(self): parsed = parse_next_expression("test") self.assertEqual(parsed.type, nsparser.ATOM)