summaryrefslogtreecommitdiff
path: root/tests/basics/bigint_array_overflow.py
diff options
context:
space:
mode:
authorBenjamin Shockley <benjaminshockley@hotmail.com>2020-08-20 13:48:15 -0500
committerGitHub <noreply@github.com>2020-08-20 13:48:15 -0500
commit0084f0af24e4e219bc040c52ee723959423de6e2 (patch)
tree1aebdb362f08bf6417caa87836e3e4e739afc964 /tests/basics/bigint_array_overflow.py
parent9aebe2f1efc99871fcf283c304e3a8700050d736 (diff)
parent4d7b9cde33934a44c4c905a49d2f831339fc8bd2 (diff)
Merge pull request #2 from adafruit/master
Master
Diffstat (limited to 'tests/basics/bigint_array_overflow.py')
-rw-r--r--tests/basics/bigint_array_overflow.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/basics/bigint_array_overflow.py b/tests/basics/bigint_array_overflow.py
new file mode 100644
index 000000000..0dd79c23d
--- /dev/null
+++ b/tests/basics/bigint_array_overflow.py
@@ -0,0 +1,28 @@
+import skip_if
+skip_if.no_bigint()
+
+try:
+ from array import array
+except ImportError:
+ print("SKIP")
+ raise SystemExit
+
+def test_array_overflow(typecode, val):
+ try:
+ print(array(typecode, [val]))
+ except OverflowError:
+ print('OverflowError')
+
+# big int -1
+test_array_overflow('Q', -2**64 // 2**64)
+test_array_overflow('L', -2**64 // 2**64)
+test_array_overflow('I', -2**64 // 2**64)
+test_array_overflow('H', -2**64 // 2**64)
+test_array_overflow('B', -2**64 // 2**64)
+
+# big int 2**63
+test_array_overflow('q', 2**63)
+test_array_overflow('l', 2**63)
+test_array_overflow('i', 2**63)
+test_array_overflow('h', 2**63)
+test_array_overflow('b', 2**63)