From fa7c2989affbef0ea05f749e210e07b55f59dcc2 Mon Sep 17 00:00:00 2001 From: Jean-Michel Vedrine Date: Tue, 2 Jan 2018 09:06:27 +0100 Subject: Fix some tests --- tests/parser_test.php | 4 ++-- tests/question_test.php | 2 +- tests/questiontype_test.php | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/parser_test.php b/tests/parser_test.php index 13dbe23..d5c9f7a 100644 --- a/tests/parser_test.php +++ b/tests/parser_test.php @@ -52,11 +52,11 @@ class qtype_algebra_parser_test extends advanced_testcase { /** * Test how various multiplications are displayed using TeX */ - public function test_parser_multiply_display() { + public function test_parser_multiply_display() { $p = new qtype_algebra_parser; $expr = $p->parse('sin(2x) + cos(3y)'); - $this->assertEquals('\sin \left( 2 x_{} \right) + \cos \left( 3 y_{} \right)', $expr->tex()); + $this->assertEquals('\sin \left( 2 x_{} \right) + \cos \left( 3 y_{} \right)', $expr->tex()); $expr = $p->parse('sin(4 x) + cos(5 y)'); $this->assertEquals('\sin \left( 4 x_{} \right) + \cos \left( 5 y_{} \right)', $expr->tex()); $expr = $p->parse('sin(6*x) + cos(7*y)'); diff --git a/tests/question_test.php b/tests/question_test.php index 91a6e23..3dabc99 100644 --- a/tests/question_test.php +++ b/tests/question_test.php @@ -107,7 +107,7 @@ class qtype_algebra_question_test extends advanced_testcase { new question_classified_response(13, '2*x', 1.0)), $question->classify_response(array('answer' => '2*x'))); $this->assertEquals(array( - new question_classified_response(15, '5*x', 0.0)), + new question_classified_response(0, '5*x', 0)), $question->classify_response(array('answer' => '5*x'))); $this->assertEquals(array( question_classified_response::no_response()), diff --git a/tests/questiontype_test.php b/tests/questiontype_test.php index 07ab4c3..93e5294 100644 --- a/tests/questiontype_test.php +++ b/tests/questiontype_test.php @@ -29,6 +29,7 @@ global $CFG; require_once($CFG->dirroot . '/question/type/algebra/questiontype.php'); require_once($CFG->dirroot . '/question/engine/tests/helpers.php'); require_once($CFG->dirroot . '/question/type/edit_question_form.php'); +require_once($CFG->dirroot . '/question/type/algebra/parser.php'); require_once($CFG->dirroot . '/question/type/algebra/edit_algebra_form.php'); /** @@ -79,6 +80,7 @@ class qtype_algebra_test extends advanced_testcase { 13 => new question_possible_response('2*x', 1), 14 => new question_possible_response('x', 0.2), null => question_possible_response::no_response() + 0 => new question_possible_response(get_string('didnotmatchanyanswer', 'question'), 0), ), ), $this->qtype->get_possible_responses($q)); } -- cgit v1.2.3