Esempio n. 1
0
 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());
 }
Esempio n. 2
0
 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());
 }
Esempio n. 3
0
 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());
 }
Esempio n. 4
0
 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);
 }
Esempio n. 5
0
 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));
 }