forked from pixie-lang/pixie
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-seqables.pxi
More file actions
45 lines (37 loc) · 1.07 KB
/
Copy pathtest-seqables.pxi
File metadata and controls
45 lines (37 loc) · 1.07 KB
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
(ns collections.test-seqables
(require pixie.test :as t))
(t/deftest test-seq
(let [l '(1 2 3)
v [1 2 3]]
(t/assert= (seq l) '(1 2 3))
(t/assert= (seq v) [1 2 3])
(t/assert= (seq nil) nil)
(t/assert= (seq []) nil)))
(t/deftest test-first
(let [l '(1 2 3)
v [1 2 3]]
(t/assert= (first l) 1)
(t/assert= (first v) 1)
(t/assert= (first (seq l)) 1)
(t/assert= (first (seq v)) 1)))
(t/deftest test-next
(let [l '(1 2 3)
v [1 2 3]]
(t/assert= (next l) '(2 3))
(t/assert= (next v) '(2 3))
(t/assert= (next (seq l)) '(2 3))
(t/assert= (next (seq v)) '(2 3))
(t/assert= (next (next (next l))) nil)
(t/assert= (next (next (next v))) nil)))
(t/deftest test-equals
(let [l '(1 2 3)]
(t/assert= l l)
(t/assert= l '(1 2 3))
(t/assert= l [1 2 3])
(t/assert= (= nil '()) false)
(t/assert= (= '() nil) false)
(t/assert= (= l '(1 2 3 4)) false)
(t/assert= (= l [1 2 3 4]) false)))
(t/deftest test-conj
(t/assert= '(3 1 2) (conj '(1 2) 3))
(t/assert= '(5 4 3 1 2) (conj '(1 2) 3 4 5)))