aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorBarry O'Reilly2013-09-11 01:03:23 -0400
committerBarry O'Reilly2013-09-11 01:03:23 -0400
commitebb99847285bca912e04f79dd3d9dcc84769ccf6 (patch)
treea3be4b8a0d987e4c6a54d284737a1383de933000 /test
parent1b3b87dfe0fae8e5266319531c0a874c8b4313b1 (diff)
downloademacs-ebb99847285bca912e04f79dd3d9dcc84769ccf6.tar.gz
emacs-ebb99847285bca912e04f79dd3d9dcc84769ccf6.zip
Change comparison functions =, <, >, <=, >= to take many arguments.
* src/data.c: Change comparison functions' interface and implementation * src/lisp.h: Make arithcompare available for efficient two arg comparisons * src/bytecode.c: Use arithcompare * src/fileio.c: Use new interface * test/automated/data-tests.el: New tests for comparison functions * etc/NEWS
Diffstat (limited to 'test')
-rw-r--r--test/automated/data-tests.el75
1 files changed, 75 insertions, 0 deletions
diff --git a/test/automated/data-tests.el b/test/automated/data-tests.el
new file mode 100644
index 00000000000..2298fa3fe71
--- /dev/null
+++ b/test/automated/data-tests.el
@@ -0,0 +1,75 @@
1;;; data-tests.el --- tests for src/data.c
2
3;; Copyright (C) 2013 Free Software Foundation, Inc.
4
5;; This file is part of GNU Emacs.
6
7;; This program is free software: you can redistribute it and/or
8;; modify it under the terms of the GNU General Public License as
9;; published by the Free Software Foundation, either version 3 of the
10;; License, or (at your option) any later version.
11;;
12;; This program is distributed in the hope that it will be useful, but
13;; WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15;; General Public License for more details.
16;;
17;; You should have received a copy of the GNU General Public License
18;; along with this program. If not, see `http://www.gnu.org/licenses/'.
19
20;;; Commentary:
21
22;;; Code:
23
24(ert-deftest data-tests-= ()
25 (should-error (=))
26 (should (= 1))
27 (should (= 2 2))
28 (should (= 9 9 9 9 9 9 9 9 9))
29 (should-not (apply #'= '(3 8 3)))
30 (should-error (= 9 9 'foo))
31 ;; Short circuits before getting to bad arg
32 (should-not (= 9 8 'foo)))
33
34(ert-deftest data-tests-< ()
35 (should-error (<))
36 (should (< 1))
37 (should (< 2 3))
38 (should (< -6 -1 0 2 3 4 8 9 999))
39 (should-not (apply #'< '(3 8 3)))
40 (should-error (< 9 10 'foo))
41 ;; Short circuits before getting to bad arg
42 (should-not (< 9 8 'foo)))
43
44(ert-deftest data-tests-> ()
45 (should-error (>))
46 (should (> 1))
47 (should (> 3 2))
48 (should (> 6 1 0 -2 -3 -4 -8 -9 -999))
49 (should-not (apply #'> '(3 8 3)))
50 (should-error (> 9 8 'foo))
51 ;; Short circuits before getting to bad arg
52 (should-not (> 8 9 'foo)))
53
54(ert-deftest data-tests-<= ()
55 (should-error (<=))
56 (should (<= 1))
57 (should (<= 2 3))
58 (should (<= -6 -1 -1 0 0 0 2 3 4 8 999))
59 (should-not (apply #'<= '(3 8 3 3)))
60 (should-error (<= 9 10 'foo))
61 ;; Short circuits before getting to bad arg
62 (should-not (<= 9 8 'foo)))
63
64(ert-deftest data-tests->= ()
65 (should-error (>=))
66 (should (>= 1))
67 (should (>= 3 2))
68 (should (>= 666 1 0 0 -2 -3 -3 -3 -4 -8 -8 -9 -999))
69 (should-not (apply #'>= '(3 8 3)))
70 (should-error (>= 9 8 'foo))
71 ;; Short circuits before getting to bad arg
72 (should-not (>= 8 9 'foo)))
73
74;;; data-tests.el ends here
75