NOBUG qtype numerical fix unit test.

This commit is contained in:
Tim Hunt 2010-07-28 15:03:04 +00:00
parent 1b20b92792
commit c95ce1dc52

View File

@ -131,14 +131,14 @@ class question_numerical_qtype_test extends UnitTestCase {
(object) array('unit' => 'inch', 'multiplier' => 1.0/0.0254)
);
$this->assertWithinMargin($this->qtype->apply_unit('1', $units), 1, $this->tolerance);
$this->assertWithinMargin($this->qtype->apply_unit('1.0', $units), 1, $this->tolerance);
$this->assertWithinMargin($this->qtype->apply_unit('-1e0', $units), -1, $this->tolerance);
$this->assertWithinMargin($this->qtype->apply_unit('100m', $units), 100, $this->tolerance);
$this->assertWithinMargin($this->qtype->apply_unit('1cm', $units), 0.01, $this->tolerance);
$this->assertWithinMargin($this->qtype->apply_unit('12inch', $units), .3048, $this->tolerance);
$this->assertWithinMargin($this->qtype->apply_unit_old('1', $units), 1, $this->tolerance);
$this->assertWithinMargin($this->qtype->apply_unit_old('1.0', $units), 1, $this->tolerance);
$this->assertWithinMargin($this->qtype->apply_unit_old('-1e0', $units), -1, $this->tolerance);
$this->assertWithinMargin($this->qtype->apply_unit_old('100m', $units), 100, $this->tolerance);
$this->assertWithinMargin($this->qtype->apply_unit_old('1cm', $units), 0.01, $this->tolerance);
$this->assertWithinMargin($this->qtype->apply_unit_old('12inch', $units), .3048, $this->tolerance);
// $this->assertIdentical($this->qtype->apply_unit('1km', $units), false);
$this->assertWithinMargin($this->qtype->apply_unit('-100', array()), -100, $this->tolerance);
$this->assertWithinMargin($this->qtype->apply_unit_old('-100', array()), -100, $this->tolerance);
// $this->assertIdentical($this->qtype->apply_unit('1000 miles', array()), false);
}