summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam T <pxqr.sta@gmail.com>2013-06-07 00:54:09 +0400
committerSam T <pxqr.sta@gmail.com>2013-06-07 00:54:09 +0400
commit65282d73004fb45b502a5e9bf50359159f6179de (patch)
tree5ac07d389d1280ea86b2d97540b7841ea1385c88 /src
parent50454e4cc0af670a3ad68efd828aa505811ed28a (diff)
+ Add tests for bitfield.
Diffstat (limited to 'src')
-rw-r--r--src/Data/Bitfield.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Data/Bitfield.hs b/src/Data/Bitfield.hs
index 3424a0c6..a1033ff2 100644
--- a/src/Data/Bitfield.hs
+++ b/src/Data/Bitfield.hs
@@ -19,6 +19,7 @@ module Data.Bitfield
19 , haveAll, haveNone, have 19 , haveAll, haveNone, have
20 20
21 -- * Query 21 -- * Query
22 , Data.Bitfield.null
22 , haveCount, totalCount, completeness 23 , haveCount, totalCount, completeness
23 , findMin, findMax 24 , findMin, findMax
24 25
@@ -100,6 +101,10 @@ have ix Bitfield {..}
100 Query 101 Query
101-----------------------------------------------------------------------} 102-----------------------------------------------------------------------}
102 103
104-- | Test if bitifield have no one index: peer do not have anything.
105null :: Bitfield -> Bool
106null Bitfield {..} = S.null bfSet
107
103-- | Count of peer have pieces. 108-- | Count of peer have pieces.
104haveCount :: Bitfield -> PieceCount 109haveCount :: Bitfield -> PieceCount
105haveCount = S.size . bfSet 110haveCount = S.size . bfSet