Fix accepting incorrect answer

Make min nonzero value
Alter the last test to accept only correct answers
pull/3790/head
Santhosh Kumar Srinivasan 2015-10-18 13:44:17 +05:30
parent af654aebdc
commit 6e41fc1d38
1 changed files with 2 additions and 2 deletions

View File

@ -934,10 +934,10 @@
"assert(myFunction() >= min, 'message: The random number generated by <code>myFunction</code> should be greater than or equal to the minimum number.');",
"assert(myFunction() <= max, 'message: The random number generated by <code>myFunction</code> should be less than or equal to the maximum number.');",
"assert(myFunction() % 1 === 0 , 'message: The random number generated by <code>myFunction</code> should be an integer, not a decimal.');",
"assert((function(){if(editor.getValue().match(/max/g).length >= 2 && editor.getValue().match(/min/g).length >= 2 && editor.getValue().match(/Math.floor/g) && editor.getValue().match(/Math.random/g)){return true;}else{return false;}})(), 'message: You should be using the function given in the description to calculate the random in number in a range.');"
"assert((function(){if(editor.getValue().match(/max/g).length >= 3 && editor.getValue().match(/min/g).length >= 4 && editor.getValue().match(/Math.floor/g) && editor.getValue().match(/Math.random/g)){return true;}else{return false;}})(), 'message: You should be using the function given in the description to calculate the random in number in a range.');"
],
"challengeSeed":[
"var min = 0;",
"var min = 1;",
"var max = 9;",
"function myFunction() {",
" // Make myFunction return a random number between min and max values instead of a decimal",