From 34f498cacb251c43eaa4ecde92912c20fb38da0a Mon Sep 17 00:00:00 2001 From: Clemens Geibel Date: Fri, 5 Aug 2022 08:50:25 +0200 Subject: [PATCH] Added pred int-gt-n? --- src/main/cljc/dda/c4k_common/predicate.cljc | 5 +++++ src/test/cljc/dda/c4k_common/predicate_test.cljc | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/cljc/dda/c4k_common/predicate.cljc b/src/main/cljc/dda/c4k_common/predicate.cljc index f71ef6e..c76e9b5 100644 --- a/src/main/cljc/dda/c4k_common/predicate.cljc +++ b/src/main/cljc/dda/c4k_common/predicate.cljc @@ -50,3 +50,8 @@ (every? true? (map #(string? %) input)))) +(defn int-gt-n? + [n input] + (and (int? input) + (> input n))) + diff --git a/src/test/cljc/dda/c4k_common/predicate_test.cljc b/src/test/cljc/dda/c4k_common/predicate_test.cljc index b3ca535..c91bb19 100644 --- a/src/test/cljc/dda/c4k_common/predicate_test.cljc +++ b/src/test/cljc/dda/c4k_common/predicate_test.cljc @@ -54,4 +54,12 @@ (deftest test-string-sequence? (is (true? (cut/string-sequence? ["hallo" "welt" "!"]))) (is (false? (cut/string-sequence? ["hallo" 1 "welt" "!"]))) - (is (false? (cut/string-sequence? "hallo welt!")))) \ No newline at end of file + (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))))