diff options
author | Andrew Scheller <github@loowis.durge.org> | 2014-05-01 21:21:43 +0100 |
---|---|---|
committer | Andrew Scheller <github@loowis.durge.org> | 2014-05-01 21:21:43 +0100 |
commit | 37067666ee24b018f260a011375f65aa69b49041 (patch) | |
tree | 9b062622de8f0f35a6d4b3c909ad720d2668d847 /tests | |
parent | 1f85d6255d6929edbcfc087e4e07c2fde39c3632 (diff) | |
download | micropython-37067666ee24b018f260a011375f65aa69b49041.tar.gz micropython-37067666ee24b018f260a011375f65aa69b49041.zip |
Fix the builtin min() and max() functions (and add tests).
Fixes #539
Diffstat (limited to 'tests')
-rw-r--r-- | tests/basics/builtin-minmax.py | 15 | ||||
-rw-r--r-- | tests/float/builtin-float-minmax.py | 26 |
2 files changed, 41 insertions, 0 deletions
diff --git a/tests/basics/builtin-minmax.py b/tests/basics/builtin-minmax.py new file mode 100644 index 0000000000..8ee4bbca7d --- /dev/null +++ b/tests/basics/builtin-minmax.py @@ -0,0 +1,15 @@ +# test builtin min and max functions + +print(min(0,1)) +print(min(1,0)) +print(min(0,-1)) +print(min(-1,0)) + +print(max(0,1)) +print(max(1,0)) +print(max(0,-1)) +print(max(-1,0)) + +print(min([1,2,4,0,-1,2])) +print(max([1,2,4,0,-1,2])) + diff --git a/tests/float/builtin-float-minmax.py b/tests/float/builtin-float-minmax.py new file mode 100644 index 0000000000..ce45a768a5 --- /dev/null +++ b/tests/float/builtin-float-minmax.py @@ -0,0 +1,26 @@ +# test builtin min and max functions with float args + +print(min(0,1.0)) +print(min(1.0,0)) +print(min(0,-1.0)) +print(min(-1.0,0)) + +print(max(0,1.0)) +print(max(1.0,0)) +print(max(0,-1.0)) +print(max(-1.0,0)) + +print(min(1.5,-1.5)) +print(min(-1.5,1.5)) + +print(max(1.5,-1.5)) +print(max(-1.5,1.5)) + +print(min([1,2.9,4,0,-1,2])) +print(max([1,2.9,4,0,-1,2])) + +print(min([1,2.9,4,6.5,-1,2])) +print(max([1,2.9,4,6.5,-1,2])) +print(min([1,2.9,4,-6.5,-1,2])) +print(max([1,2.9,4,-6.5,-1,2])) + |