mirror of
https://github.com/micropython/micropython.git
synced 2025-07-20 20:41:10 +02:00
tests/extmod/json_loads_int_64.py: Add test cases for LONGINT parse.
These tests cover the use of mp_obj_new_int_from_str_len when mp_parse_num_integer overflows the SMALLINT limit, and also the case where the value may not be null terminated. Placed in a separate test file so that extmod/json test doesn't rely on bigint support. Signed-off-by: Yoctopuce dev <dev@yoctopuce.com> Signed-off-by: Angus Gratton <angus@redyak.com.au>
This commit is contained in:
committed by
Damien George
parent
2d8d64059f
commit
6d93b150b8
16
tests/extmod/json_loads_int_64.py
Normal file
16
tests/extmod/json_loads_int_64.py
Normal file
@@ -0,0 +1,16 @@
|
||||
# Parse 64-bit integers from JSON payloads.
|
||||
#
|
||||
# This also exercises parsing integers from strings
|
||||
# where the value may not be null terminated (last line)
|
||||
try:
|
||||
import json
|
||||
except ImportError:
|
||||
print("SKIP")
|
||||
raise SystemExit
|
||||
|
||||
|
||||
print(json.loads("9111222333444555666"))
|
||||
print(json.loads("-9111222333444555666"))
|
||||
print(json.loads("9111222333444555666"))
|
||||
print(json.loads("-9111222333444555666"))
|
||||
print(json.loads("[\"9111222333444555666777\",9111222333444555666]"))
|
Reference in New Issue
Block a user