123456789101112131415161718192021222324 |
- #!/usr/bin/env python3
- from rfc1982_serial_number import Serial
- from random import randint
- from subprocess import run
- def test(n, cmd):
- print(f"\nTest: {test}: {cmd[0]} {cmd[1]} {cmd[2]}")
- run(cmd)
- for n in range(100):
- i1 = randint(0, Serial.modulus - 1)
- i2 = randint(0, Serial.modulus - 1)
- test(n, ("./rfc1982_serial_number.py", str(i1), str(i2)))
- for n in range(10):
- i1 = randint(0, Serial.modulus - 1)
- i2 = i1 ^ (Serial.modulus >> 1)
- test(n, ("./rfc1982_serial_number.py", str(i1), str(i2)))
- for n in range(10):
- i1 = randint(0, Serial.modulus - 1)
- i2 = (i1 + Serial.modulus - 1) & (Serial.modulus - 1)
- test(n, ("./rfc1982_serial_number.py", str(i1), str(i2)))
|