예제 #1
0
 function testEncodeVarintFloat()
 {
     foreach ($this->tests as $i => $enc) {
         if (!hasExactRepresentation($i) || $i < 0) {
             continue;
         }
         if (is_string($i)) {
             $i = (double) $i;
         }
         $result = Protobuf::encode_varint_float($i);
         $this->assertBinaryEqual($enc, $result, "Failed to encode_varint_float({$i})");
     }
 }
예제 #2
0
 function testEncodeVarintFloat()
 {
     foreach ($this->tests as $i => $enc) {
         if (!hasExactRepresentation($i) || $i < 0) {
             // Skip encoding floats without exact representation, as we will never get it right
             continue;
         }
         if (is_string($i)) {
             $i = (double) $i;
         }
         $result = Protobuf::encode_varint_float($i);
         $this->assertBinaryEqual($enc, $result, "Failed to encode_varint_float({$i})");
     }
 }