Skip to content

Commit

Permalink
test[php]: php protocol test
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysunxiao committed Jul 16, 2024
1 parent 60ec9a7 commit 8d343b3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions protocol/src/main/resources/php/ByteBuffer.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ public function getWriteOffset(): int
public function setWriteOffset(int $writeIndex): void
{
if ($writeIndex > strlen($this->buffer)) {
throw new Exception("writeIndex[" . $writeIndex . "] out of bounds exception: readerIndex: " . $this->readOffset .
", writerIndex: " . $this->writeOffset . "(expected: 0 <= readerIndex <= writerIndex <= capacity:" . strlen($this->buffer));
throw new Exception("writeIndex[" . $writeIndex . "] out of bounds exception: readOffset: " . $this->readOffset .
", writeOffset: " . $this->writeOffset . "(expected: 0 <= readOffset <= writeOffset <= capacity:" . strlen($this->buffer) . ")");
}
$this->writeOffset = $writeIndex;
}
Expand All @@ -78,8 +78,8 @@ public function getReadOffset(): int
public function setReadOffset(int $readIndex): void
{
if ($readIndex > $this->writeOffset) {
throw new Exception("readIndex[" . $readIndex . "] out of bounds exception: readerIndex: " . $this->readOffset .
", writerIndex: " . $this->writeOffset . "(expected: 0 <= readerIndex <= writerIndex <= capacity:" . strlen($this->buffer));
throw new Exception("readIndex[" . $readIndex . "] out of bounds exception: readOffset: " . $this->readOffset .
", writeOffset: " . $this->writeOffset . "(expected: 0 <= readOffset <= writeOffset <= capacity:" . strlen($this->buffer));
}
$this->readOffset = $readIndex;
}
Expand Down
8 changes: 4 additions & 4 deletions protocol/src/test/php/zfoophp/ByteBuffer.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ public function getWriteOffset(): int
public function setWriteOffset(int $writeIndex): void
{
if ($writeIndex > strlen($this->buffer)) {
throw new Exception("writeIndex[" . $writeIndex . "] out of bounds exception: readerIndex: " . $this->readOffset .
", writerIndex: " . $this->writeOffset . "(expected: 0 <= readerIndex <= writerIndex <= capacity:" . strlen($this->buffer));
throw new Exception("writeIndex[" . $writeIndex . "] out of bounds exception: readOffset: " . $this->readOffset .
", writeOffset: " . $this->writeOffset . "(expected: 0 <= readOffset <= writeOffset <= capacity:" . strlen($this->buffer) . ")");
}
$this->writeOffset = $writeIndex;
}
Expand All @@ -78,8 +78,8 @@ public function getReadOffset(): int
public function setReadOffset(int $readIndex): void
{
if ($readIndex > $this->writeOffset) {
throw new Exception("readIndex[" . $readIndex . "] out of bounds exception: readerIndex: " . $this->readOffset .
", writerIndex: " . $this->writeOffset . "(expected: 0 <= readerIndex <= writerIndex <= capacity:" . strlen($this->buffer));
throw new Exception("readIndex[" . $readIndex . "] out of bounds exception: readOffset: " . $this->readOffset .
", writeOffset: " . $this->writeOffset . "(expected: 0 <= readOffset <= writeOffset <= capacity:" . strlen($this->buffer));
}
$this->readOffset = $readIndex;
}
Expand Down

0 comments on commit 8d343b3

Please sign in to comment.