Move xdrlib tests from the module into a separate test script,
port the tests to unittest and add a few new tests.
diff --git a/Lib/test/output/test_xdrlib b/Lib/test/output/test_xdrlib
deleted file mode 100644
index d86caa9..0000000
--- a/Lib/test/output/test_xdrlib
+++ /dev/null
@@ -1,19 +0,0 @@
-test_xdrlib
-pack test 0 succeeded
-pack test 1 succeeded
-pack test 2 succeeded
-pack test 3 succeeded
-pack test 4 succeeded
-pack test 5 succeeded
-pack test 6 succeeded
-pack test 7 succeeded
-pack test 8 succeeded
-unpack test 0 succeeded : 9
-unpack test 1 succeeded : True
-unpack test 2 succeeded : False
-unpack test 3 succeeded : 45
-unpack test 4 succeeded : 1.89999997616
-unpack test 5 succeeded : 1.9
-unpack test 6 succeeded : hello world
-unpack test 7 succeeded : [0, 1, 2, 3, 4]
-unpack test 8 succeeded : ['what', 'is', 'hapnin', 'doctor']
diff --git a/Lib/test/test_xdrlib.py b/Lib/test/test_xdrlib.py
index e9517c5..8fc88a5 100644
--- a/Lib/test/test_xdrlib.py
+++ b/Lib/test/test_xdrlib.py
@@ -1,3 +1,56 @@
+from test import test_support
+import unittest
+
 import xdrlib
 
-xdrlib._test()
+class XDRTest(unittest.TestCase):
+
+    def test_xdr(self):
+        p = xdrlib.Packer()
+
+        s = 'hello world'
+        a = ['what', 'is', 'hapnin', 'doctor']
+
+        p.pack_int(42)
+        p.pack_uint(9)
+        p.pack_bool(True)
+        p.pack_bool(False)
+        p.pack_uhyper(45L)
+        p.pack_float(1.9)
+        p.pack_double(1.9)
+        p.pack_string(s)
+        p.pack_list(range(5), p.pack_uint)
+        p.pack_array(a, p.pack_string)
+
+        # now verify
+        data = p.get_buffer()
+        up = xdrlib.Unpacker(data)
+
+        self.assertEqual(up.get_position(), 0)
+
+        self.assertEqual(up.unpack_int(), 42)
+        self.assertEqual(up.unpack_uint(), 9)
+        self.assert_(up.unpack_bool() is True)
+
+        # remember position
+        pos = up.get_position()
+        self.assert_(up.unpack_bool() is False)
+
+        # rewind and unpack again
+        up.set_position(pos)
+        self.assert_(up.unpack_bool() is False)
+
+        self.assertEqual(up.unpack_uhyper(), 45L)
+        self.assertAlmostEqual(up.unpack_float(), 1.9)
+        self.assertAlmostEqual(up.unpack_double(), 1.9)
+        self.assertEqual(up.unpack_string(), s)
+        self.assertEqual(up.unpack_list(up.unpack_uint), range(5))
+        self.assertEqual(up.unpack_array(up.unpack_string), a)
+        up.done()
+        self.assertRaises(EOFError, up.unpack_uint)
+
+def test_main():
+    test_support.run_unittest(XDRTest)
+
+if __name__ == "__main__":
+    test_main()