summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-04-02 14:23:04 +0100
committerDamien George <damien.p.george@gmail.com>2014-04-02 14:23:04 +0100
commit10e21b977091703dbb22f839465902e91fcc6ac3 (patch)
tree9df029a1f79bcb4281828d1d6794649f7444e9fa
parent93b7faa29a647c233a7ee2cf292c657e09753824 (diff)
downloadmicropython-10e21b977091703dbb22f839465902e91fcc6ac3.tar.gz
micropython-10e21b977091703dbb22f839465902e91fcc6ac3.zip
Add more tests.
-rw-r--r--tests/basics/int-big-lshift.py13
-rw-r--r--tests/basics/list_slice.py18
-rwxr-xr-xtests/run-tests2
3 files changed, 32 insertions, 1 deletions
diff --git a/tests/basics/int-big-lshift.py b/tests/basics/int-big-lshift.py
index 7d1fe3fe1e..af1d97504c 100644
--- a/tests/basics/int-big-lshift.py
+++ b/tests/basics/int-big-lshift.py
@@ -2,3 +2,16 @@
for i in range(1, 17):
for shift in range(70):
print(i, '<<', shift, '=', i << shift)
+
+# test bit-shifting negative integers
+for i in range(8):
+ print(-100000000000000000000000000000 << i)
+ print(-100000000000000000000000000001 << i)
+ print(-100000000000000000000000000002 << i)
+ print(-100000000000000000000000000003 << i)
+ print(-100000000000000000000000000004 << i)
+ print(-100000000000000000000000000000 >> i)
+ print(-100000000000000000000000000001 >> i)
+ print(-100000000000000000000000000002 >> i)
+ print(-100000000000000000000000000003 >> i)
+ print(-100000000000000000000000000004 >> i)
diff --git a/tests/basics/list_slice.py b/tests/basics/list_slice.py
new file mode 100644
index 0000000000..a9962132e2
--- /dev/null
+++ b/tests/basics/list_slice.py
@@ -0,0 +1,18 @@
+# test slices; only 2 argument version supported by Micro Python at the moment
+x = list(range(10))
+a = 2
+b = 4
+c = 3
+print(x[:])
+print(x[::])
+#print(x[::c])
+print(x[:b])
+print(x[:b:])
+#print(x[:b:c])
+print(x[a])
+print(x[a:])
+print(x[a::])
+#print(x[a::c])
+print(x[a:b])
+print(x[a:b:])
+#print(x[a:b:c])
diff --git a/tests/run-tests b/tests/run-tests
index 259c18cd22..134ed52617 100755
--- a/tests/run-tests
+++ b/tests/run-tests
@@ -23,7 +23,7 @@ failed_tests = []
tests = []
if not sys.argv[1:]:
- tests = sorted(glob('basics/*.py') + glob('io/*.py'))
+ tests = sorted(glob('basics/*.py') + glob('io/*.py') + glob('misc/*.py'))
else:
tests = sys.argv[1:]