version 1.1, 2010/12/20 18:14:18
|
version 1.3, 2012/02/04 15:12:40
|
Line 46 my $message='';
|
Line 46 my $message='';
|
foreach my $testcase (split(/\,/,$FORM{'LONCAPA_correct_answer'})) { |
foreach my $testcase (split(/\,/,$FORM{'LONCAPA_correct_answer'})) { |
my ($value,$result)=split(/\=/,$testcase); |
my ($value,$result)=split(/\=/,$testcase); |
# Execute the student code and call the expected function |
# Execute the student code and call the expected function |
my $studentanswer=$compartment->reval($FORM{'LONCAPA_student_response'}.'&factorial('.$value.')'); |
my $studentanswer=$compartment->reval( |
|
$FORM{'somecode'}."\n". |
|
$FORM{'LONCAPA_student_response'}."\n". |
|
'&factorial('.$value.')' |
|
); |
# A syntax error occurred |
# A syntax error occurred |
if ($@) { |
if ($@) { |
$award='WRONG_FORMAT'; |
$award='WRONG_FORMAT'; |
Line 83 foreach my $testcase (split(/\,/,$FORM{'
|
Line 87 foreach my $testcase (split(/\,/,$FORM{'
|
# 'EXACT_ANS','COMMA_FAIL' |
# 'EXACT_ANS','COMMA_FAIL' |
# |
# |
# plus a free-form $message. |
# plus a free-form $message. |
|
# |
|
# For partial correctness, awarddetail needs to be ASSIGNED_SCORE |
|
# The partial score would be in <awarded> |
|
# The message is passed as unparsed character data, so embedded HTML |
|
# or entities do not get parsed by LON-CAPA's internal parser. Remove |
|
# the CDATA wrapper if you want the parser to process the message. |
|
# |
|
|
print (<<ENDOUT); |
print (<<ENDOUT); |
<loncapagrade> |
<loncapagrade> |
<awarddetail>$award</awarddetail> |
<awarddetail>$award</awarddetail> |
<message>$message</message> |
<message><![CDATA[$message]]></message> |
|
<awarded></awarded> |
</loncapagrade> |
</loncapagrade> |
ENDOUT |
ENDOUT |
exit; |
exit; |