summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>1996-12-17 00:00:53 (GMT)
committerBarry Warsaw <barry@python.org>1996-12-17 00:00:53 (GMT)
commit3863fb53b85946782e51c3ea3eb2643286be942c (patch)
tree63bda627efb408f6fe7fc4bd4c6f350c7915e8c1
parent237efc5d6f8c16424467e69327dff14dc10cf5ac (diff)
downloadcpython-3863fb53b85946782e51c3ea3eb2643286be942c.zip
cpython-3863fb53b85946782e51c3ea3eb2643286be942c.tar.gz
cpython-3863fb53b85946782e51c3ea3eb2643286be942c.tar.bz2
A test of the _xdrmodule (not the entire xdr.py module).
-rw-r--r--Lib/test/test_xdr.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/Lib/test/test_xdr.py b/Lib/test/test_xdr.py
new file mode 100644
index 0000000..5d9a139
--- /dev/null
+++ b/Lib/test/test_xdr.py
@@ -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()'