From: Barry Warsaw Date: Tue, 17 Dec 1996 00:00:53 +0000 (+0000) Subject: A test of the _xdrmodule (not the entire xdr.py module). X-Git-Tag: v1.5a1~728 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3863fb53b85946782e51c3ea3eb2643286be942c;p=thirdparty%2FPython%2Fcpython.git A test of the _xdrmodule (not the entire xdr.py module). --- diff --git a/Lib/test/test_xdr.py b/Lib/test/test_xdr.py new file mode 100644 index 000000000000..5d9a139b04bb --- /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()'