Test if the observed and expected values are within the accepted tolerance

@param float $observed
The observed value
@param float $expected
The expected value
@return boolean
963355
public function isTolerable($observed, $expected)
    {
        $diff = $this->getDifference($observed, $expected);

        if ($diff > $this->tolerance) {
            return false;
        }

        return true;
    }
472878
protected function assertGreaterThan($expected, $actual, $message = '')
    {
        \PHPUnit\Framework\Assert::assertGreaterThan($expected, $actual, $message);
    }
110872
public static function match($actual, $expected)
    {
        if (is_string($actual)) {
            return strpos($actual, $expected) !== false;
        } elseif (is_array($actual) || $actual instanceof Traversable) {
            foreach ($actual as $key => $value) {
                if ($value === $expected) {
                    return true;
                }
            }
        }
        return false;
    }
820430
public function offsetExists($offset)
    {
        switch ($offset) {
            case 'position': return isset($this->position);
            break;
            case 'subSpecs': return (0 < count($this->subSpecs)) ? true : false;
            break;
            default: return false;
        }
    }
1025442
public static function compareSize($val, string $operator, $expected): bool
    {
        // type must be same
        if (\gettype($val) !== \gettype($expected)) {
            return false;
        }

        // not in: int, string, array
        if (($len = self::length($val)) < 0) {
            return false;
        }

        $wantLen = self::length($expected);

        switch ($operator) {
            case '>':
                $ok = $len > $wantLen;
                break;
            case '>=':
                $ok = $len >= $wantLen;
                break;
            case '<':
                $ok = $len < $wantLen;
                break;
            case '<=':
                $ok = $len <= $wantLen;
                break;
            default:
                $ok = false;
        }

        return $ok;
    }
1329499
static function isArrayEqual($expected, $actual) {

		if (Arrays::isNumeric($actual) and Arrays::isNumeric($expected)) {
			sort($expected);
			sort($actual);
		} else {
			asort($expected);
			asort($actual);
		}

		return $expected == $actual;
	}
1001371
private function isMatch(Rule $expected, array $value): bool
    {
        return 0 === count(array_diff(array_keys($expected->getReflectedMap()), array_keys($value)));
    }
1277618
public function matches($method, $arguments)
    {
        foreach ($this->expectations as $expectation) {
            if ($expectation->matches($method, $arguments)) {
                return true;
            }
        }
        
        return false;
    }
610875
public static function match($actual, $expected)
    {
        $a = static::actual($actual);
        $e = static::expected($expected);

        static::_buildDescription($a, $e);
        return $a === $e;
    }
209072
public function offsetExists($offset)
    {
        switch ($offset) {
            case 'field':
                return isset($this->field);
            break;
            case 'indicator': return isset($this->indicator);
            break;
            case 'subfields': return (0 < count($this->subfields)) ? true : false;
            break;
            default:
                return false;
        }
    }
272649
public function verify()
    {
        if ($this->currentIndex < $this->sequenceIndex) {
            throw new PHPUnit_Framework_ExpectationFailedException(
              sprintf(
                "The expected invocation at method '%s' index %d was never reached.",

                $this->method,
                $this->sequenceIndex
              )
            );
        }
    }
628866
public function setExpectedResult($expected = Table::RETURN_MODEL,
            $checkNotSet = false) {
        if (!$checkNotSet || ($checkNotSet && is_null($this->expected)))
                $this->expected = $expected;
        return $this;
    }
67959
protected function expected($expecting, $got, $return = false)
    {
        $ex = new ValidationException(ValidationException::VALIDATION_FAILED);
        $ex->addError($this->attribute, ValidationException::DATA_TYPE, [
            $expecting,
            $got
        ]);

        if ($return) {
            return $ex;
        }

        throw $ex;
    }
292657
protected function assertArrayEquals(array $actual, array $expected)
    {
        $propertyAccessor = new PropertyAccessor();

        foreach ($expected as $key => $needle) {
            $expectedValue = $expected[$key];

            // Fix type
            if ($expectedValue == '@true') {
                $expectedValue = true;
            } else if ($expectedValue == '@false') {
                $expectedValue = false;
            } else if ($expectedValue == '@null') {
                $expectedValue = null;
            } else if (preg_match('/^@\[([^\]]+)?\]$/', $expectedValue, $parts)) {
                if (!empty($parts[1])) {
                    $expectedValue = explode(',', $parts[1]);
                    $expectedValue = array_map('trim', $expectedValue);
                } else {
                    $expectedValue = [];
                }
            }

            if (strpos($key, '[') !== false) {
                // Try get value via "PropertyPath"
                $elements = explode('[', $key);
                $elements = array_map(function ($element){
                    return trim($element, '][');
                }, $elements);

                $propertyPath = '[' . implode($elements, '][') . ']';

                $propertyPath = new PropertyPath($propertyPath);
                $actualValue = $propertyAccessor->getValue($actual, $propertyPath);
                $rootKey = $propertyPath->getElement(0);
            } else {
                $actualValue = $actual[$key];
                $rootKey = $key;
            }

            Assertions::assertArrayHasKey($rootKey, $actual, sprintf(
                'Not found key "%s" in array (%s).',
                $rootKey,
                json_encode($actual)
            ));

            if ($expectedValue == '@notNull') {
                Assertions::assertNotNull($actualValue, sprintf(
                    'Failed assert equals for key "%s". Expected: NOT NULL. Body: "%s"',
                    $key,
                    $this->response->getBody()
                ));
            } else {
                Assertions::assertEquals($expectedValue, $actualValue, sprintf(
                    'Failed assert equals for key "%s". Expected: "%s"; Actual: "%s". Body: "%s"',
                    $key,
                    is_scalar($expectedValue) ? $expectedValue : (is_array($expectedValue) ? 'Array(' . json_encode($expectedValue) . ')' : 'Invalid type'),
                    is_scalar($actualValue) ? $actualValue : (is_array($actualValue) ? 'Array(' . json_encode($actualValue) . ')' : 'Invalid type'),
                    $this->response->getBody()
                ));
            }
        }
    }
880636
public function assert(callable $callback, bool $expected): bool
    {
        $index = 0;
        foreach ($this->items as $key => $value) {
            if ($callback($value, $key, $index++) !== $expected) {
                return false;
            }
        }

        return true;
    }
1354289
private function checkAnalyzer($property, $expectedAnalyzer)
    {
        $isAnalyzerCorrect = true;

        if ($property['type'] == self::FIELD_TYPE_TEXT || $property['type'] == self::FIELD_TYPE_KEYWORD) {
            $isAnalyzed = $expectedAnalyzer !== self::ANALYZER_UNTOUCHED;

            if ($isAnalyzed && (!isset($property['analyzer']) || $property['analyzer'] != $expectedAnalyzer)) {
                $isAnalyzerCorrect = false;
            } elseif (!$isAnalyzed && $property['type'] !== self::FIELD_TYPE_KEYWORD) {
                $isAnalyzerCorrect = false;
            }
        }

        return $isAnalyzerCorrect;
    }
367645
protected function assertGreaterThanOrEqual($expected, $actual, $message = '')
    {
        \PHPUnit\Framework\Assert::assertGreaterThanOrEqual($expected, $actual, $message);
    }