本文整理汇总了Python中sut.newStatements函数的典型用法代码示例。如果您正苦于以下问题:Python newStatements函数的具体用法?Python newStatements怎么用?Python newStatements使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了newStatements函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: running_oh
def running_oh():
global actinos, elapsed, lastAddCoverage, median_even, median_odd
if len(sut.newBranches()) != set ([]):
print "ACTION:", list_actions[0]
for s in sut.newBranches():
print elapsed,len(sut.allBranches()),"New branch",s
if len(sut.newStatements())> 0:
print "ACTION:", list_actions[0]
for s in sut.newStatements():
print elapsed,len(sut.allStatements()),"New statement",s
old_test = list(sut.test())
store_new_test = sut.reduce(old_test,sut.coversStatements(sut.newStatements()))
sut.replay(old_test)
testBuffer.append(store_new_test)
currentStatementBuffer.append(set(sut.currStatements()))
lastAddCoverage = set(sut.currStatements())
for s in median_odd or median_even:
if s in sut.currStatements() and s not in lastAddCoverage:
print "find new path to lower coverstatements: ", s
testBuffer.append(list(sut.test()) )
currentStatementBuffer.append(set(sut.currStatements()))
lastAddCoverage = set(sut.currStatements() )
开发者ID:agroce,项目名称:cs569sp16,代码行数:28,代码来源:comparsion.py
示例2: tester
def tester():
global sut,act,n,test,para,lCovered,actNum,bugs,M,flag, filename
act = sut.randomEnabled(rgen)
flag = 0
n = sut.safely(act)
if running:
if sut.newBranches() != set([]):
for d in sut.newBranches():
print time.time() - start, len(sut.allBranches()),"New branch",d
if len(sut.newStatements()) > 0:
test = sut.state()
para = True
print sut.newStatements()
if (para == False):
if (lCovered != None):
if (lCovered in sut.currStatements()):
test = sut.state()
para = True
actNum += 1
if (n == 0):
bugs += 1
print "A failure has been found!", bugs
print sut.failure()
M = sut.reduce(sut.test(),sut.fails, True, True)
sut.prettyPrintTest(M)
print sut.failure()
filename ='failure%d.test'%bugs
sut.saveTest(M,filename)
flag = 1
开发者ID:agroce,项目名称:cs569sp16,代码行数:29,代码来源:tester2.py
示例3: randomAction
def randomAction():
global actCount, bugs, visited
act = sut.randomEnabled(rgen)
actCount += 1
ok = sut.safely(act)
elapsed = time.time() - start
if not ok:
bugs += 1
if FAULTS:
name = "failure"+str(bugs)+".test"
f = sut.test()
sut.saveTest(f,name)
else:
if RUNNING:
if sut.newBranches() != set([]):
print "ACTION:",act[0]
for d in sut.newBranches():
print elapsed,len(sut.allBranches()),"New branch",d
sawNew = True
else:
sawNew = False
if sut.newStatements() != set([]):
print "ACTION:",act[0]
for s in sut.newStatements():
print elapsed,len(sut.allStatements()),"New statement",s
sawNew = True
else:
sawNew = False
if len(sut.newStatements()) != 0:
visited.append((list(sut.test()), set(sut.currStatements())))
return ok
开发者ID:agroce,项目名称:cs569sp16,代码行数:34,代码来源:finaltester.py
示例4: newState
def newState():
global rgen,sut,collected_test,storedTest,action_cnt,bugfound
for i in xrange(0,DEPTH):
action = sut.randomEnabled(rgen)
no_bug_found = sut.safely(action)
if RUNNING:
if sut.newBranches() != set([]):
for d in sut.newBranches():
print time.time() - start,len(sut.allBranches()),"New Branches",d
if len(sut.newStatements()) > 0:
collected_test = sut.state()
storedTest = True
print "new statement:",sut.newStatements()
if (not storedTest) and (lst_coverage != None) and (lst_coverage in sut.currStatements()):
collected_test = sut.state()
storedTest = True
action_cnt += 1
if not no_bug_found:
bugfound += 1
print "A failure happened here."
rds = sut.reduce(sut.test(),sut.fails, True, True)
sut.prettyPrintTest(rds)
print sut.failure()
break
开发者ID:agroce,项目名称:cs569sp16,代码行数:25,代码来源:tester1.py
示例5: running_oh
def running_oh():
global actinos, elapsed
if len(sut.newStatements())> 0:
print "ACTION:", list_actions[0]
for s in sut.newStatements():
print "***NEW STATEMENT :", elapsed, len(sut.allStatements()), s
if len(sut.newBranches())> 0:
print "ACTION:", list_actions[0]
for s in sut.newBranches():
print elapsed, len(sut.allBranches()),"*** NEW branch: ",s
开发者ID:agroce,项目名称:cs569sp16,代码行数:10,代码来源:tester1.py
示例6: newStatement
def newStatement():
global lastAddCoverage
print "NEW STATEMENTS DISCOVERED",sut.newStatements()
oldTest = list(sut.test())
storeTest = sut.reduce(oldTest,sut.coversStatements(sut.newStatements()))
print "OLD LENGTH = ",len(oldTest),"NEW LENGTH = ",len(storeTest)
sut.replay(oldTest)
fullPool.append((storeTest, set(sut.currStatements())))
lastAddCoverage = set(sut.currStatements())
return
开发者ID:agroce,项目名称:cs569sp16,代码行数:10,代码来源:tester2.py
示例7: showRunning
def showRunning():
global sut, start
elapsed = time.time() - start
if sut.newBranches() != set([]):
for b in sut.newBranches():
print elapsed, len(sut.allBranches()), "New branch", b
if sut.newStatements() != set([]):
for s in sut.newStatements():
print elapsed, len(sut.allStatements()), "New statement", s
return
开发者ID:agroce,项目名称:cs569sp16,代码行数:10,代码来源:mytester.py
示例8: running_oh
def running_oh():
global actinos, elapsed
if len(sut.newStatements())> 0:
print "ACTION:", list_actions[0]
for s in sut.newStatements():
print elapsed,len(sut.allStatements()),"New statement",s
if len(sut.newBranches())> 0:
print "ACTION:", list_actions[0]
for s in sut.newBranches():
print elapsed,len(sut.allBranches()),"New branch",s
开发者ID:agroce,项目名称:cs569sp16,代码行数:10,代码来源:tester2.py
示例9: main
def main():
global config,rgen,actCount,failCount,ntests,coverageCount
parsed_args, parser = parse_args()
config = make_config(parsed_args, parser)
rgen = random.Random(config.seed)
actCount = 0
failCount = 0
coverageCount = {}
start = time.time()
ntests = 0
while True:
elapsed = time.time() - start
if elapsed > config.timeout:
print "STOPPING TEST DUE TO TIMEOUT, TERMINATED AT LENGTH",ntests
break
for i in xrange(0, config.depth):
sut.restart()
ntests += 1
for j in xrange(0, config.width):
act = sut.randomEnabled(rgen)
actCount += 1
ok = sut.safely(act)
if not ok:
failCount += 1
print "FOUND A FAILURE"
collectCoverage()
R = sut.reduce(sut.test(),sut.fails, True, True)
sut.prettyPrintTest(R)
print sut.failure()
break
if config.running:
if sut.newBranches() != set([]):
for b in sut.newBranches():
print time.time()-start, len(sut.allBranches()), "New branch", b
if sut.newStatements() != set([]):
for s in sut.newStatements():
print time.time()-start,len(sut.allStatements()),"New statement",s
collectCoverage()
if config.faults:
print "TOTAL FAULTS", failCount
if config.coverage:
print len(sut.allBranches()),"BRANCHES COVERED"
print len(sut.allStatements()),"STATEMENTS COVERED"
print "TOTAL ACTIONS",actCount
print "TOTAL RUNTIME",time.time()-start
开发者ID:Cianna,项目名称:cs569sp16,代码行数:54,代码来源:tester1.py
示例10: runtimeCoverage
def runtimeCoverage():
'Handler for generating running info on branch and statement coverage'
elapsed = time.time() - start
if sut.newBranches() != set([]):
for b in sut.newBranches():
print elapsed, len(sut.allBranches()),"New branch", b
if sut.newStatements() != set([]):
for s in sut.newStatements():
print elapsed, len(sut.newStatements()), "New statement", s
开发者ID:agroce,项目名称:cs569sp16,代码行数:11,代码来源:tester1.py
示例11: main
def main():
global config,rgen,actCount,failCount,ntests,fullPool
parsed_args, parser = parse_args()
config = make_config(parsed_args, parser)
rgen = random.Random(config.seed)
actCount = 0
failCount = 0
fullPool = []
start = time.time()
ntests = 0
while time.time() - start < config.timeout:
ntests += 1
sut.restart()
for d in xrange(0, config.depth):
act = sut.randomEnabled(rgen)
actCount += 1
ok = sut.safely(act)
expandPool()
if config.running:
if sut.newBranches() != set([]):
for b in sut.newBranches():
print time.time()-start, len(sut.allBranches()), "New branch", b
if sut.newStatements() != set([]):
for s in sut.newStatements():
print time.time()-start, len(sut.allStatements()),"New statement",s
if not ok:
failCount += 1
if config.faults:
failureHandle(failCount)
print "FOUND A FAILURE"
R = sut.reduce(sut.test(),sut.fails, True, True)
sut.prettyPrintTest(R)
print sut.failure()
sut.restart()
break
if time.time() - start > config.timeout:
print "STOPPING TEST DUE TO TIMEOUT, TERMINATED AT LENGTH",ntests
break
if config.faults:
print "TOTAL FAULTS", failCount
if config.coverage:
sut.internalReport()
print "TOTAL ACTIONS",actCount
print "TOTAL RUNTIME",time.time()-start
开发者ID:agroce,项目名称:cs569sp16,代码行数:53,代码来源:tester1.py
示例12: main
def main():
global start,BUDGET,sut,COVERAGE_REPORT,savedcoverage,rgen,storedTest,act,ok,savedcoverage,running,savedcoverage,Num,faults,foundbug,savedTestState
while time.time()-start < BUDGET:
sut.restart()
if (savedcoverage != None) and (rgen.random() > 0.3):
print "Processing"
sut.backtrack(savedcoverage)
storedTest = False
print "First: AVL tree"
for s in xrange(0,100):
act = sut.randomEnabled(rgen)
ok = sut.safely(act)
if running:
if sut.newBranches() != set([]):
## print "ACTION:",a[0],tryStutter
for d in sut.newBranches():
print time.time()-start,len(sut.allBranches()),"New branch",d
if len(sut.newStatements()) > 0:
savedcoverage = sut.state()
storedTest = True
if(running):
print "New Statement",sut.newStatements()
if (not storedTest) and (i != None) and (i in sut.currStatements()):
savedcoverage = sut.state()
storedTest = True
Num += 1
if(faults):
if not ok:
foundbug += 1
print "Failed"
print sut.failure()
print "REDUCE"
R = sut.reduce(sut.test(),sut.fails, True, True)
sut.prettyPrintTest(R)
print sut.failure()
filename = 'failure%d.test'%bugs_found
sut.saveTest(R,filename)
break
savedTestState = sut.state()
expandNewState()
if coverage:
sut.internalReport()
print foundbug,"FAILED"
print "ACTIVE",Num
print "RUNTIME",time.time()-start
开发者ID:agroce,项目名称:cs569sp16,代码行数:50,代码来源:tester2.py
示例13: Statement
def Statement():
global belowMid,lastAddCoverage
if len(sut.newStatements()) != 0:
oldTest = list(sut.test())
storeTest = sut.reduce(oldTest,sut.coversStatements(sut.newStatements()))
sut.replay(oldTest)
visited.append((storeTest, set(sut.currStatements())))
lastAddCoverage = set(sut.currStatements())
return
for s in belowMid:
if s in sut.currStatements() and s not in lastAddCoverage:
visited.append((list(sut.test()), set(sut.currStatements())))
lastAddCoverage = set(sut.currStatements())
return
开发者ID:Cianna,项目名称:cs569sp16,代码行数:14,代码来源:tester1.py
示例14: about_branch
def about_branch(running, action):
if running:
if sut.newBranches() != set([]):
print "ACTION:", action[0] # , tryStutter
for b in sut.newBranches():
print elapsed, len(sut.allBranches()), "New branch", b
sawNew = True
if sut.newStatements() != set([]):
print "ACTION:", a[0]
for s in sut.newStatements():
print elapsed, len(sut.allStatements()), "New statement", s
sawNew = True
else:
sawNew = False
开发者ID:agroce,项目名称:cs569sp16,代码行数:15,代码来源:finaltester.py
示例15: randomAction
def randomAction():
global actCount, bugs,newseq,currseq
act = sut.randomEnabled(R)
actCount += 1
ok = sut.safely(act)
if running:
if len(sut.newBranches()) > 0:
print "ACTION:",sut.randomEnabled(random.Random(seed))[0]
for b in sut.newBranches():
print time.time() - start, len(sut.allBranches()),"New branch",b
for s1 in sut.newStatements():
print time.time() - start, len(sut.allStatements()),"New statement",s1
if not ok:
bugs += 1
print "FOUND A FAILURE"
if faults:
f = sut.reduce(sut.test(), sut.fails, True, True)
sut.prettyPrintTest(f)
currseq.append((f,set(sut.currStatements())))
print("SHOW FAULT")
file = 'failure' + str(actCount) + '.test'
sut.saveTest(sut.test(), file)
sut.restart()
print sut.failure()
return ok
开发者ID:agroce,项目名称:cs569sp16,代码行数:29,代码来源:tester2.py
示例16: action
def action():
global actCount, bugs, failPool
act = sut.randomEnabled(rgen)
actCount += 1
ok = sut.safely(act)
if running == 1:
if len(sut.newBranches()) > 0:
print "ACTION:", act[0]
for b in sut.newBranches():
print time.time() - start, len(sut.allBranches()), "New branch", b
for s in sut.newStatements():
print time.time() - start, len(sut.allStatements()),"New statement",s
if not ok:
if faults:
bugs += 1
print "FOUND A FAILURE"
print sut.failure()
print "REDUCING"
failPool.append(sut.test())
collectCoverage()
R = sut.reduce(sut.test(),sut.fails, True, True)
sut.prettyPrintTest(R)
print sut.failure()
fname="failure" + str(bugs) + ".test"
sut.saveTest(sut.test(),fname)
errorSeqs.append(sut.currStatements())
sut.restart()
else:
expand()
return ok
开发者ID:agroce,项目名称:cs569sp16,代码行数:32,代码来源:tester2.py
示例17: branchFun
def branchFun(running,possible,elapsed):
if running:
if sut.newBranches() != set([]):
print "ACTION:",possible[0]
for b in sut.newBranches():
print elapsed,len(sut.allBranches()),"New branch",b
sawNew = True
else:
sawNew = False
if sut.newStatements() != set([]):
print "ACTION:",possible[0]
for s in sut.newStatements():
print elapsed,len(sut.allStatements()),"New statement",s
sawNew = True
else:
sawNew = False
开发者ID:agroce,项目名称:cs569sp16,代码行数:16,代码来源:tester1.py
示例18: randomAction
def randomAction():
global actCount, bugs, coverageCount, belowMean,lastAddCoverage
act = sut.randomEnabled(random.Random())
actCount += 1
ok = sut.safely(act)
if running:
if len(sut.newBranches()) > 0:
print "ACTION:",sut.randomEnabled(random.Random(seed))[0]
for b in sut.newBranches():
print time.time() - start, len(sut.allBranches()),"New branch",b
for s1 in sut.newStatements():
print time.time() - start, len(sut.allStatements()),"New statement",b
if not ok or not sut.check():
bugs += 1
print "FOUND A FAILURE"
if faults:
print("SHOW FAULT")
print sut.failure()
error.append(sut.test())
R = sut.reduce(sut.test(),sut.fails, True, True)
sut.prettyPrintTest(R)
print sut.failure()
sut.restart()
return ok
开发者ID:agroce,项目名称:cs569sp16,代码行数:28,代码来源:tester1.py
示例19: expandPool
def expandPool():
global belowMean,lastAddCoverage
if len(sut.newStatements()) != 0:
print "NEW STATEMENTS DISCOVERED",sut.newStatements()
oldTest = list(sut.test())
storeTest = sut.reduce(oldTest,sut.coversStatements(sut.newStatements()))
print "OLD LENGTH = ",len(oldTest),"NEW LENGTH = ",len(storeTest)
sut.replay(oldTest)
fullPool.append((storeTest, set(sut.currStatements())))
lastAddCoverage = set(sut.currStatements())
return
for s in belowMean:
if s in sut.currStatements() and s not in lastAddCoverage:
print "NEW PATH TO LOW COVERAGE STATEMENT",s
fullPool.append((list(sut.test()), set(sut.currStatements())))
lastAddCoverage = set(sut.currStatements())
return
开发者ID:Cianna,项目名称:cs569sp16,代码行数:17,代码来源:newCover.py
示例20: expand
def expand():
global lastAddCoverage
nonErrorSeqs.append(sut.currStatements())
if len(sut.newStatements()) != 0:
print "NEW STATEMENTS DISCOVERED",sut.newStatements()
newSeq = sut.newStatements()
if (newSeq in nonErrorSeqs or newSeq in errorSeqs):
action()
#sut.restart()
else:
oldTest = list(sut.test())
storeTest = sut.reduce(oldTest,sut.coversStatements(newSeq))
print "OLD LENGTH = ",len(oldTest),"NEW LENGTH = ",len(storeTest)
sut.replay(oldTest)
fullPool.append((storeTest, set(sut.currStatements())))
lastAddCoverage = set(sut.currStatements())
return
开发者ID:agroce,项目名称:cs569sp16,代码行数:17,代码来源:tester2.py
注:本文中的sut.newStatements函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论