Skip to content

Commit 1c55eea

Browse files
committed
Test uuid?
This closes #556.
1 parent 9b38590 commit 1c55eea

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
(ns clojure.core-test.uuid-qmark
2+
(:require [clojure.test :refer [are deftest testing]]
3+
[clojure.core-test.portability #?(:cljs :refer-macros :default :refer) [when-var-exists]]))
4+
5+
(when-var-exists uuid?
6+
7+
(deftest test-uuid?
8+
(testing "uuids"
9+
(are [x] (uuid? x)
10+
#uuid "0-0-0-0-0"
11+
#uuid "f81d4fae-7dec-11d0-a765-00a0c91e6bf6"
12+
(parse-uuid "f81d4fae-7dec-11d0-a765-00a0c91e6bf6")
13+
(random-uuid)))
14+
15+
(when-var-exists read-string
16+
(testing "more uuids"
17+
(read-string "#uuid \"f81d4fae-7dec-11d0-a765-00a0c91e6bf6\"")))
18+
19+
(testing "not uuids"
20+
(are [x] (not (uuid? x))
21+
nil
22+
true
23+
false
24+
0
25+
1
26+
-1
27+
0.0
28+
1.0
29+
-1.0
30+
##NaN
31+
##Inf
32+
"f81d4fae-7dec-11d0-a765-00a0c91e6bf6"
33+
{:a :map}
34+
#{:a-set}
35+
[:a :vector]
36+
'(:a :list)
37+
:a-keyword
38+
'a-symbol
39+
(range)
40+
\a))))

0 commit comments

Comments
 (0)