ia64/xen-unstable

view tools/python/xen/xend/tests/test_uuid.py @ 7427:c24fae1cd39d

Added uuid unit test.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@leeni.uk.xensource.com
date Tue Oct 18 18:01:14 2005 +0100 (2005-10-18)
parents
children b7790c2874c4
line source
1 import unittest
3 from xen.xend import uuid
6 class test_uuid(unittest.TestCase):
8 def testStringRoundtrip(self):
9 def t(inp):
10 self.assertEqual(uuid.fromString(uuid.toString(inp)), inp)
12 t(uuid.create())
13 t(uuid.create())
14 t(uuid.create())
15 t(uuid.create())
16 t(uuid.create())
19 def testToFromString(self):
20 def t(inp, expected):
21 self.assertEqual(uuid.toString(inp), expected)
22 self.assertEqual(uuid.fromString(expected), inp)
24 t([0 for i in range(0, 16)], "00000000-0000-0000-0000-000000000000")
25 t([185, 158, 125, 206, 250, 178, 125, 57, 2, 6, 162, 74, 178, 236,
26 196, 5], "b99e7dce-fab2-7d39-0206-a24ab2ecc405")
29 def test_suite():
30 return unittest.makeSuite(test_uuid)