[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Added uuid unit test.



# HG changeset patch
# User emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID c24fae1cd39d21d39ec0144b4fd0b9a1f396e073
# Parent  377b64f085d0c1b8cf126b2910d803670100bdff
Added uuid unit test.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>

diff -r 377b64f085d0 -r c24fae1cd39d tools/python/xen/xend/tests/test_uuid.py
--- /dev/null   Tue Oct 18 16:45:50 2005
+++ b/tools/python/xen/xend/tests/test_uuid.py  Tue Oct 18 17:01:14 2005
@@ -0,0 +1,30 @@
+import unittest
+
+from xen.xend import uuid
+
+
+class test_uuid(unittest.TestCase):
+
+    def testStringRoundtrip(self):
+        def t(inp):
+            self.assertEqual(uuid.fromString(uuid.toString(inp)), inp)
+
+        t(uuid.create())
+        t(uuid.create())
+        t(uuid.create())
+        t(uuid.create())
+        t(uuid.create())
+
+
+    def testToFromString(self):
+        def t(inp, expected):
+            self.assertEqual(uuid.toString(inp), expected)
+            self.assertEqual(uuid.fromString(expected), inp)
+
+        t([0 for i in range(0, 16)], "00000000-0000-0000-0000-000000000000")
+        t([185, 158, 125, 206, 250, 178, 125, 57, 2, 6, 162, 74, 178, 236,
+           196, 5], "b99e7dce-fab2-7d39-0206-a24ab2ecc405")
+
+
+def test_suite():
+    return unittest.makeSuite(test_uuid)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.