aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Michel Vedrine <vedrine@vedrine.org>2018-01-02 09:06:27 +0100
committerJean-Michel Vedrine <vedrine@vedrine.org>2018-01-02 09:06:27 +0100
commitfa7c2989affbef0ea05f749e210e07b55f59dcc2 (patch)
treeb001b2fb714b044862ccc19437c44a41b5db484d
parent97a4d3fc97ab9f8cc58ab693989fbec2b152998c (diff)
Fix some tests
-rw-r--r--tests/parser_test.php4
-rw-r--r--tests/question_test.php2
-rw-r--r--tests/questiontype_test.php2
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));
}