summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_xdr.py
blob: 0cc7a3aff73a8ea5e4a6265936dda20bcef6ec50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from test_support import verbose
import _xdr

fd = 8.01
print '_xdr.pack_float()'
s = _xdr.pack_float(fd)
if verbose:
    print `s`
print '_xdr.unpack_float()'
f = _xdr.unpack_float(s)
if verbose:
    print f
if int(100*f) <> int(100*fd):
    print 'pack_float() <> unpack_float()'

fd = 9900000.9
print '_xdr.pack_double()'
s = _xdr.pack_double(fd)
if verbose:
    print `s`
print '_xdr.unpack_double()'
f = _xdr.unpack_double(s)
if verbose:
    print f

if int(100*f) <> int(100*fd):
    print 'pack_double() <> unpack_double()'