Added pred int-gt-n?

This commit is contained in:
Clemens Geibel 2022-08-05 08:50:25 +02:00
parent 54d9836d49
commit 34f498cacb
2 changed files with 14 additions and 1 deletions

View file

@ -50,3 +50,8 @@
(every? true? (every? true?
(map #(string? %) input)))) (map #(string? %) input))))
(defn int-gt-n?
[n input]
(and (int? input)
(> input n)))

View file

@ -55,3 +55,11 @@
(is (true? (cut/string-sequence? ["hallo" "welt" "!"]))) (is (true? (cut/string-sequence? ["hallo" "welt" "!"])))
(is (false? (cut/string-sequence? ["hallo" 1 "welt" "!"]))) (is (false? (cut/string-sequence? ["hallo" 1 "welt" "!"])))
(is (false? (cut/string-sequence? "hallo welt!")))) (is (false? (cut/string-sequence? "hallo welt!"))))
(deftest test-int-gt-n?
(is (not (cut/int-gt-n? 5 0)))
(is (not (cut/int-gt-n? 5 "s")))
(is (not (cut/int-gt-n? 0 0)))
(is (cut/int-gt-n? 5 6))
(is ((partial cut/int-gt-n? 5) 10))
(is (not ((partial cut/int-gt-n? 5) 4))))