public function testSubstringCompare()
 {
     $this->eq(s::substringCompare('xabcx', 'abc', 1, 3), 0);
     $this->ne(s::substringCompare('xabcx', 'def', 1, 3), 0);
     $this->lt(s::substringCompare('xabcx', 'xyz', 1, 0), 0);
     $this->eq(s::substringCompare('xabcx', '', 1, 0), 0);
     $this->eq(s::substringCompare('xxabc', 'abc', 2, 5), 0);
     $this->lt(s::substringCompare('xxabc', 'abcd', 2, 5), 0);
     $this->eq(s::substringCompare('xxxxx', '', 5, 5), 0);
     $this->lt(s::substringCompare('xxxxx', 'a', 5, 5), 0);
     $this->eq(s::substringCompare('xabcx', '', 10, 5), 0);
     $this->lt(s::substringCompare('xabcx', 'xyz', 10, 5), 0);
     $this->eq(s::substringCompare('xxabc', 'abc', 2, null), 0);
     $this->eq(s::substringCompare('xxabc', 'abc', -3, null), 0);
     $this->eq(s::substringCompare('abcxx', 'abc', -7, 5), 0);
     $this->eq(s::substringCompare('abcde', 'abcde', -7, null), 0);
     $this->eq(s::substringCompare('abcde', '', -15, 5), 0);
     $this->eq(s::substringCompare('abcde', 'abcde', -15, null), 0);
     $this->lt(s::substringCompare('', 'abc', 0, 1), 0);
     $this->lt(s::substringCompare('', 'abc', -5, 1), 0);
     $this->lt(s::substringCompare('', 'abc', -3, null), 0);
 }
Beispiel #2
0
 public function substringCompare($that, $offset, $length)
 {
     return s::substringCompare($this->value, self::unwrap($that), $offset, $length);
 }