1 ;;; inversion-utest.el --- Unit tests for Inversion.
3 ;; Copyright (C) 2011 Eric M. Ludlam
5 ;; Author: Eric M. Ludlam <eric@siege-engine.com>
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.
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.
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/.
25 (defun inversion-unit-test ()
26 "Test inversion to make sure it can identify different version strings."
28 (let ((c1 (inversion-package-version 'inversion
))
29 (c1i (inversion-package-incompatibility-version 'inversion
))
30 (c2 (inversion-decode-version "1.3alpha2"))
31 (c3 (inversion-decode-version "1.3beta4"))
32 (c4 (inversion-decode-version "1.3 beta5"))
33 (c5 (inversion-decode-version "1.3.4"))
34 (c6 (inversion-decode-version "2.3alpha"))
35 (c7 (inversion-decode-version "1.3"))
36 (c8 (inversion-decode-version "1.3pre1"))
37 (c9 (inversion-decode-version "2.4 (patch 2)"))
38 (c10 (inversion-decode-version "2.4 (patch 3)"))
39 (c11 (inversion-decode-version "2.4.2.1"))
40 (c12 (inversion-decode-version "2.4.2.2"))
65 (not (inversion-< c3 c2
))
66 (not (inversion-< c4 c3
))
67 (not (inversion-< c5 c4
))
68 (not (inversion-< c6 c5
))
69 (not (inversion-< c7 c2
))
70 (not (inversion-< c7 c8
))
71 (not (inversion-< c12 c11
))
72 ;; Test the tester on inversion
73 (not (inversion-test 'inversion inversion-version
))
74 ;; Test that we throw an error
75 (inversion-test 'inversion
"0.0.0")
76 (inversion-test 'inversion
"1000.0")
78 (error "Inversion tests failed")
79 (message "Inversion tests passed."))))
82 (provide 'inversion-utest
)
84 ;;; inversion.el ends here