Skip to content
Snippets Groups Projects
Commit b560c2cc authored by Chris Sangwin's avatar Chris Sangwin
Browse files

Fix two unit tests.

parent 3f50673c
No related branches found
No related tags found
No related merge requests found
......@@ -558,11 +558,23 @@ class qtype_stack_question extends question_graded_automatically_with_countback
public function is_gradable_response(array $response) {
// If any PRT is gradable, then we can grade the question.
$noprts = true;
foreach ($this->prts as $index => $prt) {
$noprts = false;
if ($this->can_execute_prt($prt, $response, true)) {
return true;
}
}
// In the case of no PRTs, questions are in state "is_gradable" if we have
// at least one input in the "score" or "valid" state.
if ($noprts) {
foreach ($this->inputstates as $key => $inputstate) {
if ($inputstate->status == 'score' || $inputstate->status == 'valid') {
return true;
}
}
}
// Otherwise we are not "is_gradable".
return false;
}
......
......@@ -325,7 +325,7 @@ class stack_equiv_input_test extends qtype_stack_testcase {
$this->assertEquals(stack_input::VALID, $state->status);
$this->assertEquals('[x^4=16,x=2 nounor x=-2 nounor x=2*i nounor x=-2*i]', $state->contentsmodified);
$this->assertEquals('\[ \begin{array}{lll}\color{blue}{(\mathbb{R})}&x^4=16& \cr '.
'\color{green}{\Leftrightarrow}\, \color{blue}{(\mathbb{R})}&x=2\,{\mbox{ or }}\, '.
'\color{green}{\Leftrightarrow}&x=2\,{\mbox{ or }}\, '.
'x=-2\,{\mbox{ or }}\, x=2\cdot \mathrm{i}\,{\mbox{ or }}\, x=-2\cdot \mathrm{i}& \cr \end{array} \]',
$state->contentsdisplayed);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment