2 // This file is part of Moodle - http://moodle.org/
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
18 * Unit tests for the Moodle GIFT format.
22 * @copyright 2010 The Open University
23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
27 defined('MOODLE_INTERNAL') || die();
30 require_once($CFG->libdir . '/questionlib.php');
31 require_once($CFG->dirroot . '/question/format.php');
32 require_once($CFG->dirroot . '/question/format/gift/format.php');
33 require_once($CFG->dirroot . '/question/engine/tests/helpers.php');
37 * Unit tests for the GIFT import/export format.
39 * @copyright 2010 The Open University
40 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
42 class qformat_gift_test extends question_testcase {
43 public function assert_same_gift($expectedtext, $text) {
44 $this->assertEquals(str_replace("\r\n", "\n", $expectedtext),
45 str_replace("\r\n", "\n", $text));
48 public function test_import_essay() {
51 ::Q8:: How are you? {}';
52 $lines = preg_split('/[\\n\\r]/', str_replace("\r\n", "\n", $gift));
54 $importer = new qformat_gift();
55 $q = $importer->readquestion($lines);
57 $expectedq = (object) array(
59 'questiontext' => 'How are you?',
60 'questiontextformat' => FORMAT_MOODLE,
61 'generalfeedback' => '',
62 'generalfeedbackformat' => FORMAT_MOODLE,
65 'penalty' => 0.3333333,
67 'responseformat' => 'editor',
68 'responsefieldlines' => 15,
70 'graderinfo' => array(
72 'format' => FORMAT_HTML,
76 $this->assert(new question_check_specified_fields_expectation($expectedq), $q);
79 public function test_export_essay() {
80 $qdata = (object) array(
83 'questiontext' => 'How are you?',
84 'questiontextformat' => FORMAT_MOODLE,
85 'generalfeedback' => '',
86 'generalfeedbackformat' => FORMAT_MOODLE,
88 'penalty' => 0.3333333,
91 'options' => (object) array(
92 'responseformat' => 'editor',
93 'responsefieldlines' => 15,
96 'graderinfoformat' => FORMAT_HTML,
100 $exporter = new qformat_gift();
101 $gift = $exporter->writequestion($qdata);
103 $expectedgift = "// question: 666 name: Q8
108 $this->assert_same_gift($expectedgift, $gift);
111 public function test_import_match() {
113 // question: 2 name: Moodle activities
114 ::Moodle activities::[html]Match the <b>activity</b> to the description.{
115 =[html]An activity supporting asynchronous discussions. -> Forum
116 =[moodle]A teacher asks a question and specifies a choice of multiple responses. -> Choice
117 =[plain]A bank of record entries which participants can add to. -> Database
118 =[markdown]A collection of web pages that anyone can add to or edit. -> Wiki
121 $lines = preg_split('/[\\n\\r]/', str_replace("\r\n", "\n", $gift));
123 $importer = new qformat_gift();
124 $q = $importer->readquestion($lines);
126 $expectedq = (object) array(
127 'name' => 'Moodle activities',
128 'questiontext' => 'Match the <b>activity</b> to the description.',
129 'questiontextformat' => FORMAT_HTML,
130 'generalfeedback' => '',
131 'generalfeedbackformat' => FORMAT_HTML,
134 'penalty' => 0.3333333,
136 'shuffleanswers' => '1',
137 'correctfeedback' => array(
139 'format' => FORMAT_HTML,
142 'partiallycorrectfeedback' => array(
144 'format' => FORMAT_HTML,
147 'incorrectfeedback' => array(
149 'format' => FORMAT_HTML,
152 'subquestions' => array(
154 'text' => 'An activity supporting asynchronous discussions.',
155 'format' => FORMAT_HTML,
159 'text' => 'A teacher asks a question and specifies a choice of multiple responses.',
160 'format' => FORMAT_MOODLE,
164 'text' => 'A bank of record entries which participants can add to.',
165 'format' => FORMAT_PLAIN,
169 'text' => 'A collection of web pages that anyone can add to or edit.',
170 'format' => FORMAT_MARKDOWN,
175 'format' => FORMAT_HTML,
179 'subanswers' => array(
188 // Repeated test for better failure messages.
189 $this->assertEquals($expectedq->subquestions, $q->subquestions);
190 $this->assert(new question_check_specified_fields_expectation($expectedq), $q);
193 public function test_export_match() {
194 $qdata = (object) array(
196 'name' => 'Moodle activities',
197 'questiontext' => 'Match the <b>activity</b> to the description.',
198 'questiontextformat' => FORMAT_HTML,
199 'generalfeedback' => '',
200 'generalfeedbackformat' => FORMAT_HTML,
202 'penalty' => 0.3333333,
205 'options' => (object) array(
208 'shuffleanswers' => 1,
209 'subquestions' => array(
210 42 => (object) array(
214 'questiontext' => '<div class="frog">An activity supporting asynchronous discussions.</div>',
215 'questiontextformat' => FORMAT_HTML,
216 'answertext' => 'Forum',
218 43 => (object) array(
222 'questiontext' => 'A teacher asks a question and specifies a choice of multiple responses.',
223 'questiontextformat' => FORMAT_MOODLE,
224 'answertext' => 'Choice',
226 44 => (object) array(
230 'questiontext' => 'A bank of record entries which participants can add to.',
231 'questiontextformat' => FORMAT_PLAIN,
232 'answertext' => 'Database',
234 45 => (object) array(
238 'questiontext' => 'A collection of web pages that anyone can add to or edit.',
239 'questiontextformat' => FORMAT_MARKDOWN,
240 'answertext' => 'Wiki',
242 46 => (object) array(
246 'questiontext' => '',
247 'questiontextformat' => FORMAT_MARKDOWN,
248 'answertext' => 'Chat',
254 $exporter = new qformat_gift();
255 $gift = $exporter->writequestion($qdata);
257 $expectedgift = "// question: 666 name: Moodle activities
258 ::Moodle activities::[html]Match the <b>activity</b> to the description.{
259 \t=<div class\\=\"frog\">An activity supporting asynchronous discussions.</div> -> Forum
260 \t=[moodle]A teacher asks a question and specifies a choice of multiple responses. -> Choice
261 \t=[plain]A bank of record entries which participants can add to. -> Database
262 \t=[markdown]A collection of web pages that anyone can add to or edit. -> Wiki
268 $this->assert_same_gift($expectedgift, $gift);
271 public function test_import_multichoice() {
273 // multiple choice with specified feedback for right and wrong answers
274 ::Q2:: What's between orange and green in the spectrum?
276 =yellow # right; good!
277 ~red # [html]wrong, it's yellow
278 ~[plain]blue # wrong, it's yellow
280 $lines = preg_split('/[\\n\\r]/', str_replace("\r\n", "\n", $gift));
282 $importer = new qformat_gift();
283 $q = $importer->readquestion($lines);
285 $expectedq = (object) array(
287 'questiontext' => "What's between orange and green in the spectrum?",
288 'questiontextformat' => FORMAT_MOODLE,
289 'generalfeedback' => '',
290 'generalfeedbackformat' => FORMAT_MOODLE,
291 'qtype' => 'multichoice',
293 'penalty' => 0.3333333,
296 'shuffleanswers' => '1',
297 'answernumbering' => 'abc',
298 'correctfeedback' => array(
300 'format' => FORMAT_MOODLE,
303 'partiallycorrectfeedback' => array(
305 'format' => FORMAT_MOODLE,
308 'incorrectfeedback' => array(
310 'format' => FORMAT_MOODLE,
316 'format' => FORMAT_MOODLE,
321 'format' => FORMAT_MOODLE,
326 'format' => FORMAT_PLAIN,
330 'fraction' => array(1, 0, 0),
333 'text' => 'right; good!',
334 'format' => FORMAT_MOODLE,
338 'text' => "wrong, it's yellow",
339 'format' => FORMAT_HTML,
343 'text' => "wrong, it's yellow",
344 'format' => FORMAT_MOODLE,
350 // Repeated test for better failure messages.
351 $this->assertEquals($expectedq->answer, $q->answer);
352 $this->assertEquals($expectedq->feedback, $q->feedback);
353 $this->assert(new question_check_specified_fields_expectation($expectedq), $q);
356 public function test_import_multichoice_multi() {
358 // multiple choice, multiple response with specified feedback for right and wrong answers
359 ::colours:: What's between orange and green in the spectrum?
361 ~%50%yellow # right; good!
362 ~%-100%red # [html]wrong
363 ~%50%off-beige # right; good!
364 ~%-100%[plain]blue # wrong
366 $lines = preg_split('/[\\n\\r]/', str_replace("\r\n", "\n", $gift));
368 $importer = new qformat_gift();
369 $q = $importer->readquestion($lines);
371 $expectedq = (object) array(
373 'questiontext' => "What's between orange and green in the spectrum?",
374 'questiontextformat' => FORMAT_MOODLE,
375 'generalfeedback' => '',
376 'generalfeedbackformat' => FORMAT_MOODLE,
377 'qtype' => 'multichoice',
379 'penalty' => 0.3333333,
382 'shuffleanswers' => '1',
383 'answernumbering' => 'abc',
384 'correctfeedback' => array(
386 'format' => FORMAT_MOODLE,
389 'partiallycorrectfeedback' => array(
391 'format' => FORMAT_MOODLE,
394 'incorrectfeedback' => array(
396 'format' => FORMAT_MOODLE,
402 'format' => FORMAT_MOODLE,
407 'format' => FORMAT_MOODLE,
411 'text' => 'off-beige',
412 'format' => FORMAT_MOODLE,
417 'format' => FORMAT_PLAIN,
421 'fraction' => array(0.5, -1, 0.5, -1),
424 'text' => 'right; good!',
425 'format' => FORMAT_MOODLE,
430 'format' => FORMAT_HTML,
434 'text' => "right; good!",
435 'format' => FORMAT_MOODLE,
440 'format' => FORMAT_MOODLE,
446 // Repeated test for better failure messages.
447 $this->assertEquals($expectedq->answer, $q->answer);
448 $this->assertEquals($expectedq->feedback, $q->feedback);
449 $this->assert(new question_check_specified_fields_expectation($expectedq), $q);
452 public function test_export_multichoice() {
453 $qdata = (object) array(
456 'questiontext' => "What's between orange and green in the spectrum?",
457 'questiontextformat' => FORMAT_MOODLE,
458 'generalfeedback' => '',
459 'generalfeedbackformat' => FORMAT_MOODLE,
461 'penalty' => 0.3333333,
463 'qtype' => 'multichoice',
464 'options' => (object) array(
466 'shuffleanswers' => '1',
467 'answernumbering' => 'abc',
468 'correctfeedback' => '',
469 'correctfeedbackformat' => FORMAT_MOODLE,
470 'partiallycorrectfeedback' => '',
471 'partiallycorrectfeedbackformat' => FORMAT_MOODLE,
472 'incorrectfeedback' => '',
473 'incorrectfeedbackformat' => FORMAT_MOODLE,
475 123 => (object) array(
477 'answer' => 'yellow',
478 'answerformat' => FORMAT_MOODLE,
480 'feedback' => 'right; good!',
481 'feedbackformat' => FORMAT_MOODLE,
483 124 => (object) array(
486 'answerformat' => FORMAT_MOODLE,
488 'feedback' => "wrong, it's yellow",
489 'feedbackformat' => FORMAT_HTML,
491 125 => (object) array(
494 'answerformat' => FORMAT_PLAIN,
496 'feedback' => "wrong, it's yellow",
497 'feedbackformat' => FORMAT_MOODLE,
503 $exporter = new qformat_gift();
504 $gift = $exporter->writequestion($qdata);
506 $expectedgift = "// question: 666 name: Q8
507 ::Q8::What's between orange and green in the spectrum?{
508 \t=yellow#right; good!
509 \t~red#[html]wrong, it's yellow
510 \t~[plain]blue#wrong, it's yellow
515 $this->assert_same_gift($expectedgift, $gift);
518 public function test_import_numerical() {
520 // math range question
521 ::Q5:: What is a number from 1 to 5? {#3:2~#Completely wrong}";
522 $lines = preg_split('/[\\n\\r]/', str_replace("\r\n", "\n", $gift));
524 $importer = new qformat_gift();
525 $q = $importer->readquestion($lines);
527 $expectedq = (object) array(
529 'questiontext' => "What is a number from 1 to 5?",
530 'questiontextformat' => FORMAT_MOODLE,
531 'generalfeedback' => '',
532 'generalfeedbackformat' => FORMAT_MOODLE,
533 'qtype' => 'numerical',
535 'penalty' => 0.3333333,
541 'fraction' => array(1, 0),
545 'format' => FORMAT_MOODLE,
549 'text' => "Completely wrong",
550 'format' => FORMAT_MOODLE,
554 'tolerance' => array(2, 0),
557 // Repeated test for better failure messages.
558 $this->assertEquals($expectedq->answer, $q->answer);
559 $this->assertEquals($expectedq->fraction, $q->fraction);
560 $this->assertEquals($expectedq->feedback, $q->feedback);
561 $this->assert(new question_check_specified_fields_expectation($expectedq), $q);
564 public function test_export_numerical() {
565 $qdata = (object) array(
568 'questiontext' => "What is a number from 1 to 5?",
569 'questiontextformat' => FORMAT_MOODLE,
570 'generalfeedback' => '',
571 'generalfeedbackformat' => FORMAT_MOODLE,
575 'qtype' => 'numerical',
576 'options' => (object) array(
582 'unitgradingtype' => 0,
592 'feedbackformat' => FORMAT_MOODLE,
600 'feedback' => "Completely wrong",
601 'feedbackformat' => FORMAT_MOODLE,
607 $exporter = new qformat_gift();
608 $gift = $exporter->writequestion($qdata);
610 $expectedgift = "// question: 666 name: Q5
611 ::Q5::What is a number from 1 to 5?{#
618 $this->assert_same_gift($expectedgift, $gift);
621 public function test_import_shortanswer() {
623 // question: 666 name: Shortanswer
624 ::Shortanswer::Which is the best animal?{
626 =%50%Cat#What is it with Moodlers and cats?
627 =%0%*#Completely wrong
629 $lines = preg_split('/[\\n\\r]/', str_replace("\r\n", "\n", $gift));
631 $importer = new qformat_gift();
632 $q = $importer->readquestion($lines);
634 $expectedq = (object) array(
635 'name' => 'Shortanswer',
636 'questiontext' => "Which is the best animal?",
637 'questiontextformat' => FORMAT_MOODLE,
638 'generalfeedback' => '',
639 'generalfeedbackformat' => FORMAT_MOODLE,
640 'qtype' => 'shortanswer',
642 'penalty' => 0.3333333,
649 'fraction' => array(1, 0.5, 0),
653 'format' => FORMAT_MOODLE,
657 'text' => "What is it with Moodlers and cats?",
658 'format' => FORMAT_MOODLE,
662 'text' => "Completely wrong",
663 'format' => FORMAT_MOODLE,
669 // Repeated test for better failure messages.
670 $this->assertEquals($expectedq->answer, $q->answer);
671 $this->assertEquals($expectedq->fraction, $q->fraction);
672 $this->assertEquals($expectedq->feedback, $q->feedback);
673 $this->assert(new question_check_specified_fields_expectation($expectedq), $q);
676 public function test_import_shortanswer_with_general_feedback() {
678 // question: 666 name: Shortanswer
679 ::Shortanswer::Which is the best animal?{
681 =%50%Cat#What is it with Moodlers and cats?
682 =%0%*#Completely wrong
683 ####[html]Here is some general feedback!
685 $lines = preg_split('/[\\n\\r]/', str_replace("\r\n", "\n", $gift));
687 $importer = new qformat_gift();
688 $q = $importer->readquestion($lines);
690 $expectedq = (object) array(
691 'name' => 'Shortanswer',
692 'questiontext' => "Which is the best animal?",
693 'questiontextformat' => FORMAT_MOODLE,
694 'generalfeedback' => 'Here is some general feedback!',
695 'generalfeedbackformat' => FORMAT_HTML,
696 'qtype' => 'shortanswer',
698 'penalty' => 0.3333333,
705 'fraction' => array(1, 0.5, 0),
709 'format' => FORMAT_MOODLE,
713 'text' => "What is it with Moodlers and cats?",
714 'format' => FORMAT_MOODLE,
718 'text' => "Completely wrong",
719 'format' => FORMAT_MOODLE,
725 // Repeated test for better failure messages.
726 $this->assertEquals($expectedq->answer, $q->answer);
727 $this->assertEquals($expectedq->fraction, $q->fraction);
728 $this->assertEquals($expectedq->feedback, $q->feedback);
729 $this->assert(new question_check_specified_fields_expectation($expectedq), $q);
732 public function test_export_shortanswer() {
733 $qdata = (object) array(
735 'name' => 'Shortanswer',
736 'questiontext' => "Which is the best animal?",
737 'questiontextformat' => FORMAT_MOODLE,
738 'generalfeedback' => '',
739 'generalfeedbackformat' => FORMAT_MOODLE,
743 'qtype' => 'shortanswer',
744 'options' => (object) array(
754 'feedback' => 'Good!',
755 'feedbackformat' => FORMAT_MOODLE,
762 'feedback' => "What is it with Moodlers and cats?",
763 'feedbackformat' => FORMAT_MOODLE,
770 'feedback' => "Completely wrong",
771 'feedbackformat' => FORMAT_MOODLE,
777 $exporter = new qformat_gift();
778 $gift = $exporter->writequestion($qdata);
780 $expectedgift = "// question: 666 name: Shortanswer
781 ::Shortanswer::Which is the best animal?{
783 \t=%50%Cat#What is it with Moodlers and cats?
784 \t=%0%*#Completely wrong
789 $this->assert_same_gift($expectedgift, $gift);
792 public function test_export_shortanswer_with_general_feedback() {
793 $qdata = (object) array(
795 'name' => 'Shortanswer',
796 'questiontext' => "Which is the best animal?",
797 'questiontextformat' => FORMAT_MOODLE,
798 'generalfeedback' => 'Here is some general feedback!',
799 'generalfeedbackformat' => FORMAT_HTML,
803 'qtype' => 'shortanswer',
804 'options' => (object) array(
814 'feedback' => 'Good!',
815 'feedbackformat' => FORMAT_MOODLE,
822 'feedback' => "What is it with Moodlers and cats?",
823 'feedbackformat' => FORMAT_MOODLE,
830 'feedback' => "Completely wrong",
831 'feedbackformat' => FORMAT_MOODLE,
837 $exporter = new qformat_gift();
838 $gift = $exporter->writequestion($qdata);
840 $expectedgift = "// question: 666 name: Shortanswer
841 ::Shortanswer::Which is the best animal?{
843 \t=%50%Cat#What is it with Moodlers and cats?
844 \t=%0%*#Completely wrong
845 \t####[html]Here is some general feedback!
850 $this->assert_same_gift($expectedgift, $gift);
853 public function test_import_truefalse() {
856 ::Q1:: 42 is the Absolute Answer to everything.{
857 FALSE#42 is the Ultimate Answer.#You gave the right answer.}";
858 $lines = preg_split('/[\\n\\r]/', str_replace("\r\n", "\n", $gift));
860 $importer = new qformat_gift();
861 $q = $importer->readquestion($lines);
863 $expectedq = (object) array(
865 'questiontext' => "42 is the Absolute Answer to everything.",
866 'questiontextformat' => FORMAT_MOODLE,
867 'generalfeedback' => '',
868 'generalfeedbackformat' => FORMAT_MOODLE,
869 'qtype' => 'truefalse',
873 'correctanswer' => 0,
874 'feedbacktrue' => array(
875 'text' => '42 is the Ultimate Answer.',
876 'format' => FORMAT_MOODLE,
879 'feedbackfalse' => array(
880 'text' => 'You gave the right answer.',
881 'format' => FORMAT_MOODLE,
886 $this->assert(new question_check_specified_fields_expectation($expectedq), $q);
889 public function test_import_truefalse_true_answer1() {
890 $gift = "// name 0-11
891 ::2-08 TSL::TSL is blablabla.{T}";
892 $lines = preg_split('/[\\n\\r]/', str_replace("\r\n", "\n", $gift));
894 $importer = new qformat_gift();
895 $q = $importer->readquestion($lines);
897 $expectedq = (object) array(
898 'name' => '2-08 TSL',
899 'questiontext' => "TSL is blablabla.",
900 'questiontextformat' => FORMAT_MOODLE,
901 'generalfeedback' => '',
902 'generalfeedbackformat' => FORMAT_MOODLE,
903 'qtype' => 'truefalse',
907 'correctanswer' => 1,
908 'feedbacktrue' => array(
910 'format' => FORMAT_MOODLE,
913 'feedbackfalse' => array(
915 'format' => FORMAT_MOODLE,
920 $this->assert(new question_check_specified_fields_expectation($expectedq), $q);
923 public function test_import_truefalse_true_answer2() {
924 $gift = "// name 0-11
925 ::2-08 TSL::TSL is blablabla.{TRUE}";
926 $lines = preg_split('/[\\n\\r]/', str_replace("\r\n", "\n", $gift));
928 $importer = new qformat_gift();
929 $q = $importer->readquestion($lines);
931 $expectedq = (object) array(
932 'name' => '2-08 TSL',
933 'questiontext' => "TSL is blablabla.",
934 'questiontextformat' => FORMAT_MOODLE,
935 'generalfeedback' => '',
936 'generalfeedbackformat' => FORMAT_MOODLE,
937 'qtype' => 'truefalse',
941 'correctanswer' => 1,
942 'feedbacktrue' => array(
944 'format' => FORMAT_MOODLE,
947 'feedbackfalse' => array(
949 'format' => FORMAT_MOODLE,
954 $this->assert(new question_check_specified_fields_expectation($expectedq), $q);
957 public function test_export_truefalse() {
958 $qdata = (object) array(
961 'questiontext' => "42 is the Absolute Answer to everything.",
962 'questiontextformat' => FORMAT_MOODLE,
963 'generalfeedback' => '',
964 'generalfeedbackformat' => FORMAT_MOODLE,
968 'qtype' => 'truefalse',
969 'options' => (object) array(
980 'feedback' => 'You gave the right answer.',
981 'feedbackformat' => FORMAT_MOODLE,
988 'feedback' => "42 is the Ultimate Answer.",
989 'feedbackformat' => FORMAT_HTML,
995 $exporter = new qformat_gift();
996 $gift = $exporter->writequestion($qdata);
998 $expectedgift = "// question: 666 name: Q1
999 ::Q1::42 is the Absolute Answer to everything.{TRUE#[html]42 is the Ultimate Answer.#You gave the right answer.}
1003 $this->assert_same_gift($expectedgift, $gift);
1006 public function test_export_backslash() {
1007 // There was a bug (MDL-34171) where \\ was getting exported as \\, not
1008 // \\\\, and on import, \\ in converted to \.
1009 // We need \\\\ in the test code, because of PHPs string escaping rules.
1010 $qdata = (object) array(
1012 'name' => 'backslash',
1013 'questiontext' => 'A \\ B \\\\ C',
1014 'questiontextformat' => FORMAT_MOODLE,
1015 'generalfeedback' => '',
1016 'generalfeedbackformat' => FORMAT_MOODLE,
1018 'penalty' => 0.3333333,
1021 'options' => (object) array(
1022 'responseformat' => 'editor',
1023 'responsefieldlines' => 15,
1026 'graderinfoformat' => FORMAT_HTML,
1030 $exporter = new qformat_gift();
1031 $gift = $exporter->writequestion($qdata);
1033 $expectedgift = "// question: 666 name: backslash
1034 ::backslash::A \\\\ B \\\\\\\\ C{}
1038 $this->assert_same_gift($expectedgift, $gift);
1041 public function test_import_backslash() {
1042 // There was a bug (MDL-34171) where \\ in the import was getting changed
1043 // to \. This test checks for that.
1044 // We need \\\\ in the test code, because of PHPs string escaping rules.
1047 ::double backslash:: A \\\\ B \\\\\\\\ C{}';
1048 $lines = preg_split('/[\\n\\r]/', str_replace("\r\n", "\n", $gift));
1050 $importer = new qformat_gift();
1051 $q = $importer->readquestion($lines);
1053 $expectedq = (object) array(
1054 'name' => 'double backslash',
1055 'questiontext' => 'A \\ B \\\\ C',
1056 'questiontextformat' => FORMAT_MOODLE,
1057 'generalfeedback' => '',
1058 'generalfeedbackformat' => FORMAT_MOODLE,
1061 'penalty' => 0.3333333,
1063 'responseformat' => 'editor',
1064 'responsefieldlines' => 15,
1066 'graderinfo' => array(
1068 'format' => FORMAT_HTML,
1069 'files' => array()),
1072 $this->assert(new question_check_specified_fields_expectation($expectedq), $q);