You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
874 B

//~ Function that test the user code
async function submit(){
var test = editor.getValue()+`\n
import random as r
def conditionVerif(list,a):
for i in list:
if(i == 1):
a += 1
elif(i != 2):
a -=1
elif(i < 3):
a *= a
elif(i > 6):
a +=4
else:
a +=5
return a
def conditionTest(x):
condition([],0)
list=[]
for i in range(x):
for i in range(r.randint(1,10)):
list.append(r.randint(1,10))
a=r.randint(1,10)
if(condition(list,a)!=conditionVerif(list,a)):
return False
return True
print(conditionTest(5))
`;
exec("print('True')", "code");
exec(test, "solution");
result.innerHTML = "Test en cours...";
await new Promise(r => setTimeout(r, 1500));
check();
}