Changement du test 10
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
ea2b43e76f
commit
63a31a1933
@ -1,34 +0,0 @@
|
|||||||
//~ Function that test the user code
|
|
||||||
|
|
||||||
async function submit(){
|
|
||||||
var test = editor.getValue()+`\n
|
|
||||||
import random as r
|
|
||||||
|
|
||||||
def triVerif(a,b):
|
|
||||||
s = ""
|
|
||||||
i = 0
|
|
||||||
while len(s)<len(a+b):
|
|
||||||
if(len(a)>i):
|
|
||||||
s += a[i]
|
|
||||||
if(len(b)>i):
|
|
||||||
s += b[i]
|
|
||||||
i += 1
|
|
||||||
return s
|
|
||||||
|
|
||||||
def triTest(x):
|
|
||||||
a = "Hlowrd"
|
|
||||||
b = "el ol"
|
|
||||||
if(triVerif(a,b)!=tri(a,b)):
|
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
print(triTest(5))
|
|
||||||
`;
|
|
||||||
exec("print('True')", "code");
|
|
||||||
exec(test, "solution");
|
|
||||||
result.innerHTML = "Test en cours...";
|
|
||||||
await new Promise(r => setTimeout(r, 1500));
|
|
||||||
check();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
|||||||
|
//~ Function that test the user code
|
||||||
|
|
||||||
|
async function submit(){
|
||||||
|
var test = editor.getValue()+`\n
|
||||||
|
def double_elementVerif(list):
|
||||||
|
return [i*2 for i in list]
|
||||||
|
|
||||||
|
import random as r
|
||||||
|
def testDoubleElement(x):
|
||||||
|
l=[1,2,3,2,1]
|
||||||
|
if(double_element(l) != [2,4,6,4,2]):
|
||||||
|
return False
|
||||||
|
l=[9,5,7,7,9]
|
||||||
|
if(double_element(l) != [18,10,14,14,18]):
|
||||||
|
return False
|
||||||
|
l=[]
|
||||||
|
for i in range(x):
|
||||||
|
for j in range(r.randint(1,10)):
|
||||||
|
l.append(r.randint(0,9))
|
||||||
|
if(double_elementVerif(l)!=double_element(l)):
|
||||||
|
return False
|
||||||
|
l=[]
|
||||||
|
return True
|
||||||
|
|
||||||
|
print(testDoubleElement(5))
|
||||||
|
`;
|
||||||
|
exec("print ('True')", "code");
|
||||||
|
exec(test, "solution");
|
||||||
|
result.innerHTML = "Test en cours...";
|
||||||
|
await new Promise(r => setTimeout(r, 1500));
|
||||||
|
check();
|
||||||
|
}
|
Loading…
Reference in new issue