Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.
   1  <?php
   2  // This file is part of Moodle - http://moodle.org/
   3  //
   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.
   8  //
   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.
  13  //
  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/>.
  16  
  17  /**
  18   * Tests of the upgrade to the new Moodle question engine for attempts at
  19   * calculated questions.
  20   *
  21   * @package    qtype
  22   * @subpackage calculated
  23   * @copyright  2011 The Open University
  24   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  25   */
  26  
  27  
  28  defined('MOODLE_INTERNAL') || die();
  29  
  30  global $CFG;
  31  require_once($CFG->dirroot . '/question/engine/upgrade/tests/helper.php');
  32  
  33  
  34  /**
  35   * Testing the upgrade of calculated question attempts.
  36   *
  37   * @copyright  2011 The Open University
  38   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  39   */
  40  class qtype_calculated_attempt_upgrader_test extends question_attempt_upgrader_test_base {
  41      public function test_calculated_adaptive_qsession97() {
  42          $quiz = (object) array(
  43              'id' => '4',
  44              'course' => '2',
  45              'name' => 'Calculated quiz',
  46              'intro' => '',
  47              'introformat' => '1',
  48              'timeopen' => '0',
  49              'timeclose' => '0',
  50              'attempts' => '0',
  51              'attemptonlast' => '0',
  52              'grademethod' => '1',
  53              'decimalpoints' => '2',
  54              'questiondecimalpoints' => '-1',
  55              'questionsperpage' => '1',
  56              'shufflequestions' => '0',
  57              'shuffleanswers' => '1',
  58              'sumgrades' => '3.00000',
  59              'grade' => '10.00000',
  60              'timecreated' => '0',
  61              'timemodified' => '1305648351',
  62              'timelimit' => '0',
  63              'password' => '',
  64              'subnet' => '',
  65              'popup' => '0',
  66              'delay1' => '0',
  67              'delay2' => '0',
  68              'showuserpicture' => '0',
  69              'showblocks' => '0',
  70              'preferredbehaviour' => 'adaptive',
  71              'reviewattempt' => '69888',
  72              'reviewcorrectness' => '69888',
  73              'reviewmarks' => '69888',
  74              'reviewspecificfeedback' => '69888',
  75              'reviewgeneralfeedback' => '69888',
  76              'reviewrightanswer' => '69888',
  77              'reviewoverallfeedback' => '4352',
  78          );
  79          $attempt = (object) array(
  80              'id' => '13',
  81              'uniqueid' => '13',
  82              'quiz' => '4',
  83              'userid' => '4',
  84              'attempt' => '1',
  85              'sumgrades' => '0.00000',
  86              'timestart' => '1305830650',
  87              'timefinish' => '1305830656',
  88              'timemodified' => '1305830656',
  89              'layout' => '16,0,17,0,18,0',
  90              'preview' => '0',
  91          );
  92          $question = (object) array(
  93              'id' => '18',
  94              'category' => '2',
  95              'parent' => '0',
  96              'name' => 'Calculated',
  97              'questiontext' => '<p>What is {a} m + {b} m?</p><p>_______________</p><p>Remember to type a unit.</p>',
  98              'questiontextformat' => '1',
  99              'generalfeedback' => '',
 100              'generalfeedbackformat' => '1',
 101              'defaultmark' => '1.0000000',
 102              'penalty' => '0.1',
 103              'qtype' => 'calculated',
 104              'length' => '1',
 105              'stamp' => 'tjh238.vledev2.open.ac.uk+110519184316+ELvZeg',
 106              'version' => 'tjh238.vledev2.open.ac.uk+110519184317+exx1Bm',
 107              'hidden' => '0',
 108              'timecreated' => '1305830596',
 109              'timemodified' => '1305830596',
 110              'createdby' => '2',
 111              'modifiedby' => '2',
 112              'maxmark' => '1.0000000',
 113              'options' => (object) array(
 114                  'id' => '2',
 115                  'question' => '18',
 116                  'synchronize' => '0',
 117                  'single' => '0',
 118                  'shuffleanswers' => '1',
 119                  'correctfeedback' => '',
 120                  'correctfeedbackformat' => '0',
 121                  'partiallycorrectfeedback' => '',
 122                  'partiallycorrectfeedbackformat' => '0',
 123                  'incorrectfeedback' => '',
 124                  'incorrectfeedbackformat' => '0',
 125                  'answernumbering' => 'abc',
 126                  'shownumcorrect' => '0',
 127                  'answers' => array(
 128                      28 => (object) array(
 129                          'id' => '28',
 130                          'question' => '18',
 131                          'answer' => '{a} + {b}',
 132                          'answerformat' => '0',
 133                          'fraction' => '1.0000000',
 134                          'feedback' => '',
 135                          'feedbackformat' => '1',
 136                          'tolerance' => '0.01',
 137                          'tolerancetype' => '1',
 138                          'correctanswerlength' => '2',
 139                          'correctanswerformat' => '1',
 140                      ),
 141                  ),
 142                  'units' => array(
 143                      0 => (object) array(
 144                          'id' => '9',
 145                          'question' => '18',
 146                          'multiplier' => 1,
 147                          'unit' => 'm',
 148                      ),
 149                  ),
 150                  'unitgradingtype' => '1',
 151                  'unitpenalty' => '0.5000000',
 152                  'showunits' => '0',
 153                  'unitsleft' => '0',
 154              ),
 155              'hints' => array(
 156              ),
 157          );
 158          $qsession = (object) array(
 159              'id' => '97',
 160              'attemptid' => '13',
 161              'questionid' => '18',
 162              'newest' => '258',
 163              'newgraded' => '258',
 164              'sumpenalty' => '0.1000000',
 165              'manualcomment' => '',
 166              'manualcommentformat' => '1',
 167              'flagged' => '0',
 168          );
 169          $qstates = array(
 170              255 => (object) array(
 171                  'id' => '255',
 172                  'attempt' => '13',
 173                  'question' => '18',
 174                  'seq_number' => '0',
 175                  'answer' => 'dataset10-|||||',
 176                  'timestamp' => '1305830650',
 177                  'event' => '0',
 178                  'grade' => '0.0000000',
 179                  'raw_grade' => '0.0000000',
 180                  'penalty' => '0.0000000',
 181              ),
 182              258 => (object) array(
 183                  'id' => '258',
 184                  'attempt' => '13',
 185                  'question' => '18',
 186                  'seq_number' => '1',
 187                  'answer' => 'dataset10-|||||',
 188                  'timestamp' => '1305830650',
 189                  'event' => '6',
 190                  'grade' => '0.0000000',
 191                  'raw_grade' => '0.0000000',
 192                  'penalty' => '0.1000000',
 193              ),
 194          );
 195          $this->loader->put_dataset_in_cache($question->id, 10, array('a' => '7.5', 'b' => '4.9'));
 196  
 197          $qa = $this->updater->convert_question_attempt($quiz, $attempt, $question, $qsession, $qstates);
 198  
 199          $expectedqa = (object) array(
 200              'behaviour' => 'adaptive',
 201              'questionid' => 18,
 202              'variant' => 10,
 203              'maxmark' => 1.0000000,
 204              'minfraction' => 0,
 205              'maxfraction' => 1,
 206              'flagged' => 0,
 207              'questionsummary' => 'What is 7.5 m + 4.9 m?
 208  
 209  _______________
 210  
 211  Remember to type a unit.',
 212              'rightanswer' => '12.4 m',
 213              'responsesummary' => '',
 214              'timemodified' => 1305830650,
 215              'steps' => array(
 216                  0 => (object) array(
 217                      'sequencenumber' => 0,
 218                      'state' => 'todo',
 219                      'fraction' => null,
 220                      'timecreated' => 1305830650,
 221                      'userid' => 4,
 222                      'data' => array('_separators' => '.$,',
 223                              '_var_a' => '7.5', '_var_b' => '4.9'),
 224                  ),
 225                  1 => (object) array(
 226                      'sequencenumber' => 1,
 227                      'state' => 'gradedwrong',
 228                      'fraction' => null,
 229                      'timecreated' => 1305830650,
 230                      'userid' => 4,
 231                      'data' => array('answer' => '', '-finish' => 1, '-_try' => 1, '-_rawfraction' => 0),
 232                  ),
 233              ),
 234          );
 235  
 236          $this->compare_qas($expectedqa, $qa);
 237      }
 238  
 239      public function test_calculated_adaptive_qsession100() {
 240          $quiz = (object) array(
 241              'id' => '4',
 242              'course' => '2',
 243              'name' => 'Calculated quiz',
 244              'intro' => '',
 245              'introformat' => '1',
 246              'timeopen' => '0',
 247              'timeclose' => '0',
 248              'attempts' => '0',
 249              'attemptonlast' => '0',
 250              'grademethod' => '1',
 251              'decimalpoints' => '2',
 252              'questiondecimalpoints' => '-1',
 253              'questionsperpage' => '1',
 254              'shufflequestions' => '0',
 255              'shuffleanswers' => '1',
 256              'sumgrades' => '3.00000',
 257              'grade' => '10.00000',
 258              'timecreated' => '0',
 259              'timemodified' => '1305648351',
 260              'timelimit' => '0',
 261              'password' => '',
 262              'subnet' => '',
 263              'popup' => '0',
 264              'delay1' => '0',
 265              'delay2' => '0',
 266              'showuserpicture' => '0',
 267              'showblocks' => '0',
 268              'preferredbehaviour' => 'adaptive',
 269              'reviewattempt' => '69888',
 270              'reviewcorrectness' => '69888',
 271              'reviewmarks' => '69888',
 272              'reviewspecificfeedback' => '69888',
 273              'reviewgeneralfeedback' => '69888',
 274              'reviewrightanswer' => '69888',
 275              'reviewoverallfeedback' => '4352',
 276          );
 277          $attempt = (object) array(
 278              'id' => '14',
 279              'uniqueid' => '14',
 280              'quiz' => '4',
 281              'userid' => '4',
 282              'attempt' => '2',
 283              'sumgrades' => '2.80000',
 284              'timestart' => '1305830661',
 285              'timefinish' => '1305830729',
 286              'timemodified' => '1305830729',
 287              'layout' => '16,0,17,0,18,0',
 288              'preview' => '0',
 289          );
 290          $question = (object) array(
 291              'id' => '18',
 292              'category' => '2',
 293              'parent' => '0',
 294              'name' => 'Calculated',
 295              'questiontext' => '<p>What is {a} m + {b} m?</p><p>_______________</p><p>Remember to type a unit.</p>',
 296              'questiontextformat' => '1',
 297              'generalfeedback' => '',
 298              'generalfeedbackformat' => '1',
 299              'defaultmark' => '1.0000000',
 300              'penalty' => '0.1',
 301              'qtype' => 'calculated',
 302              'length' => '1',
 303              'stamp' => 'tjh238.vledev2.open.ac.uk+110519184316+ELvZeg',
 304              'version' => 'tjh238.vledev2.open.ac.uk+110519184317+exx1Bm',
 305              'hidden' => '0',
 306              'timecreated' => '1305830596',
 307              'timemodified' => '1305830596',
 308              'createdby' => '2',
 309              'modifiedby' => '2',
 310              'maxmark' => '1.0000000',
 311              'options' => (object) array(
 312                  'id' => '2',
 313                  'question' => '18',
 314                  'synchronize' => '0',
 315                  'single' => '0',
 316                  'shuffleanswers' => '1',
 317                  'correctfeedback' => '',
 318                  'correctfeedbackformat' => '0',
 319                  'partiallycorrectfeedback' => '',
 320                  'partiallycorrectfeedbackformat' => '0',
 321                  'incorrectfeedback' => '',
 322                  'incorrectfeedbackformat' => '0',
 323                  'answernumbering' => 'abc',
 324                  'shownumcorrect' => '0',
 325                  'answers' => array(
 326                      28 => (object) array(
 327                          'id' => '28',
 328                          'question' => '18',
 329                          'answer' => '{a} + {b}',
 330                          'answerformat' => '0',
 331                          'fraction' => '1.0000000',
 332                          'feedback' => '',
 333                          'feedbackformat' => '1',
 334                          'tolerance' => '0.01',
 335                          'tolerancetype' => '1',
 336                          'correctanswerlength' => '2',
 337                          'correctanswerformat' => '1',
 338                      ),
 339                  ),
 340                  'units' => array(
 341                      0 => (object) array(
 342                          'id' => '9',
 343                          'question' => '18',
 344                          'multiplier' => 1,
 345                          'unit' => 'm',
 346                      ),
 347                  ),
 348                  'unitgradingtype' => '1',
 349                  'unitpenalty' => '0.5000000',
 350                  'showunits' => '0',
 351                  'unitsleft' => '0',
 352              ),
 353              'hints' => array(
 354              ),
 355          );
 356          $qsession = (object) array(
 357              'id' => '100',
 358              'attemptid' => '14',
 359              'questionid' => '18',
 360              'newest' => '269',
 361              'newgraded' => '269',
 362              'sumpenalty' => '0.3000000',
 363              'manualcomment' => '',
 364              'manualcommentformat' => '1',
 365              'flagged' => '0',
 366          );
 367          $qstates = array(
 368              261 => (object) array(
 369                  'id' => '261',
 370                  'attempt' => '14',
 371                  'question' => '18',
 372                  'seq_number' => '0',
 373                  'answer' => 'dataset11-|||||',
 374                  'timestamp' => '1305830661',
 375                  'event' => '0',
 376                  'grade' => '0.0000000',
 377                  'raw_grade' => '0.0000000',
 378                  'penalty' => '0.0000000',
 379              ),
 380              265 => (object) array(
 381                  'id' => '265',
 382                  'attempt' => '14',
 383                  'question' => '18',
 384                  'seq_number' => '1',
 385                  'answer' => 'dataset11-9.6|||||',
 386                  'timestamp' => '1305830714',
 387                  'event' => '3',
 388                  'grade' => '0.5000000',
 389                  'raw_grade' => '0.5000000',
 390                  'penalty' => '0.1000000',
 391              ),
 392              266 => (object) array(
 393                  'id' => '266',
 394                  'attempt' => '14',
 395                  'question' => '18',
 396                  'seq_number' => '2',
 397                  'answer' => 'dataset11-9.6|||||m',
 398                  'timestamp' => '1305830722',
 399                  'event' => '3',
 400                  'grade' => '0.9000000',
 401                  'raw_grade' => '1.0000000',
 402                  'penalty' => '0.1000000',
 403              ),
 404              269 => (object) array(
 405                  'id' => '269',
 406                  'attempt' => '14',
 407                  'question' => '18',
 408                  'seq_number' => '3',
 409                  'answer' => 'dataset11-9.6|||||m',
 410                  'timestamp' => '1305830722',
 411                  'event' => '6',
 412                  'grade' => '0.9000000',
 413                  'raw_grade' => '1.0000000',
 414                  'penalty' => '0.1000000',
 415              ),
 416          );
 417          $this->loader->put_dataset_in_cache($question->id, 11, array('a' => '5.1', 'b' => '4.5'));
 418  
 419          $qa = $this->updater->convert_question_attempt($quiz, $attempt, $question, $qsession, $qstates);
 420  
 421          $expectedqa = (object) array(
 422              'behaviour' => 'adaptive',
 423              'questionid' => 18,
 424              'variant' => 11,
 425              'maxmark' => 1.0000000,
 426              'minfraction' => 0,
 427              'maxfraction' => 1,
 428              'flagged' => 0,
 429              'questionsummary' => 'What is 5.1 m + 4.5 m?
 430  
 431  _______________
 432  
 433  Remember to type a unit.',
 434              'rightanswer' => '9.6 m',
 435              'responsesummary' => '9.6 m',
 436              'timemodified' => 1305830722,
 437              'steps' => array(
 438                  0 => (object) array(
 439                      'sequencenumber' => 0,
 440                      'state' => 'todo',
 441                      'fraction' => null,
 442                      'timecreated' => 1305830661,
 443                      'userid' => 4,
 444                      'data' => array('_separators' => '.$,',
 445                              '_var_a' => '5.1', '_var_b' => '4.5'),
 446                  ),
 447                  1 => (object) array(
 448                      'sequencenumber' => 1,
 449                      'state' => 'todo',
 450                      'fraction' => 0.5,
 451                      'timecreated' => 1305830714,
 452                      'userid' => 4,
 453                      'data' => array('answer' => 9.6, '-_try' => 1,
 454                              '-_rawfraction' => 0.5, '-submit' => 1),
 455                  ),
 456                  2 => (object) array(
 457                      'sequencenumber' => 2,
 458                      'state' => 'todo',
 459                      'fraction' => 0.9,
 460                      'timecreated' => 1305830722,
 461                      'userid' => 4,
 462                      'data' => array('answer' => '9.6 m', '-_try' => 2,
 463                              '-_rawfraction' => 1, '-submit' => 1),
 464                  ),
 465                  3 => (object) array(
 466                      'sequencenumber' => 3,
 467                      'state' => 'gradedright',
 468                      'fraction' => 0.9,
 469                      'timecreated' => 1305830722,
 470                      'userid' => 4,
 471                      'data' => array('answer' => '9.6 m', '-_try' => 2,
 472                              '-_rawfraction' => 1, '-finish' => 1),
 473                  ),
 474              ),
 475          );
 476  
 477          $this->compare_qas($expectedqa, $qa);
 478      }
 479  
 480      public function test_calculated_adaptive_qsession103() {
 481          $quiz = (object) array(
 482              'id' => '4',
 483              'course' => '2',
 484              'name' => 'Calculated quiz',
 485              'intro' => '',
 486              'introformat' => '1',
 487              'timeopen' => '0',
 488              'timeclose' => '0',
 489              'attempts' => '0',
 490              'attemptonlast' => '0',
 491              'grademethod' => '1',
 492              'decimalpoints' => '2',
 493              'questiondecimalpoints' => '-1',
 494              'questionsperpage' => '1',
 495              'shufflequestions' => '0',
 496              'shuffleanswers' => '1',
 497              'sumgrades' => '3.00000',
 498              'grade' => '10.00000',
 499              'timecreated' => '0',
 500              'timemodified' => '1305648351',
 501              'timelimit' => '0',
 502              'password' => '',
 503              'subnet' => '',
 504              'popup' => '0',
 505              'delay1' => '0',
 506              'delay2' => '0',
 507              'showuserpicture' => '0',
 508              'showblocks' => '0',
 509              'preferredbehaviour' => 'adaptive',
 510              'reviewattempt' => '69888',
 511              'reviewcorrectness' => '69888',
 512              'reviewmarks' => '69888',
 513              'reviewspecificfeedback' => '69888',
 514              'reviewgeneralfeedback' => '69888',
 515              'reviewrightanswer' => '69888',
 516              'reviewoverallfeedback' => '4352',
 517          );
 518          $attempt = (object) array(
 519              'id' => '15',
 520              'uniqueid' => '15',
 521              'quiz' => '4',
 522              'userid' => '3',
 523              'attempt' => '1',
 524              'sumgrades' => '0.70000',
 525              'timestart' => '1305830744',
 526              'timefinish' => '0',
 527              'timemodified' => '1305830792',
 528              'layout' => '16,0,17,0,18,0',
 529              'preview' => '0',
 530          );
 531          $question = (object) array(
 532              'id' => '18',
 533              'category' => '2',
 534              'parent' => '0',
 535              'name' => 'Calculated',
 536              'questiontext' => '<p>What is {a} m + {b} m?</p><p>_______________</p><p>Remember to type a unit.</p>',
 537              'questiontextformat' => '1',
 538              'generalfeedback' => '',
 539              'generalfeedbackformat' => '1',
 540              'defaultmark' => '1.0000000',
 541              'penalty' => '0.1',
 542              'qtype' => 'calculated',
 543              'length' => '1',
 544              'stamp' => 'tjh238.vledev2.open.ac.uk+110519184316+ELvZeg',
 545              'version' => 'tjh238.vledev2.open.ac.uk+110519184317+exx1Bm',
 546              'hidden' => '0',
 547              'timecreated' => '1305830596',
 548              'timemodified' => '1305830596',
 549              'createdby' => '2',
 550              'modifiedby' => '2',
 551              'maxmark' => '1.0000000',
 552              'options' => (object) array(
 553                  'id' => '2',
 554                  'question' => '18',
 555                  'synchronize' => '0',
 556                  'single' => '0',
 557                  'shuffleanswers' => '1',
 558                  'correctfeedback' => '',
 559                  'correctfeedbackformat' => '0',
 560                  'partiallycorrectfeedback' => '',
 561                  'partiallycorrectfeedbackformat' => '0',
 562                  'incorrectfeedback' => '',
 563                  'incorrectfeedbackformat' => '0',
 564                  'answernumbering' => 'abc',
 565                  'shownumcorrect' => '0',
 566                  'answers' => array(
 567                      28 => (object) array(
 568                          'id' => '28',
 569                          'question' => '18',
 570                          'answer' => '{a} + {b}',
 571                          'answerformat' => '0',
 572                          'fraction' => '1.0000000',
 573                          'feedback' => '',
 574                          'feedbackformat' => '1',
 575                          'tolerance' => '0.01',
 576                          'tolerancetype' => '1',
 577                          'correctanswerlength' => '2',
 578                          'correctanswerformat' => '1',
 579                      ),
 580                  ),
 581                  'units' => array(
 582                      0 => (object) array(
 583                          'id' => '9',
 584                          'question' => '18',
 585                          'multiplier' => 1,
 586                          'unit' => 'm',
 587                      ),
 588                  ),
 589                  'unitgradingtype' => '1',
 590                  'unitpenalty' => '0.5000000',
 591                  'showunits' => '0',
 592                  'unitsleft' => '0',
 593              ),
 594              'hints' => array(
 595              ),
 596          );
 597          $qsession = (object) array(
 598              'id' => '103',
 599              'attemptid' => '15',
 600              'questionid' => '18',
 601              'newest' => '280',
 602              'newgraded' => '279',
 603              'sumpenalty' => '0.1000000',
 604              'manualcomment' => '',
 605              'manualcommentformat' => '1',
 606              'flagged' => '0',
 607          );
 608          $qstates = array(
 609              272 => (object) array(
 610                  'id' => '272',
 611                  'attempt' => '15',
 612                  'question' => '18',
 613                  'seq_number' => '0',
 614                  'answer' => 'dataset1-|||||',
 615                  'timestamp' => '1305830744',
 616                  'event' => '0',
 617                  'grade' => '0.0000000',
 618                  'raw_grade' => '0.0000000',
 619                  'penalty' => '0.0000000',
 620              ),
 621              279 => (object) array(
 622                  'id' => '279',
 623                  'attempt' => '15',
 624                  'question' => '18',
 625                  'seq_number' => '1',
 626                  'answer' => 'dataset1-123|||||cm',
 627                  'timestamp' => '1305830775',
 628                  'event' => '3',
 629                  'grade' => '0.0000000',
 630                  'raw_grade' => '0.0000000',
 631                  'penalty' => '0.1000000',
 632              ),
 633              280 => (object) array(
 634                  'id' => '280',
 635                  'attempt' => '15',
 636                  'question' => '18',
 637                  'seq_number' => '2',
 638                  'answer' => 'dataset1-12.4|||||',
 639                  'timestamp' => '1305830787',
 640                  'event' => '2',
 641                  'grade' => '0.0000000',
 642                  'raw_grade' => '0.5000000',
 643                  'penalty' => '0.1000000',
 644              ),
 645          );
 646          $this->loader->put_dataset_in_cache($question->id, 1, array('a' => '9.9', 'b' => '2.5'));
 647  
 648          $qa = $this->updater->convert_question_attempt($quiz, $attempt, $question, $qsession, $qstates);
 649  
 650          $expectedqa = (object) array(
 651              'behaviour' => 'adaptive',
 652              'questionid' => 18,
 653              'variant' => 1,
 654              'maxmark' => 1.0000000,
 655              'minfraction' => 0,
 656              'maxfraction' => 1,
 657              'flagged' => 0,
 658              'questionsummary' => 'What is 9.9 m + 2.5 m?
 659  
 660  _______________
 661  
 662  Remember to type a unit.',
 663              'rightanswer' => '12.4 m',
 664              'responsesummary' => '12.4',
 665              'timemodified' => 1305830787,
 666              'steps' => array(
 667                  0 => (object) array(
 668                      'sequencenumber' => 0,
 669                      'state' => 'todo',
 670                      'fraction' => null,
 671                      'timecreated' => 1305830744,
 672                      'userid' => 3,
 673                      'data' => array('_separators' => '.$,',
 674                              '_var_a' => '9.9', '_var_b' => '2.5'),
 675                  ),
 676                  1 => (object) array(
 677                      'sequencenumber' => 1,
 678                      'state' => 'todo',
 679                      'fraction' => 0,
 680                      'timecreated' => 1305830775,
 681                      'userid' => 3,
 682                      'data' => array('answer' => '123 cm', '-_try' => 1,
 683                              '-_rawfraction' => 0, '-submit' => 1),
 684                  ),
 685                  2 => (object) array(
 686                      'sequencenumber' => 2,
 687                      'state' => 'complete',
 688                      'fraction' => 0,
 689                      'timecreated' => 1305830787,
 690                      'userid' => 3,
 691                      'data' => array('answer' => '12.4'),
 692                  ),
 693              ),
 694          );
 695  
 696          $this->compare_qas($expectedqa, $qa);
 697      }
 698  }