summaryrefslogtreecommitdiff
path: root/test.py
blob: cd48e1cfdab1b805791240226922be8585630b60 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/env python3

from rfc1982_serial_number import Serial, step, show
from random import randint

for test in range(10000):
    i1 = Serial(randint(0, Serial.modulus - 1))
    i2 = Serial(randint(0, Serial.modulus - 1))

    assert i1 == i2 or \
        (i1 < i2 and not (i1 > i2)) or \
        (i1 > i2 and not (i1 < i2)) or \
        int(i1) & int(i2) == Serial.modulus >> 1
    
    show(step(i1, i2))