A test of the _xdrmodule (not the entire xdr.py module).
This commit is contained in:
parent
237efc5d6f
commit
3863fb53b8
|
@ -0,0 +1,24 @@
|
||||||
|
import _xdr
|
||||||
|
|
||||||
|
verbose = 0
|
||||||
|
if __name__ == '__main__':
|
||||||
|
verbose = 1
|
||||||
|
|
||||||
|
fd = 8.01
|
||||||
|
s = _xdr.pack_float(fd)
|
||||||
|
f = _xdr.unpack_float(s)
|
||||||
|
|
||||||
|
if verbose:
|
||||||
|
print f
|
||||||
|
if int(100*f) <> int(100*fd):
|
||||||
|
print 'pack_float() <> unpack_float()'
|
||||||
|
|
||||||
|
fd = 9900000.9
|
||||||
|
s = _xdr.pack_double(fd)
|
||||||
|
f = _xdr.unpack_double(s)
|
||||||
|
|
||||||
|
if verbose:
|
||||||
|
print f
|
||||||
|
|
||||||
|
if int(100*f) <> int(100*fd):
|
||||||
|
print 'pack_double() <> unpack_double()'
|
Loading…
Reference in New Issue