diff options
author | Damien George <damien.p.george@gmail.com> | 2015-03-02 17:21:10 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-03-02 17:21:10 +0000 |
commit | 24ffb8e8762c2f14fe109edbc42401285eb8247b (patch) | |
tree | 45ed2f0f56dd1ef4677b567135ecdd642b38ae65 /tests/basics | |
parent | db1e10d5ea1d8d7233a615bec6ada77c9ca6ac5f (diff) | |
download | micropython-24ffb8e8762c2f14fe109edbc42401285eb8247b.tar.gz micropython-24ffb8e8762c2f14fe109edbc42401285eb8247b.zip |
tests: Add tests for builtins: all, any, sum, abs.
Diffstat (limited to 'tests/basics')
-rw-r--r-- | tests/basics/builtin_allany.py | 20 | ||||
-rw-r--r-- | tests/basics/builtin_sum.py | 14 |
2 files changed, 34 insertions, 0 deletions
diff --git a/tests/basics/builtin_allany.py b/tests/basics/builtin_allany.py new file mode 100644 index 0000000000..7eb8bc6afe --- /dev/null +++ b/tests/basics/builtin_allany.py @@ -0,0 +1,20 @@ +# test builtin "all" and "any" + +tests = ( + (), + [], + [False], + [True], + [False, True], + [True, False], + [False, False], + [True, True], + (False for i in range(10)), + (True for i in range(10)), +) + +for test in tests: + print(all(test)) + +for test in tests: + print(any(test)) diff --git a/tests/basics/builtin_sum.py b/tests/basics/builtin_sum.py new file mode 100644 index 0000000000..1512a333f6 --- /dev/null +++ b/tests/basics/builtin_sum.py @@ -0,0 +1,14 @@ +# test builtin "sum" + +tests = ( + (), + [], + [0], + [1], + [0, 1, 2], + (i for i in range(10)), +) + +for test in tests: + print(sum(test)) + print(sum(test, -2)) |