Permalink
Browse files

Fix codechecker issues.

  • Loading branch information...
1 parent b62375e commit 988af2c6d15c56fbab6e23cbd0d782b3328ce00a @timhunt committed Sep 12, 2012
View
@@ -150,7 +150,7 @@
$config = get_config('qtype_stack');
echo html_writer::tag('p', stack_string('healthcheckcache_' . $config->casresultscache));
-// Print out the table itself
+// Print out the table itself.
$table->finish_output();
if ($anstest) {
View
@@ -184,7 +184,7 @@
$string['settingcasmaximaversion_desc'] = 'Käytössä olevan Maximan versio.';
$string['settingcasresultscache'] = 'CAS tulosten välimuistiin tallennus';
$string['settingcasresultscache_db'] = 'Välimuisti tietokannassa';
-$string['settingcasresultscache_desc'] = 'Tallennetaanko CAS kutsut välimuistiin? Tämän on syytä olla päällä, muutoin kuin ohjelmistokehitystilanteissa. Välimuistin tila näkyy kuntotarkistus-sivulla. Välimuisti pitää tyhjentää jos CAS tai gnuplot asetukset muuttuvat.';
+$string['settingcasresultscache_desc'] = 'Tallennetaanko CAS kutsut välimuistiin? Tämän on syytä olla päällä, muutoin kuin ohjelmistokehitystilanteissa. Välimuistin tila näkyy kuntotarkistus-sivulla. Välimuisti pitää tyhjentää jos CAS tai gnuplot asetukset muuttuvat.';
$string['settingcasresultscache_none'] = 'Älä tallenna välimuistiin';
$string['settingcastimeout'] = 'CAS yhteyden aikaraja';
$string['settingcastimeout_desc'] = 'Kauanko aikaa sallitaan yhden CAS kutsun käsittelyyn.';
@@ -413,8 +413,8 @@
$string['FacForm_UnPick_intfac'] = $string['irred_Q_commonint'];
$string['ATFacForm_error_list'] = 'Vastauksen tarkastuksessa tapahtui virhe. Ota yhteyttä järjestelmän ylläpitäjiin ';
$string['ATFacForm_error_degreeSA'] = 'Vastauskesi astetta ei pystytty määrittämään.';
-$string['ATFacForm_isfactored'] = 'Vastauksesi on jaettu tekijöihin. '; // needs a space at the end.
-$string['ATFacForm_notfactored'] = 'Vastaustasi ei ole jaettu tekijöihin. '; // needs a space at the end.
+$string['ATFacForm_isfactored'] = 'Vastauksesi on jaettu tekijöihin. '; // Needs a space at the end.
+$string['ATFacForm_notfactored'] = 'Vastaustasi ei ole jaettu tekijöihin. '; // Needs a space at the end.
$string['ATFacForm_notalgequiv'] = 'Vastauksesi ei ole algebrallisesti yhtä kuin oikean vastaus. Jokin virhe on tapahtunut laskussasi. ';
@@ -255,7 +255,7 @@ public function validate($security='s', $syntax=true, $insertstars=false) {
// We cannot search for arbitrary closing tags, e.g. for the pattern '</' because
// we pass back strings with HTML in when we have already evaluated plots!
$htmlfragments = array('<span', '</span>', '<p>', '</p>');
- foreach ($htmlfragments as $frag){
+ foreach ($htmlfragments as $frag) {
if (strpos($cmd, $frag) !== false) {
$this->add_error(get_string('htmlfragment', 'qtype_stack').' <pre>'.$cmd.'</pre>');
$this->valid = false;
@@ -178,15 +178,15 @@ public function test_qmchar() {
}
public function test_simplify_false() {
-
+
$cs=array('a:2+3', 'b:ev(a,simp)');
foreach ($cs as $s) {
$cs = new stack_cas_casstring($s);
$cs->validate('t');
$s1[] = $cs;
}
-
+
$options = new stack_options();
$options->set_option('simplify', false);
$at1 = new stack_cas_session($s1, $options, 0);
@@ -199,8 +199,8 @@ public function test_simplify_false() {
public function test_redefine_variable() {
- // This example redefines the value of n.
- // It should return the last value.
+ // This example redefines the value of n.
+ // It should return the last value.
$cs = array('n:3', 'n:n+3', 'n:n^2');
foreach ($cs as $s) {
@@ -220,11 +220,13 @@ public function test_redefine_variable() {
public function test_indirect_redefinition_of_varibale() {
- // This example uses a loop to change the values of elements of C.
+ // This example uses a loop to change the values of elements of C.
// However the loop returns "done", and the values of C are changed.
- $cs = array('A:matrix([5,2],[4,3])', 'B:matrix([4,5],[6,5])', 'C:zeromatrix (first(matrix_size(A)), second(matrix_size(A)))');
+ $cs = array('A:matrix([5,2],[4,3])', 'B:matrix([4,5],[6,5])',
+ 'C:zeromatrix (first(matrix_size(A)), second(matrix_size(A)))');
$cs[] = 'BT:transpose(B)';
- $cs[] = 'S:for a:1 thru first(matrix_size(A)) do for b:1 thru second(matrix_size(A)) do C[ev(a,simp),ev(b,simp)]:apply("+",zip_with("*",A[ev(a,simp)],BT[ev(b,simp)]))';
+ $cs[] = 'S:for a:1 thru first(matrix_size(A)) do for b:1 thru second(matrix_size(A)) do ' .
+ 'C[ev(a,simp),ev(b,simp)]:apply("+",zip_with("*",A[ev(a,simp)],BT[ev(b,simp)]))';
$cs[] = 'D:ev(C,simp)';
// We need this last assignment to re-evaluate C, and then we can grab the results.....
$cs[] = 'C:C';
@@ -141,8 +141,10 @@ public function test_auto_generated_key_names() {
public function test_redefine_variables() {
// Notice this means that within a session the value of n has to be returned at every stage....
- $at1 = new stack_cas_text('Let $n$ be defined by @n:3@. Now add one to get @n:n+1@ and square the result @n:n^2@.', null, 0);
- $this->assertEquals('Let $n$ be defined by $3$. Now add one to get $4$ and square the result $16$.', $at1->get_display_castext());
+ $at1 = new stack_cas_text(
+ 'Let $n$ be defined by @n:3@. Now add one to get @n:n+1@ and square the result @n:n^2@.', null, 0);
+ $this->assertEquals('Let $n$ be defined by $3$. Now add one to get $4$ and square the result $16$.',
+ $at1->get_display_castext());
}
public function testcheck_external_forbidden_words() {
@@ -171,11 +173,17 @@ public function test_hints() {
public function test_bad_variablenames() {
$cs = new stack_cas_session(array(), null, 0);
- $rawcastext = '\[\begin{array}{rcl} & =& @Ax2@ + @double_cAx@ + @c2A@ + @Bx2@ + @cBx@ + @Cx@,\\ & =& @ApBx2@ + @xterm@ + @c2A@. \end{array}\] Matching coefficients \[\begin{array}{rcl} A + B& =& @a@\,\\ @double_cA + cB@ + C& =& 0,\\ @Ac2@& =& @b@. \end{array}\]';
+ $rawcastext = '\[\begin{array}{rcl} & =& @Ax2@ + @double_cAx@ + @c2A@ + @Bx2@ + @cBx@ + @Cx@,\\ & =' .
+ '& @ApBx2@ + @xterm@ + @c2A@. \end{array}\] Matching coefficients \[\begin{array}{rcl} A + B& =' .
+ '& @a@\,\\ @double_cA + cB@ + C& =& 0,\\ @Ac2@& =& @b@. \end{array}\]';
$at1 = new stack_cas_text($rawcastext, $cs, 0, 't', false, true);
$this->assertFalse($at1->get_valid());
- $this->assertEquals($at1->get_errors(), '<span class="error">CASText failed validation. </span>CAS commands not valid. </br>You seem to be missing * characters. Perhaps you meant to type <span class="stacksyntaxexample">c2<font color="red">*</font>A</span>.You seem to be missing * characters. Perhaps you meant to type <span class="stacksyntaxexample">c2<font color="red">*</font>A</span>.');
+ $this->assertEquals($at1->get_errors(), '<span class="error">CASText failed validation. </span>' .
+ 'CAS commands not valid. </br>You seem to be missing * characters. Perhaps you meant to type ' .
+ '<span class="stacksyntaxexample">c2<font color="red">*</font>A</span>.' .
+ 'You seem to be missing * characters. Perhaps you meant to type ' .
+ '<span class="stacksyntaxexample">c2<font color="red">*</font>A</span>.');
}
}
@@ -146,7 +146,8 @@ public function test_do_test_fail_quiet() {
$tans = new stack_cas_casstring('3*(x+2)');
$tans->validate('t');
$node = new stack_potentialresponse_node($sans, $tans, 'FacForm', 'x', true);
- $node->add_branch(0, '+', 0.5, '', -1, 'Boo! Your answer should be in factored form, i.e. @factor(ans1)@.', FORMAT_HTML, '1-0-0');
+ $node->add_branch(0, '+', 0.5, '', -1, 'Boo! Your answer should be in factored form, i.e. @factor(ans1)@.',
+ FORMAT_HTML, '1-0-0');
$node->add_branch(1, '=', 2, '', 3, 'Yeah!', FORMAT_HTML, '1-0-1');
$options = new stack_options();
View
@@ -408,7 +408,8 @@ public static function make_stack_question_test4() {
$tans->get_valid('t');
$node = new stack_potentialresponse_node($sans, $tans, 'AlgEquiv', null);
$node->add_branch(0, '=', 0, $q->penalty, -1,
- 'Your answer and my answer are plotted below. Look they are different! @plot([p,ans1],[x,-2,2])@', FORMAT_HTML, 'plots-0-0');
+ 'Your answer and my answer are plotted below. Look they are different! @plot([p,ans1],[x,-2,2])@',
+ FORMAT_HTML, 'plots-0-0');
$node->add_branch(1, '=', 1, $q->penalty, -1, '', FORMAT_HTML, 'plots-0-1');
$q->prts['plots'] = new stack_potentialresponse_tree('plots',
'', true, 1, null, array($node));
@@ -493,7 +494,8 @@ public static function make_stack_question_test5() {
$node2 = new stack_potentialresponse_node($sans, $tans, 'AlgEquiv', null);
$node2->add_branch(0, '=', 0, $q->penalty, -1, '', FORMAT_HTML, 'sol-2-0');
$node2->add_branch(1, '=', 1, $q->penalty, -1,
- 'You have correctly solved the equation you have entered in part 1. Please try both parts again!', FORMAT_HTML, 'sol-2-1');
+ 'You have correctly solved the equation you have entered in part 1. Please try both parts again!',
+ FORMAT_HTML, 'sol-2-1');
$sans = new stack_cas_casstring('ans2');
$sans->get_valid('t');
View
@@ -203,13 +203,13 @@ protected function check_output_does_not_contain_stray_placeholders() {
$this->assertNotRegExp('~\[\[|\]\]~', $this->currentoutput, 'Not all placehoders were replaced.');
}
- protected function check_output_contains_lang_string($identifier, $component = '', $a = NULL) {
+ protected function check_output_contains_lang_string($identifier, $component = '', $a = null) {
$string = get_string($identifier, $component, $a);
$this->assertNotContains($string, $this->currentoutput,
'Expected string ' . $string . ' not found in ' . $this->currentoutput);
}
- protected function check_output_does_not_contain_lang_string($identifier, $component = '', $a = NULL) {
+ protected function check_output_does_not_contain_lang_string($identifier, $component = '', $a = null) {
$string = get_string($identifier, $component, $a);
$this->assertContains($string, $this->currentoutput,
'The string ' . $string . ' should not be present in ' . $this->currentoutput);

0 comments on commit 988af2c

Please sign in to comment.