From dd555991d3cf575c06c665f6dbf4ad03182dd38f Mon Sep 17 00:00:00 2001 From: Artem Yankov Date: Thu, 27 Sep 2012 21:13:44 -0700 Subject: [PATCH] add tests for strings --- .lein-failures | 1 + test/memobot/test/strings.clj | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 .lein-failures create mode 100644 test/memobot/test/strings.clj diff --git a/.lein-failures b/.lein-failures new file mode 100644 index 0000000..65dcdc3 --- /dev/null +++ b/.lein-failures @@ -0,0 +1 @@ +#{} \ No newline at end of file diff --git a/test/memobot/test/strings.clj b/test/memobot/test/strings.clj new file mode 100644 index 0000000..58058eb --- /dev/null +++ b/test/memobot/test/strings.clj @@ -0,0 +1,25 @@ +(ns memobot.test.strings + (:use [memobot core strings redis db]) + (:use [clojure.test])) + +(deftest strings-test + (testing "set" + (is (= (set-cmd 'k 10) 10))) + (testing "setnx" + (testing "when key doesn't exist" + (is (= (setnx-cmd :new 10) 10))) + (testing "when key exists" + (is (= (setnx-cmd 'k 10) 'k)))) + (testing "strlen" + (is (= (strlen-cmd "robot") 5))) + (is (= (strlen-cmd 6) 1)) + (testing "incr" + (is (= (incr-cmd 10) 11))) + (testing "decr" + (is (= (decr-cmd 10) 9))) + (testing "incrby" + (is (= (incrby-cmd 10 5) 15))) + (testing "decrby" + (is (= (decrby-cmd 10 5) 5)))) + +