Question: import re def good ( input , output ) : searchObj = re . search ( r ' ^ checkCode [ 1 - 9 ]
import re
def goodinput output:
searchObj research rcheckCode ddAZAZazddddd$ input, reM
if searchObj:
if output "true":
print Error on input input we got 'true' but you expected output
return False
else:
if output "false":
print Error on input input we got 'false' but you expected output
return False
return True
def badinput output:
searchObj research rcheckCode ddAZAZazddddd$ input, reM
if searchObj:
if output "true":
return True
else:
if output "false":
return True
return False
file openDriverJavasample.java"
contents file.readlines
file.close
inputs
outputs
ctr
while ctr lencontents:
if in contentsctr:
data contentsctr
start data.index
end data.index
data datastart:end
out contentsctr
start out.index
end out.index
out outstart:end
inputs.appenddata
outputsdata out
ctr ctr
ctr ctr
correct True
ctr
for input in inputs:
result goodinput outputsinput
if not result:
print for test case strctr
correct correct and result
ctr
if correct:
print All of your test cases were correct!"
bug False
for input in inputs:
if badinput outputsinput and correct:
bug True
print Great job! You found the bug"
if not bug and correct:
print Try writing more test cases. You did not find the bug."
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
