diff options
Diffstat (limited to 'test2.py')
-rwxr-xr-x | test2.py | 19 |
1 files changed, 8 insertions, 11 deletions
@@ -4,21 +4,18 @@ 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]}") +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) 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): - 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): - 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)) |