Skip to content

Commit

Permalink
Add more tests to ItemIdListSpec
Browse files Browse the repository at this point in the history
  • Loading branch information
rvoicilas committed Sep 6, 2012
1 parent 9b12920 commit 996bb04
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/test/scala/net/lag/kestrel/ItemIdListSpec.scala
Expand Up @@ -48,5 +48,28 @@ class ItemIdListSpec extends Specification {
val expected = Set(7, 20, 22)
iil.remove(expected) mustEqual expected
}

"add and pop" in {
iil.add(Seq(5, 4))
iil.size mustEqual 2
iil.pop() mustEqual Some(5)
iil.pop() mustEqual Some(4)
iil.pop() mustEqual None
}

"remove from the middle" in {
iil.add(Seq(7, 6, 5, 4, 3, 2))
iil.pop() mustEqual Some(7)
iil.remove(Set(5, 4, 2)) mustEqual Set(5, 4, 2)
iil.popAll() mustEqual Seq(6, 3)
}

"remove and pop combined" in {
iil.add(Seq(7, 6, 5, 4, 3, 2))
iil.remove(Set(6)) mustEqual Set(6)
iil.pop() mustEqual Some(7)
iil.pop() mustEqual Some(5)
iil.popAll() mustEqual Seq(4, 3, 2)
}
}
}

0 comments on commit 996bb04

Please sign in to comment.