From 65282d73004fb45b502a5e9bf50359159f6179de Mon Sep 17 00:00:00 2001 From: Sam T Date: Fri, 7 Jun 2013 00:54:09 +0400 Subject: + Add tests for bitfield. --- src/Data/Bitfield.hs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/Data') 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 , haveAll, haveNone, have -- * Query + , Data.Bitfield.null , haveCount, totalCount, completeness , findMin, findMax @@ -100,6 +101,10 @@ have ix Bitfield {..} Query -----------------------------------------------------------------------} +-- | Test if bitifield have no one index: peer do not have anything. +null :: Bitfield -> Bool +null Bitfield {..} = S.null bfSet + -- | Count of peer have pieces. haveCount :: Bitfield -> PieceCount haveCount = S.size . bfSet -- cgit v1.2.3