• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python typing.type_check_bmch函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中typing.type_check_bmch函数的典型用法代码示例。如果您正苦于以下问题:Python type_check_bmch函数的具体用法?Python type_check_bmch怎么用?Python type_check_bmch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了type_check_bmch函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_examples_knights_knaves

    def test_examples_knights_knaves(self):
        string ='''
        MACHINE KnightsKnaves
        /* Puzzle from Smullyan:
        Knights: always tell the truth
        Knaves: always lie

        1: A says: “B is a knave or C is a knave”
        2: B says “A is a knight”

        What are A & B & C?
        */
        CONSTANTS A,B,C
        PROPERTIES
        A:BOOL & B:BOOL & C:BOOL /* TRUE if they are a Knight */
        &
        (A=TRUE <=> (B=FALSE or C=FALSE)) &
        (B=TRUE <=> A=TRUE)
        END'''
        # Build AST
        string_to_file(string, file_name)
        ast_string = file_to_AST_str(file_name)
        root = str_ast_to_python_ast(ast_string)

        # Test
        env = Environment()
        mch = parse_ast(root, env)
        type_check_bmch(root, env, mch) # also checks all included, seen, used and extend
        arbitrary_init_machine(root, env, mch) # search for CONSTANTS which make PROPERTIES True
        assert env.get_value("A") == True
        assert env.get_value("B") == True
        assert env.get_value("C") == False
开发者ID:hhu-stups,项目名称:pyB,代码行数:32,代码来源:test_mch_load.py


示例2: test_genAST_sub_let

    def test_genAST_sub_let(self):
        string = '''
        MACHINE Test
        VARIABLES SumR, DifferenceR, Var1, Var2
        INVARIANT SumR:NAT & DifferenceR:NAT & Var1:NAT & Var2:NAT
        INITIALISATION BEGIN Var1:=2; Var2:=3;
                        LET r1, r2 BE
                        r1 = (Var1 + Var2) / 2 &
                        r2 = (Var1 - Var2) / 2
                        IN
                        SumR := r1 + r2 ||
                        DifferenceR := r1 - r2
                        END

                    END
        END'''
        string_to_file(string, file_name)
        ast_string = file_to_AST_str(file_name)
        root = str_ast_to_python_ast(ast_string)

        # Test
        env = Environment()
        env._min_int = -1
        env._max_int = 5
        mch = parse_ast(root, env)
        type_check_bmch(root, env, mch) # also checks all included, seen, used and extend
        arbitrary_init_machine(root, env, mch) # init VARIABLES and eval INVARIANT
        assert isinstance(root.children[2], AInvariantMachineClause)
        assert interpret(root.children[2], env)
        assert env.get_value("SumR")==1
        assert env.get_value("DifferenceR")==3
        assert env.get_value("Var1")==2
        assert env.get_value("Var2")==3
开发者ID:hhu-stups,项目名称:pyB,代码行数:33,代码来源:test_interp_substitutions.py


示例3: test_examples_simple_bakery1

    def test_examples_simple_bakery1(self):
        string ='''
        MACHINE Bakery1

        ABSTRACT_VARIABLES  p1, p2, y1, y2

        INVARIANT  
                p1:0..2 & p2:0..2 & y1:NATURAL & y2:NATURAL &
                (p1=2 => p2<2) &
                (p2=2 => p1<2) 

        INITIALISATION  p1,p2,y1,y2 := 0,0,0,0

        END'''

        # Build AST
        string_to_file(string, file_name)
        ast_string = file_to_AST_str(file_name)
        root = str_ast_to_python_ast(ast_string)

        # Test
        env = Environment()
        mch = parse_ast(root, env)
        type_check_bmch(root, env, mch) # also checks all included, seen, used and extend
        arbitrary_init_machine(root, env, mch) # init VARIABLES and eval INVARIANT
        assert isinstance(root.children[2], AInvariantMachineClause)
        assert interpret(root.children[2], env)
开发者ID:hhu-stups,项目名称:pyB,代码行数:27,代码来源:test_mch_load.py


示例4: test_genAST_sub_any

    def test_genAST_sub_any(self):
        string = '''
        MACHINE Test
        VARIABLES xx
        INVARIANT xx:NAT 
        INITIALISATION BEGIN xx:=1;
                        ANY r1, r2 WHERE
                        r1 : NAT &
                        r2 : NAT &
                        r1*r1 + r2*r2 = 25
                        THEN
                        xx := r1 + r2
                        END
                    END
        END'''
        string_to_file(string, file_name)
        ast_string = file_to_AST_str(file_name)
        root = str_ast_to_python_ast(ast_string)

        # Test
        env = Environment()
        env._min_int = -1
        env._max_int = 5
        mch = parse_ast(root, env)
        type_check_bmch(root, env, mch) # also checks all included, seen, used and extend
        arbitrary_init_machine(root, env, mch) # init VARIABLES and eval INVARIANT
        assert isinstance(root.children[2], AInvariantMachineClause)
        assert interpret(root.children[2], env)
        assert env.get_value("xx")==5 or env.get_value("xx")==7 # 3+4 or 5+0
开发者ID:hhu-stups,项目名称:pyB,代码行数:29,代码来源:test_interp_substitutions.py


示例5: test_examples_simple_testset

    def test_examples_simple_testset(self):
        string = '''
        MACHINE TestSet
        SETS
        ID={aa, bb, cc}

        CONSTANTS iv
        PROPERTIES
        iv:ID
        VARIABLES xx
        INVARIANT
        xx:ID
        INITIALISATION xx:=iv
        END'''

        # Build AST
        string_to_file(string, file_name)
        ast_string = file_to_AST_str(file_name)
        root = str_ast_to_python_ast(ast_string)

        # Test
        env = Environment()
        mch = parse_ast(root, env)
        type_check_bmch(root, env, mch) # also checks all included, seen, used and extend
        arbitrary_init_machine(root, env, mch) # init VARIABLES and eval INVARIANT
        assert isinstance(root.children[5], AInvariantMachineClause)
        assert interpret(root.children[5], env)
开发者ID:hhu-stups,项目名称:pyB,代码行数:27,代码来源:test_mch_load.py


示例6: test_genAST_sub_case3

    def test_genAST_sub_case3(self):
        # Build AST
        string = '''
        MACHINE Test
        VARIABLES xx
        INVARIANT xx:NAT 
        INITIALISATION 
            BEGIN xx:=1; 
                CASE 1+1 OF 
                EITHER 4,5,6 THEN xx:=2 
                OR 7,8,9 THEN xx:=3
                ELSE xx:=4 END 
                END
            END
        END'''
        string_to_file(string, file_name)
        ast_string = file_to_AST_str(file_name)
        root = str_ast_to_python_ast(ast_string)

        # Test
        env = Environment()
        mch = parse_ast(root, env)
        type_check_bmch(root, env, mch) # also checks all included, seen, used and extend
        arbitrary_init_machine(root, env, mch) # init VARIABLES and eval INVARIANT
        assert isinstance(root.children[2], AInvariantMachineClause)
        assert interpret(root.children[2], env)
        assert env.get_value("xx")==4
开发者ID:hhu-stups,项目名称:pyB,代码行数:27,代码来源:test_interp_substitutions.py


示例7: test_genAST_sub_var

    def test_genAST_sub_var(self):
        # Build AST
        string = '''
        MACHINE Test
        VARIABLES xx
        INVARIANT xx:NAT 
        INITIALISATION BEGIN xx:=1; 
                        VAR varLoc1, varLoc2 IN
                        varLoc1 := xx + 1 ;
                        varLoc2 := 2 * varLoc1 ;
                        xx := varLoc2
                        END
                    END
        END'''
        string_to_file(string, file_name)
        ast_string = file_to_AST_str(file_name)
        root = str_ast_to_python_ast(ast_string)

        # Test
        env = Environment()
        env._min_int = -1
        env._max_int = 5
        mch = parse_ast(root, env)
        type_check_bmch(root, env, mch) # also checks all included, seen, used and extend
        arbitrary_init_machine(root, env, mch) # init VARIABLES and eval INVARIANT
        assert isinstance(root.children[2], AInvariantMachineClause)
        assert interpret(root.children[2], env)
        assert env.get_value("xx")==4
开发者ID:hhu-stups,项目名称:pyB,代码行数:28,代码来源:test_interp_substitutions.py


示例8: test_genAST_subst_def2

    def test_genAST_subst_def2(self):
        string='''
        MACHINE Test
        VARIABLES z, b, x
        INVARIANT x:NAT & z:NAT & b:BOOL
        INITIALISATION x:=2 ; Assign(x+1, z) ; Assign(TRUE, b)
        DEFINITIONS Assign(Expr, VarName) == VarName := Expr;
        END'''
        string_to_file(string, file_name)
        ast_string = file_to_AST_str(file_name)
        root = str_ast_to_python_ast(ast_string)

        #Test
        env = Environment()
        dh = DefinitionHandler(env, str_ast_to_python_ast)
        dh.repl_defs(root)
        mch = parse_ast(root, env)
        type_check_bmch(root, env, mch) # also checks all included, seen, used and extend
        arbitrary_init_machine(root, env, mch)# init VARIABLES and eval INVARIANT
        invariant = root.children[2]
        assert isinstance(invariant, AInvariantMachineClause)
        assert interpret(invariant, env)
        assert env.get_value("z")==3
        assert env.get_value("b")==True
        assert env.get_value("x")==2
开发者ID:hhu-stups,项目名称:pyB,代码行数:25,代码来源:test_interp_definitions.py


示例9: test_types_complex_union_empty_set

 def test_types_complex_union_empty_set(self):          
     string = '''MACHINE Test
     SETS U = {g, h, i}; R={j,k,l}        
     CONSTANTS gg
     PROPERTIES
     gg : U +-> (R >+> R) & gg = { g |-> {j |-> l}, h |-> {k |-> k}, i |-> {}} 
     END'''
     # Build AST
     string_to_file(string, file_name)
     ast_string = file_to_AST_str(file_name)
     root = str_ast_to_python_ast(ast_string)       
  
     # Test
     env = Environment()
     mch = parse_ast(root, env)
     type_check_bmch(root, env, mch)
     assert isinstance(get_type_by_name(env, "gg"), PowerSetType)
     assert isinstance(get_type_by_name(env, "gg").data, CartType)
     assert isinstance(get_type_by_name(env, "gg").data.left, PowerSetType)
     assert isinstance(get_type_by_name(env, "gg").data.right, PowerSetType)
     assert isinstance(get_type_by_name(env, "gg").data.left.data, SetType)
     assert get_type_by_name(env, "gg").data.left.data.name =="U"
     image_type = get_type_by_name(env, "gg").data.right.data.data
     assert isinstance(image_type, CartType)
     assert isinstance(image_type.left.data, SetType)
     assert isinstance(image_type.right.data, SetType)
     assert image_type.left.data.name=="R"
     assert image_type.right.data.name=="R"
开发者ID:hhu-stups,项目名称:pyB,代码行数:28,代码来源:test_types_relations.py


示例10: test_examples_no_query_op

    def test_examples_no_query_op(self):
        string = '''
        MACHINE Query

        VARIABLES xx

        INVARIANT  xx:NAT

        INITIALISATION xx:=1
        
        OPERATIONS
        
        no_query = xx:=2

        END'''

        # Build AST
        string_to_file(string, file_name)
        ast_string = file_to_AST_str(file_name)
        root = str_ast_to_python_ast(ast_string)

        # Test
        env = Environment()
        mch = parse_ast(root, env)
        type_check_bmch(root, env, mch) # also checks all included, seen, used and extend
        arbitrary_init_machine(root, env, mch) # init VARIABLES and eval INVARIANT
        assert isinstance(root.children[2], AInvariantMachineClause)
        assert interpret(root.children[2], env)
开发者ID:hhu-stups,项目名称:pyB,代码行数:28,代码来源:test_mch_load.py


示例11: test_genAST_para_def

    def test_genAST_para_def(self):
        # Build AST
        string ='''
        MACHINE Test
        VARIABLES z
        INVARIANT z:MyType 
        INITIALISATION z:= Expr(2)
        DEFINITIONS
        Expr(X) == 1+X;
        MyType == NAT;
        END'''
        string_to_file(string, file_name)
        ast_string = file_to_AST_str(file_name)
        root = str_ast_to_python_ast(ast_string)

        # Test
        env = Environment()
        dh = DefinitionHandler(env, str_ast_to_python_ast)
        dh.repl_defs(root)
        mch = parse_ast(root, env)
        type_check_bmch(root, env, mch) # also checks all included, seen, used and extend
        arbitrary_init_machine(root, env, mch) # init VARIABLES and eval INVARIANT
        invariant = root.children[2]
        assert isinstance(invariant, AInvariantMachineClause)
        assert interpret(invariant, env)
        assert env.get_value("z")==3
开发者ID:hhu-stups,项目名称:pyB,代码行数:26,代码来源:test_interp_definitions.py


示例12: test_library_length

    def test_library_length(self):
        string = '''
        MACHINE LibraryStrings
        CONSTANTS length
        PROPERTIES
          /* compute the length of a string */
          length: STRING --> INTEGER &
          length = %x.(x:STRING|STRING_LENGTH(x)) 
        DEFINITIONS
          STRING_LENGTH(x) == length(x);
          EXTERNAL_FUNCTION_STRING_LENGTH == STRING --> INTEGER;
        ASSERTIONS
          length("abc") = 3;
          length("") = 0;
          length("hello") = 5
        END
        '''
        # Build AST
        string_to_file(string, file_name)
        ast_string = file_to_AST_str(file_name)
        root = str_ast_to_python_ast(ast_string)

        # Test
        env = Environment()
        dh = DefinitionHandler(env, str_ast_to_python_ast)                                   
        dh.repl_defs(root)
        mch = parse_ast(root, env)
        type_check_bmch(root, env, mch)
        assert isinstance(get_type_by_name(env, "length"), PowerSetType)
        assert isinstance(get_type_by_name(env, "length").data, CartType)
        assert isinstance(get_type_by_name(env, "length").data.left.data, StringType)
        assert isinstance(get_type_by_name(env, "length").data.right.data, IntegerType)
        arbitrary_init_machine(root, env, mch) # init VARIABLES and eval INVARIANT
        assert isinstance(root.children[4], AAssertionsMachineClause)
        interpret(root.children[4], env)
开发者ID:hhu-stups,项目名称:pyB,代码行数:35,代码来源:test_library.py


示例13: test_simple_model_checking2

    def test_simple_model_checking2(self):
        path = "examples/rpython_performance/SigmaLoop.mch"
        if os.name=='nt':
            path="examples/rpython_performance\SigmaLoop"
        ast_string = file_to_AST_str(path)
        root = str_ast_to_python_ast(ast_string)

        # Test
        env = Environment()
        env._max_int = 2**31
        mch = parse_ast(root, env)
        type_check_bmch(root, env, mch) # also checks all included, seen, used and extend 
        
        solution_file_read = False
        bstates = set_up_constants(root, env, mch, solution_file_read)
        assert len(bstates)==0 # no setup possible
        bstates = exec_initialisation(root, env, mch, solution_file_read)
        assert len(bstates)==1 # only one possibility (sum:=45)  
        assert len(env.state_space.seen_states)==0        
        assert isinstance(bstates[0], BState)
        env.state_space.set_current_state(bstates[0])
        assert len(env.state_space.seen_states)==1
        invatiant = root.children[2]
        assert isinstance(invatiant, AInvariantMachineClause)
        assert interpret(invatiant, env)
        assert len(env.state_space.stack)==2 
        next_states = calc_next_states(env, mch)
        assert len(next_states)==1
        assert len(env.state_space.stack)==2 # init and empty setup
        assert env.get_value('sum')==55
        env.state_space.set_current_state(next_states[0].bstate) 
        assert env.get_value('sum')==55  
开发者ID:hhu-stups,项目名称:pyB,代码行数:32,代码来源:test_model_checker.py


示例14: test_set_up_constants_nondeterministic2

 def test_set_up_constants_nondeterministic2(self):        
     string = '''
     MACHINE         Param2
     PROPERTIES      num:NAT & num <4
     CONSTANTS       num
     VARIABLES       xx
     INVARIANT       xx:NAT
     INITIALISATION  xx:=num
     END'''
     # Build AST
     string_to_file(string, file_name)
     ast_string = file_to_AST_str(file_name)
     root = str_ast_to_python_ast(ast_string)
     
     # Test
     env = Environment()
     env._min_int = -16
     env._max_int = 16
     mch = parse_ast(root, env)
     type_check_bmch(root, env, mch)
     bstates = set_up_constants(root, env, mch)
     assert len(bstates)==4
     for bstate in bstates:
         env.state_space.add_state(bstate)
         num = bstate.get_value("num", mch)
         assert num in [0,1,2,3]
         env.state_space.undo()
开发者ID:hhu-stups,项目名称:pyB,代码行数:27,代码来源:test_mch_load.py


示例15: test_CartesianProductOverride

    def test_CartesianProductOverride(self):
        string = '''
        MACHINE CartesianProductOverride
        SETS
         S;T
        CONSTANTS a,b,c
        PROPERTIES
         /* Rule Hypotheses */
         a :  S <-> T &
         dom(a) = b &
         c <: T & 
        
         /* Rule Conclusion */
         not( a <+ b * c = b * c )
        END'''
        # Build AST
        string_to_file(string, file_name)
        ast_string = file_to_AST_str(file_name)
        root = str_ast_to_python_ast(ast_string)

        # Test
        env = Environment()
        mch = parse_ast(root, env)
        type_check_bmch(root, env, mch) # also checks all included, seen, used and extend
        arbitrary_init_machine(root, env, mch) # eval CONSTANTS and PROPERTIES
        assert isinstance(root.children[3], APropertiesMachineClause)
        assert interpret(root.children[3], env)
开发者ID:hhu-stups,项目名称:pyB,代码行数:27,代码来源:test_mch_load.py


示例16: test_genAST_sub_let2

    def test_genAST_sub_let2(self):
        string = '''
        MACHINE Test
        VARIABLES X, Y
        INVARIANT X:NAT & Y:NAT
        INITIALISATION BEGIN X:=10; 
                        LET r1, X BE
                    X  = 6 &
                        r1 = X / 2 
                        IN
                        Y := r1
                        END

                    END
        END'''
        string_to_file(string, file_name)
        ast_string = file_to_AST_str(file_name)
        root = str_ast_to_python_ast(ast_string)
        
        # Test
        env = Environment()
        env._min_int = -1
        env._max_int = 5
        mch = parse_ast(root, env)
        type_check_bmch(root, env, mch) # also checks all included, seen, used and extend
        arbitrary_init_machine(root, env, mch) # init VARIABLES and eval INVARIANT
        assert isinstance(root.children[2], AInvariantMachineClause)
        assert interpret(root.children[2], env)
        assert env.get_value("X")==10
        assert env.get_value("Y")==3
开发者ID:hhu-stups,项目名称:pyB,代码行数:30,代码来源:test_interp_substitutions.py


示例17: test_simple_model_checking0

    def test_simple_model_checking0(self):
        path = "examples/rpython_performance/Lift2.mch"
        if os.name=='nt':
            path="examples\rpython_performance\Lift2"
        ast_string = file_to_AST_str(path)
        root = str_ast_to_python_ast(ast_string)

        # Test
        env = Environment()
        mch = parse_ast(root, env)
        type_check_bmch(root, env, mch) # also checks all included, seen, used and extend
        env._max_int = 2**31
        solution_file_read = False
        bstates = set_up_constants(root, env, mch, solution_file_read)
        assert len(bstates)==0 # no setup possible
        bstates = exec_initialisation(root, env, mch, solution_file_read)
        assert len(bstates)==1 # only one possibility (floor:=4)
        assert len(env.state_space.seen_states)==0        
        assert isinstance(bstates[0], BState)
        env.state_space.set_current_state(bstates[0])
        assert len(env.state_space.seen_states)==1
        invatiant = root.children[2]
        assert isinstance(invatiant, AInvariantMachineClause)
        assert interpret(invatiant, env)
        assert len(env.state_space.stack)==2 
        next_states = calc_next_states(env, mch)
        assert len(next_states)==2
        assert len(env.state_space.stack)==2 # init and empty setup
        assert env.get_value('floor')==4
        env.state_space.undo()
        assert len(env.state_space.stack)==1 # setup
        assert len(env.state_space.seen_states)==1
        for n_state in next_states:
            bstate = n_state.bstate
            assert isinstance(bstate, BState)
            if not env.state_space.is_seen_state(bstate):
                env.state_space.set_current_state(bstate)
        assert len(env.state_space.stack)==3 # dec, inc, setup
        assert len(env.state_space.seen_states)==3
        assert env.get_value('floor')==3 or env.get_value('floor')==5
        
        # TODO: Bstate needs refactoring. 
        # - Remove init state
        # - dont map None to values if parsing unit is no machine
        # - check empty on stack length 0
        # model checking loop
        while not env.state_space.empty():
            assert interpret(invatiant, env) 
            next_states = calc_next_states(env, mch)
            env.state_space.undo()
            for n_state in next_states:
                bstate = n_state.bstate
                if not env.state_space.is_seen_state(bstate):
                    env.state_space.set_current_state(bstate)  
        assert len(env.state_space.seen_states)==100
开发者ID:hhu-stups,项目名称:pyB,代码行数:55,代码来源:test_model_checker.py


示例18: test_abrial_book_page83_fail

    def test_abrial_book_page83_fail(self):
        # added some 42 in the assertions clause
        string = """
        MACHINE BBook_Page83
        /* Translation of example from page 83 of Abrial's B-Book */
        CONSTANTS p,w,q,f,g,s,t,h,k
        PROPERTIES
        p = {3|->5, 3|->9, 6|->3, 9|->2} &
        w = {1, 2, 3} &
        p[w] = {5,9} &
        q = {2|->7, 3|->4, 5|->1, 9|->5} &
        q <+ p = {3|->5, 3|->9, 6|->3, 9|->2, 2|->7, 5|->1} &
        f = {8|->10, 7|->11, 2|->11, 6|->12} &
        g = {1|->20, 7|->20, 2|->21, 1|->22} &
        f >< g = {(7|->(11|->20)), (2|->(11|->21))} &
        s = {1,4} &
        t = {2,3} &
        prj1(s,t) = {((1|->2)|->1),((1|->3)|->1),((4|->2)|->4),((4|->3)|->4)} &
        prj2(s,t) = {((1|->2)|->2),((1|->3)|->3),((4|->2)|->2),((4|->3)|->3)} &
        h = {1|->11, 4|->12} &
        k = {2|->21, 7|->22} &
        (h||k) = { (1,2) |-> (11,21), (1,7) |-> (11,22),
                    (4,2) |-> (12,21), (4,7) |-> (12,22) }
        ASSERTIONS
        p[w] = {5,42};
        q <+ p = {(3|->5),(3|->9),(6|->3),(9|->2),(2|->7),(5|->42)};
        f >< g = {(7|->(11|->20)), (2|->(11|->42))};
        prj1(s,t) = {((1|->2)|->1),((1|->3)|->1),((4|->2)|->4),((4|->3)|->42)};
        prj2(s,t) = {((1|->2)|->2),((1|->3)|->3),((4|->2)|->2),((4|->3)|->42)};
        (h||k) = { (1,2) |-> (11,21), (1,7) |-> (11,22),
                    (4,2) |-> (12,21), (4,7) |-> (12,42) }
        END"""

        # Build AST
        string_to_file(string, file_name)
        ast_string = file_to_AST_str(file_name)
        root = str_ast_to_python_ast(ast_string)

        # Test
        env = Environment()
        mch = parse_ast(root, env)
        type_check_bmch(root, env, mch)  # also checks all included, seen, used and extend
        arbitrary_init_machine(root, env, mch)  # eval CONSTANTS and PROPERTIES
        # eval ASSERTIONS (again)
        assert isinstance(root.children[3], AAssertionsMachineClause)
        assert not interpret(root.children[3].children[0], env)
        assert not interpret(root.children[3].children[1], env)
        assert not interpret(root.children[3].children[2], env)
        assert not interpret(root.children[3].children[3], env)
        assert not interpret(root.children[3].children[4], env)
        assert not interpret(root.children[3].children[5], env)
开发者ID:hhu-stups,项目名称:pyB,代码行数:51,代码来源:test_mch_assertions.py


示例19: test_only_invariant

 def test_only_invariant(self):
     string = '''
     MACHINE Only
     INVARIANT 4=4   
     END'''
     # Build AST
     string_to_file(string, file_name)
     ast_string = file_to_AST_str(file_name)
     root = str_ast_to_python_ast(ast_string)
     
     # Test
     env = Environment()
     mch = parse_ast(root, env)
     type_check_bmch(root, env, mch)
     arbitrary_init_machine(root, env, mch) 
开发者ID:hhu-stups,项目名称:pyB,代码行数:15,代码来源:test_mch_load.py


示例20: test_types_complex_function_image8

 def test_types_complex_function_image8(self):
     string = '''
     MACHINE         Test
     VARIABLES       f,x,y,z
     INVARIANT       f(x,y,z)=42 & x=1 & y = (1,1) & z=1
     INITIALISATION  f:={((1,(1,1)),1,42),((1,(1,1)),1,42)} ; x:=1; z:=1 ; y:=(1,1)
     END'''
     string_to_file(string, file_name)
     ast_string = file_to_AST_str(file_name)
     root = str_ast_to_python_ast(ast_string)
     
     # Test
     env = Environment()
     mch = parse_ast(root, env)
     type_check_bmch(root, env, mch)    
开发者ID:hhu-stups,项目名称:pyB,代码行数:15,代码来源:test_types_relations.py



注:本文中的typing.type_check_bmch函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python typing.typevar函数代码示例发布时间:2022-05-27
下一篇:
Python typing.get_type_hints函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap