Differences Between: [Versions 310 and 403] [Versions 39 and 403]
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 namespace qbehaviour_deferredcbm; 18 19 use question_cbm; 20 21 defined('MOODLE_INTERNAL') || die(); 22 23 global $CFG; 24 require_once (__DIR__ . '/../../../engine/lib.php'); 25 26 /** 27 * Unit tests for the deferred feedback with certainty base marking behaviour. 28 * 29 * @package qbehaviour_deferredcbm 30 * @copyright 2009 The Open University 31 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 32 */ 33 class question_cbm_test extends \basic_testcase { 34 35 public function test_adjust_fraction() { 36 $this->assertEqualsWithDelta( 1, question_cbm::adjust_fraction( 1, question_cbm::LOW), 0.0000001); 37 $this->assertEqualsWithDelta( 2, question_cbm::adjust_fraction( 1, question_cbm::MED), 0.0000001); 38 $this->assertEqualsWithDelta( 3, question_cbm::adjust_fraction( 1, question_cbm::HIGH), 0.0000001); 39 $this->assertEqualsWithDelta( 0, question_cbm::adjust_fraction( 0, question_cbm::LOW), 0.0000001); 40 $this->assertEqualsWithDelta(-2, question_cbm::adjust_fraction( 0, question_cbm::MED), 0.0000001); 41 $this->assertEqualsWithDelta(-6, question_cbm::adjust_fraction( 0, question_cbm::HIGH), 0.0000001); 42 $this->assertEqualsWithDelta( 0.5, question_cbm::adjust_fraction( 0.5, question_cbm::LOW), 0.0000001); 43 $this->assertEqualsWithDelta( 1, question_cbm::adjust_fraction( 0.5, question_cbm::MED), 0.0000001); 44 $this->assertEqualsWithDelta( 1.5, question_cbm::adjust_fraction( 0.5, question_cbm::HIGH), 0.0000001); 45 $this->assertEqualsWithDelta( 0, question_cbm::adjust_fraction(-0.25, question_cbm::LOW), 0.0000001); 46 $this->assertEqualsWithDelta(-2, question_cbm::adjust_fraction(-0.25, question_cbm::MED), 0.0000001); 47 $this->assertEqualsWithDelta(-6, question_cbm::adjust_fraction(-0.25, question_cbm::HIGH), 0.0000001); 48 } 49 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body