1 ;; Tests for replacement functions for `cl.el'
3 (add-to-list 'load-path
".")
7 (ert-deftest rst-signum
()
9 (should (equal (rst-signum 10) 1))
10 (should (equal (rst-signum -
10) -
1))
11 (should (equal (rst-signum 0) 0))
14 (ert-deftest rst-some
()
16 (should (equal (rst-some nil
) nil
))
17 (should (equal (rst-some '(t)) t
))
18 (should (equal (rst-some '(0)) 0))
19 (should (equal (rst-some '(1)) 1))
20 (should (equal (rst-some '(nil 1)) 1))
21 (should (equal (rst-some '(nil nil
)) nil
))
22 (should (equal (rst-some nil
'not
) nil
))
23 (should (equal (rst-some '(t) 'not
) nil
))
24 (should (equal (rst-some '(0) 'not
) nil
))
25 (should (equal (rst-some '(1 nil
) 'not
) t
))
26 (should (equal (rst-some '(nil 1) 'not
) t
))
27 (should (equal (rst-some '(nil nil
) 'not
) t
))
30 (ert-deftest rst-position
()
31 "Test `rst-position'."
32 (should (equal (rst-position nil nil
) nil
))
33 (should (equal (rst-position t
'(nil)) nil
))
34 (should (equal (rst-position nil
'(t)) nil
))
35 (should (equal (rst-position nil
'(nil)) 0))
36 (should (equal (rst-position t
'(t)) 0))
37 (should (equal (rst-position t
'(nil t
)) 1))
38 (should (equal (rst-position t
'(nil t t nil sym
)) 1))
39 (should (equal (rst-position t
'(nil (t) t nil sym
)) 2))
40 (should (equal (rst-position 'sym
'(nil (t) t nil sym
)) 4))
41 (should (equal (rst-position 'sym
'(nil (t) t nil t
)) nil
))
42 (should (equal (rst-position '(t) '(nil (t) t nil sym
)) 1))
43 (should (equal (rst-position '(1 2 3) '(nil (t) t nil sym
)) nil
))
44 (should (equal (rst-position '(1 2 3) '(nil (t) t
(1 2 3) t
)) 3))
45 (should (equal (rst-position '(1 2 3) '(nil (t) t
(1 2 3) (1 2 3))) 3))
48 (ert-deftest rst-position-if
()
49 "Test `rst-position-if'."
50 (should (equal (rst-position-if 'not
'(t nil nil
)) 1))
52 (should (equal (rst-position-if 'not nil
) nil
))
53 (should (equal (rst-position-if 'identity
'(nil)) nil
))
54 (should (equal (rst-position-if 'not
'(t)) nil
))
55 (should (equal (rst-position-if 'not
'(nil)) 0))
56 (should (equal (rst-position-if 'not
'(nil nil
)) 0))
57 (should (equal (rst-position-if 'not
'(t t nil
)) 2))