Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[zAdd] #26

Merged
merged 5 commits into from Oct 27, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -40,7 +40,7 @@ object SortedSetRequests {
implicit writer: Writer[W]
) extends Request[Long](
ZAdd, key +: unpair(
members.map {
(members toList).map {
case (member, score) => (score.stringValue, writer.write(member))
}
): _*
Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/scredis/commands/SortedSetCommandsSpec.scala
Expand Up @@ -86,11 +86,11 @@ class SortedSetCommandsSpec extends WordSpec
"add the provided members only if they are not already contained " +
"in the sorted set" taggedAs (V240) in {
client.zAdd("SET", Map("A" -> 2.5, "B" -> 3.8)).futureValue should be (0)
client.zAdd("SET", Map("C" -> -1.3, "D" -> -2.6)).futureValue should be (2)
client.zAdd("SET", Map("C" -> -1.3, "D" -> -2.6, "E" -> -2.6)).futureValue should be (3)
client.zRangeWithScores(
"SET"
).futureValue should contain theSameElementsInOrderAs List[(String, Score)](
("D", -2.6), ("C", -1.3), ("A", 2.5), ("B", 3.8)
("D", -2.6), ("E", -2.6), ("C", -1.3), ("A", 2.5), ("B", 3.8)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have any guarantee from Redis that D will appear before E? If not then we should account for that in the test case and allow them to switch place.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The elements having the same score are returned in lexicographical order.

http://redis.io/commands/zrangebyscore

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

)
client.del("SET")
}
Expand Down