aboutsummaryrefslogtreecommitdiffstats
path: root/test/src/data-tests.el
diff options
context:
space:
mode:
authorPaul Eggert2017-03-06 15:14:32 -0800
committerPaul Eggert2017-03-06 17:26:55 -0800
commit37940b347052418f0589bd52b06e56fffb594ea2 (patch)
tree40d63a87959ed1afa9b0dad7a2cabb5cdbe88121 /test/src/data-tests.el
parent3bd2e9e975ed29daaf03ca7559e4664aade0674f (diff)
downloademacs-37940b347052418f0589bd52b06e56fffb594ea2.tar.gz
emacs-37940b347052418f0589bd52b06e56fffb594ea2.zip
min and max now return one of their arguments
* doc/lispref/numbers.texi (Comparison of Numbers): * etc/NEWS: Document this. * src/data.c (Amax, Amin): Remove constants. All uses removed. (minmax_driver): New function. (Fmax, Fmin): Use it instead of arith_driver. * test/src/data-tests.el (data-tests-max, data-tests-min): New tests.
Diffstat (limited to 'test/src/data-tests.el')
-rw-r--r--test/src/data-tests.el20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/src/data-tests.el b/test/src/data-tests.el
index d38760cdde6..70ffdabe4d4 100644
--- a/test/src/data-tests.el
+++ b/test/src/data-tests.el
@@ -80,6 +80,26 @@
80 ;; Short circuits before getting to bad arg 80 ;; Short circuits before getting to bad arg
81 (should-not (>= 8 9 'foo))) 81 (should-not (>= 8 9 'foo)))
82 82
83(ert-deftest data-tests-max ()
84 (should-error (max))
85 (should (= 1 (max 1)))
86 (should (= 3 (max 3 2)))
87 (should (= 666 (max 666 1 0 0 -2 -3 -3 -3 -4 -8 -8 -9 -999)))
88 (should (= (1+ most-negative-fixnum)
89 (max (float most-negative-fixnum) (1+ most-negative-fixnum))))
90 (should (= 8 (apply #'max '(3 8 3))))
91 (should-error (max 9 8 'foo)))
92
93(ert-deftest data-tests-min ()
94 (should-error (min))
95 (should (= 1 (min 1)))
96 (should (= 2 (min 3 2)))
97 (should (= -999 (min 666 1 0 0 -2 -3 -3 -3 -4 -8 -8 -9 -999)))
98 (should (= most-positive-fixnum
99 (min (+ 1.0 most-positive-fixnum) most-positive-fixnum)))
100 (should (= 3 (apply #'min '(3 8 3))))
101 (should-error (min 9 8 'foo)))
102
83;; Bool vector tests. Compactly represent bool vectors as hex 103;; Bool vector tests. Compactly represent bool vectors as hex
84;; strings. 104;; strings.
85 105