public function testSetPosition() { $this->resource = fopen(__DIR__ . '/assets/non-font-file.txt', 'r'); $stream = new Stream($this->resource); $stream->setPosition(1); $this->assertEquals(1, $stream->getPosition()); }
public function testUInt32LittleEndianOutsideBuffer() { $this->resource = fopen(tempnam(sys_get_temp_dir(), 'binary'), 'a+'); $stream = new Stream($this->resource); $stream->writeUInt32LE(2147483647); $stream->setPosition(0); $this->assertEquals(2147483647, $stream->readUInt32LE()); }
public function testInt8LittleEndianOutsideBuffer() { $this->resource = fopen(tempnam(sys_get_temp_dir(), 'binary'), 'a+'); $stream = new Stream($this->resource); $stream->writeInt8LE(128); $stream->setPosition(0); $this->assertEquals(-128, $stream->readInt8LE()); }
public function testFloat64LE() { $this->resource = fopen(tempnam(sys_get_temp_dir(), 'binary'), 'a+'); $stream = new Stream($this->resource); $stream->writeFloat64LE(12.34); $stream->setPosition(0); $this->assertEquals(12.34, $stream->readFloat64LE(), '', 1.0E-5); }
public function testString() { $this->resource = fopen(tempnam(sys_get_temp_dir(), 'binary'), 'a+'); $stream = new Stream($this->resource); $stream->writeString('Hello World'); $stream->setPosition(0); $this->assertEquals('Hello World', $stream->readString(11)); }