Esempio n. 1
0
 def check(self, type, value, compare=True):
   t = PRIMITIVE[type]
   sc = StringCodec()
   sc.write_primitive(t, value)
   decoded = sc.read_primitive(t)
   if compare:
     assert decoded == value, "%s, %s" % (decoded, value)
   return decoded
Esempio n. 2
0
 def check(self, type, value, compare=True):
     t = PRIMITIVE[type]
     sc = StringCodec()
     sc.write_primitive(t, value)
     decoded = sc.read_primitive(t)
     if compare:
         assert decoded == value, "%s, %s" % (decoded, value)
     return decoded
Esempio n. 3
0
 def decode(x):
   sc = StringCodec(x)
   return sc.read_primitive(type)