저자: Iván Montes (drslump@pollinimini.net)
저자: Fabio B. Silva (fabio.bat.silva@gmail.com)
예제 #1
0
 public function testIsBigEndian()
 {
     list(, $result) = unpack('L', pack('V', 1));
     $actual = BigEndian::isBigEndian();
     $expected = $result !== 1;
     $this->assertEquals($expected, $actual);
 }
 public function testConstructInitializeGmpValues()
 {
     $encoder = new GmpNegativeEncoder();
     $gmp_x00 = $this->getPropertyValue($encoder, 'gmp_x00');
     $gmp_x7f = $this->getPropertyValue($encoder, 'gmp_x7f');
     $gmp_x80 = $this->getPropertyValue($encoder, 'gmp_x80');
     $gmp_xff = $this->getPropertyValue($encoder, 'gmp_xff');
     $gmp_x100 = $this->getPropertyValue($encoder, 'gmp_x100');
     $is32Bit = $this->getPropertyValue($encoder, 'is32Bit');
     $this->assertNotNull($gmp_x00);
     $this->assertNotNull($gmp_x7f);
     $this->assertNotNull($gmp_x80);
     $this->assertNotNull($gmp_xff);
     $this->assertNotNull($gmp_x100);
     $this->assertEquals(0, gmp_intval($gmp_x00));
     $this->assertEquals(127, gmp_intval($gmp_x7f));
     $this->assertEquals(128, gmp_intval($gmp_x80));
     $this->assertEquals(255, gmp_intval($gmp_xff));
     $this->assertEquals(256, gmp_intval($gmp_x100));
     $this->assertEquals(BigEndian::is32Bit(), $is32Bit);
 }
예제 #3
0
 /**
  * @return boolean
  */
 public function is32Bit()
 {
     return BigEndian::is32Bit();
 }
예제 #4
0
 /**
  * Constructor
  *
  * @param \Protobuf\Configuration $config
  */
 public function __construct(Configuration $config)
 {
     $this->config = $config;
     $this->isBigEndian = BigEndian::isBigEndian();
     $this->negativeEncoder = $config->getPlatformFactory()->getNegativeEncoder();
 }
예제 #5
0
 /**
  * Constructor
  *
  * @param \Protobuf\Configuration $config
  */
 public function __construct(Configuration $config)
 {
     $this->config = $config;
     $this->isBigEndian = BigEndian::isBigEndian();
 }