From e711e2d44a24024fcd7d7f5b39f285f979b66a77 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 9 May 2017 10:49:19 +1000 Subject: [PATCH] tests/basics: Add memoryview test for big ints. --- tests/basics/memoryview2.py | 4 ---- tests/basics/memoryview_intbig.py | 11 +++++++++++ 2 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 tests/basics/memoryview_intbig.py diff --git a/tests/basics/memoryview2.py b/tests/basics/memoryview2.py index edb7c9e640..4b5af852b2 100644 --- a/tests/basics/memoryview2.py +++ b/tests/basics/memoryview2.py @@ -12,7 +12,3 @@ print(list(memoryview(array('b', [0x7f, -0x80])))) print(list(memoryview(array('B', [0x7f, 0x80, 0x81, 0xff])))) print(list(memoryview(array('h', [0x7f00, -0x8000])))) print(list(memoryview(array('H', [0x7f00, 0x8000, 0x8100, 0xffff])))) - -# these constructors give an internal overflow in uPy -#print(list(memoryview(array('i', [0x7f000000, -0x80000000])))) -#print(list(memoryview(array('I', [0x7f000000, 0x80000000, 0x81000000, 0xffffffff])))) diff --git a/tests/basics/memoryview_intbig.py b/tests/basics/memoryview_intbig.py new file mode 100644 index 0000000000..180f15d186 --- /dev/null +++ b/tests/basics/memoryview_intbig.py @@ -0,0 +1,11 @@ +# test memoryview accessing maximum values for signed/unsigned elements +try: + from array import array + memoryview +except: + import sys + print("SKIP") + sys.exit() + +print(list(memoryview(array('i', [0x7f000000, -0x80000000])))) +print(list(memoryview(array('I', [0x7f000000, 0x80000000, 0x81000000, 0xffffffff]))))