summaryrefslogtreecommitdiffstatshomepage
path: root/tests/float/builtin-float-minmax.py
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-05-01 23:42:18 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-05-01 23:42:18 +0300
commit28dfbc2ba2ef41a7810e4e39290031eb2207a0a9 (patch)
treedfe78c6aa53b8705cc6209fc1c358709327fe7cb /tests/float/builtin-float-minmax.py
parent7917b731f66bde41341b3898c19616ab2d1d0bb1 (diff)
parent37067666ee24b018f260a011375f65aa69b49041 (diff)
downloadmicropython-28dfbc2ba2ef41a7810e4e39290031eb2207a0a9.tar.gz
micropython-28dfbc2ba2ef41a7810e4e39290031eb2207a0a9.zip
Merge pull request #544 from lurch/fix-minmax
Fix the builtin min() and max() functions (and add tests).
Diffstat (limited to 'tests/float/builtin-float-minmax.py')
-rw-r--r--tests/float/builtin-float-minmax.py26
1 files changed, 26 insertions, 0 deletions
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]))
+