]> git.saurik.com Git - redis.git/blobdiff - client-libraries/clojure/src/redis/tests.clj
TODO changes and mostly theoretical minor skiplist change
[redis.git] / client-libraries / clojure / src / redis / tests.clj
index 8add90af61d2849abb1d39b0975d1f5ef0ea7355..070b45be7957cba5344ba19181733fafdac12112 100644 (file)
   (redis/lset "list" -1 "test3")
   (is (= "test3" (redis/lindex "list" 2))))
 
-
-;; TBD
 (deftest lrem
   (is (thrown? Exception (redis/lrem "foo" 0 "bar")))
-  (is (= 0 (redis/lrem "list" 0 ""))))
+  (is (= 0 (redis/lrem "newlist" 0 "")))
+  (is (= 1 (redis/lrem "list" 1 "two")))
+  (is (= 1 (redis/lrem "list" 42 "three")))
+  (is (= 1 (redis/llen "list"))))
 
 
 (deftest lpop
   (is (thrown? Exception (redis/lpop "foo")))
-  (is (= "one" (redis/lpop "list"))))
+  (is (= nil (redis/lpop "newlist")))
+  (is (= "one" (redis/lpop "list")))
+  (is (= 2 (redis/llen "list"))))
 
 (deftest rpop
   (is (thrown? Exception (redis/rpop "foo")))
-  (is (= "three" (redis/rpop "list"))))
+  (is (= nil (redis/rpop "newlist")))
+  (is (= "three" (redis/rpop "list")))
+  (is (= 2 (redis/llen "list"))))
 
 ;;
 ;; Set commands
 
 (deftest srem
   (is (thrown? Exception (redis/srem "foo" "bar")))
-  (is (thrown? Exception (redis/srem "newset" "member")))
+  (is (= false (redis/srem "newset" "member")))
   (is (= true (redis/srem "set" "two")))
   (is (= false (redis/sismember "set" "two")))
   (is (= false (redis/srem "set" "blahonga"))))
 
+(deftest spop
+  (is (thrown? Exception (redis/spop "foo" "bar")))
+  (is (= nil (redis/spop "newset")))
+  (is (contains? #{"one" "two" "three"} (redis/spop "set"))))
+
 (deftest smove
   (is (thrown? Exception (redis/smove "foo" "set" "one")))
   (is (thrown? Exception (redis/smove "set" "foo" "one")))