version 1.8, 2000/10/30 20:24:38
|
version 1.9, 2000/10/30 20:36:18
|
Line 12 sub caparesponse_check {
|
Line 12 sub caparesponse_check {
|
my $sig_lbound=''; |
my $sig_lbound=''; |
my $sig_ubound=''; |
my $sig_ubound=''; |
my $ans_fmt=''; |
my $ans_fmt=''; |
my $unit_str=''; |
my $units=''; |
my $calc=''; |
my $calc=''; |
my ($response,$expr)=@_; |
my ($response,$expr)=@_; |
|
|
($answer,$type,$tol_type,$tolerance,$sig_lbound,$sig_ubound,$ans_fmt, |
($answer,$type,$tol_type,$tolerance,$sig_lbound,$sig_ubound,$ans_fmt, |
$unit_str,$calc) = eval $expr.'return $answer,$type,$tol_type,$tolerance,$sig_lbound,$sig_ubound,$ans_fmt,$unit_str,$calc'; |
$units,$calc) = eval $expr.'return $answer,$type,$tol_type,$tolerance,$sig_lbound,$sig_ubound,$ans_fmt,$units,$calc'; |
|
|
#type's definitons come from capaParser.h |
#type's definitons come from capaParser.h |
if ($type eq '' ) { |
if ($type eq '' ) { |
Line 28 sub caparesponse_check {
|
Line 28 sub caparesponse_check {
|
} elsif ($type eq 'ci') { $type = 3; |
} elsif ($type eq 'ci') { $type = 3; |
} elsif ($type eq 'mc') { $type = 5; |
} elsif ($type eq 'mc') { $type = 5; |
} elsif ($type eq 'fml') { $type = 8; |
} elsif ($type eq 'fml') { $type = 8; |
} elsif ($type eq 'subj') { $type = 7;} |
} elsif ($type eq 'subj') { $type = 7; |
|
} else { return "ERROR: Unknown type of answer: $type" } |
} |
} |
|
|
|
|
my $result = &caparesponse_capa_check_answer($response,$answer,$type, |
my $result = &caparesponse_capa_check_answer($response,$answer,$type, |
$tol_type,$tolerance, |
$tol_type,$tolerance, |
$sig_lbound,$sig_ubound, |
$sig_lbound,$sig_ubound, |
$ans_fmt, $unit_str,$calc); |
$ans_fmt, $units,$calc); |
|
|
|
if ($result == '1') { $result='EXACT_ANS'; } |
|
elsif ($result == '2') { $result='APPROX_ANS'; } |
|
elsif ($result == '3') { $result='SIG_FAIL'; } |
|
elsif ($result == '4') { $result='UNIT_FAIL'; } |
|
elsif ($result == '5') { $result='NO_UNIT'; } |
|
elsif ($result == '6') { $result='UNIT_OK'; } |
|
elsif ($result == '7') { $result='INCORRECT'; } |
|
elsif ($result == '8') { $result='UNIT_NOTNEEDED'; } |
|
elsif ($result == '9') { $result='ANS_CNT_NOT_MATCH'; } |
|
elsif ($result =='10') { $result='SUB_RECORDED'; } |
|
elsif ($result =='11') { $result='BAD_FORMULA'; } |
|
elsif ($result =='12') { $result='WANTED_NUMERIC'; } |
|
else {$result = "ERROR: Unknown Result: $result";} |
|
|
return ":$result:$response:$answer:"; |
return ":$result:$response:$answer:"; |
} |
} |
|
|