diff options
| author | Glenn Morris | 2018-08-14 09:06:43 -0700 |
|---|---|---|
| committer | Glenn Morris | 2018-08-14 09:06:43 -0700 |
| commit | 2eabf4c13c16b58bddfa232adada667f1ebf9135 (patch) | |
| tree | f51622053b18fbbb72ced29013870dcafee1d6b4 /test/src/data-tests.el | |
| parent | 2e08ca25fd2cdc00dd1fa1067dd351228f58049e (diff) | |
| parent | 34e75c144efe54dd6063fbb65d5a40176952422c (diff) | |
| download | emacs-2eabf4c13c16b58bddfa232adada667f1ebf9135.tar.gz emacs-2eabf4c13c16b58bddfa232adada667f1ebf9135.zip | |
Merge from origin/emacs-26
34e75c1 Add comment about floating point test
e73e683 Ibuffer: Add toggle ibuffer-do-toggle-lock
12f7116 Ibuffer: Detect correctly the buffers running a process
Diffstat (limited to 'test/src/data-tests.el')
| -rw-r--r-- | test/src/data-tests.el | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/test/src/data-tests.el b/test/src/data-tests.el index ee6a3eb9222..82649022576 100644 --- a/test/src/data-tests.el +++ b/test/src/data-tests.el | |||
| @@ -23,13 +23,21 @@ | |||
| 23 | 23 | ||
| 24 | (require 'cl-lib) | 24 | (require 'cl-lib) |
| 25 | 25 | ||
| 26 | (defconst data-tests--float-greater-than-fixnums (+ 1.0 most-positive-fixnum) | ||
| 27 | "A floating-point value that is greater than all fixnums. | ||
| 28 | It is also as small as conveniently possible, to make the tests sharper. | ||
| 29 | Adding 1.0 to most-positive-fixnum should suffice on all | ||
| 30 | practical Emacs platforms, since the result is a power of 2 and | ||
| 31 | this is exactly representable and is greater than | ||
| 32 | most-positive-fixnum, which is just less than a power of 2.") | ||
| 33 | |||
| 26 | (ert-deftest data-tests-= () | 34 | (ert-deftest data-tests-= () |
| 27 | (should-error (=)) | 35 | (should-error (=)) |
| 28 | (should (= 1)) | 36 | (should (= 1)) |
| 29 | (should (= 2 2)) | 37 | (should (= 2 2)) |
| 30 | (should (= 9 9 9 9 9 9 9 9 9)) | 38 | (should (= 9 9 9 9 9 9 9 9 9)) |
| 31 | (should (= most-negative-fixnum (float most-negative-fixnum))) | 39 | (should (= most-negative-fixnum (float most-negative-fixnum))) |
| 32 | (should-not (= most-positive-fixnum (+ 1.0 most-positive-fixnum))) | 40 | (should-not (= most-positive-fixnum data-tests--float-greater-than-fixnums)) |
| 33 | (should-not (apply #'= '(3 8 3))) | 41 | (should-not (apply #'= '(3 8 3))) |
| 34 | (should-error (= 9 9 'foo)) | 42 | (should-error (= 9 9 'foo)) |
| 35 | ;; Short circuits before getting to bad arg | 43 | ;; Short circuits before getting to bad arg |
| @@ -40,7 +48,7 @@ | |||
| 40 | (should (< 1)) | 48 | (should (< 1)) |
| 41 | (should (< 2 3)) | 49 | (should (< 2 3)) |
| 42 | (should (< -6 -1 0 2 3 4 8 9 999)) | 50 | (should (< -6 -1 0 2 3 4 8 9 999)) |
| 43 | (should (< 0.5 most-positive-fixnum (+ 1.0 most-positive-fixnum))) | 51 | (should (< 0.5 most-positive-fixnum data-tests--float-greater-than-fixnums)) |
| 44 | (should-not (apply #'< '(3 8 3))) | 52 | (should-not (apply #'< '(3 8 3))) |
| 45 | (should-error (< 9 10 'foo)) | 53 | (should-error (< 9 10 'foo)) |
| 46 | ;; Short circuits before getting to bad arg | 54 | ;; Short circuits before getting to bad arg |
| @@ -51,7 +59,7 @@ | |||
| 51 | (should (> 1)) | 59 | (should (> 1)) |
| 52 | (should (> 3 2)) | 60 | (should (> 3 2)) |
| 53 | (should (> 6 1 0 -2 -3 -4 -8 -9 -999)) | 61 | (should (> 6 1 0 -2 -3 -4 -8 -9 -999)) |
| 54 | (should (> (+ 1.0 most-positive-fixnum) most-positive-fixnum 0.5)) | 62 | (should (> data-tests--float-greater-than-fixnums most-positive-fixnum 0.5)) |
| 55 | (should-not (apply #'> '(3 8 3))) | 63 | (should-not (apply #'> '(3 8 3))) |
| 56 | (should-error (> 9 8 'foo)) | 64 | (should-error (> 9 8 'foo)) |
| 57 | ;; Short circuits before getting to bad arg | 65 | ;; Short circuits before getting to bad arg |
| @@ -62,7 +70,7 @@ | |||
| 62 | (should (<= 1)) | 70 | (should (<= 1)) |
| 63 | (should (<= 2 3)) | 71 | (should (<= 2 3)) |
| 64 | (should (<= -6 -1 -1 0 0 0 2 3 4 8 999)) | 72 | (should (<= -6 -1 -1 0 0 0 2 3 4 8 999)) |
| 65 | (should (<= 0.5 most-positive-fixnum (+ 1.0 most-positive-fixnum))) | 73 | (should (<= 0.5 most-positive-fixnum data-tests--float-greater-than-fixnums)) |
| 66 | (should-not (apply #'<= '(3 8 3 3))) | 74 | (should-not (apply #'<= '(3 8 3 3))) |
| 67 | (should-error (<= 9 10 'foo)) | 75 | (should-error (<= 9 10 'foo)) |
| 68 | ;; Short circuits before getting to bad arg | 76 | ;; Short circuits before getting to bad arg |
| @@ -73,7 +81,7 @@ | |||
| 73 | (should (>= 1)) | 81 | (should (>= 1)) |
| 74 | (should (>= 3 2)) | 82 | (should (>= 3 2)) |
| 75 | (should (>= 666 1 0 0 -2 -3 -3 -3 -4 -8 -8 -9 -999)) | 83 | (should (>= 666 1 0 0 -2 -3 -3 -3 -4 -8 -8 -9 -999)) |
| 76 | (should (>= (+ 1.0 most-positive-fixnum) most-positive-fixnum)) | 84 | (should (>= data-tests--float-greater-than-fixnums most-positive-fixnum)) |
| 77 | (should-not (apply #'>= '(3 8 3))) | 85 | (should-not (apply #'>= '(3 8 3))) |
| 78 | (should-error (>= 9 8 'foo)) | 86 | (should-error (>= 9 8 'foo)) |
| 79 | ;; Short circuits before getting to bad arg | 87 | ;; Short circuits before getting to bad arg |
| @@ -97,7 +105,7 @@ | |||
| 97 | (should (= 2 (min 3 2))) | 105 | (should (= 2 (min 3 2))) |
| 98 | (should (= -999 (min 666 1 0 0 -2 -3 -3 -3 -4 -8 -8 -9 -999))) | 106 | (should (= -999 (min 666 1 0 0 -2 -3 -3 -3 -4 -8 -8 -9 -999))) |
| 99 | (should (= most-positive-fixnum | 107 | (should (= most-positive-fixnum |
| 100 | (min (+ 1.0 most-positive-fixnum) most-positive-fixnum))) | 108 | (min data-tests--float-greater-than-fixnums most-positive-fixnum))) |
| 101 | (should (= 3 (apply #'min '(3 8 3)))) | 109 | (should (= 3 (apply #'min '(3 8 3)))) |
| 102 | (should-error (min 9 8 'foo)) | 110 | (should-error (min 9 8 'foo)) |
| 103 | (should-error (min (make-marker))) | 111 | (should-error (min (make-marker))) |