|
@@ -4,21 +4,18 @@ from rfc1982_serial_number import Serial
|
|
from random import randint
|
|
from random import randint
|
|
from subprocess import run
|
|
from subprocess import run
|
|
|
|
|
|
-def test(n, cmd):
|
|
|
|
- print(f"\nTest: {test}: {cmd[0]} {cmd[1]} {cmd[2]}")
|
|
|
|
|
|
+def test(n, i1, i2):
|
|
|
|
+ cmd = ("./rfc1982_serial_number.py", str(i1), str(i2))
|
|
|
|
+ print(f"\nTest: {n}: {cmd[0]} {cmd[1]} {cmd[2]}")
|
|
run(cmd)
|
|
run(cmd)
|
|
|
|
|
|
for n in range(100):
|
|
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)))
|
|
|
|
|
|
+ test(n, randint(0, Serial.modulus - 1), randint(0, Serial.modulus - 1))
|
|
|
|
|
|
for n in range(10):
|
|
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)))
|
|
|
|
|
|
+ t = randint(0, Serial.modulus - 1)
|
|
|
|
+ test(n, t, t ^ (Serial.modulus >> 1))
|
|
|
|
|
|
for n in range(10):
|
|
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)))
|
|
|
|
|
|
+ t = randint(0, Serial.modulus - 1)
|
|
|
|
+ test(n, t, (t + Serial.modulus - 1) & (Serial.modulus - 1))
|