(scheme-in-list): Add a fallback to create an error tag.
[cedet.git] / tests / inversion-utest.el
blob330313e691e0df6c2d345a38482774626e56e85a
1 ;;; inversion-utest.el --- Unit tests for Inversion.
2 ;;
3 ;; Copyright (C) 2011 Eric M. Ludlam
4 ;;
5 ;; Author: Eric M. Ludlam <eric@siege-engine.com>
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.
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/.
20 ;;; Commentary:
23 (require 'inversion)
25 (defun inversion-unit-test ()
26 "Test inversion to make sure it can identify different version strings."
27 (interactive)
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"))
42 (if (not (and
43 (inversion-= c1 c1)
44 (inversion-< c1i c1)
45 (inversion-< c2 c3)
46 (inversion-< c3 c4)
47 (inversion-< c4 c5)
48 (inversion-< c5 c6)
49 (inversion-< c2 c4)
50 (inversion-< c2 c5)
51 (inversion-< c2 c6)
52 (inversion-< c3 c5)
53 (inversion-< c3 c6)
54 (inversion-< c7 c6)
55 (inversion-< c4 c7)
56 (inversion-< c2 c7)
57 (inversion-< c8 c6)
58 (inversion-< c8 c7)
59 (inversion-< c4 c8)
60 (inversion-< c2 c8)
61 (inversion-< c9 c10)
62 (inversion-< c10 c11)
63 (inversion-< c11 c12)
64 ;; Negatives
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