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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
| | ;;; test-org-plot.el --- Tests for org-plot.el
;; Copyright (C) 2020 Mario Frasca
;; Author: Mario Frasca <mario at anche dot no>
;; Released under the GNU General Public License version 3
;; see: http://www.gnu.org/licenses/gpl-3.0.html
;;;; Comments
\f
;;; Code:
(require 'org-plot)
(ert-deftest test-org-plot/zip ()
"Test `org-plot/zip' specifications."
;; zipping two equal length lists
(should
(equal '((1 . "a") (2 . "b") (3 . "c"))
(org-plot/zip '(1 2 3) '("a" "b" "c"))))
;; if second is shorter, fill in with "lines"
(should
(equal '((1 . "a") (2 . "b") (3 . "lines"))
(org-plot/zip '(1 2 3) '("a" "b"))))
;; if first is shorter, stop there
(should
(equal '((1 . "a") (2 . "b"))
(org-plot/zip '(1 2) '("a" "b" "c")))))
(ert-deftest test-org-plot/zip-deps-with ()
"Test `org-plot/zip-deps-with' specifications."
;; no deps, no with. defaults to all except ind, and "lines"
(should
(equal (org-plot/zip-deps-with 3 1 nil nil)
'((2 . "lines") (3 . "lines"))))
;; no deps, single with. defaults to all except ind, and repeated with
(should
(equal (org-plot/zip-deps-with 3 1 nil "hist")
'((2 . "hist") (3 . "hist"))))
;; no deps, explicit with
(should
(equal (org-plot/zip-deps-with 3 1 nil '("points" "hist"))
'((2 . "points") (3 . "hist"))))
;; explicit with, same length as deps
(should
(equal (org-plot/zip-deps-with 5 1 '(2 4) '("points" "hist"))
'((2 . "points") (4 . "hist"))))
;; same as above, but different order
(should
(equal (org-plot/zip-deps-with 5 1 '(4 2) '("points" "hist"))
'((4 . "points") (2 . "hist"))))
;; fills in with "lines"
(should
(equal (org-plot/zip-deps-with 5 1 '(4 2 3) '("points"))
'((4 . "points") (2 . "lines") (3 . "lines")))))
(provide 'test-org-plot)
;;; test-org-plot.el end here
|