diff options
author | Rob Austein <sra@hactrn.net> | 2024-04-12 14:58:54 -0400 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2024-04-12 14:58:54 -0400 |
commit | f2976c2d08db3f940735d3b7727a18c10ef8b5c1 (patch) | |
tree | 0164e69191e5aee083ac55aa26ebd3a4e417e6b5 /test.py | |
parent | b134449fa977769ea00c2c36214d65fa5a379dec (diff) |
split out test code
Diffstat (limited to 'test.py')
-rwxr-xr-x | test.py | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -0,0 +1,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)) |