Skip to content

Optimize offsetGet #467

Optimize offsetGet

Optimize offsetGet #467

Triggered via pull request September 7, 2023 21:09
Status Failure
Total duration 1m 28s
Artifacts

mutation-tests.yml

on: pull_request
Matrix: tests
Fit to window
Zoom out
Zoom in

Annotations

1 error and 10 warnings
Mutation tests with PHP 8.1
Process completed with exit code 1.
Mutation tests with PHP 8.1: src/UtfString.php#L80
Escaped Mutant for Mutator "MBString": --- Original +++ New @@ @@ public function __construct($str) { $this->str = $str; - $this->byteLen = mb_strlen($str, '8bit'); + $this->byteLen = strlen($str); if (!mb_check_encoding($str, 'UTF-8')) { $this->charLen = 0; } else {
Mutation tests with PHP 8.1: src/UtfString.php#L82
Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ $this->str = $str; $this->byteLen = mb_strlen($str, '8bit'); if (!mb_check_encoding($str, 'UTF-8')) { - $this->charLen = 0; + $this->charLen = -1; } else { $this->charLen = mb_strlen($str, 'UTF-8'); }
Mutation tests with PHP 8.1: src/UtfString.php#L95
Escaped Mutant for Mutator "GreaterThanOrEqualTo": --- Original +++ New @@ @@ */ public function offsetExists($offset) : bool { - return $offset >= 0 && $offset < $this->charLen; + return $offset > 0 && $offset < $this->charLen; } /** * Gets the character at given offset.
Mutation tests with PHP 8.1: src/UtfString.php#L111
Escaped Mutant for Mutator "GreaterThan": --- Original +++ New @@ @@ return null; } $delta = $offset - $this->charIdx; - if ($delta > 0) { + if ($delta >= 0) { // Fast forwarding. while ($delta-- > 0) { $this->byteIdx += strlen(mb_substr(substr($this->str, $this->byteIdx, 4), 0, 1));
Mutation tests with PHP 8.1: src/UtfString.php#L114
Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ if ($delta > 0) { // Fast forwarding. while ($delta-- > 0) { - $this->byteIdx += strlen(mb_substr(substr($this->str, $this->byteIdx, 4), 0, 1)); + $this->byteIdx += strlen(mb_substr(substr($this->str, $this->byteIdx, 5), 0, 1)); ++$this->charIdx; } } elseif ($delta < 0) {
Mutation tests with PHP 8.1: src/UtfString.php#L117
Escaped Mutant for Mutator "LessThan": --- Original +++ New @@ @@ $this->byteIdx += strlen(mb_substr(substr($this->str, $this->byteIdx, 4), 0, 1)); ++$this->charIdx; } - } elseif ($delta < 0) { + } elseif ($delta <= 0) { // Rewinding. while ($delta++ < 0) { do {
Mutation tests with PHP 8.1: src/UtfString.php#L122
Escaped Mutant for Mutator "GreaterThanOrEqualTo": --- Original +++ New @@ @@ while ($delta++ < 0) { do { $byte = ord($this->str[--$this->byteIdx]); - } while ($byte >= 128 && $byte < 192); + } while ($byte > 128 && $byte < 192); --$this->charIdx; } }
Mutation tests with PHP 8.1: src/UtfString.php#L122
Escaped Mutant for Mutator "LessThan": --- Original +++ New @@ @@ while ($delta++ < 0) { do { $byte = ord($this->str[--$this->byteIdx]); - } while ($byte >= 128 && $byte < 192); + } while ($byte >= 128 && $byte <= 192); --$this->charIdx; } }
Mutation tests with PHP 8.1: src/UtfString.php#L128
Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ --$this->charIdx; } } - return mb_substr(substr($this->str, $this->byteIdx, 4), 0, 1); + return mb_substr(substr($this->str, $this->byteIdx, 5), 0, 1); } /** * Sets the value of a character.
Mutation tests with PHP 8.1
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/