mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
add more cases
This commit is contained in:
parent
faa01ac82e
commit
c154d40da6
@ -205,3 +205,21 @@ assert repr(c.void_p(255)) == '<void* at 0xff>'
|
|||||||
assert repr(c.void_p(256)) == '<void* at 0x100>'
|
assert repr(c.void_p(256)) == '<void* at 0x100>'
|
||||||
assert repr(c.void_p(257)) == '<void* at 0x101>'
|
assert repr(c.void_p(257)) == '<void* at 0x101>'
|
||||||
assert repr(c.void_p(17)) == '<void* at 0x11>'
|
assert repr(c.void_p(17)) == '<void* at 0x11>'
|
||||||
|
|
||||||
|
# random hex test
|
||||||
|
import random
|
||||||
|
|
||||||
|
|
||||||
|
def test(__min, __max):
|
||||||
|
for _ in range(100):
|
||||||
|
num = random.randint(__min, __max)
|
||||||
|
hex_num = hex(num)
|
||||||
|
assert eval(hex_num) == num
|
||||||
|
if num >= 0:
|
||||||
|
assert repr(c.void_p(num)) == f'<void* at 0x{hex_num[2:]}>'
|
||||||
|
|
||||||
|
test(0, 100)
|
||||||
|
test(0, 100000)
|
||||||
|
test(-100, 100)
|
||||||
|
test(-100000, 100000)
|
||||||
|
test(-2**60, 2**60)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user