#!/usr/bin/env python3 from rfc1982_serial_number import Serial, find_intermediate 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 step = [i1, i2] wrap = find_intermediate(i1, i2) if wrap is not None: step.insert(1, wrap) print(" => ".join(str(s) for s in step))