aboutsummaryrefslogtreecommitdiffstats
path: root/test/src/data-tests.el
diff options
context:
space:
mode:
authorPaul Eggert2017-03-02 09:11:11 -0800
committerPaul Eggert2017-03-02 09:12:49 -0800
commit4e2622bf0d63c40f447d44e6401ea054ef55b261 (patch)
tree10f66df3cd59695ffe15546aaa961987a3fe2ba1 /test/src/data-tests.el
parentd546be31a9320d94769cb322f008f49d08d852a8 (diff)
downloademacs-4e2622bf0d63c40f447d44e6401ea054ef55b261.tar.gz
emacs-4e2622bf0d63c40f447d44e6401ea054ef55b261.zip
Fix rounding errors in <, =, etc.
* etc/NEWS: Document this. * src/bytecode.c (exec_byte_code): * src/data.c (arithcompare): Do not lose information when comparing floats to integers. * test/src/data-tests.el (data-tests-=, data-tests-<) (data-tests->, data-tests-<=, data-tests->=): Test this.
Diffstat (limited to 'test/src/data-tests.el')
-rw-r--r--test/src/data-tests.el6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/src/data-tests.el b/test/src/data-tests.el
index 2e4a6aa2e8a..d38760cdde6 100644
--- a/test/src/data-tests.el
+++ b/test/src/data-tests.el
@@ -29,6 +29,8 @@
29 (should (= 1)) 29 (should (= 1))
30 (should (= 2 2)) 30 (should (= 2 2))
31 (should (= 9 9 9 9 9 9 9 9 9)) 31 (should (= 9 9 9 9 9 9 9 9 9))
32 (should (= most-negative-fixnum (float most-negative-fixnum)))
33 (should-not (= most-positive-fixnum (+ 1.0 most-positive-fixnum)))
32 (should-not (apply #'= '(3 8 3))) 34 (should-not (apply #'= '(3 8 3)))
33 (should-error (= 9 9 'foo)) 35 (should-error (= 9 9 'foo))
34 ;; Short circuits before getting to bad arg 36 ;; Short circuits before getting to bad arg
@@ -39,6 +41,7 @@
39 (should (< 1)) 41 (should (< 1))
40 (should (< 2 3)) 42 (should (< 2 3))
41 (should (< -6 -1 0 2 3 4 8 9 999)) 43 (should (< -6 -1 0 2 3 4 8 9 999))
44 (should (< 0.5 most-positive-fixnum (+ 1.0 most-positive-fixnum)))
42 (should-not (apply #'< '(3 8 3))) 45 (should-not (apply #'< '(3 8 3)))
43 (should-error (< 9 10 'foo)) 46 (should-error (< 9 10 'foo))
44 ;; Short circuits before getting to bad arg 47 ;; Short circuits before getting to bad arg
@@ -49,6 +52,7 @@
49 (should (> 1)) 52 (should (> 1))
50 (should (> 3 2)) 53 (should (> 3 2))
51 (should (> 6 1 0 -2 -3 -4 -8 -9 -999)) 54 (should (> 6 1 0 -2 -3 -4 -8 -9 -999))
55 (should (> (+ 1.0 most-positive-fixnum) most-positive-fixnum 0.5))
52 (should-not (apply #'> '(3 8 3))) 56 (should-not (apply #'> '(3 8 3)))
53 (should-error (> 9 8 'foo)) 57 (should-error (> 9 8 'foo))
54 ;; Short circuits before getting to bad arg 58 ;; Short circuits before getting to bad arg
@@ -59,6 +63,7 @@
59 (should (<= 1)) 63 (should (<= 1))
60 (should (<= 2 3)) 64 (should (<= 2 3))
61 (should (<= -6 -1 -1 0 0 0 2 3 4 8 999)) 65 (should (<= -6 -1 -1 0 0 0 2 3 4 8 999))
66 (should (<= 0.5 most-positive-fixnum (+ 1.0 most-positive-fixnum)))
62 (should-not (apply #'<= '(3 8 3 3))) 67 (should-not (apply #'<= '(3 8 3 3)))
63 (should-error (<= 9 10 'foo)) 68 (should-error (<= 9 10 'foo))
64 ;; Short circuits before getting to bad arg 69 ;; Short circuits before getting to bad arg
@@ -69,6 +74,7 @@
69 (should (>= 1)) 74 (should (>= 1))
70 (should (>= 3 2)) 75 (should (>= 3 2))
71 (should (>= 666 1 0 0 -2 -3 -3 -3 -4 -8 -8 -9 -999)) 76 (should (>= 666 1 0 0 -2 -3 -3 -3 -4 -8 -8 -9 -999))
77 (should (>= (+ 1.0 most-positive-fixnum) most-positive-fixnum))
72 (should-not (apply #'>= '(3 8 3))) 78 (should-not (apply #'>= '(3 8 3)))
73 (should-error (>= 9 8 'foo)) 79 (should-error (>= 9 8 'foo))
74 ;; Short circuits before getting to bad arg 80 ;; Short circuits before getting to bad arg