File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
graalpython/com.oracle.graal.python.test/src/tests Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -145,3 +145,17 @@ def test_pack_unpack():
145145def test_pack_nan ():
146146 import math
147147 assert struct .pack ('<d' , math .nan ) == b'\x00 \x00 \x00 \x00 \x00 \x00 \xf8 \x7f '
148+
149+
150+ def test_pack_large_long ():
151+ for fmt in ('l' , 'q' ):
152+ assert struct .pack (fmt , 0 ) == b'\x00 ' * struct .calcsize (fmt )
153+ assert struct .unpack (fmt , b'\x00 ' * struct .calcsize (fmt )) == (0 ,)
154+ assert struct .pack (fmt , - 1 ) == b'\xff ' * struct .calcsize (fmt )
155+ assert struct .unpack (fmt , b'\xff ' * struct .calcsize (fmt )) == (- 1 ,)
156+
157+ for fmt in ('L' , 'Q' ):
158+ assert struct .pack (fmt , 0 ) == b'\x00 ' * struct .calcsize (fmt )
159+ assert struct .unpack (fmt , b'\x00 ' * struct .calcsize (fmt )) == (0 ,)
160+ assert struct .pack (fmt , 18446744073709551615 ) == b'\xff \xff \xff \xff \xff \xff \xff \xff '
161+ assert struct .unpack (fmt , b'\xff \xff \xff \xff \xff \xff \xff \xff ' ) == (18446744073709551615 ,)
You can’t perform that action at this time.
0 commit comments