diff --git a/lang/en/qtype_stack.php b/lang/en/qtype_stack.php index 072b01484a10fe381de5408786bfb6e65310549e..602848289923fa197f42979b57ff363a3b312389 100644 --- a/lang/en/qtype_stack.php +++ b/lang/en/qtype_stack.php @@ -918,6 +918,7 @@ $string['Illegal_sets'] = 'Your answer contains sets "{a,b,c}" these are not all $string['Illegal_groups'] = 'Your answer contains evaluation groups "(a,b,c)" these are not allowed here.'; $string['Illegal_groupping'] = 'Your answer contains parenthesis used to group operations, these are forbidden here. You should probably manipulate the expression to eliminate them.'; $string['Illegal_control_flow'] = 'Your answer contains control-flow statements like the <code>if</code>-conditional or the <code>do</code>-loop, these are forbidden here, you should probably provide the result of these statements as the answer.'; +$string['Illegal_extraevaluation'] = "Maxima's extra evaluation operator <code>''</code> is not supported by STACK."; $string['qm_error'] = 'Your answer contains question mark characters, ?, which are not permitted in answers. You should replace these with a specific value.'; $string['Equiv_Illegal_set'] = 'Sets are not allowed when reasoning by equivalence.'; $string['Equiv_Illegal_list'] = 'Lists are not allowed when reasoning by equivalence.'; diff --git a/stack/cas/parsingrules/033_no_extra_evaluation.filter.php b/stack/cas/parsingrules/033_no_extra_evaluation.filter.php new file mode 100644 index 0000000000000000000000000000000000000000..9f6061144f91f1df1a6c27017c4c690f6866a47e --- /dev/null +++ b/stack/cas/parsingrules/033_no_extra_evaluation.filter.php @@ -0,0 +1,42 @@ +<?php +// This file is part of Stack - https://stack.maths.ed.ac.uk +// +// Stack is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Stack is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Stack. If not, see <http://www.gnu.org/licenses/>. + +defined('MOODLE_INTERNAL') || die(); +require_once(__DIR__ . '/filter.interface.php'); + +/** + * AST filter that looks for the Maxima '' operator for extra evaluation, which is not supported. + */ +class stack_ast_filter_033_no_extra_evaluation implements stack_cas_astfilter { + + public function filter(MP_Node $ast, array &$errors, array &$answernotes, stack_cas_security $identifierrules): MP_Node { + + $process = function($node) use (&$errors, &$answernotes) { + if ($node instanceof MP_PrefixOp && + $node->op === "''") { + $node->position['invalid'] = true; + if (array_search('Illegal_extraevaluation', $answernotes) === false) { + $answernotes[] = 'Illegal_extraevaluation'; + $errors[] = stack_string('Illegal_extraevaluation'); + } + $answernotes[] = 'Illegal_extraevaluation'; + } + return true; + }; + $ast->callbackRecurse($process); + return $ast; + } +} diff --git a/stack/cas/parsingrules/parsingrule.factory.php b/stack/cas/parsingrules/parsingrule.factory.php index a6943fd9aafef0fd29aa56e99d260f294a6cf72c..1aacd11149b3fcb034c67e06017d42a46345417f 100644 --- a/stack/cas/parsingrules/parsingrule.factory.php +++ b/stack/cas/parsingrules/parsingrule.factory.php @@ -27,6 +27,7 @@ require_once(__DIR__ . '/022_trig_replace_synonyms.filter.php'); require_once(__DIR__ . '/025_no_trig_power.filter.php'); require_once(__DIR__ . '/030_no_trig_space.filter.php'); require_once(__DIR__ . '/031_no_trig_brackets.filter.php'); +require_once(__DIR__ . '/033_no_extra_evaluation.filter.php'); require_once(__DIR__ . '/050_no_chained_inequalities.filter.php'); require_once(__DIR__ . '/090_special_forbidden_characters.filter.php'); require_once(__DIR__ . '/101_no_floats.filter.php'); @@ -102,6 +103,8 @@ class stack_parsing_rule_factory { return new stack_ast_filter_030_no_trig_space(); case '031_no_trig_brackets': return new stack_ast_filter_031_no_trig_brackets(); + case '033_no_extra_evaluation': + return new stack_ast_filter_033_no_extra_evaluation(); case '050_no_chained_inequalities': return new stack_ast_filter_050_no_chained_inequalities(); case '090_special_forbidden_characters': @@ -204,6 +207,7 @@ class stack_parsing_rule_factory { '022_trig_replace_synonyms', '025_no_trig_power', '030_no_trig_space', '031_no_trig_brackets', + '033_no_extra_evaluation', '050_no_chained_inequalities', '090_special_forbidden_characters', '101_no_floats', '102_no_strings', diff --git a/tests/ast_filter_000_099_common_core_auto_generated_test.php b/tests/ast_filter_000_099_common_core_auto_generated_test.php index 4a50fa813efe92cc2cd206885fa99691b4022be5..dc42bee08e245a2c2cd77c207594e0e9c07ecbc5 100644 --- a/tests/ast_filter_000_099_common_core_auto_generated_test.php +++ b/tests/ast_filter_000_099_common_core_auto_generated_test.php @@ -37,6 +37,11 @@ class ast_filter_000_099_common_core_auto_generated_test extends qtype_stack_ast $this->security = new stack_cas_security(false); $this->filter = stack_parsing_rule_factory::get_filter_pipeline([], [], true); + $this->expect("''diff(x,y)", + "''diff(x,y)", + ['Illegal_extraevaluation', 'Illegal_extraevaluation'], + false, true); + $this->expect('(x+2)(x+3)', '(x+2)*(x+3)', ['missing_stars'], @@ -173,6 +178,11 @@ class ast_filter_000_099_common_core_auto_generated_test extends qtype_stack_ast $this->security = new stack_cas_security(true); $this->filter = stack_parsing_rule_factory::get_filter_pipeline([], [], true); + $this->expect("''diff(x,y)", + "''diff(x,y)", + ['Illegal_extraevaluation', 'Illegal_extraevaluation'], + false, true); + $this->expect('(x+2)(x+3)', '(x+2)*(x+3)', ['missing_stars'], diff --git a/tests/ast_filter_001_fix_call_of_a_group_or_function_auto_generated_test.php b/tests/ast_filter_001_fix_call_of_a_group_or_function_auto_generated_test.php index f75a2476813bac27dc9f858f0e62b74e553a197b..9c15b0cbc15b7e0e70e943e40a9841769a0f516f 100644 --- a/tests/ast_filter_001_fix_call_of_a_group_or_function_auto_generated_test.php +++ b/tests/ast_filter_001_fix_call_of_a_group_or_function_auto_generated_test.php @@ -139,6 +139,11 @@ class ast_filter_001_fix_call_of_a_group_or_function_auto_generated_test extends [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1895,6 +1900,11 @@ class ast_filter_001_fix_call_of_a_group_or_function_auto_generated_test extends [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_002_log_candy_auto_generated_test.php b/tests/ast_filter_002_log_candy_auto_generated_test.php index f6b193594375ce44ffeed9e8bbcbd80543655812..601916d45ce23e1e693d1b31679b243cda3fa5f5 100644 --- a/tests/ast_filter_002_log_candy_auto_generated_test.php +++ b/tests/ast_filter_002_log_candy_auto_generated_test.php @@ -159,6 +159,11 @@ class ast_filter_002_log_candy_auto_generated_test extends qtype_stack_ast_testc [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1905,6 +1910,11 @@ class ast_filter_002_log_candy_auto_generated_test extends qtype_stack_ast_testc [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_003_no_dot_dot_auto_generated_test.php b/tests/ast_filter_003_no_dot_dot_auto_generated_test.php index 7fecf724c661e55003a8ad792b534a7a6691efbc..fa806c97da624dcc3b70b2b7910f8c0bbdb0ff04 100644 --- a/tests/ast_filter_003_no_dot_dot_auto_generated_test.php +++ b/tests/ast_filter_003_no_dot_dot_auto_generated_test.php @@ -119,6 +119,11 @@ class ast_filter_003_no_dot_dot_auto_generated_test extends qtype_stack_ast_test [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1885,6 +1890,11 @@ class ast_filter_003_no_dot_dot_auto_generated_test extends qtype_stack_ast_test [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_005_i_is_never_a_function_auto_generated_test.php b/tests/ast_filter_005_i_is_never_a_function_auto_generated_test.php index 613aa2cefc348294f2782bda4d7089a57855cf6f..1c68c1604e5b2f51621fa8343ff21e53f119195f 100644 --- a/tests/ast_filter_005_i_is_never_a_function_auto_generated_test.php +++ b/tests/ast_filter_005_i_is_never_a_function_auto_generated_test.php @@ -119,6 +119,11 @@ class ast_filter_005_i_is_never_a_function_auto_generated_test extends qtype_sta [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1885,6 +1890,11 @@ class ast_filter_005_i_is_never_a_function_auto_generated_test extends qtype_sta [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_022_trig_replace_synonyms_auto_generated_test.php b/tests/ast_filter_022_trig_replace_synonyms_auto_generated_test.php index eee55b4bf944222ecb3292821588b017b7d318fd..e0be35e6efd4629410b67bce8c96f0f527e85081 100644 --- a/tests/ast_filter_022_trig_replace_synonyms_auto_generated_test.php +++ b/tests/ast_filter_022_trig_replace_synonyms_auto_generated_test.php @@ -99,6 +99,11 @@ class ast_filter_022_trig_replace_synonyms_auto_generated_test extends qtype_sta [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1875,6 +1880,11 @@ class ast_filter_022_trig_replace_synonyms_auto_generated_test extends qtype_sta [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_025_no_trig_power_auto_generated_test.php b/tests/ast_filter_025_no_trig_power_auto_generated_test.php index 9fad3cb998f57b99e12dd2a21663a43db4f95f7d..3d864ad1f668ca0baa503756ff702eb5537adaa1 100644 --- a/tests/ast_filter_025_no_trig_power_auto_generated_test.php +++ b/tests/ast_filter_025_no_trig_power_auto_generated_test.php @@ -109,6 +109,11 @@ class ast_filter_025_no_trig_power_auto_generated_test extends qtype_stack_ast_t [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1880,6 +1885,11 @@ class ast_filter_025_no_trig_power_auto_generated_test extends qtype_stack_ast_t [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_030_no_trig_space_auto_generated_test.php b/tests/ast_filter_030_no_trig_space_auto_generated_test.php index 359cf38ea190019d638556bc112ca1068e84f8e4..f711203e8425fa8548209ab1438e1be40ef123af 100644 --- a/tests/ast_filter_030_no_trig_space_auto_generated_test.php +++ b/tests/ast_filter_030_no_trig_space_auto_generated_test.php @@ -99,6 +99,11 @@ class ast_filter_030_no_trig_space_auto_generated_test extends qtype_stack_ast_t [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1875,6 +1880,11 @@ class ast_filter_030_no_trig_space_auto_generated_test extends qtype_stack_ast_t [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_031_no_trig_brackets_auto_generated_test.php b/tests/ast_filter_031_no_trig_brackets_auto_generated_test.php index 58121aae3b30ee56cd449cea88f239159be32de0..6b9b12bc0184de8bc7f8ebe12356d16d5a917632 100644 --- a/tests/ast_filter_031_no_trig_brackets_auto_generated_test.php +++ b/tests/ast_filter_031_no_trig_brackets_auto_generated_test.php @@ -99,6 +99,11 @@ class ast_filter_031_no_trig_brackets_auto_generated_test extends qtype_stack_as [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1875,6 +1880,11 @@ class ast_filter_031_no_trig_brackets_auto_generated_test extends qtype_stack_as [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_033_no_extra_evaluation_auto_generated_test.php b/tests/ast_filter_033_no_extra_evaluation_auto_generated_test.php new file mode 100644 index 0000000000000000000000000000000000000000..f0fc5d007f5c1ea223d99132736d890847fc2665 --- /dev/null +++ b/tests/ast_filter_033_no_extra_evaluation_auto_generated_test.php @@ -0,0 +1,3619 @@ +<?php +// This file is part of Stack - http://stack.maths.ed.ac.uk/ +// +// Stack is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Stack is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Stack. If not, see <http://www.gnu.org/licenses/>. + +namespace qtype_stack; + +use qtype_stack_ast_testcase; +use stack_cas_security; +use stack_parsing_rule_factory; + +defined('MOODLE_INTERNAL') || die(); + +require_once(__DIR__ . '/../tests/fixtures/ast_filter_test_base.php'); + +// Auto-generated unit tests for AST-filter DO NOT EDIT! +/** + * @group qtype_stack + * @group qtype_stack_ast_filters + * @covers \ast_filter_033_no_extra_evaluation + */ + +class ast_filter_033_no_extra_evaluation_auto_generated_test extends qtype_stack_ast_testcase { + + public function test_affected_no_units() { + $this->security = new stack_cas_security(false); + $this->filter = stack_parsing_rule_factory::get_by_common_name('033_no_extra_evaluation'); + + $this->expect("''diff(x,y)", + "''diff(x,y)", + ['Illegal_extraevaluation', 'Illegal_extraevaluation'], + false, true); + + } + + public function test_affected_units() { + $this->security = new stack_cas_security(true); + $this->filter = stack_parsing_rule_factory::get_by_common_name('033_no_extra_evaluation'); + + $this->expect("''diff(x,y)", + "''diff(x,y)", + ['Illegal_extraevaluation', 'Illegal_extraevaluation'], + false, true); + + } + + public function test_non_affected_units() { + $this->security = new stack_cas_security(true); + $this->filter = stack_parsing_rule_factory::get_by_common_name('033_no_extra_evaluation'); + + $this->expect('"+"(a,b)', + '"+"(a,b)', + [], + true, false); + + $this->expect('"1+1"', + '"1+1"', + [], + true, false); + + $this->expect('"Hello world"', + '"Hello world"', + [], + true, false); + + $this->expect('%e^x', + '%e^x', + [], + true, false); + + $this->expect('2pi r^2', + '2*pi*r^2', + [], + true, false); + + $this->expect('2pir^2', + '2*pir^2', + [], + true, false); + + $this->expect("'diff(x,y)", + "'diff(x,y)", + [], + true, false); + + $this->expect("'int(x,y)", + "'int(x,y)", + [], + true, false); + + $this->expect('(()x)', + '(()*x)', + [], + true, false); + + $this->expect('((x))', + '((x))', + [], + true, false); + + $this->expect('()x', + '()*x', + [], + true, false); + + $this->expect('(+1)', + '(+1)', + [], + true, false); + + $this->expect('(-1)', + '(-1)', + [], + true, false); + + $this->expect('(-b+-sqrt(b^2))/(2*a)', + '(-b+-sqrt(b^2))/(2*a)', + [], + true, false); + + $this->expect('(-x)*y', + '(-x)*y', + [], + true, false); + + $this->expect('(1+i)*x', + '(1+i)*x', + [], + true, false); + + $this->expect('(1+i)+x', + '(1+i)+x', + [], + true, false); + + $this->expect('(a,b,c)', + '(a,b,c)', + [], + true, false); + + $this->expect('((a,b),c)', + '((a,b),c)', + [], + true, false); + + $this->expect('(a,(b,c))', + '(a,(b,c))', + [], + true, false); + + $this->expect('{(a,b),(x,y)}', + '{(a,b),(x,y)}', + [], + true, false); + + $this->expect('(a-b)-c', + '(a-b)-c', + [], + true, false); + + $this->expect('(x)', + '(x)', + [], + true, false); + + $this->expect('(x*y)*z', + '(x*y)*z', + [], + true, false); + + $this->expect('(x+2)(x+3)', + '(x+2)(x+3)', + [], + true, false); + + $this->expect('(x+2)3', + '(x+2)*3', + [], + true, false); + + $this->expect('(x+2)y', + '(x+2)*y', + [], + true, false); + + $this->expect('(x+y)+z', + '(x+y)+z', + [], + true, false); + + $this->expect('(x+y)^z', + '(x+y)^z', + [], + true, false); + + $this->expect('(x-y)+z', + '(x-y)+z', + [], + true, false); + + $this->expect('(x/y)/z', + '(x/y)/z', + [], + true, false); + + $this->expect('+-1', + '+-1', + [], + true, false); + + $this->expect('+0.2', + '+0.2', + [], + true, false); + + $this->expect('+1', + '+1', + [], + true, false); + + $this->expect('+e', + '+e', + [], + true, false); + + $this->expect('+i', + '+i', + [], + true, false); + + $this->expect('+pi', + '+pi', + [], + true, false); + + $this->expect('+x', + '+x', + [], + true, false); + + $this->expect('-(1/512) + i(sqrt(3)/512)', + '-(1/512)+i(sqrt(3)/512)', + [], + true, false); + + $this->expect('-1', + '-1', + [], + true, false); + + $this->expect('-1234', + '-1234', + [], + true, false); + + $this->expect('-0.2', + '-0.2', + [], + true, false); + + $this->expect('-10/-1', + '-10/-1', + [], + true, false); + + $this->expect('-3(x+1)', + '-3*(x+1)', + [], + true, false); + + $this->expect('-3+i', + '-3+i', + [], + true, false); + + $this->expect('-3x(1+x)', + '-3*x(1+x)', + [], + true, false); + + $this->expect('-b(5-b)', + '-b(5-b)', + [], + true, false); + + $this->expect('-e', + '-e', + [], + true, false); + + $this->expect('-i', + '-i', + [], + true, false); + + $this->expect('-pi', + '-pi', + [], + true, false); + + $this->expect('-x', + '-x', + [], + true, false); + + $this->expect('-x(1+x)', + '-x(1+x)', + [], + true, false); + + $this->expect('-x[3]', + '-x[3]', + [], + true, false); + + $this->expect('.1', + '.1', + [], + true, false); + + $this->expect('-0.2433 + 0.1111', + '-0.2433+0.1111', + [], + true, false); + + $this->expect('-0.2433e23 + 0.1111e-45 * 0.23e12 / -0.11e-11', + '-0.2433E23+0.1111E-45*0.23E12/-0.11E-11', + [], + true, false); + + $this->expect('-35.3 * 10^23', + '-35.3*10^23', + [], + true, false); + + $this->expect('0..1', + '0. . 1', + [], + true, false); + + $this->expect('0.1..1.2', + '0.1 . .1 . 2', + [], + true, false); + + $this->expect('0.1.1.2', + '0.1 . 1.2', + [], + true, false); + + $this->expect('0.1. 1.2', + '0.1 . 1.2', + [], + true, false); + + $this->expect('1', + '1', + [], + true, false); + + $this->expect('1234', + '1234', + [], + true, false); + + $this->expect('1 x', + '1*x', + [], + true, false); + + $this->expect('1+2i', + '1+2*i', + [], + true, false); + + $this->expect('1+i', + '1+i', + [], + true, false); + + $this->expect('1-x(1+x)', + '1-x(1+x)', + [], + true, false); + + $this->expect('1/0', + '1/0', + [], + true, false); + + $this->expect('1/2', + '1/2', + [], + true, false); + + $this->expect('1/sin(+x)', + '1/sin(+x)', + [], + true, false); + + $this->expect('1<=x<y^2', + '1 <= x < y^2', + [], + true, false); + + $this->expect('1<x<3', + '1 < x < 3', + [], + true, false); + + $this->expect('1E+3', + '1E+3', + [], + true, false); + + $this->expect('1E3', + '1E3', + [], + true, false); + + $this->expect('1 E 3', + '1*E*3', + [], + true, false); + + $this->expect('23.2*x*10^5', + '23.2*x*10^5', + [], + true, false); + + $this->expect('23.2 x 10^5', + '23.2*x*10^5', + [], + true, false); + + $this->expect('23.2x10^5', + '23.2*x10^5', + [], + true, false); + + $this->expect('23.2x 10^5', + '23.2*x*10^5', + [], + true, false); + + $this->expect('23.2 x10^5', + '23.2*x10^5', + [], + true, false); + + $this->expect('1E23*10^45', + '1E23*10^45', + [], + true, false); + + $this->expect('9.81x10^2*m/s', + '9.81*x10^2*m/s', + [], + true, false); + + $this->expect('9.81x*10^2*m/s', + '9.81*x*10^2*m/s', + [], + true, false); + + $this->expect('1x', + '1*x', + [], + true, false); + + $this->expect('2*e', + '2*e', + [], + true, false); + + $this->expect('2*i', + '2*i', + [], + true, false); + + $this->expect('2*i^3', + '2*i^3', + [], + true, false); + + $this->expect('2*pi', + '2*pi', + [], + true, false); + + $this->expect('2+3(x+1)', + '2+3*(x+1)', + [], + true, false); + + $this->expect('2+log_x(1/(x+b))*x^2', + '2+log_x(1/(x+b))*x^2', + [], + true, false); + + $this->expect('2/4', + '2/4', + [], + true, false); + + $this->expect('2^y*x', + '2^y*x', + [], + true, false); + + $this->expect('3(x+1)', + '3*(x+1)', + [], + true, false); + + $this->expect('3-i', + '3-i', + [], + true, false); + + $this->expect('3 5', + '3*5', + [], + true, false); + + $this->expect('3.14 5', + '3.14*5', + [], + true, false); + + $this->expect('3 5.2789', + '3*5.2789', + [], + true, false); + + $this->expect('3.14 5.2789', + '3.14*5.2789', + [], + true, false); + + $this->expect('33 578 32', + '33*578*32', + [], + true, false); + + $this->expect('9 8 7.6', + '9*8*7.6', + [], + true, false); + + $this->expect('9 8.5 7.6', + '9*8.5*7.6', + [], + true, false); + + $this->expect('3b+5/a(x)', + '3*b+5/a(x)', + [], + true, false); + + $this->expect('3beta_47', + '3*beta_47', + [], + true, false); + + $this->expect('3e-2', + '3E-2', + [], + true, false); + + $this->expect('3e2', + '3E2', + [], + true, false); + + $this->expect('3E2', + '3E2', + [], + true, false); + + $this->expect('7x(2+1)', + '7*x(2+1)', + [], + true, false); + + $this->expect('Bgcd(3,2)', + 'Bgcd(3,2)', + [], + true, false); + + $this->expect('In(x)', + 'In(x)', + [], + true, false); + + $this->expect('Sin(x)', + 'Sin(x)', + [], + true, false); + + $this->expect('3.75*Btu', + '3.75*Btu', + [], + true, false); + + $this->expect('X', + 'X', + [], + true, false); + + $this->expect('["a"]', + '["a"]', + [], + true, false); + + $this->expect('[+1,+2]', + '[+1,+2]', + [], + true, false); + + $this->expect('[-1,-2]', + '[-1,-2]', + [], + true, false); + + $this->expect('[1 < x,y < 1 or y > 7]', + '[1 < x,y < 1 or y > 7]', + [], + true, false); + + $this->expect('[1,+2]', + '[1,+2]', + [], + true, false); + + $this->expect('[1,-2]', + '[1,-2]', + [], + true, false); + + $this->expect('[1,2,3.4]', + '[1,2,3.4]', + [], + true, false); + + $this->expect('[1,true,"a"]', + '[1,true,"a"]', + [], + true, false); + + $this->expect('[1<x,1<y<3]', + '[1 < x,1 < y < 3]', + [], + true, false); + + $this->expect('[1<x,x<3]', + '[1 < x,x < 3]', + [], + true, false); + + $this->expect('[1]', + '[1]', + [], + true, false); + + $this->expect('[[1,2],[3,4]]', + '[[1,2],[3,4]]', + [], + true, false); + + $this->expect('[]', + '[]', + [], + true, false); + + $this->expect('[x, y, z ]', + '[x,y,z]', + [], + true, false); + + $this->expect('a ** b', + 'a**b', + [], + true, false); + + $this->expect('a +++ b', + 'a+++b', + [], + true, false); + + $this->expect('a --- b', + 'a---b', + [], + true, false); + + $this->expect('a(x)', + 'a(x)', + [], + true, false); + + $this->expect('a++b', + 'a++b', + [], + true, false); + + $this->expect('a+-b', + 'a+-b', + [], + true, false); + + $this->expect('a,b,c', + 'a,b=true,c=true', + [], + true, false); + + $this->expect('a-(b-c)', + 'a-(b-c)', + [], + true, false); + + $this->expect('a-+b', + 'a-+b', + [], + true, false); + + $this->expect('a/(a(x+1)+2)', + 'a/(a(x+1)+2)', + [], + true, false); + + $this->expect('a/b/c', + 'a/b/c', + [], + true, false); + + $this->expect('a1', + 'a1', + [], + true, false); + + $this->expect('a9b', + 'a9b', + [], + true, false); + + $this->expect('ab98cd', + 'ab98cd', + [], + true, false); + + $this->expect('aXy1', + 'aXy1', + [], + true, false); + + $this->expect('a[1,2]', + 'a[1,2]', + [], + true, false); + + $this->expect('a[2]', + 'a[2]', + [], + true, false); + + $this->expect('a[n+1]', + 'a[n+1]', + [], + true, false); + + $this->expect('a^-b', + 'a^-b', + [], + true, false); + + $this->expect('a^b', + 'a^b', + [], + true, false); + + $this->expect('a_b', + 'a_b', + [], + true, false); + + $this->expect('abs(13)', + 'abs(13)', + [], + true, false); + + $this->expect('abs(x)', + 'abs(x)', + [], + true, false); + + $this->expect('alpha', + 'alpha', + [], + true, false); + + $this->expect('arcsin(x)', + 'arcsin(x)', + [], + true, false); + + $this->expect('asin(x)', + 'asin(x)', + [], + true, false); + + $this->expect('asinh(x)', + 'asinh(x)', + [], + true, false); + + $this->expect('b(b+1)', + 'b(b+1)', + [], + true, false); + + $this->expect('b/a(x)', + 'b/a(x)', + [], + true, false); + + $this->expect('beta', + 'beta', + [], + true, false); + + $this->expect('beta_47', + 'beta_47', + [], + true, false); + + $this->expect('bsin(t)', + 'bsin(t)', + [], + true, false); + + $this->expect('ceiling(x)', + 'ceiling(x)', + [], + true, false); + + $this->expect('chi', + 'chi', + [], + true, false); + + $this->expect('comb(x,y)', + 'comb(x,y)', + [], + true, false); + + $this->expect('cos(2x)(x+1)', + 'cos(2*x)(x+1)', + [], + true, false); + + $this->expect('cos(x)', + 'cos(x)', + [], + true, false); + + $this->expect('cos^2(x)', + 'cos^2*(x)', + [], + true, false); + + $this->expect('cosec(x)', + 'cosec(x)', + [], + true, false); + + $this->expect('cosech(x)', + 'cosech(x)', + [], + true, false); + + $this->expect('cosh(x)', + 'cosh(x)', + [], + true, false); + + $this->expect('cot(x)', + 'cot(x)', + [], + true, false); + + $this->expect('coth(x)', + 'coth(x)', + [], + true, false); + + $this->expect('csc(6*x)^2*(7*sin(6*x)*cos(7*x)-6*cos(6*x)*sin(7*x))', + 'csc(6*x)^2*(7*sin(6*x)*cos(7*x)-6*cos(6*x)*sin(7*x))', + [], + true, false); + + $this->expect('csc(x)', + 'csc(x)', + [], + true, false); + + $this->expect('delta', + 'delta', + [], + true, false); + + $this->expect('diff(sin(x))', + 'diff(sin(x))', + [], + true, false); + + $this->expect('diff(sin(x),x)', + 'diff(sin(x),x)', + [], + true, false); + + $this->expect('diff(x,y)', + 'diff(x,y)', + [], + true, false); + + $this->expect('dosomething(x,y,z)', + 'dosomething(x,y,z)', + [], + true, false); + + $this->expect('e', + 'e', + [], + true, false); + + $this->expect('e*2', + 'e*2', + [], + true, false); + + $this->expect('e^x', + 'e^x', + [], + true, false); + + $this->expect('epsilon', + 'epsilon', + [], + true, false); + + $this->expect('eta', + 'eta', + [], + true, false); + + $this->expect('exp(x)', + 'exp(x)', + [], + true, false); + + $this->expect('f(x)', + 'f(x)', + [], + true, false); + + $this->expect('f(x)(2)', + 'f(x)(2)', + [], + true, false); + + $this->expect('fact(13)', + 'fact(13)', + [], + true, false); + + $this->expect('false', + 'false', + [], + true, false); + + $this->expect('floor(x)', + 'floor(x)', + [], + true, false); + + $this->expect('gamma', + 'gamma', + [], + true, false); + + $this->expect('gcd(x,y)', + 'gcd(x,y)', + [], + true, false); + + $this->expect('gcf(x,y)', + 'gcf(x,y)', + [], + true, false); + + $this->expect('i', + 'i', + [], + true, false); + + $this->expect('i(1+i)', + 'i(1+i)', + [], + true, false); + + $this->expect('i(4)', + 'i(4)', + [], + true, false); + + $this->expect('i*2', + 'i*2', + [], + true, false); + + $this->expect('inf', + 'inf', + [], + true, false); + + $this->expect('int(sin(x))', + 'int(sin(x))', + [], + true, false); + + $this->expect('int(x,y)', + 'int(x,y)', + [], + true, false); + + $this->expect('iota', + 'iota', + [], + true, false); + + $this->expect('j', + 'j', + [], + true, false); + + $this->expect('kappa', + 'kappa', + [], + true, false); + + $this->expect('lambda', + 'lambda', + [], + true, false); + + $this->expect('len(x)', + 'len(x)', + [], + true, false); + + $this->expect('length(x)', + 'length(x)', + [], + true, false); + + $this->expect('lg(10^3)', + 'lg(10^3)', + [], + true, false); + + $this->expect('lg(x)', + 'lg(x)', + [], + true, false); + + $this->expect('lg(x,a)', + 'lg(x,a)', + [], + true, false); + + $this->expect('limit(y,x,3)', + 'limit(y,x,3)', + [], + true, false); + + $this->expect('ln(x)', + 'ln(x)', + [], + true, false); + + $this->expect('ln*x', + 'ln*x', + [], + true, false); + + $this->expect('log(2x)/x+1/2', + 'log(2*x)/x+1/2', + [], + true, false); + + $this->expect('log(x)', + 'log(x)', + [], + true, false); + + $this->expect('log10(x)', + 'log10(x)', + [], + true, false); + + $this->expect('log_10(x)', + 'log_10(x)', + [], + true, false); + + $this->expect('log_2(a)', + 'log_2(a)', + [], + true, false); + + $this->expect('log_a(b)*log_b(c)', + 'log_a(b)*log_b(c)', + [], + true, false); + + $this->expect('log_x(1/(x+b))', + 'log_x(1/(x+b))', + [], + true, false); + + $this->expect('log_x:log_x(a)', + 'log_x:log_x(a)', + [], + true, false); + + $this->expect('matrix([a,b],[c,d])', + 'matrix([a,b],[c,d])', + [], + true, false); + + $this->expect('mod(x,y)', + 'mod(x,y)', + [], + true, false); + + $this->expect('mu', + 'mu', + [], + true, false); + + $this->expect('not x', + 'not x', + [], + true, false); + + $this->expect('nu', + 'nu', + [], + true, false); + + $this->expect('omega', + 'omega', + [], + true, false); + + $this->expect('omicron', + 'omicron', + [], + true, false); + + $this->expect('p=?*s', + 'p = QMCHAR*s', + [], + true, false); + + $this->expect('partialdiff(x,y,1)', + 'partialdiff(x,y,1)', + [], + true, false); + + $this->expect('perm(x,y)', + 'perm(x,y)', + [], + true, false); + + $this->expect('phi', + 'phi', + [], + true, false); + + $this->expect('pi', + 'pi', + [], + true, false); + + $this->expect('pi*2', + 'pi*2', + [], + true, false); + + $this->expect('plot(x^2,[x,-1,1])', + 'plot(x^2,[x,-1,1])', + [], + true, false); + + $this->expect('plot2d(x^2,[x,-1,1])', + 'plot2d(x^2,[x,-1,1])', + [], + true, false); + + $this->expect('product(cos(k*x),k,1,3)', + 'product(cos(k*x),k,1,3)', + [], + true, false); + + $this->expect('psi', + 'psi', + [], + true, false); + + $this->expect('rho', + 'rho', + [], + true, false); + + $this->expect('rho*z*V/(4*pi*epsilon[0]*(R^2+z^2)^(3/2))', + 'rho*z*V/(4*pi*epsilon[0]*(R^2+z^2)^(3/2))', + [], + true, false); + + $this->expect('root(2,-3)', + 'root(2,-3)', + [], + true, false); + + $this->expect('root(x)', + 'root(x)', + [], + true, false); + + $this->expect('root(x,3)', + 'root(x,3)', + [], + true, false); + + $this->expect('sec(x)', + 'sec(x)', + [], + true, false); + + $this->expect('sech(x)', + 'sech(x)', + [], + true, false); + + $this->expect('set(x, y, z)', + 'set(x,y,z)', + [], + true, false); + + $this->expect('sgn(x)', + 'sgn(x)', + [], + true, false); + + $this->expect('sigma', + 'sigma', + [], + true, false); + + $this->expect('sign(x)', + 'sign(x)', + [], + true, false); + + $this->expect('sim(x)', + 'sim(x)', + [], + true, false); + + $this->expect('sin', + 'sin', + [], + true, false); + + $this->expect('sin x', + 'sin*x', + [], + true, false); + + $this->expect('sin(x)', + 'sin(x)', + [], + true, false); + + $this->expect('sin*2*x', + 'sin*2*x', + [], + true, false); + + $this->expect('sin[2*x]', + 'sin[2*x]', + [], + true, false); + + $this->expect('sin^-1(x)', + 'sin^-1*(x)', + [], + true, false); + + $this->expect('sinh(x)', + 'sinh(x)', + [], + true, false); + + $this->expect('sqr(x)', + 'sqr(x)', + [], + true, false); + + $this->expect('sqrt(+x)', + 'sqrt(+x)', + [], + true, false); + + $this->expect('sqrt(x)', + 'sqrt(x)', + [], + true, false); + + $this->expect('stackvector(a)', + 'stackvector(a)', + [], + true, false); + + $this->expect('sum(k^n,n,0,3)', + 'sum(k^n,n,0,3)', + [], + true, false); + + $this->expect('switch(x,a,y,b,c)', + 'switch(x,a,y,b,c)', + [], + true, false); + + $this->expect('tan(x)', + 'tan(x)', + [], + true, false); + + $this->expect('tanh(x)', + 'tanh(x)', + [], + true, false); + + $this->expect('tau', + 'tau', + [], + true, false); + + $this->expect('theta', + 'theta', + [], + true, false); + + $this->expect('true', + 'true', + [], + true, false); + + $this->expect('upsilon', + 'upsilon', + [], + true, false); + + $this->expect('x', + 'x', + [], + true, false); + + $this->expect('x * y', + 'x*y', + [], + true, false); + + $this->expect('x + 1', + 'x+1', + [], + true, false); + + $this->expect('x + y', + 'x+y', + [], + true, false); + + $this->expect('x - y', + 'x-y', + [], + true, false); + + $this->expect('x / y', + 'x/y', + [], + true, false); + + $this->expect('x < y', + 'x < y', + [], + true, false); + + $this->expect('x <= y', + 'x <= y', + [], + true, false); + + $this->expect('x = y', + 'x = y', + [], + true, false); + + $this->expect('x > y', + 'x > y', + [], + true, false); + + $this->expect('x >= y', + 'x >= y', + [], + true, false); + + $this->expect('x ^ y', + 'x^y', + [], + true, false); + + $this->expect('x and', + 'x*and', + [], + true, false); + + $this->expect('x and y', + 'x and y', + [], + true, false); + + $this->expect('x divides y', + 'x*divides*y', + [], + true, false); + + $this->expect('x or y', + 'x or y', + [], + true, false); + + $this->expect('x xor y', + 'x xor y', + [], + true, false); + + $this->expect('x y', + 'x*y', + [], + true, false); + + $this->expect('x!', + 'x!', + [], + true, false); + + $this->expect('x()', + 'x()', + [], + true, false); + + $this->expect('x(2+1)', + 'x(2+1)', + [], + true, false); + + $this->expect('x(sin(t)+1)', + 'x(sin(t)+1)', + [], + true, false); + + $this->expect('x(t+1)', + 'x(t+1)', + [], + true, false); + + $this->expect('x(x+1)', + 'x(x+1)', + [], + true, false); + + $this->expect('x*(-y)', + 'x*(-y)', + [], + true, false); + + $this->expect('x*(y*z)', + 'x*(y*z)', + [], + true, false); + + $this->expect('x*2^y', + 'x*2^y', + [], + true, false); + + $this->expect('x*divides*y', + 'x*divides*y', + [], + true, false); + + $this->expect('x*i^3', + 'x*i^3', + [], + true, false); + + $this->expect('x*y*z', + 'x*y*z', + [], + true, false); + + $this->expect('x*y^z', + 'x*y^z', + [], + true, false); + + $this->expect('x+ 1', + 'x+1', + [], + true, false); + + $this->expect('x+(y+z)', + 'x+(y+z)', + [], + true, false); + + $this->expect('x+(y^z)', + 'x+(y^z)', + [], + true, false); + + $this->expect('x+1', + 'x+1', + [], + true, false); + + $this->expect('x+y+z', + 'x+y+z', + [], + true, false); + + $this->expect('x-(y+z)', + 'x-(y+z)', + [], + true, false); + + $this->expect('x/(y+z)', + 'x/(y+z)', + [], + true, false); + + $this->expect('x/(y/z)', + 'x/(y/z)', + [], + true, false); + + $this->expect('x/y/z', + 'x/y/z', + [], + true, false); + + $this->expect('x1', + 'x1', + [], + true, false); + + $this->expect('x<1 and x>1', + 'x < 1 and x > 1', + [], + true, false); + + $this->expect('x=+-sqrt(2)', + 'x = +-sqrt(2)', + [], + true, false); + + $this->expect('x=1 or 2', + 'x = 1 or 2', + [], + true, false); + + $this->expect('x=1 or 2 or 3', + 'x = 1 or 2 or 3', + [], + true, false); + + $this->expect('x=1 or x=2', + 'x = 1 or x = 2', + [], + true, false); + + $this->expect('x>1 or (x<1 and t<sin(x))', + 'x > 1 or (x < 1 and t < sin(x))', + [], + true, false); + + $this->expect('x^(-(y+z))', + 'x^(-(y+z))', + [], + true, false); + + $this->expect('x^(-y)', + 'x^(-y)', + [], + true, false); + + $this->expect('x^(y+z)', + 'x^(y+z)', + [], + true, false); + + $this->expect('x^(y/z)', + 'x^(y/z)', + [], + true, false); + + $this->expect('x^-1', + 'x^-1', + [], + true, false); + + $this->expect('x^-y', + 'x^-y', + [], + true, false); + + $this->expect('x^7/7-2*x^6/3-4*x^3/3', + 'x^7/7-2*x^6/3-4*x^3/3', + [], + true, false); + + $this->expect('x^f(x)', + 'x^f(x)', + [], + true, false); + + $this->expect('x^y', + 'x^y', + [], + true, false); + + $this->expect('x^y^z', + 'x^y^z', + [], + true, false); + + $this->expect('x_1', + 'x_1', + [], + true, false); + + $this->expect('Xy_12', + 'Xy_12', + [], + true, false); + + $this->expect('x_y', + 'x_y', + [], + true, false); + + $this->expect('x_y_z', + 'x_y_z', + [], + true, false); + + $this->expect('x_y_1', + 'x_y_1', + [], + true, false); + + $this->expect('x_12_z', + 'x_12_z', + [], + true, false); + + $this->expect('xy_zw', + 'xy_zw', + [], + true, false); + + $this->expect('xy_12', + 'xy_12', + [], + true, false); + + $this->expect('M_2*x^2+M_1*x+M_0', + 'M_2*x^2+M_1*x+M_0', + [], + true, false); + + $this->expect('xi', + 'xi', + [], + true, false); + + $this->expect('xsin(1)', + 'xsin(1)', + [], + true, false); + + $this->expect('xy', + 'xy', + [], + true, false); + + $this->expect('y^2-2*y-0.5', + 'y^2-2*y-0.5', + [], + true, false); + + $this->expect('y^2-2*y-8', + 'y^2-2*y-8', + [], + true, false); + + $this->expect('y^3-2*y^2-8*y', + 'y^3-2*y^2-8*y', + [], + true, false); + + $this->expect('y^z * x', + 'y^z*x', + [], + true, false); + + $this->expect('ycos(2)', + 'ycos(2)', + [], + true, false); + + $this->expect('zeta', + 'zeta', + [], + true, false); + + $this->expect('{1,2,3.4}', + '{1,2,3.4}', + [], + true, false); + + $this->expect('{1}', + '{1}', + [], + true, false); + + $this->expect('{x, y, z }', + '{x,y,z}', + [], + true, false); + + $this->expect('{}', + '{}', + [], + true, false); + + $this->expect('|x|', + 'abs(x)', + [], + true, false); + + $this->expect('rand(["+","-"])(x,y)', + 'rand(["+","-"])(x,y)', + [], + true, false); + + $this->expect('rand(["sin","cos","system"])(x)', + 'rand(["sin","cos","system"])(x)', + [], + true, false); + + $this->expect('1.2*m**2', + '1.2*m**2', + [], + true, false); + + $this->expect('1.2*mˆ2', + '1.2*m^2', + [], + true, false); + + $this->expect('/* Comment */x+1', + '/* Comment */x+1', + [], + true, false); + + $this->expect('/* Comment **/x+1', + '/* Comment **/x+1', + [], + true, false); + + $this->expect('/** Comment */x+1', + '/** Comment */x+1', + [], + true, false); + + $this->expect('/** Comment **/x+1', + '/** Comment **/x+1', + [], + true, false); + + $this->expect('/*@ Comment @*/x+1', + '/*@ Comment @*/x+1', + [], + true, false); + + $this->expect('"A string that needs sanitising <script>bad stuff</script>."', + '"A string that needs sanitising <script>bad stuff</script>."', + [], + true, false); + + } + + public function test_non_affected_no_units() { + $this->security = new stack_cas_security(false); + $this->filter = stack_parsing_rule_factory::get_by_common_name('033_no_extra_evaluation'); + + $this->expect('"+"(a,b)', + '"+"(a,b)', + [], + true, false); + + $this->expect('"1+1"', + '"1+1"', + [], + true, false); + + $this->expect('"Hello world"', + '"Hello world"', + [], + true, false); + + $this->expect('%e^x', + '%e^x', + [], + true, false); + + $this->expect('2pi r^2', + '2*pi*r^2', + [], + true, false); + + $this->expect('2pir^2', + '2*pir^2', + [], + true, false); + + $this->expect("'diff(x,y)", + "'diff(x,y)", + [], + true, false); + + $this->expect("'int(x,y)", + "'int(x,y)", + [], + true, false); + + $this->expect('(()x)', + '(()*x)', + [], + true, false); + + $this->expect('((x))', + '((x))', + [], + true, false); + + $this->expect('()x', + '()*x', + [], + true, false); + + $this->expect('(+1)', + '(+1)', + [], + true, false); + + $this->expect('(-1)', + '(-1)', + [], + true, false); + + $this->expect('(-b+-sqrt(b^2))/(2*a)', + '(-b+-sqrt(b^2))/(2*a)', + [], + true, false); + + $this->expect('(-x)*y', + '(-x)*y', + [], + true, false); + + $this->expect('(1+i)*x', + '(1+i)*x', + [], + true, false); + + $this->expect('(1+i)+x', + '(1+i)+x', + [], + true, false); + + $this->expect('(a,b,c)', + '(a,b,c)', + [], + true, false); + + $this->expect('((a,b),c)', + '((a,b),c)', + [], + true, false); + + $this->expect('(a,(b,c))', + '(a,(b,c))', + [], + true, false); + + $this->expect('{(a,b),(x,y)}', + '{(a,b),(x,y)}', + [], + true, false); + + $this->expect('(a-b)-c', + '(a-b)-c', + [], + true, false); + + $this->expect('(x)', + '(x)', + [], + true, false); + + $this->expect('(x*y)*z', + '(x*y)*z', + [], + true, false); + + $this->expect('(x+2)(x+3)', + '(x+2)(x+3)', + [], + true, false); + + $this->expect('(x+2)3', + '(x+2)*3', + [], + true, false); + + $this->expect('(x+2)y', + '(x+2)*y', + [], + true, false); + + $this->expect('(x+y)+z', + '(x+y)+z', + [], + true, false); + + $this->expect('(x+y)^z', + '(x+y)^z', + [], + true, false); + + $this->expect('(x-y)+z', + '(x-y)+z', + [], + true, false); + + $this->expect('(x/y)/z', + '(x/y)/z', + [], + true, false); + + $this->expect('+-1', + '+-1', + [], + true, false); + + $this->expect('+0.2', + '+0.2', + [], + true, false); + + $this->expect('+1', + '+1', + [], + true, false); + + $this->expect('+e', + '+e', + [], + true, false); + + $this->expect('+i', + '+i', + [], + true, false); + + $this->expect('+pi', + '+pi', + [], + true, false); + + $this->expect('+x', + '+x', + [], + true, false); + + $this->expect('-(1/512) + i(sqrt(3)/512)', + '-(1/512)+i(sqrt(3)/512)', + [], + true, false); + + $this->expect('-1', + '-1', + [], + true, false); + + $this->expect('-1234', + '-1234', + [], + true, false); + + $this->expect('-0.2', + '-0.2', + [], + true, false); + + $this->expect('-10/-1', + '-10/-1', + [], + true, false); + + $this->expect('-3(x+1)', + '-3*(x+1)', + [], + true, false); + + $this->expect('-3+i', + '-3+i', + [], + true, false); + + $this->expect('-3x(1+x)', + '-3*x(1+x)', + [], + true, false); + + $this->expect('-b(5-b)', + '-b(5-b)', + [], + true, false); + + $this->expect('-e', + '-e', + [], + true, false); + + $this->expect('-i', + '-i', + [], + true, false); + + $this->expect('-pi', + '-pi', + [], + true, false); + + $this->expect('-x', + '-x', + [], + true, false); + + $this->expect('-x(1+x)', + '-x(1+x)', + [], + true, false); + + $this->expect('-x[3]', + '-x[3]', + [], + true, false); + + $this->expect('.1', + '.1', + [], + true, false); + + $this->expect('-0.2433 + 0.1111', + '-0.2433+0.1111', + [], + true, false); + + $this->expect('-0.2433e23 + 0.1111e-45 * 0.23e12 / -0.11e-11', + '-0.2433E23+0.1111E-45*0.23E12/-0.11E-11', + [], + true, false); + + $this->expect('-35.3 * 10^23', + '-35.3*10^23', + [], + true, false); + + $this->expect('0..1', + '0. . 1', + [], + true, false); + + $this->expect('0.1..1.2', + '0.1 . .1 . 2', + [], + true, false); + + $this->expect('0.1.1.2', + '0.1 . 1.2', + [], + true, false); + + $this->expect('0.1. 1.2', + '0.1 . 1.2', + [], + true, false); + + $this->expect('1', + '1', + [], + true, false); + + $this->expect('1234', + '1234', + [], + true, false); + + $this->expect('1 x', + '1*x', + [], + true, false); + + $this->expect('1+2i', + '1+2*i', + [], + true, false); + + $this->expect('1+i', + '1+i', + [], + true, false); + + $this->expect('1-x(1+x)', + '1-x(1+x)', + [], + true, false); + + $this->expect('1/0', + '1/0', + [], + true, false); + + $this->expect('1/2', + '1/2', + [], + true, false); + + $this->expect('1/sin(+x)', + '1/sin(+x)', + [], + true, false); + + $this->expect('1<=x<y^2', + '1 <= x < y^2', + [], + true, false); + + $this->expect('1<x<3', + '1 < x < 3', + [], + true, false); + + $this->expect('1E+3', + '1E+3', + [], + true, false); + + $this->expect('1E3', + '1E3', + [], + true, false); + + $this->expect('1 E 3', + '1*E*3', + [], + true, false); + + $this->expect('23.2*x*10^5', + '23.2*x*10^5', + [], + true, false); + + $this->expect('23.2 x 10^5', + '23.2*x*10^5', + [], + true, false); + + $this->expect('23.2x10^5', + '23.2*x10^5', + [], + true, false); + + $this->expect('23.2x 10^5', + '23.2*x*10^5', + [], + true, false); + + $this->expect('23.2 x10^5', + '23.2*x10^5', + [], + true, false); + + $this->expect('1E23*10^45', + '1E23*10^45', + [], + true, false); + + $this->expect('9.81x10^2*m/s', + '9.81*x10^2*m/s', + [], + true, false); + + $this->expect('9.81x*10^2*m/s', + '9.81*x*10^2*m/s', + [], + true, false); + + $this->expect('1x', + '1*x', + [], + true, false); + + $this->expect('2*e', + '2*e', + [], + true, false); + + $this->expect('2*i', + '2*i', + [], + true, false); + + $this->expect('2*i^3', + '2*i^3', + [], + true, false); + + $this->expect('2*pi', + '2*pi', + [], + true, false); + + $this->expect('2+3(x+1)', + '2+3*(x+1)', + [], + true, false); + + $this->expect('2+log_x(1/(x+b))*x^2', + '2+log_x(1/(x+b))*x^2', + [], + true, false); + + $this->expect('2/4', + '2/4', + [], + true, false); + + $this->expect('2^y*x', + '2^y*x', + [], + true, false); + + $this->expect('3(x+1)', + '3*(x+1)', + [], + true, false); + + $this->expect('3-i', + '3-i', + [], + true, false); + + $this->expect('3 5', + '3*5', + [], + true, false); + + $this->expect('3.14 5', + '3.14*5', + [], + true, false); + + $this->expect('3 5.2789', + '3*5.2789', + [], + true, false); + + $this->expect('3.14 5.2789', + '3.14*5.2789', + [], + true, false); + + $this->expect('33 578 32', + '33*578*32', + [], + true, false); + + $this->expect('9 8 7.6', + '9*8*7.6', + [], + true, false); + + $this->expect('9 8.5 7.6', + '9*8.5*7.6', + [], + true, false); + + $this->expect('3b+5/a(x)', + '3*b+5/a(x)', + [], + true, false); + + $this->expect('3beta_47', + '3*beta_47', + [], + true, false); + + $this->expect('3e-2', + '3E-2', + [], + true, false); + + $this->expect('3e2', + '3E2', + [], + true, false); + + $this->expect('3E2', + '3E2', + [], + true, false); + + $this->expect('7x(2+1)', + '7*x(2+1)', + [], + true, false); + + $this->expect('Bgcd(3,2)', + 'Bgcd(3,2)', + [], + true, false); + + $this->expect('In(x)', + 'In(x)', + [], + true, false); + + $this->expect('Sin(x)', + 'Sin(x)', + [], + true, false); + + $this->expect('3.75*Btu', + '3.75*Btu', + [], + true, false); + + $this->expect('X', + 'X', + [], + true, false); + + $this->expect('["a"]', + '["a"]', + [], + true, false); + + $this->expect('[+1,+2]', + '[+1,+2]', + [], + true, false); + + $this->expect('[-1,-2]', + '[-1,-2]', + [], + true, false); + + $this->expect('[1 < x,y < 1 or y > 7]', + '[1 < x,y < 1 or y > 7]', + [], + true, false); + + $this->expect('[1,+2]', + '[1,+2]', + [], + true, false); + + $this->expect('[1,-2]', + '[1,-2]', + [], + true, false); + + $this->expect('[1,2,3.4]', + '[1,2,3.4]', + [], + true, false); + + $this->expect('[1,true,"a"]', + '[1,true,"a"]', + [], + true, false); + + $this->expect('[1<x,1<y<3]', + '[1 < x,1 < y < 3]', + [], + true, false); + + $this->expect('[1<x,x<3]', + '[1 < x,x < 3]', + [], + true, false); + + $this->expect('[1]', + '[1]', + [], + true, false); + + $this->expect('[[1,2],[3,4]]', + '[[1,2],[3,4]]', + [], + true, false); + + $this->expect('[]', + '[]', + [], + true, false); + + $this->expect('[x, y, z ]', + '[x,y,z]', + [], + true, false); + + $this->expect('a ** b', + 'a**b', + [], + true, false); + + $this->expect('a +++ b', + 'a+++b', + [], + true, false); + + $this->expect('a --- b', + 'a---b', + [], + true, false); + + $this->expect('a(x)', + 'a(x)', + [], + true, false); + + $this->expect('a++b', + 'a++b', + [], + true, false); + + $this->expect('a+-b', + 'a+-b', + [], + true, false); + + $this->expect('a,b,c', + 'a,b=true,c=true', + [], + true, false); + + $this->expect('a-(b-c)', + 'a-(b-c)', + [], + true, false); + + $this->expect('a-+b', + 'a-+b', + [], + true, false); + + $this->expect('a/(a(x+1)+2)', + 'a/(a(x+1)+2)', + [], + true, false); + + $this->expect('a/b/c', + 'a/b/c', + [], + true, false); + + $this->expect('a1', + 'a1', + [], + true, false); + + $this->expect('a9b', + 'a9b', + [], + true, false); + + $this->expect('ab98cd', + 'ab98cd', + [], + true, false); + + $this->expect('aXy1', + 'aXy1', + [], + true, false); + + $this->expect('a[1,2]', + 'a[1,2]', + [], + true, false); + + $this->expect('a[2]', + 'a[2]', + [], + true, false); + + $this->expect('a[n+1]', + 'a[n+1]', + [], + true, false); + + $this->expect('a^-b', + 'a^-b', + [], + true, false); + + $this->expect('a^b', + 'a^b', + [], + true, false); + + $this->expect('a_b', + 'a_b', + [], + true, false); + + $this->expect('abs(13)', + 'abs(13)', + [], + true, false); + + $this->expect('abs(x)', + 'abs(x)', + [], + true, false); + + $this->expect('alpha', + 'alpha', + [], + true, false); + + $this->expect('arcsin(x)', + 'arcsin(x)', + [], + true, false); + + $this->expect('asin(x)', + 'asin(x)', + [], + true, false); + + $this->expect('asinh(x)', + 'asinh(x)', + [], + true, false); + + $this->expect('b(b+1)', + 'b(b+1)', + [], + true, false); + + $this->expect('b/a(x)', + 'b/a(x)', + [], + true, false); + + $this->expect('beta', + 'beta', + [], + true, false); + + $this->expect('beta_47', + 'beta_47', + [], + true, false); + + $this->expect('bsin(t)', + 'bsin(t)', + [], + true, false); + + $this->expect('ceiling(x)', + 'ceiling(x)', + [], + true, false); + + $this->expect('chi', + 'chi', + [], + true, false); + + $this->expect('comb(x,y)', + 'comb(x,y)', + [], + true, false); + + $this->expect('cos(2x)(x+1)', + 'cos(2*x)(x+1)', + [], + true, false); + + $this->expect('cos(x)', + 'cos(x)', + [], + true, false); + + $this->expect('cos^2(x)', + 'cos^2*(x)', + [], + true, false); + + $this->expect('cosec(x)', + 'cosec(x)', + [], + true, false); + + $this->expect('cosech(x)', + 'cosech(x)', + [], + true, false); + + $this->expect('cosh(x)', + 'cosh(x)', + [], + true, false); + + $this->expect('cot(x)', + 'cot(x)', + [], + true, false); + + $this->expect('coth(x)', + 'coth(x)', + [], + true, false); + + $this->expect('csc(6*x)^2*(7*sin(6*x)*cos(7*x)-6*cos(6*x)*sin(7*x))', + 'csc(6*x)^2*(7*sin(6*x)*cos(7*x)-6*cos(6*x)*sin(7*x))', + [], + true, false); + + $this->expect('csc(x)', + 'csc(x)', + [], + true, false); + + $this->expect('delta', + 'delta', + [], + true, false); + + $this->expect('diff(sin(x))', + 'diff(sin(x))', + [], + true, false); + + $this->expect('diff(sin(x),x)', + 'diff(sin(x),x)', + [], + true, false); + + $this->expect('diff(x,y)', + 'diff(x,y)', + [], + true, false); + + $this->expect('dosomething(x,y,z)', + 'dosomething(x,y,z)', + [], + true, false); + + $this->expect('e', + 'e', + [], + true, false); + + $this->expect('e*2', + 'e*2', + [], + true, false); + + $this->expect('e^x', + 'e^x', + [], + true, false); + + $this->expect('epsilon', + 'epsilon', + [], + true, false); + + $this->expect('eta', + 'eta', + [], + true, false); + + $this->expect('exp(x)', + 'exp(x)', + [], + true, false); + + $this->expect('f(x)', + 'f(x)', + [], + true, false); + + $this->expect('f(x)(2)', + 'f(x)(2)', + [], + true, false); + + $this->expect('fact(13)', + 'fact(13)', + [], + true, false); + + $this->expect('false', + 'false', + [], + true, false); + + $this->expect('floor(x)', + 'floor(x)', + [], + true, false); + + $this->expect('gamma', + 'gamma', + [], + true, false); + + $this->expect('gcd(x,y)', + 'gcd(x,y)', + [], + true, false); + + $this->expect('gcf(x,y)', + 'gcf(x,y)', + [], + true, false); + + $this->expect('i', + 'i', + [], + true, false); + + $this->expect('i(1+i)', + 'i(1+i)', + [], + true, false); + + $this->expect('i(4)', + 'i(4)', + [], + true, false); + + $this->expect('i*2', + 'i*2', + [], + true, false); + + $this->expect('inf', + 'inf', + [], + true, false); + + $this->expect('int(sin(x))', + 'int(sin(x))', + [], + true, false); + + $this->expect('int(x,y)', + 'int(x,y)', + [], + true, false); + + $this->expect('iota', + 'iota', + [], + true, false); + + $this->expect('j', + 'j', + [], + true, false); + + $this->expect('kappa', + 'kappa', + [], + true, false); + + $this->expect('lambda', + 'lambda', + [], + true, false); + + $this->expect('len(x)', + 'len(x)', + [], + true, false); + + $this->expect('length(x)', + 'length(x)', + [], + true, false); + + $this->expect('lg(10^3)', + 'lg(10^3)', + [], + true, false); + + $this->expect('lg(x)', + 'lg(x)', + [], + true, false); + + $this->expect('lg(x,a)', + 'lg(x,a)', + [], + true, false); + + $this->expect('limit(y,x,3)', + 'limit(y,x,3)', + [], + true, false); + + $this->expect('ln(x)', + 'ln(x)', + [], + true, false); + + $this->expect('ln*x', + 'ln*x', + [], + true, false); + + $this->expect('log(2x)/x+1/2', + 'log(2*x)/x+1/2', + [], + true, false); + + $this->expect('log(x)', + 'log(x)', + [], + true, false); + + $this->expect('log10(x)', + 'log10(x)', + [], + true, false); + + $this->expect('log_10(x)', + 'log_10(x)', + [], + true, false); + + $this->expect('log_2(a)', + 'log_2(a)', + [], + true, false); + + $this->expect('log_a(b)*log_b(c)', + 'log_a(b)*log_b(c)', + [], + true, false); + + $this->expect('log_x(1/(x+b))', + 'log_x(1/(x+b))', + [], + true, false); + + $this->expect('log_x:log_x(a)', + 'log_x:log_x(a)', + [], + true, false); + + $this->expect('matrix([a,b],[c,d])', + 'matrix([a,b],[c,d])', + [], + true, false); + + $this->expect('mod(x,y)', + 'mod(x,y)', + [], + true, false); + + $this->expect('mu', + 'mu', + [], + true, false); + + $this->expect('not x', + 'not x', + [], + true, false); + + $this->expect('nu', + 'nu', + [], + true, false); + + $this->expect('omega', + 'omega', + [], + true, false); + + $this->expect('omicron', + 'omicron', + [], + true, false); + + $this->expect('p=?*s', + 'p = QMCHAR*s', + [], + true, false); + + $this->expect('partialdiff(x,y,1)', + 'partialdiff(x,y,1)', + [], + true, false); + + $this->expect('perm(x,y)', + 'perm(x,y)', + [], + true, false); + + $this->expect('phi', + 'phi', + [], + true, false); + + $this->expect('pi', + 'pi', + [], + true, false); + + $this->expect('pi*2', + 'pi*2', + [], + true, false); + + $this->expect('plot(x^2,[x,-1,1])', + 'plot(x^2,[x,-1,1])', + [], + true, false); + + $this->expect('plot2d(x^2,[x,-1,1])', + 'plot2d(x^2,[x,-1,1])', + [], + true, false); + + $this->expect('product(cos(k*x),k,1,3)', + 'product(cos(k*x),k,1,3)', + [], + true, false); + + $this->expect('psi', + 'psi', + [], + true, false); + + $this->expect('rho', + 'rho', + [], + true, false); + + $this->expect('rho*z*V/(4*pi*epsilon[0]*(R^2+z^2)^(3/2))', + 'rho*z*V/(4*pi*epsilon[0]*(R^2+z^2)^(3/2))', + [], + true, false); + + $this->expect('root(2,-3)', + 'root(2,-3)', + [], + true, false); + + $this->expect('root(x)', + 'root(x)', + [], + true, false); + + $this->expect('root(x,3)', + 'root(x,3)', + [], + true, false); + + $this->expect('sec(x)', + 'sec(x)', + [], + true, false); + + $this->expect('sech(x)', + 'sech(x)', + [], + true, false); + + $this->expect('set(x, y, z)', + 'set(x,y,z)', + [], + true, false); + + $this->expect('sgn(x)', + 'sgn(x)', + [], + true, false); + + $this->expect('sigma', + 'sigma', + [], + true, false); + + $this->expect('sign(x)', + 'sign(x)', + [], + true, false); + + $this->expect('sim(x)', + 'sim(x)', + [], + true, false); + + $this->expect('sin', + 'sin', + [], + true, false); + + $this->expect('sin x', + 'sin*x', + [], + true, false); + + $this->expect('sin(x)', + 'sin(x)', + [], + true, false); + + $this->expect('sin*2*x', + 'sin*2*x', + [], + true, false); + + $this->expect('sin[2*x]', + 'sin[2*x]', + [], + true, false); + + $this->expect('sin^-1(x)', + 'sin^-1*(x)', + [], + true, false); + + $this->expect('sinh(x)', + 'sinh(x)', + [], + true, false); + + $this->expect('sqr(x)', + 'sqr(x)', + [], + true, false); + + $this->expect('sqrt(+x)', + 'sqrt(+x)', + [], + true, false); + + $this->expect('sqrt(x)', + 'sqrt(x)', + [], + true, false); + + $this->expect('stackvector(a)', + 'stackvector(a)', + [], + true, false); + + $this->expect('sum(k^n,n,0,3)', + 'sum(k^n,n,0,3)', + [], + true, false); + + $this->expect('switch(x,a,y,b,c)', + 'switch(x,a,y,b,c)', + [], + true, false); + + $this->expect('tan(x)', + 'tan(x)', + [], + true, false); + + $this->expect('tanh(x)', + 'tanh(x)', + [], + true, false); + + $this->expect('tau', + 'tau', + [], + true, false); + + $this->expect('theta', + 'theta', + [], + true, false); + + $this->expect('true', + 'true', + [], + true, false); + + $this->expect('upsilon', + 'upsilon', + [], + true, false); + + $this->expect('x', + 'x', + [], + true, false); + + $this->expect('x * y', + 'x*y', + [], + true, false); + + $this->expect('x + 1', + 'x+1', + [], + true, false); + + $this->expect('x + y', + 'x+y', + [], + true, false); + + $this->expect('x - y', + 'x-y', + [], + true, false); + + $this->expect('x / y', + 'x/y', + [], + true, false); + + $this->expect('x < y', + 'x < y', + [], + true, false); + + $this->expect('x <= y', + 'x <= y', + [], + true, false); + + $this->expect('x = y', + 'x = y', + [], + true, false); + + $this->expect('x > y', + 'x > y', + [], + true, false); + + $this->expect('x >= y', + 'x >= y', + [], + true, false); + + $this->expect('x ^ y', + 'x^y', + [], + true, false); + + $this->expect('x and', + 'x*and', + [], + true, false); + + $this->expect('x and y', + 'x and y', + [], + true, false); + + $this->expect('x divides y', + 'x*divides*y', + [], + true, false); + + $this->expect('x or y', + 'x or y', + [], + true, false); + + $this->expect('x xor y', + 'x xor y', + [], + true, false); + + $this->expect('x y', + 'x*y', + [], + true, false); + + $this->expect('x!', + 'x!', + [], + true, false); + + $this->expect('x()', + 'x()', + [], + true, false); + + $this->expect('x(2+1)', + 'x(2+1)', + [], + true, false); + + $this->expect('x(sin(t)+1)', + 'x(sin(t)+1)', + [], + true, false); + + $this->expect('x(t+1)', + 'x(t+1)', + [], + true, false); + + $this->expect('x(x+1)', + 'x(x+1)', + [], + true, false); + + $this->expect('x*(-y)', + 'x*(-y)', + [], + true, false); + + $this->expect('x*(y*z)', + 'x*(y*z)', + [], + true, false); + + $this->expect('x*2^y', + 'x*2^y', + [], + true, false); + + $this->expect('x*divides*y', + 'x*divides*y', + [], + true, false); + + $this->expect('x*i^3', + 'x*i^3', + [], + true, false); + + $this->expect('x*y*z', + 'x*y*z', + [], + true, false); + + $this->expect('x*y^z', + 'x*y^z', + [], + true, false); + + $this->expect('x+ 1', + 'x+1', + [], + true, false); + + $this->expect('x+(y+z)', + 'x+(y+z)', + [], + true, false); + + $this->expect('x+(y^z)', + 'x+(y^z)', + [], + true, false); + + $this->expect('x+1', + 'x+1', + [], + true, false); + + $this->expect('x+y+z', + 'x+y+z', + [], + true, false); + + $this->expect('x-(y+z)', + 'x-(y+z)', + [], + true, false); + + $this->expect('x/(y+z)', + 'x/(y+z)', + [], + true, false); + + $this->expect('x/(y/z)', + 'x/(y/z)', + [], + true, false); + + $this->expect('x/y/z', + 'x/y/z', + [], + true, false); + + $this->expect('x1', + 'x1', + [], + true, false); + + $this->expect('x<1 and x>1', + 'x < 1 and x > 1', + [], + true, false); + + $this->expect('x=+-sqrt(2)', + 'x = +-sqrt(2)', + [], + true, false); + + $this->expect('x=1 or 2', + 'x = 1 or 2', + [], + true, false); + + $this->expect('x=1 or 2 or 3', + 'x = 1 or 2 or 3', + [], + true, false); + + $this->expect('x=1 or x=2', + 'x = 1 or x = 2', + [], + true, false); + + $this->expect('x>1 or (x<1 and t<sin(x))', + 'x > 1 or (x < 1 and t < sin(x))', + [], + true, false); + + $this->expect('x^(-(y+z))', + 'x^(-(y+z))', + [], + true, false); + + $this->expect('x^(-y)', + 'x^(-y)', + [], + true, false); + + $this->expect('x^(y+z)', + 'x^(y+z)', + [], + true, false); + + $this->expect('x^(y/z)', + 'x^(y/z)', + [], + true, false); + + $this->expect('x^-1', + 'x^-1', + [], + true, false); + + $this->expect('x^-y', + 'x^-y', + [], + true, false); + + $this->expect('x^7/7-2*x^6/3-4*x^3/3', + 'x^7/7-2*x^6/3-4*x^3/3', + [], + true, false); + + $this->expect('x^f(x)', + 'x^f(x)', + [], + true, false); + + $this->expect('x^y', + 'x^y', + [], + true, false); + + $this->expect('x^y^z', + 'x^y^z', + [], + true, false); + + $this->expect('x_1', + 'x_1', + [], + true, false); + + $this->expect('Xy_12', + 'Xy_12', + [], + true, false); + + $this->expect('x_y', + 'x_y', + [], + true, false); + + $this->expect('x_y_z', + 'x_y_z', + [], + true, false); + + $this->expect('x_y_1', + 'x_y_1', + [], + true, false); + + $this->expect('x_12_z', + 'x_12_z', + [], + true, false); + + $this->expect('xy_zw', + 'xy_zw', + [], + true, false); + + $this->expect('xy_12', + 'xy_12', + [], + true, false); + + $this->expect('M_2*x^2+M_1*x+M_0', + 'M_2*x^2+M_1*x+M_0', + [], + true, false); + + $this->expect('xi', + 'xi', + [], + true, false); + + $this->expect('xsin(1)', + 'xsin(1)', + [], + true, false); + + $this->expect('xy', + 'xy', + [], + true, false); + + $this->expect('y^2-2*y-0.5', + 'y^2-2*y-0.5', + [], + true, false); + + $this->expect('y^2-2*y-8', + 'y^2-2*y-8', + [], + true, false); + + $this->expect('y^3-2*y^2-8*y', + 'y^3-2*y^2-8*y', + [], + true, false); + + $this->expect('y^z * x', + 'y^z*x', + [], + true, false); + + $this->expect('ycos(2)', + 'ycos(2)', + [], + true, false); + + $this->expect('zeta', + 'zeta', + [], + true, false); + + $this->expect('{1,2,3.4}', + '{1,2,3.4}', + [], + true, false); + + $this->expect('{1}', + '{1}', + [], + true, false); + + $this->expect('{x, y, z }', + '{x,y,z}', + [], + true, false); + + $this->expect('{}', + '{}', + [], + true, false); + + $this->expect('|x|', + 'abs(x)', + [], + true, false); + + $this->expect('rand(["+","-"])(x,y)', + 'rand(["+","-"])(x,y)', + [], + true, false); + + $this->expect('rand(["sin","cos","system"])(x)', + 'rand(["sin","cos","system"])(x)', + [], + true, false); + + $this->expect('1.2*m**2', + '1.2*m**2', + [], + true, false); + + $this->expect('1.2*mˆ2', + '1.2*m^2', + [], + true, false); + + $this->expect('/* Comment */x+1', + '/* Comment */x+1', + [], + true, false); + + $this->expect('/* Comment **/x+1', + '/* Comment **/x+1', + [], + true, false); + + $this->expect('/** Comment */x+1', + '/** Comment */x+1', + [], + true, false); + + $this->expect('/** Comment **/x+1', + '/** Comment **/x+1', + [], + true, false); + + $this->expect('/*@ Comment @*/x+1', + '/*@ Comment @*/x+1', + [], + true, false); + + $this->expect('"A string that needs sanitising <script>bad stuff</script>."', + '"A string that needs sanitising <script>bad stuff</script>."', + [], + true, false); + + } +} diff --git a/tests/ast_filter_050_no_chained_inequalities_auto_generated_test.php b/tests/ast_filter_050_no_chained_inequalities_auto_generated_test.php index 0df850d1707ce6f6f2a0d2434834a606abcb98b4..74778ea16be95e8d9ce23f73aa68b67562172219 100644 --- a/tests/ast_filter_050_no_chained_inequalities_auto_generated_test.php +++ b/tests/ast_filter_050_no_chained_inequalities_auto_generated_test.php @@ -119,6 +119,11 @@ class ast_filter_050_no_chained_inequalities_auto_generated_test extends qtype_s [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1885,6 +1890,11 @@ class ast_filter_050_no_chained_inequalities_auto_generated_test extends qtype_s [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_090_special_forbidden_characters_auto_generated_test.php b/tests/ast_filter_090_special_forbidden_characters_auto_generated_test.php index d12604d7fb06a8052dcc7df0414f9f5d208c6e60..4304cb85f284d69b804e3ea237946f7bcdfb77d3 100644 --- a/tests/ast_filter_090_special_forbidden_characters_auto_generated_test.php +++ b/tests/ast_filter_090_special_forbidden_characters_auto_generated_test.php @@ -89,6 +89,11 @@ class ast_filter_090_special_forbidden_characters_auto_generated_test extends qt [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1870,6 +1875,11 @@ class ast_filter_090_special_forbidden_characters_auto_generated_test extends qt [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_101_no_floats_auto_generated_test.php b/tests/ast_filter_101_no_floats_auto_generated_test.php index d47940bc9480d03dbfb264a117cea4ff61ebe48a..477c4a1d340c7b5af22af621c49522e2fe4044fd 100644 --- a/tests/ast_filter_101_no_floats_auto_generated_test.php +++ b/tests/ast_filter_101_no_floats_auto_generated_test.php @@ -429,6 +429,11 @@ class ast_filter_101_no_floats_auto_generated_test extends qtype_stack_ast_testc [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -2040,6 +2045,11 @@ class ast_filter_101_no_floats_auto_generated_test extends qtype_stack_ast_testc [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_102_no_strings_auto_generated_test.php b/tests/ast_filter_102_no_strings_auto_generated_test.php index 8f18277a489473a57238d99e557d000e6024a084..7b2a9f18b06902a5cb1e242f0fc748b953254a0a 100644 --- a/tests/ast_filter_102_no_strings_auto_generated_test.php +++ b/tests/ast_filter_102_no_strings_auto_generated_test.php @@ -154,6 +154,11 @@ class ast_filter_102_no_strings_auto_generated_test extends qtype_stack_ast_test [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1895,6 +1900,11 @@ class ast_filter_102_no_strings_auto_generated_test extends qtype_stack_ast_test [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_103_no_lists_auto_generated_test.php b/tests/ast_filter_103_no_lists_auto_generated_test.php index d240b5e28eaa71f4c1595cf7f780dd9fea9341a8..8bb08555e5420e2334d28812ae88df2cc07fde21 100644 --- a/tests/ast_filter_103_no_lists_auto_generated_test.php +++ b/tests/ast_filter_103_no_lists_auto_generated_test.php @@ -339,6 +339,11 @@ class ast_filter_103_no_lists_auto_generated_test extends qtype_stack_ast_testca [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1995,6 +2000,11 @@ class ast_filter_103_no_lists_auto_generated_test extends qtype_stack_ast_testca [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_104_no_sets_auto_generated_test.php b/tests/ast_filter_104_no_sets_auto_generated_test.php index b5d61d6fb98c9dd07c3912ff69b1ae3d4a60abb2..73237887e5d74194570db2d09456b6876263f1e1 100644 --- a/tests/ast_filter_104_no_sets_auto_generated_test.php +++ b/tests/ast_filter_104_no_sets_auto_generated_test.php @@ -139,6 +139,11 @@ class ast_filter_104_no_sets_auto_generated_test extends qtype_stack_ast_testcas [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1895,6 +1900,11 @@ class ast_filter_104_no_sets_auto_generated_test extends qtype_stack_ast_testcas [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_105_no_grouppings_auto_generated_test.php b/tests/ast_filter_105_no_grouppings_auto_generated_test.php index 96fb4d92316638af9a55d687d9fa27767514bbf9..feac69855dfd2c1d63763024e0a5a3738b386d3c 100644 --- a/tests/ast_filter_105_no_grouppings_auto_generated_test.php +++ b/tests/ast_filter_105_no_grouppings_auto_generated_test.php @@ -509,6 +509,11 @@ class ast_filter_105_no_grouppings_auto_generated_test extends qtype_stack_ast_t [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('()x', '()*x', [], @@ -2080,6 +2085,11 @@ class ast_filter_105_no_grouppings_auto_generated_test extends qtype_stack_ast_t [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('()x', '()*x', [], diff --git a/tests/ast_filter_106_no_control_flow_auto_generated_test.php b/tests/ast_filter_106_no_control_flow_auto_generated_test.php index 2e2c836c8b2f328be64b40e26661ce870b32654d..a6e4ce0cc769d88e7c609a670ac88a20e41212f3 100644 --- a/tests/ast_filter_106_no_control_flow_auto_generated_test.php +++ b/tests/ast_filter_106_no_control_flow_auto_generated_test.php @@ -89,6 +89,11 @@ class ast_filter_106_no_control_flow_auto_generated_test extends qtype_stack_ast [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1870,6 +1875,11 @@ class ast_filter_106_no_control_flow_auto_generated_test extends qtype_stack_ast [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_120_no_arc_auto_generated_test.php b/tests/ast_filter_120_no_arc_auto_generated_test.php index 08bfe4c0bdec104ff8f7e8be07298719bf77964d..37120c127e3766ba17e38172af42c3398a85ce33 100644 --- a/tests/ast_filter_120_no_arc_auto_generated_test.php +++ b/tests/ast_filter_120_no_arc_auto_generated_test.php @@ -99,6 +99,11 @@ class ast_filter_120_no_arc_auto_generated_test extends qtype_stack_ast_testcase [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1875,6 +1880,11 @@ class ast_filter_120_no_arc_auto_generated_test extends qtype_stack_ast_testcase [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_150_replace_unicode_letters_auto_generated_test.php b/tests/ast_filter_150_replace_unicode_letters_auto_generated_test.php index 2b8105b8d65f8f35b28d88aed3f8740175c39d5c..fcdfbfda81fe46d103dedb0f0f101555f13891ea 100644 --- a/tests/ast_filter_150_replace_unicode_letters_auto_generated_test.php +++ b/tests/ast_filter_150_replace_unicode_letters_auto_generated_test.php @@ -89,6 +89,11 @@ class ast_filter_150_replace_unicode_letters_auto_generated_test extends qtype_s [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1870,6 +1875,11 @@ class ast_filter_150_replace_unicode_letters_auto_generated_test extends qtype_s [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_180_char_based_superscripts_auto_generated_test.php b/tests/ast_filter_180_char_based_superscripts_auto_generated_test.php index cbf64117c0d3f1afa0a0b4899ee85963b150b5d8..bab988d840baf94aee6e587b69abfed2dd890ae7 100644 --- a/tests/ast_filter_180_char_based_superscripts_auto_generated_test.php +++ b/tests/ast_filter_180_char_based_superscripts_auto_generated_test.php @@ -89,6 +89,11 @@ class ast_filter_180_char_based_superscripts_auto_generated_test extends qtype_s [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1870,6 +1875,11 @@ class ast_filter_180_char_based_superscripts_auto_generated_test extends qtype_s [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_201_sig_figs_validation_auto_generated_test.php b/tests/ast_filter_201_sig_figs_validation_auto_generated_test.php index b9217990d7829ce54f9cfe7e64055895ce428d21..607571bbbba04027d887c776c9ac3deecbb5ab6a 100644 --- a/tests/ast_filter_201_sig_figs_validation_auto_generated_test.php +++ b/tests/ast_filter_201_sig_figs_validation_auto_generated_test.php @@ -77,6 +77,11 @@ class ast_filter_201_sig_figs_validation_auto_generated_test extends qtype_stack [], false, true); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + false, true); + $this->expect('(()x)', '(()*x)', [], @@ -1803,6 +1808,11 @@ class ast_filter_201_sig_figs_validation_auto_generated_test extends qtype_stack [], false, true); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + false, true); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_202_decimal_places_validation_auto_generated_test.php b/tests/ast_filter_202_decimal_places_validation_auto_generated_test.php index 6e7dbc36c315f62c1458ca90d4087b3ad983f895..fac898c7e91cab8901b2d99b5a76e955f6ef66ed 100644 --- a/tests/ast_filter_202_decimal_places_validation_auto_generated_test.php +++ b/tests/ast_filter_202_decimal_places_validation_auto_generated_test.php @@ -77,6 +77,11 @@ class ast_filter_202_decimal_places_validation_auto_generated_test extends qtype [], false, true); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + false, true); + $this->expect('(()x)', '(()*x)', [], @@ -1858,6 +1863,11 @@ class ast_filter_202_decimal_places_validation_auto_generated_test extends qtype [], false, true); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + false, true); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_210_x_used_as_multiplication_auto_generated_test.php b/tests/ast_filter_210_x_used_as_multiplication_auto_generated_test.php index d5f91a8ac0db0f82232b039481696c038e8e1354..54c14e3214224be03f0f487c73107f044f50a936 100644 --- a/tests/ast_filter_210_x_used_as_multiplication_auto_generated_test.php +++ b/tests/ast_filter_210_x_used_as_multiplication_auto_generated_test.php @@ -159,6 +159,11 @@ class ast_filter_210_x_used_as_multiplication_auto_generated_test extends qtype_ [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1905,6 +1910,11 @@ class ast_filter_210_x_used_as_multiplication_auto_generated_test extends qtype_ [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_402_split_prefix_from_common_function_name_auto_generated_test.php b/tests/ast_filter_402_split_prefix_from_common_function_name_auto_generated_test.php index d70fe26a396d241bd1e5c7d2f35d798e68eb9978..d7102eae8c81191975556dd791d07f491eb403a3 100644 --- a/tests/ast_filter_402_split_prefix_from_common_function_name_auto_generated_test.php +++ b/tests/ast_filter_402_split_prefix_from_common_function_name_auto_generated_test.php @@ -149,6 +149,11 @@ class ast_filter_402_split_prefix_from_common_function_name_auto_generated_test [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1900,6 +1905,11 @@ class ast_filter_402_split_prefix_from_common_function_name_auto_generated_test [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_403_split_at_number_letter_boundary_auto_generated_test.php b/tests/ast_filter_403_split_at_number_letter_boundary_auto_generated_test.php index bfe8aeed0585a8842136d850d9b3f3b835aa0233..15fc4bc5b5138a4b5ebcb78a67058e3759357203 100644 --- a/tests/ast_filter_403_split_at_number_letter_boundary_auto_generated_test.php +++ b/tests/ast_filter_403_split_at_number_letter_boundary_auto_generated_test.php @@ -119,6 +119,11 @@ class ast_filter_403_split_at_number_letter_boundary_auto_generated_test extends [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1885,6 +1890,11 @@ class ast_filter_403_split_at_number_letter_boundary_auto_generated_test extends [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_404_split_at_number_letter_number_boundary_auto_generated_test.php b/tests/ast_filter_404_split_at_number_letter_number_boundary_auto_generated_test.php index d4f8cffe3c2d25b26ebbfb24d5a02b92bb9bfdf6..ad047239c96625dd131ca0b0748f37a39ad831b8 100644 --- a/tests/ast_filter_404_split_at_number_letter_number_boundary_auto_generated_test.php +++ b/tests/ast_filter_404_split_at_number_letter_number_boundary_auto_generated_test.php @@ -169,6 +169,11 @@ class ast_filter_404_split_at_number_letter_number_boundary_auto_generated_test [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1910,6 +1915,11 @@ class ast_filter_404_split_at_number_letter_number_boundary_auto_generated_test [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_406_split_implied_variable_names_auto_generated_test.php b/tests/ast_filter_406_split_implied_variable_names_auto_generated_test.php index 042de6228dcc2d77bbecf95a96fc4cc37d23c11b..ef98119405c49586927b9c75c821f32c434017d7 100644 --- a/tests/ast_filter_406_split_implied_variable_names_auto_generated_test.php +++ b/tests/ast_filter_406_split_implied_variable_names_auto_generated_test.php @@ -179,6 +179,11 @@ class ast_filter_406_split_implied_variable_names_auto_generated_test extends qt [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1915,6 +1920,11 @@ class ast_filter_406_split_implied_variable_names_auto_generated_test extends qt [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_410_single_char_vars_auto_generated_test.php b/tests/ast_filter_410_single_char_vars_auto_generated_test.php index 4f0daa617ca182426ea51fe1723403466ace8de1..6f224340f874bae424bc240fa576260a500c350b 100644 --- a/tests/ast_filter_410_single_char_vars_auto_generated_test.php +++ b/tests/ast_filter_410_single_char_vars_auto_generated_test.php @@ -324,6 +324,11 @@ class ast_filter_410_single_char_vars_auto_generated_test extends qtype_stack_as [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1985,6 +1990,11 @@ class ast_filter_410_single_char_vars_auto_generated_test extends qtype_stack_as [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_420_consolidate_subscripts_auto_generated_test.php b/tests/ast_filter_420_consolidate_subscripts_auto_generated_test.php index da531d3d8c58363685011a71fa64ab969faf018b..caf616d867e849a30ce914a2b5e78451213f6af5 100644 --- a/tests/ast_filter_420_consolidate_subscripts_auto_generated_test.php +++ b/tests/ast_filter_420_consolidate_subscripts_auto_generated_test.php @@ -149,6 +149,11 @@ class ast_filter_420_consolidate_subscripts_auto_generated_test extends qtype_st [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1900,6 +1905,11 @@ class ast_filter_420_consolidate_subscripts_auto_generated_test extends qtype_st [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_441_split_unknown_functions_auto_generated_test.php b/tests/ast_filter_441_split_unknown_functions_auto_generated_test.php index 6be46f3077fb45396a1689b5095b4cc6315bebe1..f36aa678c194e38f3cdfe82e4bf4bcc40186e51f 100644 --- a/tests/ast_filter_441_split_unknown_functions_auto_generated_test.php +++ b/tests/ast_filter_441_split_unknown_functions_auto_generated_test.php @@ -529,6 +529,11 @@ class ast_filter_441_split_unknown_functions_auto_generated_test extends qtype_s [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -2090,6 +2095,11 @@ class ast_filter_441_split_unknown_functions_auto_generated_test extends qtype_s [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_442_split_all_functions_auto_generated_test.php b/tests/ast_filter_442_split_all_functions_auto_generated_test.php index 4d7e3b0c1b4d04bf3b215f538dd5b242134a8873..e2013fbf9b5241b072649ff868d18608f6740a2f 100644 --- a/tests/ast_filter_442_split_all_functions_auto_generated_test.php +++ b/tests/ast_filter_442_split_all_functions_auto_generated_test.php @@ -47,6 +47,11 @@ class ast_filter_442_split_all_functions_auto_generated_test extends qtype_stack [], true, false); + $this->expect("''diff(x,y)", + "''diff*(x,y)", + [], + true, false); + $this->expect('(-b+-sqrt(b^2))/(2*a)', '(-b+-sqrt*(b^2))/(2*a)', [], @@ -578,6 +583,11 @@ class ast_filter_442_split_all_functions_auto_generated_test extends qtype_stack [], true, false); + $this->expect("''diff(x,y)", + "''diff*(x,y)", + [], + true, false); + $this->expect('(-b+-sqrt(b^2))/(2*a)', '(-b+-sqrt*(b^2))/(2*a)', [], diff --git a/tests/ast_filter_450_split_floats_auto_generated_test.php b/tests/ast_filter_450_split_floats_auto_generated_test.php index 07aedd15f351cacb28e622237f00db79c37bb19f..8a04fc64449a1f46ffeca01e1ed36dd8aa906eb0 100644 --- a/tests/ast_filter_450_split_floats_auto_generated_test.php +++ b/tests/ast_filter_450_split_floats_auto_generated_test.php @@ -159,6 +159,11 @@ class ast_filter_450_split_floats_auto_generated_test extends qtype_stack_ast_te [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1905,6 +1910,11 @@ class ast_filter_450_split_floats_auto_generated_test extends qtype_stack_ast_te [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_502_replace_pm_auto_generated_test.php b/tests/ast_filter_502_replace_pm_auto_generated_test.php index 495a7fcd8eb2d8c7a48ee9f6394fecc339772e19..d1f46651d6ca607f95afd01d61fe902eeeda58b5 100644 --- a/tests/ast_filter_502_replace_pm_auto_generated_test.php +++ b/tests/ast_filter_502_replace_pm_auto_generated_test.php @@ -129,6 +129,11 @@ class ast_filter_502_replace_pm_auto_generated_test extends qtype_stack_ast_test [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1890,6 +1895,11 @@ class ast_filter_502_replace_pm_auto_generated_test extends qtype_stack_ast_test [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_504_insert_tuples_for_groups_auto_generated_test.php b/tests/ast_filter_504_insert_tuples_for_groups_auto_generated_test.php index 44094912f259c2f33c885e3a6e44bef7c6af3989..0c6cbabd7fae27fb87109850cb7e673604f9c011 100644 --- a/tests/ast_filter_504_insert_tuples_for_groups_auto_generated_test.php +++ b/tests/ast_filter_504_insert_tuples_for_groups_auto_generated_test.php @@ -129,6 +129,11 @@ class ast_filter_504_insert_tuples_for_groups_auto_generated_test extends qtype_ [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1890,6 +1895,11 @@ class ast_filter_504_insert_tuples_for_groups_auto_generated_test extends qtype_ [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_505_no_evaluation_groups_auto_generated_test.php b/tests/ast_filter_505_no_evaluation_groups_auto_generated_test.php index 87fc0f1a3ea0493cd7c21bc8773a78b7828c54c1..f75e0d9cdd483d507e954080c275b3efa352e555 100644 --- a/tests/ast_filter_505_no_evaluation_groups_auto_generated_test.php +++ b/tests/ast_filter_505_no_evaluation_groups_auto_generated_test.php @@ -129,6 +129,11 @@ class ast_filter_505_no_evaluation_groups_auto_generated_test extends qtype_stac [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1890,6 +1895,11 @@ class ast_filter_505_no_evaluation_groups_auto_generated_test extends qtype_stac [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_520_no_equality_with_logic_auto_generated_test.php b/tests/ast_filter_520_no_equality_with_logic_auto_generated_test.php index 11551cc9ee63f98703417f39e6d190e4df7da76e..57d7fab196b91c0d5e1d84f33bbbdecbc9c7fbcb 100644 --- a/tests/ast_filter_520_no_equality_with_logic_auto_generated_test.php +++ b/tests/ast_filter_520_no_equality_with_logic_auto_generated_test.php @@ -109,6 +109,11 @@ class ast_filter_520_no_equality_with_logic_auto_generated_test extends qtype_st [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1880,6 +1885,11 @@ class ast_filter_520_no_equality_with_logic_auto_generated_test extends qtype_st [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_541_no_unknown_functions_auto_generated_test.php b/tests/ast_filter_541_no_unknown_functions_auto_generated_test.php index 51054a8aa227f4304353a64632077d32f68b5284..155843eb8842db1efe3cec2a54e3bf0dabab33c5 100644 --- a/tests/ast_filter_541_no_unknown_functions_auto_generated_test.php +++ b/tests/ast_filter_541_no_unknown_functions_auto_generated_test.php @@ -574,6 +574,11 @@ class ast_filter_541_no_unknown_functions_auto_generated_test extends qtype_stac [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -2110,6 +2115,11 @@ class ast_filter_541_no_unknown_functions_auto_generated_test extends qtype_stac [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_542_no_functions_at_all_auto_generated_test.php b/tests/ast_filter_542_no_functions_at_all_auto_generated_test.php index 7d176fadb679cade33006442aceb6ef824e334bb..8c07f031c66c8ee7238c10424f677d83103265de 100644 --- a/tests/ast_filter_542_no_functions_at_all_auto_generated_test.php +++ b/tests/ast_filter_542_no_functions_at_all_auto_generated_test.php @@ -52,6 +52,11 @@ class ast_filter_542_no_functions_at_all_auto_generated_test extends qtype_stack ['noFunction'], false, true); + $this->expect("''diff(x,y)", + "''diff(x,y)", + ['noFunction'], + false, true); + $this->expect('(-b+-sqrt(b^2))/(2*a)', '(-b+-sqrt(b^2))/(2*a)', ['noFunction'], @@ -593,6 +598,11 @@ class ast_filter_542_no_functions_at_all_auto_generated_test extends qtype_stack ['noFunction'], false, true); + $this->expect("''diff(x,y)", + "''diff(x,y)", + ['noFunction'], + false, true); + $this->expect('(-b+-sqrt(b^2))/(2*a)', '(-b+-sqrt(b^2))/(2*a)', ['noFunction'], diff --git a/tests/ast_filter_601_castext_auto_generated_test.php b/tests/ast_filter_601_castext_auto_generated_test.php index 88f295bfbee43b715e468ae744854e6b77ed648b..b884fd71dc1e6659f600243a66bc2d5ee5cccb19 100644 --- a/tests/ast_filter_601_castext_auto_generated_test.php +++ b/tests/ast_filter_601_castext_auto_generated_test.php @@ -89,6 +89,11 @@ class ast_filter_601_castext_auto_generated_test extends qtype_stack_ast_testcas [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1870,6 +1875,11 @@ class ast_filter_601_castext_auto_generated_test extends qtype_stack_ast_testcas [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_602_castext_simplifier_auto_generated_test.php b/tests/ast_filter_602_castext_simplifier_auto_generated_test.php index a69d0ba2a5836c98ce098a0d1009dc36d1a09bd5..50ada1a3868bb0bb0f353ad0ddfaf060fc641863 100644 --- a/tests/ast_filter_602_castext_simplifier_auto_generated_test.php +++ b/tests/ast_filter_602_castext_simplifier_auto_generated_test.php @@ -89,6 +89,11 @@ class ast_filter_602_castext_simplifier_auto_generated_test extends qtype_stack_ [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1870,6 +1875,11 @@ class ast_filter_602_castext_simplifier_auto_generated_test extends qtype_stack_ [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_610_castext_static_string_extractor_auto_generated_test.php b/tests/ast_filter_610_castext_static_string_extractor_auto_generated_test.php index c4f12259feabe7618916139c3ded41b325c822f4..dc4c727068f5d43356b6491eb47cbfd099480039 100644 --- a/tests/ast_filter_610_castext_static_string_extractor_auto_generated_test.php +++ b/tests/ast_filter_610_castext_static_string_extractor_auto_generated_test.php @@ -89,6 +89,11 @@ class ast_filter_610_castext_static_string_extractor_auto_generated_test extends [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1870,6 +1875,11 @@ class ast_filter_610_castext_static_string_extractor_auto_generated_test extends [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_680_gcl_sconcat_auto_generated_test.php b/tests/ast_filter_680_gcl_sconcat_auto_generated_test.php index 39f54d7a2a49191f9f152133bec1b122705ee923..69d90fc48680c499766ceec77a9585ac8e646fa6 100644 --- a/tests/ast_filter_680_gcl_sconcat_auto_generated_test.php +++ b/tests/ast_filter_680_gcl_sconcat_auto_generated_test.php @@ -89,6 +89,11 @@ class ast_filter_680_gcl_sconcat_auto_generated_test extends qtype_stack_ast_tes [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1870,6 +1875,11 @@ class ast_filter_680_gcl_sconcat_auto_generated_test extends qtype_stack_ast_tes [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_801_singleton_numeric_auto_generated_test.php b/tests/ast_filter_801_singleton_numeric_auto_generated_test.php index f8b4b41221bd1b7a5021f5d14fef8b68061999e6..f9c7feaf6e0583c28467443192bd8d2ed5ba37b3 100644 --- a/tests/ast_filter_801_singleton_numeric_auto_generated_test.php +++ b/tests/ast_filter_801_singleton_numeric_auto_generated_test.php @@ -77,6 +77,11 @@ class ast_filter_801_singleton_numeric_auto_generated_test extends qtype_stack_a ['Illegal_form'], false, true); + $this->expect("''diff(x,y)", + "''diff(x,y)", + ['Illegal_form'], + false, true); + $this->expect('(()x)', '(()*x)', ['Illegal_form'], @@ -1788,6 +1793,11 @@ class ast_filter_801_singleton_numeric_auto_generated_test extends qtype_stack_a ['Illegal_form'], false, true); + $this->expect("''diff(x,y)", + "''diff(x,y)", + ['Illegal_form'], + false, true); + $this->expect('(()x)', '(()*x)', ['Illegal_form'], diff --git a/tests/ast_filter_802_singleton_units_auto_generated_test.php b/tests/ast_filter_802_singleton_units_auto_generated_test.php index 1c8335bc352ec902459207da3aa378a3a3f4470e..90353f262e609f9dd8eafdea1bed28933701cf62 100644 --- a/tests/ast_filter_802_singleton_units_auto_generated_test.php +++ b/tests/ast_filter_802_singleton_units_auto_generated_test.php @@ -77,6 +77,11 @@ class ast_filter_802_singleton_units_auto_generated_test extends qtype_stack_ast [], false, true); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + false, true); + $this->expect('(()x)', '(()*x)', [], @@ -1843,6 +1848,11 @@ class ast_filter_802_singleton_units_auto_generated_test extends qtype_stack_ast [], false, true); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + false, true); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_901_remove_comments_auto_generated_test.php b/tests/ast_filter_901_remove_comments_auto_generated_test.php index 44145fdfbdbcd37d1a4d3eb0d019478eac5aff50..e205ed02ad03f44af7f1f6417c1cf8ec6804a43c 100644 --- a/tests/ast_filter_901_remove_comments_auto_generated_test.php +++ b/tests/ast_filter_901_remove_comments_auto_generated_test.php @@ -139,6 +139,11 @@ class ast_filter_901_remove_comments_auto_generated_test extends qtype_stack_ast [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1895,6 +1900,11 @@ class ast_filter_901_remove_comments_auto_generated_test extends qtype_stack_ast [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_910_inert_float_for_display_auto_generated_test.php b/tests/ast_filter_910_inert_float_for_display_auto_generated_test.php index 11654acb7b50b7349c086a452dd84e7a6a97f851..acc8499b5167fb95e6e17a75681fcec383d3f74b 100644 --- a/tests/ast_filter_910_inert_float_for_display_auto_generated_test.php +++ b/tests/ast_filter_910_inert_float_for_display_auto_generated_test.php @@ -429,6 +429,11 @@ class ast_filter_910_inert_float_for_display_auto_generated_test extends qtype_s [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -2040,6 +2045,11 @@ class ast_filter_910_inert_float_for_display_auto_generated_test extends qtype_s [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_912_inert_string_for_display_auto_generated_test.php b/tests/ast_filter_912_inert_string_for_display_auto_generated_test.php index fa586cbb115fff1075d44ff5155902397b13be26..ad45e0f5c52b216818eff34db7cc1c7cf63cc7ae 100644 --- a/tests/ast_filter_912_inert_string_for_display_auto_generated_test.php +++ b/tests/ast_filter_912_inert_string_for_display_auto_generated_test.php @@ -99,6 +99,11 @@ class ast_filter_912_inert_string_for_display_auto_generated_test extends qtype_ [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1875,6 +1880,11 @@ class ast_filter_912_inert_string_for_display_auto_generated_test extends qtype_ [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_990_no_fixing_spaces_auto_generated_test.php b/tests/ast_filter_990_no_fixing_spaces_auto_generated_test.php index 35315529cb2573b09b82cd48a172844a86b786c3..07b7cf4f3459f907566d33cc650f339437105f92 100644 --- a/tests/ast_filter_990_no_fixing_spaces_auto_generated_test.php +++ b/tests/ast_filter_990_no_fixing_spaces_auto_generated_test.php @@ -254,6 +254,11 @@ class ast_filter_990_no_fixing_spaces_auto_generated_test extends qtype_stack_as [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1950,6 +1955,11 @@ class ast_filter_990_no_fixing_spaces_auto_generated_test extends qtype_stack_as [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_991_no_fixing_stars_auto_generated_test.php b/tests/ast_filter_991_no_fixing_stars_auto_generated_test.php index c984f8d29ac844c3fd7dacc5288e3295b4724eaf..c0d042fa2f11b66eb383e2f445cf0a9799cd7264 100644 --- a/tests/ast_filter_991_no_fixing_stars_auto_generated_test.php +++ b/tests/ast_filter_991_no_fixing_stars_auto_generated_test.php @@ -309,6 +309,11 @@ class ast_filter_991_no_fixing_stars_auto_generated_test extends qtype_stack_ast [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('((x))', '((x))', [], @@ -1975,6 +1980,11 @@ class ast_filter_991_no_fixing_stars_auto_generated_test extends qtype_stack_ast [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('((x))', '((x))', [], diff --git a/tests/ast_filter_995_ev_modification_auto_generated_test.php b/tests/ast_filter_995_ev_modification_auto_generated_test.php index fc7158ea8ba254a12b5195db658556069269df86..e4dbbf0b8562fa90c464bc18daa2edbade142988 100644 --- a/tests/ast_filter_995_ev_modification_auto_generated_test.php +++ b/tests/ast_filter_995_ev_modification_auto_generated_test.php @@ -89,6 +89,11 @@ class ast_filter_995_ev_modification_auto_generated_test extends qtype_stack_ast [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1870,6 +1875,11 @@ class ast_filter_995_ev_modification_auto_generated_test extends qtype_stack_ast [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_996_call_modification_auto_generated_test.php b/tests/ast_filter_996_call_modification_auto_generated_test.php index f3b230607fbde35b3000c3d4a722714e38e33498..3f4e4426c3b9951d024f5fb9bf3be0867841f548 100644 --- a/tests/ast_filter_996_call_modification_auto_generated_test.php +++ b/tests/ast_filter_996_call_modification_auto_generated_test.php @@ -42,6 +42,11 @@ class ast_filter_996_call_modification_auto_generated_test extends qtype_stack_a [], true, false); + $this->expect("''diff(x,y)", + "''%_E((%_C(diff),%_E(diff(x,y))))", + [], + true, false); + $this->expect('(-b+-sqrt(b^2))/(2*a)', '(-b+-(%_C(sqrt),sqrt(b^2)))/(2*a)', [], @@ -573,6 +578,11 @@ class ast_filter_996_call_modification_auto_generated_test extends qtype_stack_a [], true, false); + $this->expect("''diff(x,y)", + "''%_E((%_C(diff),%_E(diff(x,y))))", + [], + true, false); + $this->expect('(-b+-sqrt(b^2))/(2*a)', '(-b+-(%_C(sqrt),sqrt(b^2)))/(2*a)', [], diff --git a/tests/ast_filter_997_string_security_auto_generated_test.php b/tests/ast_filter_997_string_security_auto_generated_test.php index 0c26b0838004c0fc89c398b5ea07ba947440ca8f..00ac2fc7260f749962094ae0a5347a32b9e3f8d9 100644 --- a/tests/ast_filter_997_string_security_auto_generated_test.php +++ b/tests/ast_filter_997_string_security_auto_generated_test.php @@ -99,6 +99,11 @@ class ast_filter_997_string_security_auto_generated_test extends qtype_stack_ast [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], @@ -1875,6 +1880,11 @@ class ast_filter_997_string_security_auto_generated_test extends qtype_stack_ast [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('(()x)', '(()*x)', [], diff --git a/tests/ast_filter_998_security_auto_generated_test.php b/tests/ast_filter_998_security_auto_generated_test.php index 3082373bd56b65e44d4db2af56f9200d7b2d966f..666c2befde42ebee9a69415cbbe2766a5485fc79 100644 --- a/tests/ast_filter_998_security_auto_generated_test.php +++ b/tests/ast_filter_998_security_auto_generated_test.php @@ -52,6 +52,11 @@ class ast_filter_998_security_auto_generated_test extends qtype_stack_ast_testca ['apostrophe'], false, true); + $this->expect("''diff(x,y)", + "''diff(x,y)", + ['apostrophe'], + false, true); + $this->expect('(()x)', '(()*x)', ['emptyParens'], @@ -283,6 +288,11 @@ class ast_filter_998_security_auto_generated_test extends qtype_stack_ast_testca ['apostrophe'], false, true); + $this->expect("''diff(x,y)", + "''diff(x,y)", + ['apostrophe'], + false, true); + $this->expect('(()x)', '(()*x)', ['emptyParens'], diff --git a/tests/ast_filter_999_strict_auto_generated_test.php b/tests/ast_filter_999_strict_auto_generated_test.php index c1ad2044504e6dd151b4673ac0a6836c3e72fb4b..a5a26ba23feddd6882fb794bf85cfa331b602be3 100644 --- a/tests/ast_filter_999_strict_auto_generated_test.php +++ b/tests/ast_filter_999_strict_auto_generated_test.php @@ -459,6 +459,11 @@ class ast_filter_999_strict_auto_generated_test extends qtype_stack_ast_testcase [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('((x))', '((x))', [], @@ -2050,6 +2055,11 @@ class ast_filter_999_strict_auto_generated_test extends qtype_stack_ast_testcase [], true, false); + $this->expect("''diff(x,y)", + "''diff(x,y)", + [], + true, false); + $this->expect('((x))', '((x))', [], diff --git a/tests/fixtures/inputfixtures.class.php b/tests/fixtures/inputfixtures.class.php index c3cfb3ef30f542a2d82a725e961d837dc7d0347d..b14c038b14d6e622c492cd11559377b3a66a5632 100644 --- a/tests/fixtures/inputfixtures.class.php +++ b/tests/fixtures/inputfixtures.class.php @@ -143,6 +143,7 @@ class stack_inputvalidation_test_data { 'missing_stars | Variable_function', "", ], ["f''(x)", 'php_false', '' , '', '', 'apostrophe', "Apostrophies again..."], + ["''diff(f,x)", 'php_false', '' , '', '', 'Illegal_extraevaluation', ""], [ 'dosomething(x,y,z)', 'php_false', '', '', '', 'forbiddenFunction', "Students have a restricted list of function names. Teachers are less restricted.", diff --git a/tests/fixtures/test_strings.json b/tests/fixtures/test_strings.json index 3714ebb8672939c1e03514247cec6e659a4907f0..9a3f783d903162ed7224219c9169dfbe8a72ba4c 100644 --- a/tests/fixtures/test_strings.json +++ b/tests/fixtures/test_strings.json @@ -8,6 +8,7 @@ "2%e^x", "'diff(x,y)", "'int(x,y)", + "''diff(x,y)", "(()x)", "((x))", "()x", diff --git a/tests/input_algebraic_test.php b/tests/input_algebraic_test.php index 30fc718b2c749c5e56fb8ab68d34301a111e6558..f726f0da6e88d4bbd773e5ffaa12746ece8a4316 100644 --- a/tests/input_algebraic_test.php +++ b/tests/input_algebraic_test.php @@ -620,6 +620,21 @@ class input_algebraic_test extends qtype_stack_testcase { '\sin \left( 3\cdot x \right) \]', $state->contentsdisplayed); } + public function test_validate_student_response_extra_evaluation() { + $options = new stack_options(); + $el = stack_input_factory::make('algebraic', 'sans1', 'noundiff(y/x^2,x,1)-(2*y)/x = x^3*sin(3*x)'); + $el->set_parameter('sameType', false); + $state = $el->validate_student_response(['sans1' => "''diff(y/x^2,x,1)"], + $options, 'diff(y/x^2,x,1)-(2*y)/x = x^3*sin(3*x)', new stack_cas_security()); + $this->assertEquals(stack_input::INVALID, $state->status); + $this->assertEquals('Illegal_extraevaluation', $state->note); + $this->assertEquals("Maxima's extra evaluation operator <code>''</code> is not supported by STACK.", + $state->errors); + $this->assertEquals("''%_E(%_E(noundiff(y/x^2,x,1)))", $state->contentsmodified); + $this->assertEquals("<span class=\"stacksyntaxexample\">''diff(y/x^2,x,1)</span>", + $state->contentsdisplayed); + } + public function test_validate_student_response_single_var_chars_on() { // Check the single variable character option is tested. $options = new stack_options();