aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Oteiza2017-09-05 12:03:10 -0400
committerMark Oteiza2017-09-05 12:03:10 -0400
commit485e25312d56b6bdf59da6ade1ec08f8caaa240a (patch)
tree700c918c945e7fd2f48f5878bf1f0f296a60592e
parent9f64d59ae6d87f38276fe05254094113a171fb0e (diff)
downloademacs-485e25312d56b6bdf59da6ade1ec08f8caaa240a.tar.gz
emacs-485e25312d56b6bdf59da6ade1ec08f8caaa240a.zip
Move soundex.el test to a proper test
* test/lisp/soundex-tests.el: New file. * lisp/soundex.el: Use lexical-binding. Remove commented test.
-rw-r--r--lisp/soundex.el13
-rw-r--r--test/lisp/soundex-tests.el43
2 files changed, 45 insertions, 11 deletions
diff --git a/lisp/soundex.el b/lisp/soundex.el
index e0d83303e34..a83bab8a910 100644
--- a/lisp/soundex.el
+++ b/lisp/soundex.el
@@ -1,4 +1,4 @@
1;;; soundex.el --- implement Soundex algorithm 1;;; soundex.el --- implement Soundex algorithm -*- lexical-binding: t -*-
2 2
3;; Copyright (C) 1993, 2001-2017 Free Software Foundation, Inc. 3;; Copyright (C) 1993, 2001-2017 Free Software Foundation, Inc.
4 4
@@ -29,7 +29,7 @@
29 29
30;;; Code: 30;;; Code:
31 31
32(defvar soundex-alist 32(defconst soundex-alist
33 '((?B . "1") (?F . "1") (?P . "1") (?V . "1") 33 '((?B . "1") (?F . "1") (?P . "1") (?V . "1")
34 (?C . "2") (?G . "2") (?J . "2") (?K . "2") (?Q . "2") (?S . "2") 34 (?C . "2") (?G . "2") (?J . "2") (?K . "2") (?Q . "2") (?S . "2")
35 (?X . "2") (?Z . "2") (?D . "3") (?T . "3") (?L . "4") (?M . "5") 35 (?X . "2") (?Z . "2") (?D . "3") (?T . "3") (?L . "4") (?M . "5")
@@ -60,15 +60,6 @@ and Searching\", Addison-Wesley (1973), pp. 391-392."
60 (substring (concat key "000") 0 4) 60 (substring (concat key "000") 0 4)
61 key))) 61 key)))
62 62
63;(defvar soundex-test
64; '("Euler" "Gauss" "Hilbert" "Knuth" "Lloyd" "Lukasiewicz"
65; "Ellery" "Ghosh" "Heilbronn" "Kant" "Ladd" "Lissajous")
66; "\n Knuth's names to demonstrate the Soundex algorithm.")
67;
68;(mapcar 'soundex soundex-test)
69;("E460" "G200" "H416" "K530" "L300" "L222"
70; "E460" "G200" "H416" "K530" "L300" "L222")
71
72(provide 'soundex) 63(provide 'soundex)
73 64
74;;; soundex.el ends here 65;;; soundex.el ends here
diff --git a/test/lisp/soundex-tests.el b/test/lisp/soundex-tests.el
new file mode 100644
index 00000000000..d1bc99d8113
--- /dev/null
+++ b/test/lisp/soundex-tests.el
@@ -0,0 +1,43 @@
1;;; soundex-tests.el --- tests for soundex.el -*- lexical-binding: t -*-
2
3;; Copyright (C) 2017 Free Software Foundation, Inc.
4
5;; Maintainer: emacs-devel@gnu.org
6
7;; This file is part of GNU Emacs.
8
9;; GNU Emacs is free software: you can redistribute it and/or modify
10;; it under the terms of the GNU General Public License as published by
11;; the Free Software Foundation, either version 3 of the License, or
12;; (at your option) any later version.
13
14;; GNU Emacs is distributed in the hope that it will be useful,
15;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;; GNU General Public License for more details.
18
19;; You should have received a copy of the GNU General Public License
20;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
21
22;;; Commentary:
23
24;; Test `soundex-test-names' originally adapted from code in
25;; soundex.el by Christian Plaunt <chris@bliss.berkeley.edu>
26
27;;; Code:
28
29(require 'ert)
30(require 'soundex)
31
32(defconst soundex-test-name-list
33 '("Euler" "Gauss" "Hilbert" "Knuth" "Lloyd" "Lukasiewicz"
34 "Ellery" "Ghosh" "Heilbronn" "Kant" "Ladd" "Lissajous")
35 "Knuth's names to demonstrate the Soundex algorithm.")
36
37(ert-deftest soundex-test-names ()
38 (should
39 (equal (mapcar #'soundex soundex-test-name-list)
40 '("E460" "G200" "H416" "K530" "L300" "L222"
41 "E460" "G200" "H416" "K530" "L300" "L222"))))
42
43;;; soundex-tests.el ends here