コード例 #1
0
ファイル: StreamTest.php プロジェクト: phpfont/binary
 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());
 }
コード例 #2
0
ファイル: UInt32Test.php プロジェクト: phpfont/binary
 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());
 }
コード例 #3
0
ファイル: Int8Test.php プロジェクト: phpfont/binary
 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());
 }
コード例 #4
0
ファイル: FloatTest.php プロジェクト: phpfont/binary
 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);
 }
コード例 #5
0
ファイル: StringTest.php プロジェクト: phpfont/binary
 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));
 }