~statik/ubuntu/maverick/protobuf/A

« back to all changes in this revision

Viewing changes to python/google/protobuf/internal/encoder_test.py

  • Committer: Bazaar Package Importer
  • Author(s): Steve Kowalik
  • Date: 2010-02-11 11:13:19 UTC
  • mfrom: (2.2.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100211111319-zdn8hmw0gh8s4cf8
Tags: 2.2.0a-0.1ubuntu1
* Merge from Debian testing.
* Remaining Ubuntu changes:
  - Don't use python2.4.
* Ubuntu changes dropped:
  - Disable death tests on Itanium, fixed upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
123
123
    self.mox.VerifyAll()
124
124
    self.mox.ResetAll()
125
125
 
 
126
  VAL = 1.125  # Perfectly representable as a float (no rounding error).
 
127
  LITTLE_FLOAT_VAL = '\x00\x00\x90?'
 
128
  LITTLE_DOUBLE_VAL = '\x00\x00\x00\x00\x00\x00\xf2?'
 
129
 
126
130
  def testAppendScalars(self):
127
131
    utf8_bytes = '\xd0\xa2\xd0\xb5\xd1\x81\xd1\x82'
128
132
    utf8_string = unicode(utf8_bytes, 'utf-8')
144
148
        ['sfixed64', self.encoder.AppendSFixed64, 'AppendLittleEndian64',
145
149
         wire_format.WIRETYPE_FIXED64, -1, 0xffffffffffffffff],
146
150
        ['float', self.encoder.AppendFloat, 'AppendRawBytes',
147
 
         wire_format.WIRETYPE_FIXED32, 0.0, struct.pack('f', 0.0)],
 
151
         wire_format.WIRETYPE_FIXED32, self.VAL, self.LITTLE_FLOAT_VAL],
148
152
        ['double', self.encoder.AppendDouble, 'AppendRawBytes',
149
 
         wire_format.WIRETYPE_FIXED64, 0.0, struct.pack('d', 0.0)],
 
153
         wire_format.WIRETYPE_FIXED64, self.VAL, self.LITTLE_DOUBLE_VAL],
150
154
        ['bool', self.encoder.AppendBool, 'AppendVarint32',
151
155
         wire_format.WIRETYPE_VARINT, False],
152
156
        ['enum', self.encoder.AppendEnum, 'AppendVarint32',
185
189
        ['sfixed64', self.encoder.AppendSFixed64NoTag,
186
190
         'AppendLittleEndian64', None, 0],
187
191
        ['float', self.encoder.AppendFloatNoTag,
188
 
         'AppendRawBytes', None, 0.0, struct.pack('f', 0.0)],
 
192
         'AppendRawBytes', None, self.VAL, self.LITTLE_FLOAT_VAL],
189
193
        ['double', self.encoder.AppendDoubleNoTag,
190
 
         'AppendRawBytes', None, 0.0, struct.pack('d', 0.0)],
 
194
         'AppendRawBytes', None, self.VAL, self.LITTLE_DOUBLE_VAL],
191
195
        ['bool', self.encoder.AppendBoolNoTag, 'AppendVarint32', None, 0],
192
196
        ['enum', self.encoder.AppendEnumNoTag, 'AppendVarint32', None, 0],
193
197
        ['sint32', self.encoder.AppendSInt32NoTag,