상속: extends SimpleExpectation
예제 #1
0
 function testWithinFloatingPointMargin()
 {
     $within = new WithinMarginExpectation(1.0, 0.2);
     $this->assertFalse($within->test(0.7));
     $this->assertTrue($within->test(0.8));
     $this->assertTrue($within->test(0.9));
     $this->assertTrue($within->test(1.1));
     $this->assertTrue($within->test(1.2));
     $this->assertFalse($within->test(1.3));
 }
예제 #2
0
 /**
  *    Tests the expectation. True if it matches the
  *    held value.
  *    @param mixed $compare        Comparison value.
  *    @return boolean              True if correct.
  *    @access public
  */
 function test($compare)
 {
     return !parent::test($compare);
 }
예제 #3
0
 /**
  *    Sets the range of values to compare against.
  *    Used for comparing floating point and integer values.
  *    @param mixed $minimum      Lowest permissable value.
  *    @param mixed $maximum      Highest permissable value.
  *    @param string $message     Customised message on failure.
  *    @access public
  */
 function __construct($minimum, $maximum, $message = '%s')
 {
     parent::__construct($minimum, $maximum, $message);
     $this->upper = $maximum;
     $this->lower = $minimum;
 }