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

Python pyPathGroup.PathGroup类代码示例

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

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



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

示例1: test_var_used_in_z3_ignore

def test_var_used_in_z3_ignore():
    b = ast_parse.parse(test10).body
    p = Path(b,source=test10)
    pg = PathGroup(p)
    
    pg.explore()

    assert len(pg.completed) == 1

    s = pg.completed[0].state.copy()
    i = s.getVar('i')
    z3_obj = i.getZ3Object()

    # Not in here to begin with
    #assert not z3Helpers.varIsUsedInSolver(z3_obj,s.solver)
    assert not s.var_in_solver(z3_obj)

    # Now it will be in there
    s.addConstraint(z3_obj > 3)
    #assert z3Helpers.varIsUsedInSolver(z3_obj,s.solver)
    assert s.var_in_solver(z3_obj)

    # Now try ignoring it
    s.remove_constraints(z3_obj > 3)
    s.addConstraint(z3_obj > 3)
    assert not s.var_in_solver(z3_obj, ignore=[z3_obj > 3])
    assert not s.var_in_solver(z3_obj, ignore=z3_obj > 3)
开发者ID:Owlz,项目名称:pySym,代码行数:27,代码来源:test_state.py


示例2: test_function_pyState_BVS_ret_as_list

def test_function_pyState_BVS_ret_as_list():
    b = ast_parse.parse(test2).body
    p = Path(b,source=test2)
    pg = PathGroup(p)

    pg.explore()
    assert len(pg.completed) == 1
开发者ID:Owlz,项目名称:pySym,代码行数:7,代码来源:test_function_pyState_BVS.py


示例3: test_function_List_insert

def test_function_List_insert():
    b = ast_parse.parse(test1).body
    p = Path(b,source=test1)
    pg = PathGroup(p)

    pg.explore()

    # [5.15, 'c', 's\x00\x00\x00\x00\x00', 14, 'test', [1, 2, 4, 5], 1.234, 0, 1, 2, 3]
    assert len(pg.completed) == 1

    s = pg.completed[0].state.copy()

    l = s.getVar('l')
    
    assert type(l[0]) == Real
    assert type(l[1]) == String and len(l[1]) == 1
    assert type(l[2]) == String
    assert type(l[3]) == BitVec
    my_list = s.any_list(l)
    assert my_list[0] == 5.15
    assert my_list[1] == "c"
    assert my_list[2].startswith("s")
    assert my_list[3] == 14
    assert my_list[4] == "test"
    assert my_list[5] == [1,2,4,5]
    assert my_list[6] == 1.234
    assert my_list[7:] == [0,1,2,3]
开发者ID:Owlz,项目名称:pySym,代码行数:27,代码来源:test_function_List_insert.py


示例4: test_pyObjectManager_Char_is_unconstrained

def test_pyObjectManager_Char_is_unconstrained():
    b = ast_parse.parse(test2).body
    p = Path(b,source=test2)
    pg = PathGroup(p)

    pg.explore()
    assert len(pg.completed) == 1

    s = pg.completed[0].state.copy()
    c = s.getVar('s')[0]

    assert c.is_unconstrained
    
    # For now, this will add bounded int constraints to the solver...
    z3_obj = c.getZ3Object()
    # Those bounds should not count as constrained
    assert c.is_unconstrained

    # This constraint should eval to True, and not be added
    s.addConstraint(z3_obj > 5)
    assert c.is_unconstrained

    # Try with symbolic
    c = s.getVar('c2')[0]
    
    assert c.is_unconstrained
    
    # For now, this will add bounded int constraints to the solver...
    z3_obj = c.getZ3Object()
    # Those bounds should not count as constrained
    assert c.is_unconstrained

    # This should add a real constraint
    s.addConstraint(z3_obj > 5)
    assert c.is_constrained
开发者ID:Owlz,项目名称:pySym,代码行数:35,代码来源:test_pyObjectManager_Char.py


示例5: test_pyObjectManager_List_setitem

def test_pyObjectManager_List_setitem():
    b = ast_parse.parse(test1).body
    p = Path(b,source=test1)
    pg = PathGroup(p)

    pg.explore()
    assert len(pg.completed) == 1
    
    l = pg.completed[0].state.getVar('l')

    s = pg.completed[0].state

    # Base check
    assert l[1].count == 0
    assert type(l[1]) == Real

    # Assign an Int
    l[1] = Int(varName='x',ctx=0,state=s)
    assert l[1].count == 1
    assert type(l[1]) == Int

    # Assign back to Real
    l[1] = Real(varName='x',ctx=0,state=s)
    assert l[1].count == 2
    assert type(l[1]) == Real
    
    # Assign to BitVec
    l[1] = BitVec(varName='x',ctx=0,size=32,state=s)
    assert l[1].count == 3
    assert type(l[1]) == BitVec
    
    # Assign List
    l[1] = List(varName='x',ctx=0,state=s)
    #assert l[1].count == 4
    assert type(l[1]) == List
开发者ID:Owlz,项目名称:pySym,代码行数:35,代码来源:test_pyObjectManager_List.py


示例6: test_pySym_functionNestingTwo

def test_pySym_functionNestingTwo():
    # More intense nesting
    b = ast_parse.parse(test7).body
    p = Path(b,source=test7)
    pg = PathGroup(p)
    pg.explore()
    assert pg.completed[0].state.any_int('x') == 7
开发者ID:Owlz,项目名称:pySym,代码行数:7,代码来源:test_pyState_Call.py


示例7: test_pyState_Subscript_negative_slices

def test_pyState_Subscript_negative_slices():
    b = ast_parse.parse(test14).body
    p = Path(b,source=test14)
    pg = PathGroup(p)
    
    pg.explore()

    assert len(pg.completed) == 1
    
    s = pg.completed[0].state.copy()

    a = s.getVar('a')
    b = s.getVar('b')
    x = s.getVar('x')
    y = s.getVar('y')

    assert a.mustBe("test"[-1:])
    assert b.mustBe("test"[-3:-1])
    
    assert len(x) == 1
    assert x[0].mustBe(4)

    assert len(y) == 2
    assert y[0].mustBe(2)
    assert y[1].mustBe(3)
开发者ID:Owlz,项目名称:pySym,代码行数:25,代码来源:test_pyState_Subscript.py


示例8: test_pySym_complicated

def test_pySym_complicated():
    b = ast_parse.parse(test5).body
    p = Path(b,source=test5)
    pg = PathGroup(p)
    
    assert pg.explore(find=19)
    assert pg.found[0].state.any_int('z') == 26
开发者ID:Owlz,项目名称:pySym,代码行数:7,代码来源:test_pyState_While.py


示例9: test_pySym_nestedFor

def test_pySym_nestedFor():
    b = ast_parse.parse(test2).body
    p = Path(b,source=test2)
    pg = PathGroup(p)
    
    pg.explore()
    assert len(pg.completed) == 1
    assert pg.completed[0].state.any_int('out') == 290
开发者ID:Owlz,项目名称:pySym,代码行数:8,代码来源:test_pyState_For.py


示例10: test_function_String_rstrip_Char

def test_function_String_rstrip_Char():
    b = ast_parse.parse(test5).body
    p = Path(b,source=test5)
    pg = PathGroup(p)

    pg.explore()
    assert len(pg.completed) == 2
    assert set([p.state.any_str('x') for p in pg.completed]) == {"m","mee"}
开发者ID:Owlz,项目名称:pySym,代码行数:8,代码来源:test_function_String_rstrip.py


示例11: test_pySym_BinOp_BitStuff

def test_pySym_BinOp_BitStuff():
    b = ast_parse.parse(test5).body
    p = Path(b,source=test5)
    pg = PathGroup(p)
    pg.explore()
    
    assert len(pg.completed) == 1
    assert pg.completed[0].state.any_int('e') == 57065549561856
开发者ID:Owlz,项目名称:pySym,代码行数:8,代码来源:test_pyState_BinOp.py


示例12: test_function_List_append

def test_function_List_append():
    b = ast_parse.parse(test1).body
    p = Path(b,source=test1)
    pg = PathGroup(p)

    pg.explore()
    assert len(pg.completed) == 1
    assert pg.completed[0].state.any_list('l') == [1, 2.3, [1, 2.2, 3]]
开发者ID:Owlz,项目名称:pySym,代码行数:8,代码来源:test_function_List.py


示例13: test_function_List_append_statesplit

def test_function_List_append_statesplit():
    b = ast_parse.parse(test2).body
    p = Path(b,source=test2)
    pg = PathGroup(p)

    pg.explore()
    assert len(pg.completed) == 8
    assert set([p.state.any_list('l').pop() for p in pg.completed]) == set(range(8))
开发者ID:Owlz,项目名称:pySym,代码行数:8,代码来源:test_function_List.py


示例14: test_pyState_Subscript_AssignToVar

def test_pyState_Subscript_AssignToVar():
    b = ast_parse.parse(test1).body
    p = Path(b,source=test1)
    pg = PathGroup(p)
    
    pg.explore()
    assert len(pg.completed) == 1
    assert pg.completed[0].state.any_int('x') == 2
开发者ID:Owlz,项目名称:pySym,代码行数:8,代码来源:test_pyState_Subscript.py


示例15: test_pyState_Subscript_MultiDimentional

def test_pyState_Subscript_MultiDimentional():
    b = ast_parse.parse(test3).body
    p = Path(b,source=test3)
    pg = PathGroup(p)
    
    pg.explore()
    assert len(pg.completed) == 1
    assert pg.completed[0].state.any_int('x') == 4
开发者ID:Owlz,项目名称:pySym,代码行数:8,代码来源:test_pyState_Subscript.py


示例16: test_pyState_nestedSlice

def test_pyState_nestedSlice():
    b = ast_parse.parse(test11).body
    p = Path(b,source=test11)
    pg = PathGroup(p)
    
    pg.explore()
    assert len(pg.completed) == 1
    assert pg.completed[0].state.any_int('x') == 3
开发者ID:Owlz,项目名称:pySym,代码行数:8,代码来源:test_pyState_Subscript.py


示例17: test_function_ord_StateSplitting

def test_function_ord_StateSplitting():
    b = ast_parse.parse(test2).body
    p = Path(b,source=test2)
    pg = PathGroup(p)

    pg.explore()
    assert len(pg.completed) == 8
    assert set([p.state.any_int('x') for p in pg.completed]) == set([ord(str(x)) for x in range(8)])
开发者ID:Owlz,项目名称:pySym,代码行数:8,代码来源:test_function_ord.py


示例18: test_pySym_BinOp_StringMult

def test_pySym_BinOp_StringMult():
    b = ast_parse.parse(test14).body
    p = Path(b,source=test14)
    pg = PathGroup(p)
    pg.explore()

    assert len(pg.completed) == 1
    assert pg.completed[0].state.any_str('x') == "A" * 4
开发者ID:Owlz,项目名称:pySym,代码行数:8,代码来源:test_pyState_BinOp.py


示例19: test_pySym_BinOp_ListConcat

def test_pySym_BinOp_ListConcat():
    b = ast_parse.parse(test11).body
    p = Path(b,source=test11)
    pg = PathGroup(p)
    pg.explore()

    assert len(pg.completed) == 1
    assert pg.completed[0].state.any_list('l') == [1,2,3] + [4,5,6]
开发者ID:Owlz,项目名称:pySym,代码行数:8,代码来源:test_pyState_BinOp.py


示例20: test_pyState_GeneratorExp_General

def test_pyState_GeneratorExp_General():
    b = ast_parse.parse(test1).body
    p = Path(b,source=test1)
    pg = PathGroup(p)

    pg.explore()
    assert len(pg.completed) == 1
    assert pg.completed[0].state.any_str('x') == "".join(str(i) for i in range(5))
开发者ID:Owlz,项目名称:pySym,代码行数:8,代码来源:test_pyState_GeneratorExp.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python tuttle.core函数代码示例发布时间:2022-05-25
下一篇:
Python ast_parse.parse函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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