Beispiel #1
0
 def test_error_checking_signed(self):
     for b in range(0, 17):
         field = Field("test", b, 15+b, 'signed')
         assert field.decode(field.encode(0)) == 0
         assert field.decode(field.encode(-32768)) == -32768
         assert field.decode(field.encode(32767)) == 32767
         raises(ValueError, field.encode, 32768)
         raises(ValueError, field.encode, -32769)
Beispiel #2
0
 def test_error_checking_signed(self):
     for b in range(0, 17):
         field = Field("test", b, 15 + b, 'signed')
         assert field.decode(field.encode(0)) == 0
         assert field.decode(field.encode(-32768)) == -32768
         assert field.decode(field.encode(32767)) == 32767
         raises(ValueError, field.encode, 32768)
         raises(ValueError, field.encode, -32769)
Beispiel #3
0
 def test_error_checking_unsigned(self):
     for b in range(0, 17):
         field = Field("test", b, 15+b)
         assert field.decode(field.encode(0)) == 0
         assert field.decode(field.encode(32768)) == 32768
         assert field.decode(field.encode(65535)) == 65535
         raises(ValueError, field.encode, -32768)
         raises(ValueError, field.encode, -1)
         raises(ValueError, field.encode, 65536)
Beispiel #4
0
 def test_error_checking_unsigned(self):
     for b in range(0, 17):
         field = Field("test", b, 15 + b)
         assert field.decode(field.encode(0)) == 0
         assert field.decode(field.encode(32768)) == 32768
         assert field.decode(field.encode(65535)) == 65535
         raises(ValueError, field.encode, -32768)
         raises(ValueError, field.encode, -1)
         raises(ValueError, field.encode, 65536)