Skip to content

Commit 6d93b15

Browse files
projectgusdpgeorge
authored andcommitted
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>
1 parent 2d8d640 commit 6d93b15

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/extmod/json_loads_int_64.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Parse 64-bit integers from JSON payloads.
2+
#
3+
# This also exercises parsing integers from strings
4+
# where the value may not be null terminated (last line)
5+
try:
6+
import json
7+
except ImportError:
8+
print("SKIP")
9+
raise SystemExit
10+
11+
12+
print(json.loads("9111222333444555666"))
13+
print(json.loads("-9111222333444555666"))
14+
print(json.loads("9111222333444555666"))
15+
print(json.loads("-9111222333444555666"))
16+
print(json.loads("[\"9111222333444555666777\",9111222333444555666]"))

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy