Permalink
Browse files

add tests, fix

  • Loading branch information...
1 parent 1dbcd88 commit 1b532496d26afe2e968e96f6acf69d85726029cd @hjz hjz committed Mar 25, 2011
@@ -89,4 +89,4 @@ class Decoder extends AbstractDecoder with StateMachine {
if (args.length == 4 && !args(3).matches(DIGITS)) throw new ServerError("CAS must be a number")
if (!args(2).matches(DIGITS)) throw new ServerError("Bytes must be number")
}
-}
+}
@@ -42,7 +42,7 @@ class DecodingToResponse extends AbstractDecodingToResponse[Response] {
case ERROR => Error(new NonexistentCommand(""))
case CLIENT_ERROR => Error(new ClientError(""))
case SERVER_ERROR => Error(new ServerError(""))
- case ds => Number(ds.toInt)
+ case ds => Number(ds.toLong)
}
}
@@ -54,4 +54,4 @@ class DecodingToResponse extends AbstractDecodingToResponse[Response] {
}
Values(values)
}
-}
+}
@@ -64,6 +64,15 @@ object ClientSpec extends Specification {
client.incr("foo", 2)() mustEqual Some(3)
client.decr("foo")() mustEqual Some(2)
}
+
+ "incrl & decrl" in {
+ client.set("foo", "")()
+ client.incrl("foo")() mustEqual Some(1L)
+ val l = 1L << 50
+ client.incrl("foo", l)() mustEqual Some(l + 1L)
+ client.decrl("foo")() mustEqual Some(l)
+ client.decrl("foo", l)() mustEqual Some(0L)
+ }
}
"ketama client" in {

0 comments on commit 1b53249

Please sign in to comment.