-
Notifications
You must be signed in to change notification settings - Fork 34
/
tests.el
37 lines (32 loc) · 1.48 KB
/
tests.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
(require 'ert)
(require 'window-numbering)
(ert-deftest window-numbering-assign ()
(let ((window-numbering-windows (make-vector 10 nil))
(window-numbering-numbers (make-hash-table :size 10))
(window-numbering-left '(1 2 3)))
(should (not (null (window-numbering-assign 'xx 7))))
(should (null (window-numbering-assign 'yy 7)))
(should (not (null (window-numbering-assign 'zz 8))))
(should (equal 8 (gethash 'zz window-numbering-numbers)))
(should (equal 7 (gethash 'xx window-numbering-numbers)))
(should (equal 'zz (aref window-numbering-windows 8)))
(should (equal 'xx (aref window-numbering-windows 7)))
))
(ert-deftest window-numbering-assign-auto ()
(let ((window-numbering-windows (make-vector 10 nil))
(window-numbering-numbers (make-hash-table :size 10))
(window-numbering-left '(1 2 3 4)))
(should (eq 1 (window-numbering-assign 'xx)))
(should (not (null (window-numbering-assign 'yy 3))))
(should (eq 2 (window-numbering-assign 'zz)))
(should (eq 4 (window-numbering-assign 'aa)))
))
(ert-deftest window-numbering-calculate-left ()
(should (equal '(6) (window-numbering-calculate-left
[t t t t t nil t t t t])))
(should (equal '(1 2 3) (window-numbering-calculate-left
[nil nil nil t t t t t t t])))
(should (equal '(1 2 3 4 5 6 7 8 9 0)
(window-numbering-calculate-left
[nil nil nil nil nil nil nil nil nil nil])))
)