upd: conduct further robustness test
This commit is contained in:
@ -53,12 +53,9 @@ if True:
|
|||||||
cid=randint(0,9)
|
cid=randint(0,9)
|
||||||
oplist=['+','-','*','/']
|
oplist=['+','-','*','/']
|
||||||
op=oplist[randint(0,3)]
|
op=oplist[randint(0,3)]
|
||||||
bflag="+"
|
flaglist=['+','-','']
|
||||||
if randint(0,1)==0:
|
bflag=flaglist[randint(0,2)]
|
||||||
bflag="-"
|
cflag=flaglist[randint(0,2)]
|
||||||
cflag="+"
|
|
||||||
if randint(0,1)==0:
|
|
||||||
cflag="-"
|
|
||||||
opt_cpp.append("a_"+str(aid)+"=("+bflag+"a_"+str(bid)+")"+op+"("+cflag+"a_"+str(cid)+");")
|
opt_cpp.append("a_"+str(aid)+"=("+bflag+"a_"+str(bid)+")"+op+"("+cflag+"a_"+str(cid)+");")
|
||||||
if op=='/':
|
if op=='/':
|
||||||
opt_python.append("try:")
|
opt_python.append("try:")
|
||||||
@ -80,14 +77,16 @@ if True:
|
|||||||
bid=randint(0,9)
|
bid=randint(0,9)
|
||||||
oplist=['+','-','*','/']
|
oplist=['+','-','*','/']
|
||||||
op=oplist[randint(0,3)]
|
op=oplist[randint(0,3)]
|
||||||
opt_cpp.append("a_"+str(aid)+op+"=a_"+str(bid)+";")
|
flaglist=['+','-','']
|
||||||
|
bflag=flaglist[randint(0,2)]
|
||||||
|
opt_cpp.append("a_"+str(aid)+op+"=("+bflag+"a_"+str(bid)+");")
|
||||||
if op=='/':
|
if op=='/':
|
||||||
opt_python.append("try:")
|
opt_python.append("try:")
|
||||||
opt_python.append(" a_"+str(aid)+op+op+"=a_"+str(bid))
|
opt_python.append(" a_"+str(aid)+op+op+"=("+bflag+"a_"+str(bid)+")")
|
||||||
opt_python.append("except ZeroDivisionError:")
|
opt_python.append("except ZeroDivisionError:")
|
||||||
opt_python.append(" a_"+str(aid)+"=0")
|
opt_python.append(" a_"+str(aid)+"=0")
|
||||||
else:
|
else:
|
||||||
opt_python.append("a_"+str(aid)+op+"=a_"+str(bid))
|
opt_python.append("a_"+str(aid)+op+"=("+bflag+"a_"+str(bid)+")")
|
||||||
opt_cpp.append("a_"+str(aid)+".print(); puts(\"\");")
|
opt_cpp.append("a_"+str(aid)+".print(); puts(\"\");")
|
||||||
opt_python.append("print(a_"+str(aid)+")")
|
opt_python.append("print(a_"+str(aid)+")")
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user