File: test.py

package info (click to toggle)
egenix-mx-base 3.2.1-1.1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 8,496 kB
  • sloc: ansic: 21,976; python: 17,192; sh: 137; makefile: 116
file content (26 lines) | stat: -rw-r--r-- 640 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# -*- coding: latin-1 -*-
import mx.UID
from mx.UID import *

print 'Testing UID version %s ...' % mx.UID.__version__

uid1 = UID()
uid2 = UID()

assert uid1 != uid2
assert verify(uid1) == 1
assert verify(uid2) == 1
assert verify(uid1 + 'abc') == 0
assert verify('abc' + uid2) == 0

key = 'Marc-Andr Lemburg'
assert mangle(uid1, key) != uid1
assert mangle(uid2, key) != uid2
assert demangle(mangle(uid1, key), key) == uid1
assert demangle(mangle(uid2, key), key) == uid2
assert mangle(demangle(uid1, key), key) == uid1
assert mangle(demangle(uid2, key), key) == uid2

for i in xrange(100): u=UID();print mangle(u,'test'),u

print 'Works.'