You are here

function ArrayWithinMarginExpectation::test in Location 5.3

Tests the expectation. True if it matches the held value.

Parameters

mixed $compare Comparison value.: @return boolean True if correct. @access public

File

tests/location_test_case.php, line 40
Location specific assertions.

Class

ArrayWithinMarginExpectation
Test each element of an array for being within a range.

Code

function test($compare) {

  // First of all, if the count is off, there's DEFINATELY a problem.
  if (count($compare) != count($this->_canonicalvalues)) {
    return FALSE;
  }
  $pass = TRUE;
  foreach ($compare as $k => $v) {
    $pass = $pass && $v <= $this->_upper[$k] && $v >= $this->_lower[$k];
  }
  return $pass;
}